title: Getting 32 bit base address of program, without making a 64bit (only) program?
body: <p>I'm making a Pixel-Cheat for a game. The program only works for 64bit currently and I'm trying to compile for 32bit.</p>
  
  <p>I tried many ways of finding base address of process, but to no avail. Only the 64bit function works, and it will create a 64bit program. </p>
  
  <p>Here's my 64bit working function:</p>
  
  <pre><code>DWORD64 GetModuleBase(HANDLE hProc, string &amp;sModuleName) 
  { 
    HMODULE *hModules; 
    char szBuf[50]; 
    DWORD cModules; 
    DWORD64 dwBase = -1; 
    //------ 
  
    EnumProcessModulesEx(hProc, hModules, 0, &amp;cModules, LIST_MODULES_ALL); 
    hModules = new HMODULE[cModules/sizeof(HMODULE)]; 
  
    if(EnumProcessModulesEx(hProc, hModules, 
        cModules/sizeof(HMODULE), &amp;cModules,     LIST_MODULES_ALL)) { 
    for(int i = 0; i &lt; cModules/sizeof(HMODULE); i++) { 
       if(GetModuleBaseName(hProc, hModules[i], szBuf, sizeof(szBuf))) { 
          if(sModuleName.compare(szBuf) == 0) { 
             dwBase = (DWORD64)hModules[i]; 
             break; 
             } 
          } 
       } 
    } 
  
    delete[] hModules; 
  
    return dwBase; 
  }
  </code></pre>
  
  <p>All 32bit functions on google fails, with error:</p>
  
  <blockquote>
    <p>21   59  C:\Users\Administrator\Documents\main.cpp  [Error] cast from 'BYTE* {aka   unsigned char*}' to 'DWORD {aka long unsigned int}' loses precision [-fpermissive]</p>
  </blockquote>
  
  <p>How to get this code work in 32bit?</p>