* mmap.cc (mlock): Replace LOCK_VM_IN_WSL with correct MAP_PROCESS.
(munlock): Ditto. * ntdll.h: Rearrange to have all preprocessor definitions at the start of the file. Add comments to each definition block. (MAP_PROCESS): Rename from LOCK_VM_IN_WSL. (MAP_SYSTEM): Rename from LOCK_VM_IN_RAM.
This commit is contained in:
parent
536e00784e
commit
8912b2e56f
@ -1,3 +1,12 @@
|
||||
2011-12-05 Corinna Vinschen <vinschen@redhat.com>
|
||||
|
||||
* mmap.cc (mlock): Replace LOCK_VM_IN_WSL with correct MAP_PROCESS.
|
||||
(munlock): Ditto.
|
||||
* ntdll.h: Rearrange to have all preprocessor definitions at the start
|
||||
of the file. Add comments to each definition block.
|
||||
(MAP_PROCESS): Rename from LOCK_VM_IN_WSL.
|
||||
(MAP_SYSTEM): Rename from LOCK_VM_IN_RAM.
|
||||
|
||||
2011-12-04 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||
|
||||
* sigproc.cc (cygWFMO): Don't assume that cancellable event is always
|
||||
|
@ -1354,7 +1354,7 @@ mlock (const void *addr, size_t len)
|
||||
do
|
||||
{
|
||||
status = NtLockVirtualMemory (NtCurrentProcess (), &base, &size,
|
||||
LOCK_VM_IN_WSL);
|
||||
MAP_PROCESS);
|
||||
if (status == STATUS_WORKING_SET_QUOTA)
|
||||
{
|
||||
/* The working set is too small, try to increase it so that the
|
||||
@ -1408,7 +1408,7 @@ munlock (const void *addr, size_t len)
|
||||
PVOID base = (PVOID) rounddown((uintptr_t) addr, pagesize);
|
||||
ULONG size = roundup2 (((uintptr_t) addr - (uintptr_t) base) + len, pagesize);
|
||||
NTSTATUS status = NtUnlockVirtualMemory (NtCurrentProcess (), &base, &size,
|
||||
LOCK_VM_IN_WSL);
|
||||
MAP_PROCESS);
|
||||
if (!NT_SUCCESS (status))
|
||||
__seterrno_from_nt_status (status);
|
||||
else
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
#ifndef _NTDLL_H
|
||||
#define _NTDLL_H 1
|
||||
|
||||
/* NTSTATUS values. */
|
||||
#define STATUS_NOT_ALL_ASSIGNED ((NTSTATUS) 0x00000106)
|
||||
#define STATUS_OBJECT_NAME_EXISTS ((NTSTATUS) 0x40000000)
|
||||
#define STATUS_BUFFER_OVERFLOW ((NTSTATUS) 0x80000005)
|
||||
@ -67,20 +69,10 @@
|
||||
/* custom status code: */
|
||||
#define STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION ((NTSTATUS) 0xe0000269)
|
||||
|
||||
#define PDI_MODULES 0x01
|
||||
#define PDI_HEAPS 0x04
|
||||
#define PDI_HEAP_BLOCKS 0x10
|
||||
#define LDRP_IMAGE_DLL 0x00000004
|
||||
#define WSLE_PAGE_READONLY 0x001
|
||||
#define WSLE_PAGE_EXECUTE 0x002
|
||||
#define WSLE_PAGE_EXECUTE_READ 0x003
|
||||
#define WSLE_PAGE_READWRITE 0x004
|
||||
#define WSLE_PAGE_WRITECOPY 0x005
|
||||
#define WSLE_PAGE_EXECUTE_READWRITE 0x006
|
||||
#define WSLE_PAGE_EXECUTE_WRITECOPY 0x007
|
||||
#define WSLE_PAGE_SHARE_COUNT_MASK 0x0E0
|
||||
#define WSLE_PAGE_SHAREABLE 0x100
|
||||
#define NtCurrentProcess() ((HANDLE) 0xffffffff)
|
||||
#define NtCurrentThread() ((HANDLE) 0xfffffffe)
|
||||
|
||||
/* CreateDisposition in NtCreateFile call. */
|
||||
#define FILE_SUPERSEDED 0
|
||||
#define FILE_OPENED 1
|
||||
#define FILE_CREATED 2
|
||||
@ -88,6 +80,7 @@
|
||||
#define FILE_EXISTS 4
|
||||
#define FILE_DOES_NOT_EXIST 5
|
||||
|
||||
/* Relative file position values in NtWriteFile call. */
|
||||
#define FILE_WRITE_TO_END_OF_FILE (-1LL)
|
||||
#define FILE_USE_FILE_POINTER_POSITION (-2LL)
|
||||
|
||||
@ -102,9 +95,100 @@
|
||||
#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
|
||||
#define FILE_DEVICE_SECURE_OPEN 0x00000100
|
||||
|
||||
/* Allocation type values in NtMapViewOfSection call. */
|
||||
#define AT_EXTENDABLE_FILE 0x00002000
|
||||
#define AT_ROUND_TO_PAGE 0x40000000
|
||||
|
||||
/* Lock type in NtLockVirtualMemory/NtUnlockVirtualMemory call. */
|
||||
#define MAP_PROCESS 1
|
||||
#define MAP_SYSTEM 2
|
||||
|
||||
/* Directory access rights (only in NT namespace). */
|
||||
#define DIRECTORY_QUERY 1
|
||||
#define DIRECTORY_TRAVERSE 2
|
||||
#define DIRECTORY_CREATE_OBJECT 4
|
||||
#define DIRECTORY_CREATE_SUBDIRECTORY 8
|
||||
#define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x0f)
|
||||
|
||||
/* Symbolic link access rights (only in NT namespace). */
|
||||
#define SYMBOLIC_LINK_QUERY 1
|
||||
|
||||
/* Transaction access rights. */
|
||||
#define TRANSACTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x3F)
|
||||
|
||||
/* Event object access rights. */
|
||||
#define EVENT_QUERY_STATE 1
|
||||
|
||||
/* Semaphore access rights. */
|
||||
#define SEMAPHORE_QUERY_STATE 1
|
||||
|
||||
/* Specific ACCESS_MASKSs for objects created in Cygwin. */
|
||||
#define CYG_SHARED_DIR_ACCESS (DIRECTORY_QUERY \
|
||||
| DIRECTORY_TRAVERSE \
|
||||
| DIRECTORY_CREATE_SUBDIRECTORY \
|
||||
| DIRECTORY_CREATE_OBJECT \
|
||||
| READ_CONTROL)
|
||||
#define CYG_MUTANT_ACCESS (MUTANT_QUERY_STATE \
|
||||
| SYNCHRONIZE \
|
||||
| READ_CONTROL)
|
||||
#define CYG_EVENT_ACCESS (EVENT_QUERY_STATE \
|
||||
| EVENT_MODIFY_STATE \
|
||||
| SYNCHRONIZE \
|
||||
| READ_CONTROL)
|
||||
#define CYG_SEMAPHORE_ACCESS (SEMAPHORE_QUERY_STATE \
|
||||
| SEMAPHORE_MODIFY_STATE \
|
||||
| SYNCHRONIZE \
|
||||
| READ_CONTROL)
|
||||
|
||||
/* Definitions for first parameter of RtlQueryRegistryValues. */
|
||||
#define RTL_REGISTRY_ABSOLUTE 0
|
||||
#define RTL_REGISTRY_SERVICES 1
|
||||
#define RTL_REGISTRY_CONTROL 2
|
||||
#define RTL_REGISTRY_WINDOWS_NT 3
|
||||
#define RTL_REGISTRY_DEVICEMAP 4
|
||||
#define RTL_REGISTRY_USER 5
|
||||
#define RTL_REGISTRY_HANDLE 0x40000000
|
||||
#define RTL_REGISTRY_OPTIONAL 0x80000000
|
||||
|
||||
/* Flags values for QueryTable parameter of RtlQueryRegistryValues. */
|
||||
#define RTL_QUERY_REGISTRY_SUBKEY 0x01
|
||||
#define RTL_QUERY_REGISTRY_TOPKEY 0x02
|
||||
#define RTL_QUERY_REGISTRY_REQUIRED 0x04
|
||||
#define RTL_QUERY_REGISTRY_NOVALUE 0x08
|
||||
#define RTL_QUERY_REGISTRY_NOEXPAND 0x10
|
||||
#define RTL_QUERY_REGISTRY_DIRECT 0x20
|
||||
#define RTL_QUERY_REGISTRY_DELETE 0x40
|
||||
#define RTL_QUERY_REGISTRY_NOSTRING 0x80
|
||||
|
||||
/* What RtlQueryProcessDebugInformation shall return. */
|
||||
#define PDI_MODULES 0x01
|
||||
#define PDI_HEAPS 0x04
|
||||
#define PDI_HEAP_BLOCKS 0x10
|
||||
|
||||
/* VM working set list protection values. Returned by NtQueryVirtualMemory. */
|
||||
#define WSLE_PAGE_READONLY 0x001
|
||||
#define WSLE_PAGE_EXECUTE 0x002
|
||||
#define WSLE_PAGE_EXECUTE_READ 0x003
|
||||
#define WSLE_PAGE_READWRITE 0x004
|
||||
#define WSLE_PAGE_WRITECOPY 0x005
|
||||
#define WSLE_PAGE_EXECUTE_READWRITE 0x006
|
||||
#define WSLE_PAGE_EXECUTE_WRITECOPY 0x007
|
||||
#define WSLE_PAGE_SHARE_COUNT_MASK 0x0E0
|
||||
#define WSLE_PAGE_SHAREABLE 0x100
|
||||
|
||||
/* Known debug heap flags */
|
||||
#define HEAP_FLAG_NOSERIALIZE 0x1
|
||||
#define HEAP_FLAG_GROWABLE 0x2
|
||||
#define HEAP_FLAG_EXCEPTIONS 0x4
|
||||
#define HEAP_FLAG_NONDEFAULT 0x1000
|
||||
#define HEAP_FLAG_SHAREABLE 0x8000
|
||||
#define HEAP_FLAG_EXECUTABLE 0x40000
|
||||
#define HEAP_FLAG_DEBUGGED 0x40000000
|
||||
|
||||
/* IOCTL code to impersonate client of named pipe. */
|
||||
#define FSCTL_PIPE_IMPERSONATE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, \
|
||||
METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
|
||||
typedef enum _FILE_INFORMATION_CLASS
|
||||
{
|
||||
FileDirectoryInformation = 1,
|
||||
@ -209,45 +293,6 @@ typedef struct _FILE_ID_BOTH_DIR_INFORMATION
|
||||
WCHAR FileName[1];
|
||||
} FILE_ID_BOTH_DIR_INFORMATION, *PFILE_ID_BOTH_DIR_INFORMATION;
|
||||
|
||||
|
||||
#define AT_EXTENDABLE_FILE 0x00002000
|
||||
#define AT_ROUND_TO_PAGE 0x40000000
|
||||
|
||||
#define LOCK_VM_IN_WSL 1
|
||||
#define LOCK_VM_IN_RAM 2
|
||||
|
||||
#define DIRECTORY_QUERY 1
|
||||
#define DIRECTORY_TRAVERSE 2
|
||||
#define DIRECTORY_CREATE_OBJECT 4
|
||||
#define DIRECTORY_CREATE_SUBDIRECTORY 8
|
||||
#define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x0f)
|
||||
|
||||
#define SYMBOLIC_LINK_QUERY 1
|
||||
|
||||
#define EVENT_QUERY_STATE 1
|
||||
#define SEMAPHORE_QUERY_STATE 1
|
||||
|
||||
/* Specific ACCESS_MASKSs for objects created in Cygwin. */
|
||||
#define CYG_SHARED_DIR_ACCESS (DIRECTORY_QUERY \
|
||||
| DIRECTORY_TRAVERSE \
|
||||
| DIRECTORY_CREATE_SUBDIRECTORY \
|
||||
| DIRECTORY_CREATE_OBJECT \
|
||||
| READ_CONTROL)
|
||||
|
||||
#define CYG_MUTANT_ACCESS (MUTANT_QUERY_STATE \
|
||||
| SYNCHRONIZE \
|
||||
| READ_CONTROL)
|
||||
|
||||
#define CYG_EVENT_ACCESS (EVENT_QUERY_STATE \
|
||||
| EVENT_MODIFY_STATE \
|
||||
| SYNCHRONIZE \
|
||||
| READ_CONTROL)
|
||||
|
||||
#define CYG_SEMAPHORE_ACCESS (SEMAPHORE_QUERY_STATE \
|
||||
| SEMAPHORE_MODIFY_STATE \
|
||||
| SYNCHRONIZE \
|
||||
| READ_CONTROL)
|
||||
|
||||
typedef ULONG KAFFINITY;
|
||||
|
||||
typedef enum _SYSTEM_INFORMATION_CLASS
|
||||
@ -518,15 +563,6 @@ typedef struct _DEBUG_BUFFER
|
||||
PVOID Reserved[9];
|
||||
} DEBUG_BUFFER, *PDEBUG_BUFFER;
|
||||
|
||||
/* Known debug heap flags */
|
||||
#define HEAP_FLAG_NOSERIALIZE 0x1
|
||||
#define HEAP_FLAG_GROWABLE 0x2
|
||||
#define HEAP_FLAG_EXCEPTIONS 0x4
|
||||
#define HEAP_FLAG_NONDEFAULT 0x1000
|
||||
#define HEAP_FLAG_SHAREABLE 0x8000
|
||||
#define HEAP_FLAG_EXECUTABLE 0x40000
|
||||
#define HEAP_FLAG_DEBUGGED 0x40000000
|
||||
|
||||
typedef struct _DEBUG_HEAP_INFORMATION
|
||||
{
|
||||
ULONG Base;
|
||||
@ -982,9 +1018,6 @@ typedef struct _FILE_MAILSLOT_SET_INFORMATION
|
||||
LARGE_INTEGER ReadTimeout;
|
||||
} FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION;
|
||||
|
||||
#define FSCTL_PIPE_IMPERSONATE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, \
|
||||
METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
|
||||
typedef VOID NTAPI (*PIO_APC_ROUTINE)(PVOID, PIO_STATUS_BLOCK, ULONG);
|
||||
|
||||
typedef enum _EVENT_TYPE
|
||||
@ -1029,24 +1062,6 @@ typedef struct _TIMER_BASIC_INFORMATION {
|
||||
BOOLEAN SignalState;
|
||||
} TIMER_BASIC_INFORMATION, *PTIMER_BASIC_INFORMATION;
|
||||
|
||||
#define RTL_QUERY_REGISTRY_SUBKEY 0x01
|
||||
#define RTL_QUERY_REGISTRY_TOPKEY 0x02
|
||||
#define RTL_QUERY_REGISTRY_REQUIRED 0x04
|
||||
#define RTL_QUERY_REGISTRY_NOVALUE 0x08
|
||||
#define RTL_QUERY_REGISTRY_NOEXPAND 0x10
|
||||
#define RTL_QUERY_REGISTRY_DIRECT 0x20
|
||||
#define RTL_QUERY_REGISTRY_DELETE 0x40
|
||||
#define RTL_QUERY_REGISTRY_NOSTRING 0x80
|
||||
|
||||
#define RTL_REGISTRY_ABSOLUTE 0
|
||||
#define RTL_REGISTRY_SERVICES 1
|
||||
#define RTL_REGISTRY_CONTROL 2
|
||||
#define RTL_REGISTRY_WINDOWS_NT 3
|
||||
#define RTL_REGISTRY_DEVICEMAP 4
|
||||
#define RTL_REGISTRY_USER 5
|
||||
#define RTL_REGISTRY_HANDLE 0x40000000
|
||||
#define RTL_REGISTRY_OPTIONAL 0x80000000
|
||||
|
||||
typedef NTSTATUS (*PRTL_QUERY_REGISTRY_ROUTINE)
|
||||
(PWSTR, ULONG, PVOID, ULONG, PVOID, PVOID);
|
||||
|
||||
@ -1087,9 +1102,6 @@ typedef VOID (APIENTRY *PTIMER_APC_ROUTINE)(PVOID, ULONG, ULONG);
|
||||
/* Function declarations for ntdll.dll. These don't appear in any
|
||||
standard Win32 header. */
|
||||
|
||||
#define NtCurrentProcess() ((HANDLE) 0xffffffff)
|
||||
#define NtCurrentThread() ((HANDLE) 0xfffffffe)
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* This is the mapping of the KUSER_SHARED_DATA structure into the 32 bit
|
||||
user address space. We need it here to access the current DismountCount. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user