feedback
feedback copied to clipboard
Missing exact requirements for valid MEM_ADDRESS_REQUIREMENTS values
At the time of writing, the documentation for MEM_ADDRESS_REQUIREMENTS mentions the following regarding the valid values of its fields:
LowestStartingAddress Specifies the lowest acceptable address. This address must be a multiple of the allocation granularity returned by GetSystemInfo, or a multiple of the large page size returned by GetLargePageMinimum if large pages are being requested. If this member is NULL, then there is no lower limit.
HighestEndingAddress Specifies the highest acceptable address (inclusive). This address must not exceed lpMaximumApplicationAddress returned by GetSystemInfo. If this member is NULL, then there is no upper limit.
Alignment Specifies power-of-2 alignment. Specifying 0 aligns the returned address on the system allocation granularity.
Based on my testing with VirtualAlloc2 on Windows 10.0.19045, this documentation is missing the following key information:
- If
HighestEndingAddressis not NULL, then it must be 1 less than a multiple of the allocation granularity. - If
Alignmentis nonzero, it must be larger or equal to the allocation granularity.
This information would have saved me quite a bit of time wondering why VirtualAlloc2 kept failing with ERROR_INVALID_PARAMETER when the values I was passing seemed perfectly valid.
Thank you for opening an issue! One of our team members will get back to you with additional information.
If this is a product issue, please close this issue and contact the product's support instead. For a list of support websites, see Support for Microsoft products and apps.