Commit 341b7dce authored by Alexandre Julliard's avatar Alexandre Julliard

Implemented the ntdll virtual memory functions, and made the kernel

functions use them.
parent 4131aaa9
......@@ -940,7 +940,7 @@ init MAIN_KernelInit
@ stdcall SwitchToThread() SwitchToThread
@ forward TryEnterCriticalSection ntdll.RtlTryEnterCriticalSection
@ stdcall VirtualAllocEx(long ptr long long long) VirtualAllocEx
@ stub VirtualFreeEx
@ stdcall VirtualFreeEx(long ptr long long) VirtualFreeEx
@ stub WriteFileGather
#Win98 and higher
......
......@@ -111,6 +111,7 @@ C_SRCS = \
signal_powerpc.c \
signal_sparc.c \
sync.c \
virtual.c \
time.c \
wcstring.c
......
......@@ -293,17 +293,16 @@ static inline BOOL HEAP_Commit( SUBHEAP *subheap, void *ptr )
size = (size + COMMIT_MASK) & ~COMMIT_MASK;
if (size > subheap->size) size = subheap->size;
if (size <= subheap->commitSize) return TRUE;
if (!VirtualAlloc( (char *)subheap + subheap->commitSize,
size - subheap->commitSize, MEM_COMMIT,
PAGE_EXECUTE_READWRITE))
size -= subheap->commitSize;
if (NtAllocateVirtualMemory( GetCurrentProcess(), &ptr, (char *)subheap + subheap->commitSize,
&size, MEM_COMMIT, PAGE_EXECUTE_READWRITE))
{
WARN("Could not commit %08lx bytes at %08lx for heap %08lx\n",
size - subheap->commitSize,
(DWORD)((char *)subheap + subheap->commitSize),
size, (DWORD)((char *)subheap + subheap->commitSize),
(DWORD)subheap->heap );
return FALSE;
}
subheap->commitSize = size;
subheap->commitSize += size;
return TRUE;
}
......@@ -315,20 +314,23 @@ static inline BOOL HEAP_Commit( SUBHEAP *subheap, void *ptr )
*/
static inline BOOL HEAP_Decommit( SUBHEAP *subheap, void *ptr )
{
void *addr;
ULONG decommit_size;
DWORD size = (DWORD)((char *)ptr - (char *)subheap);
/* round to next block and add one full block */
size = ((size + COMMIT_MASK) & ~COMMIT_MASK) + COMMIT_MASK + 1;
if (size >= subheap->commitSize) return TRUE;
if (!VirtualFree( (char *)subheap + size,
subheap->commitSize - size, MEM_DECOMMIT ))
decommit_size = subheap->commitSize - size;
addr = (char *)subheap + size;
if (NtFreeVirtualMemory( GetCurrentProcess(), &addr, &decommit_size, MEM_DECOMMIT ))
{
WARN("Could not decommit %08lx bytes at %08lx for heap %08lx\n",
subheap->commitSize - size,
(DWORD)((char *)subheap + size),
(DWORD)subheap->heap );
WARN("Could not decommit %08lx bytes at %08lx for heap %p\n",
decommit_size, (DWORD)((char *)subheap + size), subheap->heap );
return FALSE;
}
subheap->commitSize = size;
subheap->commitSize -= decommit_size;
return TRUE;
}
......@@ -472,7 +474,7 @@ static void HEAP_ShrinkBlock(SUBHEAP *subheap, ARENA_INUSE *pArena, DWORD size)
static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags,
DWORD commitSize, DWORD totalSize )
{
SUBHEAP *subheap = (SUBHEAP *)address;
SUBHEAP *subheap;
FREE_LIST_ENTRY *pEntry;
int i;
......@@ -480,15 +482,16 @@ static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags,
if (flags & HEAP_SHARED)
commitSize = totalSize; /* always commit everything in a shared heap */
if (!VirtualAlloc(address, commitSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE))
if (NtAllocateVirtualMemory( GetCurrentProcess(), &address, address,
&commitSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE))
{
WARN("Could not commit %08lx bytes for sub-heap %08lx\n",
commitSize, (DWORD)address );
WARN("Could not commit %08lx bytes for sub-heap %p\n", commitSize, address );
return FALSE;
}
/* Fill the sub-heap structure */
subheap = (SUBHEAP *)address;
subheap->heap = heap;
subheap->size = totalSize;
subheap->commitSize = commitSize;
......@@ -560,10 +563,10 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, void *base, DWORD flags,
if (!address)
{
/* allocate the memory block */
if (!(address = VirtualAlloc( NULL, totalSize, MEM_RESERVE, PAGE_EXECUTE_READWRITE )))
if (NtAllocateVirtualMemory( GetCurrentProcess(), &address, NULL, &totalSize,
MEM_RESERVE, PAGE_EXECUTE_READWRITE ))
{
WARN("Could not VirtualAlloc %08lx bytes\n",
totalSize );
WARN("Could not allocate %08lx bytes\n", totalSize );
return NULL;
}
}
......@@ -573,7 +576,8 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, void *base, DWORD flags,
if (!HEAP_InitSubHeap( heap ? heap : (HEAP *)address,
address, flags, commitSize, totalSize ))
{
if (!base) VirtualFree( address, 0, MEM_RELEASE );
ULONG size = 0;
if (!base) NtFreeVirtualMemory( GetCurrentProcess(), &address, &size, MEM_RELEASE );
return NULL;
}
......@@ -988,7 +992,9 @@ HANDLE WINAPI RtlDestroyHeap( HANDLE heap )
while (subheap)
{
SUBHEAP *next = subheap->next;
VirtualFree( subheap, 0, MEM_RELEASE );
ULONG size = 0;
void *addr = subheap;
NtFreeVirtualMemory( GetCurrentProcess(), &addr, &size, MEM_RELEASE );
subheap = next;
}
return 0;
......
......@@ -418,41 +418,6 @@ NTSTATUS WINAPI NtQueryInformationToken(
*/
/******************************************************************************
* NtCreateSection [NTDLL.@]
* ZwCreateSection [NTDLL.@]
*/
NTSTATUS WINAPI NtCreateSection(
OUT PHANDLE SectionHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN PLARGE_INTEGER MaximumSize OPTIONAL,
IN ULONG SectionPageProtection OPTIONAL,
IN ULONG AllocationAttributes,
IN HANDLE FileHandle OPTIONAL)
{
FIXME("(%p,0x%08lx,%p,%p,0x%08lx,0x%08lx,0x%08x) stub\n",
SectionHandle,DesiredAccess, ObjectAttributes,
MaximumSize,SectionPageProtection,AllocationAttributes,FileHandle);
dump_ObjectAttributes(ObjectAttributes);
return 0;
}
/******************************************************************************
* NtOpenSection [NTDLL.@]
* ZwOpenSection [NTDLL.@]
*/
NTSTATUS WINAPI NtOpenSection(
PHANDLE SectionHandle,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes)
{
FIXME("(%p,0x%08lx,%p),stub!\n",
SectionHandle,DesiredAccess,ObjectAttributes);
dump_ObjectAttributes(ObjectAttributes);
return 0;
}
/******************************************************************************
* NtQuerySection [NTDLL.@]
*/
NTSTATUS WINAPI NtQuerySection(
......@@ -467,44 +432,6 @@ NTSTATUS WINAPI NtQuerySection(
return 0;
}
/******************************************************************************
* NtMapViewOfSection [NTDLL.@]
* ZwMapViewOfSection [NTDLL.@]
* FUNCTION: Maps a view of a section into the virtual address space of a process
*
* ARGUMENTS:
* SectionHandle Handle of the section
* ProcessHandle Handle of the process
* BaseAddress Desired base address (or NULL) on entry
* Actual base address of the view on exit
* ZeroBits Number of high order address bits that must be zero
* CommitSize Size in bytes of the initially committed section of the view
* SectionOffset Offset in bytes from the beginning of the section to the beginning of the view
* ViewSize Desired length of map (or zero to map all) on entry
Actual length mapped on exit
* InheritDisposition Specified how the view is to be shared with
* child processes
* AllocateType Type of allocation for the pages
* Protect Protection for the committed region of the view
*/
NTSTATUS WINAPI NtMapViewOfSection(
HANDLE SectionHandle,
HANDLE ProcessHandle,
PVOID* BaseAddress,
ULONG ZeroBits,
ULONG CommitSize,
PLARGE_INTEGER SectionOffset,
PULONG ViewSize,
SECTION_INHERIT InheritDisposition,
ULONG AllocationType,
ULONG Protect)
{
FIXME("(0x%08x,0x%08x,%p,0x%08lx,0x%08lx,%p,%p,0x%08x,0x%08lx,0x%08lx) stub\n",
SectionHandle,ProcessHandle,BaseAddress,ZeroBits,CommitSize,SectionOffset,
ViewSize,InheritDisposition,AllocationType,Protect);
return 0;
}
/*
* ports
*/
......
......@@ -63,7 +63,7 @@
@ stub NtAlertThread
@ stdcall NtAllocateLocallyUniqueId(ptr) NtAllocateLocallyUniqueId
@ stdcall NtAllocateUuids(ptr ptr ptr) NtAllocateUuids
@ stub NtAllocateVirtualMemory
@ stdcall NtAllocateVirtualMemory(long ptr ptr ptr long long) NtAllocateVirtualMemory
@ stub NtCallbackReturn
@ stub NtCancelIoFile
@ stub NtCancelTimer
......@@ -86,7 +86,7 @@
@ stdcall NtCreatePort(long long long long long) NtCreatePort
@ stub NtCreateProcess
@ stub NtCreateProfile
@ stdcall NtCreateSection(long long long long long long long) NtCreateSection
@ stdcall NtCreateSection(ptr long ptr ptr long long long) NtCreateSection
@ stdcall NtCreateSemaphore(ptr long ptr long long) NtCreateSemaphore
@ stdcall NtCreateSymbolicLinkObject(ptr long ptr ptr) NtCreateSymbolicLinkObject
@ stub NtCreateThread
......@@ -108,9 +108,9 @@
@ stub NtFlushBuffersFile
@ stub NtFlushInstructionCache
@ stdcall NtFlushKey(long) NtFlushKey
@ stub NtFlushVirtualMemory
@ stdcall NtFlushVirtualMemory(long ptr ptr long) NtFlushVirtualMemory
@ stub NtFlushWriteBuffer
@ stub NtFreeVirtualMemory
@ stdcall NtFreeVirtualMemory(long ptr ptr long) NtFreeVirtualMemory
@ stdcall NtFsControlFile(long long long long long long long long long long) NtFsControlFile
@ stub NtGetContextThread
@ stub NtGetPlugPlayEvent
......@@ -122,9 +122,9 @@
@ stub NtLoadDriver
@ stdcall NtLoadKey(ptr ptr) NtLoadKey
@ stub NtLockFile
@ stub NtLockVirtualMemory
@ stdcall NtLockVirtualMemory(long ptr ptr long) NtLockVirtualMemory
@ stub NtMakeTemporaryObject
@ stdcall NtMapViewOfSection(long long long long long long long long long long) NtMapViewOfSection
@ stdcall NtMapViewOfSection(long long ptr long long ptr ptr long long long) NtMapViewOfSection
@ stub NtNotifyChangeDirectoryFile
@ stdcall NtNotifyChangeKey(long long ptr ptr ptr long long ptr long long) NtNotifyChangeKey
@ stdcall NtOpenDirectoryObject(long long long) NtOpenDirectoryObject
......@@ -137,7 +137,7 @@
@ stub NtOpenObjectAuditAlarm
@ stub NtOpenProcess
@ stdcall NtOpenProcessToken(long long long) NtOpenProcessToken
@ stdcall NtOpenSection(long long long) NtOpenSection
@ stdcall NtOpenSection(ptr long ptr) NtOpenSection
@ stdcall NtOpenSemaphore(long long ptr) NtOpenSemaphore
@ stdcall NtOpenSymbolicLinkObject (long long long) NtOpenSymbolicLinkObject
@ stub NtOpenThread
......@@ -147,7 +147,7 @@
@ stub NtPrivilegeCheck
@ stub NtPrivilegeObjectAuditAlarm
@ stub NtPrivilegedServiceAuditAlarm
@ stub NtProtectVirtualMemory
@ stdcall NtProtectVirtualMemory(long ptr ptr long ptr) NtProtectVirtualMemory
@ stdcall NtPulseEvent(long ptr) NtPulseEvent
@ stub NtQueryAttributesFile
@ stub NtQueryDefaultLocale
......@@ -176,7 +176,7 @@
@ stub NtQueryTimer
@ stdcall NtQueryTimerResolution(long long long) NtQueryTimerResolution
@ stdcall NtQueryValueKey(long long long long long long) NtQueryValueKey
@ stub NtQueryVirtualMemory
@ stdcall NtQueryVirtualMemory(long ptr long ptr long ptr) NtQueryVirtualMemory
@ stdcall NtQueryVolumeInformationFile(long ptr ptr long long) NtQueryVolumeInformationFile
@ stdcall NtRaiseException(ptr ptr long) NtRaiseException
@ stub NtRaiseHardError
......@@ -241,8 +241,8 @@
@ stub NtUnloadDriver
@ stdcall NtUnloadKey(long) NtUnloadKey
@ stub NtUnlockFile
@ stub NtUnlockVirtualMemory
@ stub NtUnmapViewOfSection
@ stdcall NtUnlockVirtualMemory(long ptr ptr long) NtUnlockVirtualMemory
@ stdcall NtUnmapViewOfSection(long ptr) NtUnmapViewOfSection
@ stub NtVdmControl
@ stub NtW32Call
@ stub NtWaitForMultipleObjects
......@@ -581,7 +581,7 @@
@ stub ZwAlertThread
@ stub ZwAllocateLocallyUniqueId
@ stub ZwAllocateUuids
@ stub ZwAllocateVirtualMemory
@ stdcall ZwAllocateVirtualMemory(long ptr ptr ptr long long) NtAllocateVirtualMemory
@ stub ZwCallbackReturn
@ stub ZwCancelIoFile
@ stub ZwCancelTimer
......@@ -604,7 +604,7 @@
@ stdcall ZwCreatePort(long long long long long) NtCreatePort
@ stub ZwCreateProcess
@ stub ZwCreateProfile
@ stdcall ZwCreateSection(long long long long long long long) NtCreateSection
@ stdcall ZwCreateSection(ptr long ptr ptr long long long) NtCreateSection
@ stub ZwCreateSemaphore
@ stub ZwCreateSymbolicLinkObject
@ stub ZwCreateThread
......@@ -625,9 +625,9 @@
@ stub ZwFlushBuffersFile
@ stub ZwFlushInstructionCache
@ stdcall ZwFlushKey(long) NtFlushKey
@ stub ZwFlushVirtualMemory
@ stdcall ZwFlushVirtualMemory(long ptr ptr long) NtFlushVirtualMemory
@ stub ZwFlushWriteBuffer
@ stub ZwFreeVirtualMemory
@ stdcall ZwFreeVirtualMemory(long ptr ptr long) NtFreeVirtualMemory
@ stdcall ZwFsControlFile(long long long long long long long long long long) NtFsControlFile
@ stub ZwGetContextThread
@ stub ZwGetPlugPlayEvent
......@@ -639,9 +639,9 @@
@ stub ZwLoadDriver
@ stdcall ZwLoadKey(ptr ptr) NtLoadKey
@ stub ZwLockFile
@ stub ZwLockVirtualMemory
@ stdcall ZwLockVirtualMemory(long ptr ptr long) NtLockVirtualMemory
@ stub ZwMakeTemporaryObject
@ stdcall ZwMapViewOfSection(long long long long long long long long long long) NtMapViewOfSection
@ stdcall ZwMapViewOfSection(long long ptr long long ptr ptr long long long) NtMapViewOfSection
@ stub ZwNotifyChangeDirectoryFile
@ stdcall ZwNotifyChangeKey(long long ptr ptr ptr long long ptr long long) NtNotifyChangeKey
@ stdcall ZwOpenDirectoryObject(long long long) NtOpenDirectoryObject
......@@ -654,7 +654,7 @@
@ stub ZwOpenObjectAuditAlarm
@ stub ZwOpenProcess
@ stdcall ZwOpenProcessToken(long long long) NtOpenProcessToken
@ stdcall ZwOpenSection(long long long) NtOpenSection
@ stdcall ZwOpenSection(ptr long ptr) NtOpenSection
@ stub ZwOpenSemaphore
@ stub ZwOpenSymbolicLinkObject
@ stub ZwOpenThread
......@@ -664,7 +664,7 @@
@ stub ZwPrivilegeCheck
@ stub ZwPrivilegeObjectAuditAlarm
@ stub ZwPrivilegedServiceAuditAlarm
@ stub ZwProtectVirtualMemory
@ stdcall ZwProtectVirtualMemory(long ptr ptr long ptr) NtProtectVirtualMemory
@ stub ZwPulseEvent
@ stub ZwQueryAttributesFile
@ stub ZwQueryDefaultLocale
......@@ -693,7 +693,7 @@
@ stub ZwQueryTimer
@ stub ZwQueryTimerResolution
@ stdcall ZwQueryValueKey(long ptr long ptr long ptr) NtQueryValueKey
@ stub ZwQueryVirtualMemory
@ stdcall ZwQueryVirtualMemory(long ptr long ptr long ptr) NtQueryVirtualMemory
@ stdcall ZwQueryVolumeInformationFile(long ptr ptr long long) NtQueryVolumeInformationFile
@ stub ZwRaiseException
@ stub ZwRaiseHardError
......@@ -756,8 +756,8 @@
@ stub ZwUnloadDriver
@ stdcall ZwUnloadKey(long) NtUnloadKey
@ stub ZwUnlockFile
@ stub ZwUnlockVirtualMemory
@ stub ZwUnmapViewOfSection
@ stdcall ZwUnlockVirtualMemory(long ptr ptr long) NtUnlockVirtualMemory
@ stdcall ZwUnmapViewOfSection(long ptr) NtUnmapViewOfSection
@ stub ZwVdmControl
@ stub ZwW32Call
@ stub ZwWaitForMultipleObjects
......
......@@ -1501,6 +1501,7 @@ BOOL WINAPI VerifyVersionInfoW(LPOSVERSIONINFOEXW,DWORD,DWORDLONG);
LPVOID WINAPI VirtualAlloc(LPVOID,DWORD,DWORD,DWORD);
LPVOID WINAPI VirtualAllocEx(HANDLE,LPVOID,DWORD,DWORD,DWORD);
BOOL WINAPI VirtualFree(LPVOID,DWORD,DWORD);
BOOL WINAPI VirtualFreeEx(HANDLE,LPVOID,DWORD,DWORD);
BOOL WINAPI VirtualLock(LPVOID,DWORD);
BOOL WINAPI VirtualProtect(LPVOID,DWORD,DWORD,LPDWORD);
BOOL WINAPI VirtualProtectEx(HANDLE,LPVOID,DWORD,DWORD,LPDWORD);
......
......@@ -1418,6 +1418,7 @@ struct create_mapping_request
int size_high;
int size_low;
int protect;
unsigned int access;
int inherit;
obj_handle_t file_handle;
/* VARARG(name,unicode_str); */
......@@ -3209,6 +3210,6 @@ union generic_reply
struct get_window_properties_reply get_window_properties_reply;
};
#define SERVER_PROTOCOL_VERSION 81
#define SERVER_PROTOCOL_VERSION 82
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
......@@ -3185,6 +3185,13 @@ typedef enum tagSID_NAME_USE {
#define THREAD_BASE_PRIORITY_MIN -2
#define THREAD_BASE_PRIORITY_IDLE -15
#define SECTION_QUERY 0x0001
#define SECTION_MAP_WRITE 0x0002
#define SECTION_MAP_READ 0x0004
#define SECTION_MAP_EXECUTE 0x0008
#define SECTION_EXTEND_SIZE 0x0010
#define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
#define FILE_READ_DATA 0x0001 /* file & pipe */
#define FILE_LIST_DIRECTORY 0x0001 /* directory */
#define FILE_WRITE_DATA 0x0002 /* file & pipe */
......
......@@ -259,6 +259,11 @@ typedef enum _WINSTATIONINFOCLASS {
WinStationInformation = 8
} WINSTATIONINFOCLASS;
typedef enum
{
MemoryBasicInformation = 0
} MEMORY_INFORMATION_CLASS;
/***********************************************************************
* IA64 specific types and data structures
*/
......@@ -753,11 +758,13 @@ void WINAPIV DbgPrint(LPCSTR fmt, ...);
NTSTATUS WINAPI NtAccessCheck(PSECURITY_DESCRIPTOR,HANDLE,ACCESS_MASK,PGENERIC_MAPPING,PPRIVILEGE_SET,PULONG,PULONG,PBOOLEAN);
NTSTATUS WINAPI NtAdjustPrivilegesToken(HANDLE,BOOLEAN,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD);
NTSTATUS WINAPI NtAllocateVirtualMemory(HANDLE,PVOID*,PVOID,ULONG*,ULONG,ULONG);
NTSTATUS WINAPI NtClearEvent(HANDLE);
NTSTATUS WINAPI NtClose(HANDLE);
NTSTATUS WINAPI NtCreateEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *,BOOLEAN,BOOLEAN);
NTSTATUS WINAPI NtCreateFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,PLARGE_INTEGER,ULONG,ULONG,ULONG,ULONG,PVOID,ULONG);
NTSTATUS WINAPI NtCreateKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,const UNICODE_STRING*,ULONG,PULONG);
NTSTATUS WINAPI NtCreateSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const LARGE_INTEGER*,ULONG,ULONG,HANDLE);
NTSTATUS WINAPI NtCreateSemaphore(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,ULONG);
NTSTATUS WINAPI NtDeleteKey(HANDLE);
NTSTATUS WINAPI NtDeleteValueKey(HANDLE,const UNICODE_STRING *);
......@@ -766,13 +773,19 @@ NTSTATUS WINAPI NtDuplicateObject(HANDLE,HANDLE,HANDLE,PHANDLE,ACCESS_MASK,ULON
NTSTATUS WINAPI NtEnumerateKey(HANDLE,ULONG,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
NTSTATUS WINAPI NtEnumerateValueKey(HANDLE,ULONG,KEY_VALUE_INFORMATION_CLASS,PVOID,ULONG,PULONG);
NTSTATUS WINAPI NtFlushKey(HANDLE);
NTSTATUS WINAPI NtFlushVirtualMemory(HANDLE,LPCVOID*,ULONG*,ULONG);
NTSTATUS WINAPI NtFreeVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG);
NTSTATUS WINAPI NtLoadKey(const OBJECT_ATTRIBUTES *,const OBJECT_ATTRIBUTES *);
NTSTATUS WINAPI NtLockVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG);
NTSTATUS WINAPI NtMapViewOfSection(HANDLE,HANDLE,PVOID*,ULONG,ULONG,const LARGE_INTEGER*,ULONG*,SECTION_INHERIT,ULONG,ULONG);
NTSTATUS WINAPI NtNotifyChangeKey(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,BOOLEAN,PVOID,ULONG,BOOLEAN);
NTSTATUS WINAPI NtOpenEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
NTSTATUS WINAPI NtOpenFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG);
NTSTATUS WINAPI NtOpenKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
NTSTATUS WINAPI NtOpenProcessToken(HANDLE,DWORD,HANDLE *);
NTSTATUS WINAPI NtOpenSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
NTSTATUS WINAPI NtOpenThreadToken(HANDLE,DWORD,BOOLEAN,HANDLE *);
NTSTATUS WINAPI NtProtectVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG,ULONG*);
NTSTATUS WINAPI NtPulseEvent(HANDLE,PULONG);
NTSTATUS WINAPI NtQueryInformationProcess(HANDLE,PROCESSINFOCLASS,PVOID,ULONG,PULONG);
NTSTATUS WINAPI NtQueryInformationThread(HANDLE,THREADINFOCLASS,PVOID,ULONG,PULONG);
......@@ -783,6 +796,7 @@ NTSTATUS WINAPI NtQuerySecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DES
NTSTATUS WINAPI NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG,PULONG);
NTSTATUS WINAPI NtQuerySystemTime(PLARGE_INTEGER);
NTSTATUS WINAPI NtQueryValueKey(HANDLE,const UNICODE_STRING *,KEY_VALUE_INFORMATION_CLASS,void *,DWORD,DWORD *);
NTSTATUS WINAPI NtQueryVirtualMemory(HANDLE,LPCVOID,MEMORY_INFORMATION_CLASS,PVOID,ULONG,ULONG*);
void WINAPI NtRaiseException(PEXCEPTION_RECORD,PCONTEXT,BOOL);
NTSTATUS WINAPI NtReadFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,PLARGE_INTEGER,PULONG);
NTSTATUS WINAPI NtReleaseSemaphore(HANDLE,ULONG,PULONG);
......@@ -797,6 +811,8 @@ NTSTATUS WINAPI NtSetValueKey(HANDLE,const UNICODE_STRING *,ULONG,ULONG,const v
NTSTATUS WINAPI NtTerminateProcess(HANDLE,LONG);
NTSTATUS WINAPI NtTerminateThread(HANDLE,LONG);
NTSTATUS WINAPI NtUnloadKey(HANDLE);
NTSTATUS WINAPI NtUnlockVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG);
NTSTATUS WINAPI NtUnmapViewOfSection(HANDLE,PVOID);
NTSTATUS WINAPI NtWaitForSingleObject(HANDLE,BOOLEAN,PLARGE_INTEGER);
void WINAPI RtlAcquirePebLock(void);
......
......@@ -375,9 +375,7 @@ DECL_HANDLER(create_mapping)
req->protect, req->file_handle,
get_req_data(), get_req_data_size() )))
{
int access = FILE_MAP_ALL_ACCESS;
if (!(req->protect & VPROT_WRITE)) access &= ~FILE_MAP_WRITE;
reply->handle = alloc_handle( current->process, obj, access, req->inherit );
reply->handle = alloc_handle( current->process, obj, req->access, req->inherit );
release_object( obj );
}
}
......
......@@ -1043,6 +1043,7 @@ enum char_info_mode
int size_high; /* mapping size */
int size_low; /* mapping size */
int protect; /* protection flags (see below) */
unsigned int access; /* wanted access rights */
int inherit; /* inherit flag */
obj_handle_t file_handle; /* file handle */
VARARG(name,unicode_str); /* object name */
......
......@@ -1213,6 +1213,7 @@ static void dump_create_mapping_request( const struct create_mapping_request *re
fprintf( stderr, " size_high=%d,", req->size_high );
fprintf( stderr, " size_low=%d,", req->size_low );
fprintf( stderr, " protect=%d,", req->protect );
fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " inherit=%d,", req->inherit );
fprintf( stderr, " file_handle=%d,", req->file_handle );
fprintf( stderr, " name=" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment