title: Error code 487 (ERROR_INVALID_ADDRESS) when using VirtualAllocEX
body: <p>I'm trying to use VirtualAllocEx(). When I set <code>dwSize</code> (the third parameter) to a number larger than about 63 MB, it cause to generate error code 487 when I look at <code>GetLastError()</code>. However, it works with smaller sizes such as 4MB.</p>
  
  <p>Here is part of my code:</p>
  
  <pre><code>VirtualAllocEx(peProcessInformation.hProcess,
                 (LPVOID)(INH.OptionalHeader.ImageBase),
                 dwImageSize, 
                 MEM_RESERVE | MEM_COMMIT,
                 PAGE_EXECUTE_READWRITE);
  </code></pre>
  
  <p>In the case that I used a 4MB EXE file, the LPVOID return value is <code>0x00400000</code>, but in other cases (20MB or bigger file) it returns <code>0x00000000</code>. </p>
  
  <ol>
  <li><p>Is there a maximum value for the <code>dwSize</code> parameter?</p></li>
  <li><p>Is there any other solution for my problem, such as another function?</p></li>
  </ol>