Re: There is no point to specify both MEM_RESERVE and MEM_COMMIT for VirtualAlloc
Monday, January 2, 2006, 1:23:22 AM, Dmitry Timoshkov wrote:
Changelog: Dmitry Timoshkov <dmitry(a)codeweavers.com> There is no point to specify both MEM_RESERVE and MEM_COMMIT for VirtualAlloc.
According to MSDN: "To reserve and commit pages in one step, call VirtualAlloc with MEM_COMMIT | MEM_RESERVED. The function fails if you attempt to commit a page that has not been reserved. The resulting error code is ERROR_INVALID_ADDRESS." Why do you want to do something that _should_ fail? Vitaliy Margolen
"Vitaliy Margolen" <wine-devel(a)kievinfo.com> wrote:
According to MSDN:
"To reserve and commit pages in one step, call VirtualAlloc with MEM_COMMIT | MEM_RESERVED. The function fails if you attempt to commit a page that has not been reserved. The resulting error code is ERROR_INVALID_ADDRESS."
You are right. My main objection was that NtAllocateVirtualMemory rounds passed in base address to a 64k boundary in the MEM_RESERVED case and to page boundary for MEM_COMMIT one, but since (almost) all the cases in my patch use NULL as a requested base address that doesn't really matter. -- Dmitry.
participants (2)
-
Dmitry Timoshkov -
Vitaliy Margolen