Skip to content
This repository was archived by the owner on Jan 9, 2025. It is now read-only.
This repository was archived by the owner on Jan 9, 2025. It is now read-only.

Missing exact requirements for valid MEM_ADDRESS_REQUIREMENTS values #4038

@tremwil

Description

@tremwil

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 HighestEndingAddress is not NULL, then it must be 1 less than a multiple of the allocation granularity.
  • If Alignment is 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pri3bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions