Cygwin: memory: declare extended memory API

Windows 10 1803 introduced an extended memory API allowing
to specify memory regions allocations are to be taken off.

In preparation of using this API, define the struct
MEM_EXTENDED_PARAMETER and friends.  Declare and allow to
autoload the functions VirtualAlloc2 and NtMapViewOfSectionEx.

Introduce a wincap flag has_extended_mem_api.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2020-04-07 14:13:50 +02:00
parent ccb3a40dad
commit e18f7f99cc
5 changed files with 69 additions and 0 deletions

View File

@ -94,4 +94,55 @@ details. */
#define GetWindowsDirectoryW dont_use_GetWindowsDirectory
#define GetWindowsDirectoryA dont_use_GetWindowsDirectory
#ifdef __cplusplus
extern "C" {
#endif
/* Define extended memory API here as long as not available from mingw-w64. */
typedef struct _MEM_ADDRESS_REQUIREMENTS
{
PVOID LowestStartingAddress;
PVOID HighestEndingAddress;
SIZE_T Alignment;
} MEM_ADDRESS_REQUIREMENTS, *PMEM_ADDRESS_REQUIREMENTS;
typedef enum MEM_EXTENDED_PARAMETER_TYPE
{
MemExtendedParameterInvalidType = 0,
MemExtendedParameterAddressRequirements,
MemExtendedParameterNumaNode,
MemExtendedParameterPartitionHandle,
MemExtendedParameterUserPhysicalHandle,
MemExtendedParameterAttributeFlags,
MemExtendedParameterMax
} MEM_EXTENDED_PARAMETER_TYPE, *PMEM_EXTENDED_PARAMETER_TYPE;
#define MEM_EXTENDED_PARAMETER_TYPE_BITS 8
typedef struct DECLSPEC_ALIGN(8) MEM_EXTENDED_PARAMETER
{
struct
{
DWORD64 Type : MEM_EXTENDED_PARAMETER_TYPE_BITS;
DWORD64 Reserved : 64 - MEM_EXTENDED_PARAMETER_TYPE_BITS;
};
union
{
DWORD64 ULong64;
PVOID Pointer;
SIZE_T Size;
HANDLE Handle;
DWORD ULong;
};
} MEM_EXTENDED_PARAMETER, *PMEM_EXTENDED_PARAMETER;
PVOID VirtualAlloc2 (HANDLE, PVOID, SIZE_T, ULONG, ULONG,
PMEM_EXTENDED_PARAMETER, ULONG);
#ifdef __cplusplus
}
#endif
#endif /*_WINLEAN_H*/