Implemented the ntdll virtual memory functions, and made the kernel

functions use them.
oldstable
Alexandre Julliard 2002-09-17 18:54:42 +00:00
parent 4131aaa9f1
commit 341b7dceb4
14 changed files with 1944 additions and 1665 deletions

View File

@ -940,7 +940,7 @@ init MAIN_KernelInit
@ stdcall SwitchToThread() SwitchToThread @ stdcall SwitchToThread() SwitchToThread
@ forward TryEnterCriticalSection ntdll.RtlTryEnterCriticalSection @ forward TryEnterCriticalSection ntdll.RtlTryEnterCriticalSection
@ stdcall VirtualAllocEx(long ptr long long long) VirtualAllocEx @ stdcall VirtualAllocEx(long ptr long long long) VirtualAllocEx
@ stub VirtualFreeEx @ stdcall VirtualFreeEx(long ptr long long) VirtualFreeEx
@ stub WriteFileGather @ stub WriteFileGather
#Win98 and higher #Win98 and higher

View File

@ -111,6 +111,7 @@ C_SRCS = \
signal_powerpc.c \ signal_powerpc.c \
signal_sparc.c \ signal_sparc.c \
sync.c \ sync.c \
virtual.c \
time.c \ time.c \
wcstring.c wcstring.c

View File

