Cygwin: winlean.h: remove most of the extended memory API

This was added as a temporary measure in commit e18f7f99 because it
wasn't yet in the mingw-w64 headers.  With one exception, it is now in
the current release of the headers (version 8.0.0), so we don't need
it in winlean.h.

The exception is that VirtualAlloc2 is declared conditionally in
<w32api/memoryapi.h>, but the compilation of Cygwin requires it to
always be declared, even though it will only be executed on systems
that support it.  So retain the declaration in winlean.h.  And add
"WINAPI" to the declaration, as in memoryapi.h.

Add a check that version >= 8 of the mingw-w64 headers is intalled.

Also revert commit 3d136011, which was a related temporary workaround.
This commit is contained in:
Ken Brown 2020-09-23 11:04:08 -04:00
parent 8315a90822
commit c1f7c4d1b6
4 changed files with 16 additions and 42 deletions

View File

@ -1423,6 +1423,12 @@ extern "C"
NTSTATUS NTAPI NtMapViewOfSection (HANDLE, HANDLE, PVOID *, ULONG_PTR, SIZE_T,
PLARGE_INTEGER, PSIZE_T, SECTION_INHERIT,
ULONG, ULONG);
/* For the extended memory API. */
#if __MINGW64_VERSION_MAJOR < 8
#error "Version >= 8 of the w32api headers is required"
#endif
NTSTATUS NTAPI NtMapViewOfSectionEx (HANDLE, HANDLE, PVOID *, PLARGE_INTEGER,
PSIZE_T, ULONG, ULONG,
PMEM_EXTENDED_PARAMETER, ULONG);

View File

@ -99,47 +99,17 @@ details. */
extern "C" {
#endif
/* Define extended memory API here as long as not available from mingw-w64. */
/* For the extended memory API. */
#if __MINGW64_VERSION_MAJOR < 8
#error "Version >= 8 of the w32api headers is required"
#endif
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);
/* VirtualAlloc2 is declared in <w32api/memoryapi.h> if NTDDI_VERSION
>= NTDDI_WIN10_RS4 (a compile-time condition). But we need the
declaration unconditionally, even though the function will only be
executed on systems that support it (a run-time condition). */
PVOID WINAPI VirtualAlloc2 (HANDLE, PVOID, SIZE_T, ULONG, ULONG,
PMEM_EXTENDED_PARAMETER, ULONG);
#ifdef __cplusplus
}

View File

@ -24,7 +24,6 @@ details. */
#define _WIN32_WINNT 0x0a00
#define WINVER 0x0a00
#define NOCOMATTRIBUTE
#define PMEM_EXTENDED_PARAMETER PVOID
#include <windows.h>
#include <userenv.h>
#include <shlobj.h>

View File

@ -6,7 +6,6 @@ This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#define PMEM_EXTENDED_PARAMETER PVOID
#include <errno.h>
#include <stdio.h>
#include <locale.h>