@ -293,17 +293,16 @@ static inline BOOL HEAP_Commit( SUBHEAP *subheap, void *ptr )
size = (size + COMMIT_MASK) & ~COMMIT_MASK; size = (size + COMMIT_MASK) & ~COMMIT_MASK;
if (size > subheap->size) size = subheap->size; if (size > subheap->size) size = subheap->size;
if (size <= subheap->commitSize) return TRUE; if (size <= subheap->commitSize) return TRUE;
if (!VirtualAlloc( (char *)subheap + subheap->commitSize, size -= subheap->commitSize;
size - subheap->commitSize, MEM_COMMIT, if (NtAllocateVirtualMemory( GetCurrentProcess(), &ptr, (char *)subheap + subheap->commitSize,
PAGE_EXECUTE_READWRITE)) &size, MEM_COMMIT, PAGE_EXECUTE_READWRITE))
{ {
WARN("Could not commit %08lx bytes at %08lx for heap %08lx\n", WARN("Could not commit %08lx bytes at %08lx for heap %08lx\n",
size - subheap->commitSize, size, (DWORD)((char *)subheap + subheap->commitSize),
(DWORD)((char *)subheap + subheap->commitSize),
(DWORD)subheap->heap ); (DWORD)subheap->heap );
return FALSE; return FALSE;
} }
subheap->commitSize = size; subheap->commitSize += size;
return TRUE; return TRUE;
} }
@ -315,20 +314,23 @@ static inline BOOL HEAP_Commit( SUBHEAP *subheap, void *ptr )
*/ */
static inline BOOL HEAP_Decommit( 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); DWORD size = (DWORD)((char *)ptr - (char *)subheap);
/* round to next block and add one full block */ /* round to next block and add one full block */
size = ((size + COMMIT_MASK) & ~COMMIT_MASK) + COMMIT_MASK + 1; size = ((size + COMMIT_MASK) & ~COMMIT_MASK) + COMMIT_MASK + 1;
if (size >= subheap->commitSize) return TRUE; if (size >= subheap->commitSize) return TRUE;
if (!VirtualFree( (char *)subheap + size, decommit_size = subheap->commitSize - size;
subheap->commitSize - size, MEM_DECOMMIT )) addr = (char *)subheap + size;
if (NtFreeVirtualMemory( GetCurrentProcess(), &addr, &decommit_size, MEM_DECOMMIT ))
{ {
WARN("Could not decommit %08lx bytes at %08lx for heap %08lx\n", WARN("Could not decommit %08lx bytes at %08lx for heap %p\n",
subheap->commitSize - size, decommit_size, (DWORD)((char *)subheap + size), subheap->heap );
(DWORD)((char *)subheap + size),
(DWORD)subheap->heap );
return FALSE; return FALSE;
} }
subheap->commitSize = size; subheap->commitSize -= decommit_size;
return TRUE; 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, static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags,
DWORD commitSize, DWORD totalSize ) DWORD commitSize, DWORD totalSize )
{ {
SUBHEAP *subheap = (SUBHEAP *)address; SUBHEAP *subheap;
FREE_LIST_ENTRY *pEntry; FREE_LIST_ENTRY *pEntry;
int i; int i;
@ -480,15 +482,16 @@ static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags,
if (flags & HEAP_SHARED) if (flags & HEAP_SHARED)
commitSize = totalSize; /* always commit everything in a shared heap */ 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", WARN("Could not commit %08lx bytes for sub-heap %p\n", commitSize, address );
commitSize, (DWORD)address );
return FALSE; return FALSE;
} }
/* Fill the sub-heap structure */ /* Fill the sub-heap structure */
subheap = (SUBHEAP *)address;
subheap->heap = heap; subheap->heap = heap;
subheap->size = totalSize; subheap->size = totalSize;
subheap->commitSize = commitSize; subheap->commitSize = commitSize;
@ -560,10 +563,10 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, void *base, DWORD flags,
if (!address) if (!address)
{ {
/* allocate the memory block */ /* 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", WARN("Could not allocate %08lx bytes\n", totalSize );
totalSize );
return NULL; return NULL;
} }
} }
@ -573,7 +576,8 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, void *base, DWORD flags,
if (!HEAP_InitSubHeap( heap ? heap : (HEAP *)address, if (!HEAP_InitSubHeap( heap ? heap : (HEAP *)address,
address, flags, commitSize, totalSize )) address, flags, commitSize, totalSize ))
{ {
if (!base) VirtualFree( address, 0, MEM_RELEASE ); ULONG size = 0;
if (!base) NtFreeVirtualMemory( GetCurrentProcess(), &address, &size, MEM_RELEASE );
return NULL; return NULL;
} }
@ -988,7 +992,9 @@ HANDLE WINAPI RtlDestroyHeap( HANDLE heap )
while (subheap) while (subheap)
{ {
SUBHEAP *next = subheap->next; SUBHEAP *next = subheap->next;
VirtualFree( subheap, 0, MEM_RELEASE ); ULONG size = 0;
void *addr = subheap;
NtFreeVirtualMemory( GetCurrentProcess(), &addr, &size, MEM_RELEASE );
subheap = next; subheap = next;
} }
return 0; return 0;

View File

@ -417,41 +417,6 @@ NTSTATUS WINAPI NtQueryInformationToken(
* Section * Section
*/ */
/******************************************************************************
* 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.@] * NtQuerySection [NTDLL.@]
*/ */
@ -467,44 +432,6 @@ NTSTATUS WINAPI NtQuerySection(
return 0; 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 * ports
*/ */

View File

@ -63,7 +63,7 @@
@ stub NtAlertThread @ stub NtAlertThread
@ stdcall NtAllocateLocallyUniqueId(ptr) NtAllocateLocallyUniqueId @ stdcall NtAllocateLocallyUniqueId(ptr) NtAllocateLocallyUniqueId
@ stdcall NtAllocateUuids(ptr ptr ptr) NtAllocateUuids @ stdcall NtAllocateUuids(ptr ptr ptr) NtAllocateUuids
@ stub NtAllocateVirtualMemory @ stdcall NtAllocateVirtualMemory(long ptr ptr ptr long long) NtAllocateVirtualMemory
@ stub NtCallbackReturn @ stub NtCallbackReturn
@ stub NtCancelIoFile @ stub NtCancelIoFile
@ stub NtCancelTimer @ stub NtCancelTimer
@ -86,7 +86,7 @@
@ stdcall NtCreatePort(long long long long long) NtCreatePort @ stdcall NtCreatePort(long long long long long) NtCreatePort
@ stub NtCreateProcess @ stub NtCreateProcess
@ stub NtCreateProfile @ 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 NtCreateSemaphore(ptr long ptr long long) NtCreateSemaphore
@ stdcall NtCreateSymbolicLinkObject(ptr long ptr ptr) NtCreateSymbolicLinkObject @ stdcall NtCreateSymbolicLinkObject(ptr long ptr ptr) NtCreateSymbolicLinkObject
@ stub NtCreateThread @ stub NtCreateThread
@ -108,9 +108,9 @@
@ stub NtFlushBuffersFile @ stub NtFlushBuffersFile
@ stub NtFlushInstructionCache @ stub NtFlushInstructionCache
@ stdcall NtFlushKey(long) NtFlushKey @ stdcall NtFlushKey(long) NtFlushKey
@ stub NtFlushVirtualMemory @ stdcall NtFlushVirtualMemory(long ptr ptr long) NtFlushVirtualMemory
@ stub NtFlushWriteBuffer @ stub NtFlushWriteBuffer
@ stub NtFreeVirtualMemory @ stdcall NtFreeVirtualMemory(long ptr ptr long) NtFreeVirtualMemory
@ stdcall NtFsControlFile(long long long long long long long long long long) NtFsControlFile @ stdcall NtFsControlFile(long long long long long long long long long long) NtFsControlFile
@ stub NtGetContextThread @ stub NtGetContextThread
@ stub NtGetPlugPlayEvent @ stub NtGetPlugPlayEvent
@ -122,9 +122,9 @@
@ stub NtLoadDriver @ stub NtLoadDriver
@ stdcall NtLoadKey(ptr ptr) NtLoadKey @ stdcall NtLoadKey(ptr ptr) NtLoadKey
@ stub NtLockFile @ stub NtLockFile
@ stub NtLockVirtualMemory @ stdcall NtLockVirtualMemory(long ptr ptr long) NtLockVirtualMemory
@ stub NtMakeTemporaryObject @ 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 @ stub NtNotifyChangeDirectoryFile
@ stdcall NtNotifyChangeKey(long long ptr ptr ptr long long ptr long long) NtNotifyChangeKey @ stdcall NtNotifyChangeKey(long long ptr ptr ptr long long ptr long long) NtNotifyChangeKey
@ stdcall NtOpenDirectoryObject(long long long) NtOpenDirectoryObject @ stdcall NtOpenDirectoryObject(long long long) NtOpenDirectoryObject
@ -137,7 +137,7 @@
@ stub NtOpenObjectAuditAlarm @ stub NtOpenObjectAuditAlarm
@ stub NtOpenProcess @ stub NtOpenProcess
@ stdcall NtOpenProcessToken(long long long) NtOpenProcessToken @ 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 NtOpenSemaphore(long long ptr) NtOpenSemaphore
@ stdcall NtOpenSymbolicLinkObject (long long long) NtOpenSymbolicLinkObject @ stdcall NtOpenSymbolicLinkObject (long long long) NtOpenSymbolicLinkObject
@ stub NtOpenThread @ stub NtOpenThread
@ -147,7 +147,7 @@
@ stub NtPrivilegeCheck @ stub NtPrivilegeCheck
@ stub NtPrivilegeObjectAuditAlarm @ stub NtPrivilegeObjectAuditAlarm
@ stub NtPrivilegedServiceAuditAlarm @ stub NtPrivilegedServiceAuditAlarm
@ stub NtProtectVirtualMemory @ stdcall NtProtectVirtualMemory(long ptr ptr long ptr) NtProtectVirtualMemory
@ stdcall NtPulseEvent(long ptr) NtPulseEvent @ stdcall NtPulseEvent(long ptr) NtPulseEvent
@ stub NtQueryAttributesFile @ stub NtQueryAttributesFile
@ stub NtQueryDefaultLocale @ stub NtQueryDefaultLocale
@ -176,7 +176,7 @@
@ stub NtQueryTimer @ stub NtQueryTimer
@ stdcall NtQueryTimerResolution(long long long) NtQueryTimerResolution @ stdcall NtQueryTimerResolution(long long long) NtQueryTimerResolution
@ stdcall NtQueryValueKey(long long long long long long) NtQueryValueKey @ 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 NtQueryVolumeInformationFile(long ptr ptr long long) NtQueryVolumeInformationFile
@ stdcall NtRaiseException(ptr ptr long) NtRaiseException @ stdcall NtRaiseException(ptr ptr long) NtRaiseException
@ stub NtRaiseHardError @ stub NtRaiseHardError
@ -241,8 +241,8 @@
@ stub NtUnloadDriver @ stub NtUnloadDriver
@ stdcall NtUnloadKey(long) NtUnloadKey @ stdcall NtUnloadKey(long) NtUnloadKey
@ stub NtUnlockFile @ stub NtUnlockFile
@ stub NtUnlockVirtualMemory @ stdcall NtUnlockVirtualMemory(long ptr ptr long) NtUnlockVirtualMemory
@ stub NtUnmapViewOfSection @ stdcall NtUnmapViewOfSection(long ptr) NtUnmapViewOfSection
@ stub NtVdmControl @ stub NtVdmControl
@ stub NtW32Call @ stub NtW32Call
@ stub NtWaitForMultipleObjects @ stub NtWaitForMultipleObjects
@ -581,7 +581,7 @@
@ stub ZwAlertThread @ stub ZwAlertThread
@ stub ZwAllocateLocallyUniqueId @ stub ZwAllocateLocallyUniqueId
@ stub ZwAllocateUuids @ stub ZwAllocateUuids
@ stub ZwAllocateVirtualMemory @ stdcall ZwAllocateVirtualMemory(long ptr ptr ptr long long) NtAllocateVirtualMemory
@ stub ZwCallbackReturn @ stub ZwCallbackReturn
@ stub ZwCancelIoFile @ stub ZwCancelIoFile
@ stub ZwCancelTimer @ stub ZwCancelTimer
@ -604,7 +604,7 @@
@ stdcall ZwCreatePort(long long long long long) NtCreatePort @ stdcall ZwCreatePort(long long long long long) NtCreatePort
@ stub ZwCreateProcess @ stub ZwCreateProcess
@ stub ZwCreateProfile @ 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 ZwCreateSemaphore
@ stub ZwCreateSymbolicLinkObject @ stub ZwCreateSymbolicLinkObject
@ stub ZwCreateThread @ stub ZwCreateThread
@ -625,9 +625,9 @@
@ stub ZwFlushBuffersFile @ stub ZwFlushBuffersFile
@ stub ZwFlushInstructionCache @ stub ZwFlushInstructionCache
@ stdcall ZwFlushKey(long) NtFlushKey @ stdcall ZwFlushKey(long) NtFlushKey
@ stub ZwFlushVirtualMemory @ stdcall ZwFlushVirtualMemory(long ptr ptr long) NtFlushVirtualMemory
@ stub ZwFlushWriteBuffer @ stub ZwFlushWriteBuffer
@ stub ZwFreeVirtualMemory @ stdcall ZwFreeVirtualMemory(long ptr ptr long) NtFreeVirtualMemory
@ stdcall ZwFsControlFile(long long long long long long long long long long) NtFsControlFile @ stdcall ZwFsControlFile(long long long long long long long long long long) NtFsControlFile
@ stub ZwGetContextThread @ stub ZwGetContextThread
@ stub ZwGetPlugPlayEvent @ stub ZwGetPlugPlayEvent
@ -639,9 +639,9 @@
@ stub ZwLoadDriver @ stub ZwLoadDriver
@ stdcall ZwLoadKey(ptr ptr) NtLoadKey @ stdcall ZwLoadKey(ptr ptr) NtLoadKey
@ stub ZwLockFile @ stub ZwLockFile
@ stub ZwLockVirtualMemory @ stdcall ZwLockVirtualMemory(long ptr ptr long) NtLockVirtualMemory
@ stub ZwMakeTemporaryObject @ 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 @ stub ZwNotifyChangeDirectoryFile
@ stdcall ZwNotifyChangeKey(long long ptr ptr ptr long long ptr long long) NtNotifyChangeKey @ stdcall ZwNotifyChangeKey(long long ptr ptr ptr long long ptr long long) NtNotifyChangeKey
@ stdcall ZwOpenDirectoryObject(long long long) NtOpenDirectoryObject @ stdcall ZwOpenDirectoryObject(long long long) NtOpenDirectoryObject
@ -654,7 +654,7 @@
@ stub ZwOpenObjectAuditAlarm @ stub ZwOpenObjectAuditAlarm
@ stub ZwOpenProcess @ stub ZwOpenProcess
@ stdcall ZwOpenProcessToken(long long long) NtOpenProcessToken @ stdcall ZwOpenProcessToken(long long long) NtOpenProcessToken
@ stdcall ZwOpenSection(long long long) NtOpenSection @ stdcall ZwOpenSection(ptr long ptr) NtOpenSection
@ stub ZwOpenSemaphore @ stub ZwOpenSemaphore
@ stub ZwOpenSymbolicLinkObject @ stub ZwOpenSymbolicLinkObject
@ stub ZwOpenThread @ stub ZwOpenThread
@ -664,7 +664,7 @@
@ stub ZwPrivilegeCheck @ stub ZwPrivilegeCheck
@ stub ZwPrivilegeObjectAuditAlarm @ stub ZwPrivilegeObjectAuditAlarm
@ stub ZwPrivilegedServiceAuditAlarm @ stub ZwPrivilegedServiceAuditAlarm
@ stub ZwProtectVirtualMemory @ stdcall ZwProtectVirtualMemory(long ptr ptr long ptr) NtProtectVirtualMemory
@ stub ZwPulseEvent @ stub ZwPulseEvent
@ stub ZwQueryAttributesFile @ stub ZwQueryAttributesFile
@ stub ZwQueryDefaultLocale @ stub ZwQueryDefaultLocale
@ -693,7 +693,7 @@
@ stub ZwQueryTimer @ stub ZwQueryTimer
@ stub ZwQueryTimerResolution @ stub ZwQueryTimerResolution
@ stdcall ZwQueryValueKey(long ptr long ptr long ptr) NtQueryValueKey @ 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 @ stdcall ZwQueryVolumeInformationFile(long ptr ptr long long) NtQueryVolumeInformationFile
@ stub ZwRaiseException @ stub ZwRaiseException
@ stub ZwRaiseHardError @ stub ZwRaiseHardError
@ -756,8 +756,8 @@
@ stub ZwUnloadDriver @ stub ZwUnloadDriver
@ stdcall ZwUnloadKey(long) NtUnloadKey @ stdcall ZwUnloadKey(long) NtUnloadKey
@ stub ZwUnlockFile @ stub ZwUnlockFile
@ stub ZwUnlockVirtualMemory @ stdcall ZwUnlockVirtualMemory(long ptr ptr long) NtUnlockVirtualMemory
@ stub ZwUnmapViewOfSection @ stdcall ZwUnmapViewOfSection(long ptr) NtUnmapViewOfSection
@ stub ZwVdmControl @ stub ZwVdmControl
@ stub ZwW32Call @ stub ZwW32Call
@ stub ZwWaitForMultipleObjects @ stub ZwWaitForMultipleObjects

1535
dlls/ntdll/virtual.c 100644

File diff suppressed because it is too large Load Diff

View File

@ -1500,10 +1500,11 @@ BOOL WINAPI VerifyVersionInfoW(LPOSVERSIONINFOEXW,DWORD,DWORDLONG);
#define VerifyVersionInfo WINELIB_NAME_AW(VerifyVersionInfo) #define VerifyVersionInfo WINELIB_NAME_AW(VerifyVersionInfo)
LPVOID WINAPI VirtualAlloc(LPVOID,DWORD,DWORD,DWORD); LPVOID WINAPI VirtualAlloc(LPVOID,DWORD,DWORD,DWORD);
LPVOID WINAPI VirtualAllocEx(HANDLE,LPVOID,DWORD,DWORD,DWORD); LPVOID WINAPI VirtualAllocEx(HANDLE,LPVOID,DWORD,DWORD,DWORD);
BOOL WINAPI VirtualFree(LPVOID,DWORD,DWORD); BOOL WINAPI VirtualFree(LPVOID,DWORD,DWORD);
BOOL WINAPI VirtualLock(LPVOID,DWORD); BOOL WINAPI VirtualFreeEx(HANDLE,LPVOID,DWORD,DWORD);
BOOL WINAPI VirtualProtect(LPVOID,DWORD,DWORD,LPDWORD); BOOL WINAPI VirtualLock(LPVOID,DWORD);
BOOL WINAPI VirtualProtectEx(HANDLE,LPVOID,DWORD,DWORD,LPDWORD); BOOL WINAPI VirtualProtect(LPVOID,DWORD,DWORD,LPDWORD);
BOOL WINAPI VirtualProtectEx(HANDLE,LPVOID,DWORD,DWORD,LPDWORD);
DWORD WINAPI VirtualQuery(LPCVOID,LPMEMORY_BASIC_INFORMATION,DWORD); DWORD WINAPI VirtualQuery(LPCVOID,LPMEMORY_BASIC_INFORMATION,DWORD);
DWORD WINAPI VirtualQueryEx(HANDLE,LPCVOID,LPMEMORY_BASIC_INFORMATION,DWORD); DWORD WINAPI VirtualQueryEx(HANDLE,LPCVOID,LPMEMORY_BASIC_INFORMATION,DWORD);
BOOL WINAPI VirtualUnlock(LPVOID,DWORD); BOOL WINAPI VirtualUnlock(LPVOID,DWORD);

View File

@ -1418,6 +1418,7 @@ struct create_mapping_request
int size_high; int size_high;
int size_low; int size_low;
int protect; int protect;
unsigned int access;
int inherit; int inherit;
obj_handle_t file_handle; obj_handle_t file_handle;
/* VARARG(name,unicode_str); */ /* VARARG(name,unicode_str); */
@ -3209,6 +3210,6 @@ union generic_reply
struct get_window_properties_reply get_window_properties_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 */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -3185,6 +3185,13 @@ typedef enum tagSID_NAME_USE {
#define THREAD_BASE_PRIORITY_MIN -2 #define THREAD_BASE_PRIORITY_MIN -2
#define THREAD_BASE_PRIORITY_IDLE -15 #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_READ_DATA 0x0001 /* file & pipe */
#define FILE_LIST_DIRECTORY 0x0001 /* directory */ #define FILE_LIST_DIRECTORY 0x0001 /* directory */
#define FILE_WRITE_DATA 0x0002 /* file & pipe */ #define FILE_WRITE_DATA 0x0002 /* file & pipe */

View File

@ -259,6 +259,11 @@ typedef enum _WINSTATIONINFOCLASS {
WinStationInformation = 8 WinStationInformation = 8
} WINSTATIONINFOCLASS; } WINSTATIONINFOCLASS;
typedef enum
{
MemoryBasicInformation = 0
} MEMORY_INFORMATION_CLASS;
/*********************************************************************** /***********************************************************************
* IA64 specific types and data structures * 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 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 NtAdjustPrivilegesToken(HANDLE,BOOLEAN,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD);
NTSTATUS WINAPI NtAllocateVirtualMemory(HANDLE,PVOID*,PVOID,ULONG*,ULONG,ULONG);
NTSTATUS WINAPI NtClearEvent(HANDLE); NTSTATUS WINAPI NtClearEvent(HANDLE);
NTSTATUS WINAPI NtClose(HANDLE); NTSTATUS WINAPI NtClose(HANDLE);
NTSTATUS WINAPI NtCreateEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *,BOOLEAN,BOOLEAN); 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 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 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 NtCreateSemaphore(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,ULONG);
NTSTATUS WINAPI NtDeleteKey(HANDLE); NTSTATUS WINAPI NtDeleteKey(HANDLE);
NTSTATUS WINAPI NtDeleteValueKey(HANDLE,const UNICODE_STRING *); 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 NtEnumerateKey(HANDLE,ULONG,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
NTSTATUS WINAPI NtEnumerateValueKey(HANDLE,ULONG,KEY_VALUE_INFORMATION_CLASS,PVOID,ULONG,PULONG); NTSTATUS WINAPI NtEnumerateValueKey(HANDLE,ULONG,KEY_VALUE_INFORMATION_CLASS,PVOID,ULONG,PULONG);
NTSTATUS WINAPI NtFlushKey(HANDLE); 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 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 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 NtOpenEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
NTSTATUS WINAPI NtOpenFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG); NTSTATUS WINAPI NtOpenFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG);
NTSTATUS WINAPI NtOpenKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *); NTSTATUS WINAPI NtOpenKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
NTSTATUS WINAPI NtOpenProcessToken(HANDLE,DWORD,HANDLE *); NTSTATUS WINAPI NtOpenProcessToken(HANDLE,DWORD,HANDLE *);
NTSTATUS WINAPI NtOpenSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
NTSTATUS WINAPI NtOpenThreadToken(HANDLE,DWORD,BOOLEAN,HANDLE *); NTSTATUS WINAPI NtOpenThreadToken(HANDLE,DWORD,BOOLEAN,HANDLE *);
NTSTATUS WINAPI NtProtectVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG,ULONG*);
NTSTATUS WINAPI NtPulseEvent(HANDLE,PULONG); NTSTATUS WINAPI NtPulseEvent(HANDLE,PULONG);
NTSTATUS WINAPI NtQueryInformationProcess(HANDLE,PROCESSINFOCLASS,PVOID,ULONG,PULONG); NTSTATUS WINAPI NtQueryInformationProcess(HANDLE,PROCESSINFOCLASS,PVOID,ULONG,PULONG);
NTSTATUS WINAPI NtQueryInformationThread(HANDLE,THREADINFOCLASS,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 NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG,PULONG);
NTSTATUS WINAPI NtQuerySystemTime(PLARGE_INTEGER); NTSTATUS WINAPI NtQuerySystemTime(PLARGE_INTEGER);
NTSTATUS WINAPI NtQueryValueKey(HANDLE,const UNICODE_STRING *,KEY_VALUE_INFORMATION_CLASS,void *,DWORD,DWORD *); 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); 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 NtReadFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,PLARGE_INTEGER,PULONG);
NTSTATUS WINAPI NtReleaseSemaphore(HANDLE,ULONG,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 NtTerminateProcess(HANDLE,LONG);
NTSTATUS WINAPI NtTerminateThread(HANDLE,LONG); NTSTATUS WINAPI NtTerminateThread(HANDLE,LONG);
NTSTATUS WINAPI NtUnloadKey(HANDLE); NTSTATUS WINAPI NtUnloadKey(HANDLE);
NTSTATUS WINAPI NtUnlockVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG);
NTSTATUS WINAPI NtUnmapViewOfSection(HANDLE,PVOID);
NTSTATUS WINAPI NtWaitForSingleObject(HANDLE,BOOLEAN,PLARGE_INTEGER); NTSTATUS WINAPI NtWaitForSingleObject(HANDLE,BOOLEAN,PLARGE_INTEGER);
void WINAPI RtlAcquirePebLock(void); void WINAPI RtlAcquirePebLock(void);

File diff suppressed because it is too large Load Diff

View File

@ -375,9 +375,7 @@ DECL_HANDLER(create_mapping)
req->protect, req->file_handle, req->protect, req->file_handle,
get_req_data(), get_req_data_size() ))) get_req_data(), get_req_data_size() )))
{ {
int access = FILE_MAP_ALL_ACCESS; reply->handle = alloc_handle( current->process, obj, req->access, req->inherit );
if (!(req->protect & VPROT_WRITE)) access &= ~FILE_MAP_WRITE;
reply->handle = alloc_handle( current->process, obj, access, req->inherit );
release_object( obj ); release_object( obj );
} }
} }

View File

@ -1043,6 +1043,7 @@ enum char_info_mode
int size_high; /* mapping size */ int size_high; /* mapping size */
int size_low; /* mapping size */ int size_low; /* mapping size */
int protect; /* protection flags (see below) */ int protect; /* protection flags (see below) */
unsigned int access; /* wanted access rights */
int inherit; /* inherit flag */ int inherit; /* inherit flag */
obj_handle_t file_handle; /* file handle */ obj_handle_t file_handle; /* file handle */
VARARG(name,unicode_str); /* object name */ VARARG(name,unicode_str); /* object name */

View File

@ -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_high=%d,", req->size_high );
fprintf( stderr, " size_low=%d,", req->size_low ); fprintf( stderr, " size_low=%d,", req->size_low );
fprintf( stderr, " protect=%d,", req->protect ); fprintf( stderr, " protect=%d,", req->protect );
fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " inherit=%d,", req->inherit ); fprintf( stderr, " inherit=%d,", req->inherit );
fprintf( stderr, " file_handle=%d,", req->file_handle ); fprintf( stderr, " file_handle=%d,", req->file_handle );
fprintf( stderr, " name=" ); fprintf( stderr, " name=" );