Commit 5a8d7328 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ntdll: Fix LdrLockLoaderLock()/LdrUnlockLoaderLock() on 64bit.

parent a0c2d641
...@@ -538,7 +538,7 @@ BOOL WINAPI GetModuleHandleExW( DWORD flags, LPCWSTR name, HMODULE *module ) ...@@ -538,7 +538,7 @@ BOOL WINAPI GetModuleHandleExW( DWORD flags, LPCWSTR name, HMODULE *module )
{ {
NTSTATUS status = STATUS_SUCCESS; NTSTATUS status = STATUS_SUCCESS;
HMODULE ret; HMODULE ret;
ULONG magic; ULONG_PTR magic;
BOOL lock; BOOL lock;
if (!module) if (!module)
...@@ -666,7 +666,8 @@ DWORD WINAPI GetModuleFileNameA( ...@@ -666,7 +666,8 @@ DWORD WINAPI GetModuleFileNameA(
*/ */
DWORD WINAPI GetModuleFileNameW( HMODULE hModule, LPWSTR lpFileName, DWORD size ) DWORD WINAPI GetModuleFileNameW( HMODULE hModule, LPWSTR lpFileName, DWORD size )
{ {
ULONG magic, len = 0; ULONG len = 0;
ULONG_PTR magic;
LDR_MODULE *pldr; LDR_MODULE *pldr;
NTSTATUS nts; NTSTATUS nts;
WIN16_SUBSYSTEM_TIB *win16_tib; WIN16_SUBSYSTEM_TIB *win16_tib;
...@@ -911,7 +912,7 @@ static HMODULE load_library( const UNICODE_STRING *libname, DWORD flags ) ...@@ -911,7 +912,7 @@ static HMODULE load_library( const UNICODE_STRING *libname, DWORD flags )
if (flags & LOAD_LIBRARY_AS_DATAFILE) if (flags & LOAD_LIBRARY_AS_DATAFILE)
{ {
ULONG magic; ULONG_PTR magic;
LdrLockLoaderLock( 0, NULL, &magic ); LdrLockLoaderLock( 0, NULL, &magic );
if (!LdrGetDllHandle( load_path, flags, libname, &hModule )) if (!LdrGetDllHandle( load_path, flags, libname, &hModule ))
......
...@@ -61,8 +61,8 @@ static void (WINAPI *pLdrShutdownProcess)(void); ...@@ -61,8 +61,8 @@ static void (WINAPI *pLdrShutdownProcess)(void);
static BOOLEAN (WINAPI *pRtlDllShutdownInProgress)(void); static BOOLEAN (WINAPI *pRtlDllShutdownInProgress)(void);
static NTSTATUS (WINAPI *pNtAllocateVirtualMemory)(HANDLE, PVOID *, ULONG, SIZE_T *, ULONG, ULONG); static NTSTATUS (WINAPI *pNtAllocateVirtualMemory)(HANDLE, PVOID *, ULONG, SIZE_T *, ULONG, ULONG);
static NTSTATUS (WINAPI *pNtFreeVirtualMemory)(HANDLE, PVOID *, SIZE_T *, ULONG); static NTSTATUS (WINAPI *pNtFreeVirtualMemory)(HANDLE, PVOID *, SIZE_T *, ULONG);
static NTSTATUS (WINAPI *pLdrLockLoaderLock)(ULONG, ULONG *, ULONG *); static NTSTATUS (WINAPI *pLdrLockLoaderLock)(ULONG, ULONG *, ULONG_PTR *);
static NTSTATUS (WINAPI *pLdrUnlockLoaderLock)(ULONG, ULONG); static NTSTATUS (WINAPI *pLdrUnlockLoaderLock)(ULONG, ULONG_PTR);
static void (WINAPI *pRtlAcquirePebLock)(void); static void (WINAPI *pRtlAcquirePebLock)(void);
static void (WINAPI *pRtlReleasePebLock)(void); static void (WINAPI *pRtlReleasePebLock)(void);
static PVOID (WINAPI *pResolveDelayLoadedAPI)(PVOID, PCIMAGE_DELAYLOAD_DESCRIPTOR, static PVOID (WINAPI *pResolveDelayLoadedAPI)(PVOID, PCIMAGE_DELAYLOAD_DESCRIPTOR,
...@@ -1367,7 +1367,7 @@ static DWORD WINAPI mutex_thread_proc(void *param) ...@@ -1367,7 +1367,7 @@ static DWORD WINAPI mutex_thread_proc(void *param)
if (ret == WAIT_OBJECT_0) break; if (ret == WAIT_OBJECT_0) break;
else if (ret == WAIT_OBJECT_0 + 1) else if (ret == WAIT_OBJECT_0 + 1)
{ {
ULONG loader_lock_magic; ULONG_PTR loader_lock_magic;
trace("%04u: mutex_thread_proc: Entering loader lock\n", GetCurrentThreadId()); trace("%04u: mutex_thread_proc: Entering loader lock\n", GetCurrentThreadId());
ret = pLdrLockLoaderLock(0, NULL, &loader_lock_magic); ret = pLdrLockLoaderLock(0, NULL, &loader_lock_magic);
ok(!ret, "LdrLockLoaderLock error %#x\n", ret); ok(!ret, "LdrLockLoaderLock error %#x\n", ret);
......
...@@ -2435,7 +2435,7 @@ static NTSTATUS open_nt_file( HANDLE *handle, UNICODE_STRING *name ) ...@@ -2435,7 +2435,7 @@ static NTSTATUS open_nt_file( HANDLE *handle, UNICODE_STRING *name )
static NTSTATUS get_module_filename( HMODULE module, UNICODE_STRING *str, unsigned int extra_len ) static NTSTATUS get_module_filename( HMODULE module, UNICODE_STRING *str, unsigned int extra_len )
{ {
NTSTATUS status; NTSTATUS status;
ULONG magic; ULONG_PTR magic;
LDR_MODULE *pldr; LDR_MODULE *pldr;
LdrLockLoaderLock(0, NULL, &magic); LdrLockLoaderLock(0, NULL, &magic);
...@@ -2934,7 +2934,7 @@ static NTSTATUS find_query_actctx( HANDLE *handle, DWORD flags, ULONG class ) ...@@ -2934,7 +2934,7 @@ static NTSTATUS find_query_actctx( HANDLE *handle, DWORD flags, ULONG class )
} }
else if (flags & (QUERY_ACTCTX_FLAG_ACTCTX_IS_ADDRESS|QUERY_ACTCTX_FLAG_ACTCTX_IS_HMODULE)) else if (flags & (QUERY_ACTCTX_FLAG_ACTCTX_IS_ADDRESS|QUERY_ACTCTX_FLAG_ACTCTX_IS_HMODULE))
{ {
ULONG magic; ULONG_PTR magic;
LDR_MODULE *pldr; LDR_MODULE *pldr;
if (!*handle) return STATUS_INVALID_PARAMETER; if (!*handle) return STATUS_INVALID_PARAMETER;
......
...@@ -1340,7 +1340,7 @@ NTSTATUS WINAPI LdrFindEntryForAddress(const void* addr, PLDR_MODULE* pmod) ...@@ -1340,7 +1340,7 @@ NTSTATUS WINAPI LdrFindEntryForAddress(const void* addr, PLDR_MODULE* pmod)
* Note: some flags are not implemented. * Note: some flags are not implemented.
* Flag 0x01 is used to raise exceptions on errors. * Flag 0x01 is used to raise exceptions on errors.
*/ */
NTSTATUS WINAPI LdrLockLoaderLock( ULONG flags, ULONG *result, ULONG *magic ) NTSTATUS WINAPI LdrLockLoaderLock( ULONG flags, ULONG *result, ULONG_PTR *magic )
{ {
if (flags & ~0x2) FIXME( "flags %x not supported\n", flags ); if (flags & ~0x2) FIXME( "flags %x not supported\n", flags );
...@@ -1372,7 +1372,7 @@ NTSTATUS WINAPI LdrLockLoaderLock( ULONG flags, ULONG *result, ULONG *magic ) ...@@ -1372,7 +1372,7 @@ NTSTATUS WINAPI LdrLockLoaderLock( ULONG flags, ULONG *result, ULONG *magic )
/****************************************************************** /******************************************************************
* LdrUnlockLoaderUnlock (NTDLL.@) * LdrUnlockLoaderUnlock (NTDLL.@)
*/ */
NTSTATUS WINAPI LdrUnlockLoaderLock( ULONG flags, ULONG magic ) NTSTATUS WINAPI LdrUnlockLoaderLock( ULONG flags, ULONG_PTR magic )
{ {
if (magic) if (magic)
{ {
......
...@@ -90,8 +90,8 @@ static CHAR * (WINAPI *pRtlIpv4AddressToStringA)(const IN_ADDR *, LPSTR); ...@@ -90,8 +90,8 @@ static CHAR * (WINAPI *pRtlIpv4AddressToStringA)(const IN_ADDR *, LPSTR);
static NTSTATUS (WINAPI *pRtlIpv4AddressToStringExA)(const IN_ADDR *, USHORT, LPSTR, PULONG); static NTSTATUS (WINAPI *pRtlIpv4AddressToStringExA)(const IN_ADDR *, USHORT, LPSTR, PULONG);
static NTSTATUS (WINAPI *pRtlIpv4StringToAddressA)(PCSTR, BOOLEAN, PCSTR *, IN_ADDR *); static NTSTATUS (WINAPI *pRtlIpv4StringToAddressA)(PCSTR, BOOLEAN, PCSTR *, IN_ADDR *);
static NTSTATUS (WINAPI *pLdrAddRefDll)(ULONG, HMODULE); static NTSTATUS (WINAPI *pLdrAddRefDll)(ULONG, HMODULE);
static NTSTATUS (WINAPI *pLdrLockLoaderLock)(ULONG, ULONG*, ULONG*); static NTSTATUS (WINAPI *pLdrLockLoaderLock)(ULONG, ULONG*, ULONG_PTR*);
static NTSTATUS (WINAPI *pLdrUnlockLoaderLock)(ULONG, ULONG); static NTSTATUS (WINAPI *pLdrUnlockLoaderLock)(ULONG, ULONG_PTR);
static HMODULE hkernel32 = 0; static HMODULE hkernel32 = 0;
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
...@@ -1549,7 +1549,8 @@ static void test_LdrAddRefDll(void) ...@@ -1549,7 +1549,8 @@ static void test_LdrAddRefDll(void)
static void test_LdrLockLoaderLock(void) static void test_LdrLockLoaderLock(void)
{ {
ULONG result, magic; ULONG_PTR magic;
ULONG result;
NTSTATUS status; NTSTATUS status;
if (!pLdrLockLoaderLock) if (!pLdrLockLoaderLock)
...@@ -1564,12 +1565,12 @@ static void test_LdrLockLoaderLock(void) ...@@ -1564,12 +1565,12 @@ static void test_LdrLockLoaderLock(void)
status = pLdrLockLoaderLock(0x10, &result, &magic); status = pLdrLockLoaderLock(0x10, &result, &magic);
ok(status == STATUS_INVALID_PARAMETER_1, "got 0x%08x\n", status); ok(status == STATUS_INVALID_PARAMETER_1, "got 0x%08x\n", status);
ok(result == 0, "got %d\n", result); ok(result == 0, "got %d\n", result);
ok(magic == 0, "got 0x%08x\n", magic); ok(magic == 0, "got %lx\n", magic);
magic = 0xdeadbeef; magic = 0xdeadbeef;
status = pLdrLockLoaderLock(0x10, NULL, &magic); status = pLdrLockLoaderLock(0x10, NULL, &magic);
ok(status == STATUS_INVALID_PARAMETER_1, "got 0x%08x\n", status); ok(status == STATUS_INVALID_PARAMETER_1, "got 0x%08x\n", status);
ok(magic == 0, "got 0x%08x\n", magic); ok(magic == 0, "got %lx\n", magic);
result = 10; result = 10;
status = pLdrLockLoaderLock(0x10, &result, NULL); status = pLdrLockLoaderLock(0x10, &result, NULL);
...@@ -1580,7 +1581,7 @@ static void test_LdrLockLoaderLock(void) ...@@ -1580,7 +1581,7 @@ static void test_LdrLockLoaderLock(void)
magic = 0xdeadbeef; magic = 0xdeadbeef;
status = pLdrLockLoaderLock(0x2, NULL, &magic); status = pLdrLockLoaderLock(0x2, NULL, &magic);
ok(status == STATUS_INVALID_PARAMETER_2, "got 0x%08x\n", status); ok(status == STATUS_INVALID_PARAMETER_2, "got 0x%08x\n", status);
ok(magic == 0, "got 0x%08x\n", magic); ok(magic == 0, "got %lx\n", magic);
/* magic pointer is null */ /* magic pointer is null */
result = 10; result = 10;
...@@ -1594,7 +1595,7 @@ static void test_LdrLockLoaderLock(void) ...@@ -1594,7 +1595,7 @@ static void test_LdrLockLoaderLock(void)
status = pLdrLockLoaderLock(0x2, &result, &magic); status = pLdrLockLoaderLock(0x2, &result, &magic);
ok(status == STATUS_SUCCESS, "got 0x%08x\n", status); ok(status == STATUS_SUCCESS, "got 0x%08x\n", status);
ok(result == 1, "got %d\n", result); ok(result == 1, "got %d\n", result);
ok(magic != 0, "got 0x%08x\n", magic); ok(magic != 0, "got %lx\n", magic);
pLdrUnlockLoaderLock(0, magic); pLdrUnlockLoaderLock(0, magic);
} }
......
...@@ -2020,14 +2020,14 @@ NTSYSAPI NTSTATUS WINAPI LdrGetDllHandle(LPCWSTR, ULONG, const UNICODE_STRING*, ...@@ -2020,14 +2020,14 @@ NTSYSAPI NTSTATUS WINAPI LdrGetDllHandle(LPCWSTR, ULONG, const UNICODE_STRING*,
NTSYSAPI NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE, const ANSI_STRING*, ULONG, void**); NTSYSAPI NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE, const ANSI_STRING*, ULONG, void**);
NTSYSAPI void WINAPI LdrInitializeThunk(void*,ULONG_PTR,ULONG_PTR,ULONG_PTR); NTSYSAPI void WINAPI LdrInitializeThunk(void*,ULONG_PTR,ULONG_PTR,ULONG_PTR);
NTSYSAPI NTSTATUS WINAPI LdrLoadDll(LPCWSTR, DWORD, const UNICODE_STRING*, HMODULE*); NTSYSAPI NTSTATUS WINAPI LdrLoadDll(LPCWSTR, DWORD, const UNICODE_STRING*, HMODULE*);
NTSYSAPI NTSTATUS WINAPI LdrLockLoaderLock(ULONG,ULONG*,ULONG*); NTSYSAPI NTSTATUS WINAPI LdrLockLoaderLock(ULONG,ULONG*,ULONG_PTR*);
IMAGE_BASE_RELOCATION * WINAPI LdrProcessRelocationBlock(void*,UINT,USHORT*,INT_PTR); IMAGE_BASE_RELOCATION * WINAPI LdrProcessRelocationBlock(void*,UINT,USHORT*,INT_PTR);
NTSYSAPI NTSTATUS WINAPI LdrQueryImageFileExecutionOptions(const UNICODE_STRING*,LPCWSTR,ULONG,void*,ULONG,ULONG*); NTSYSAPI NTSTATUS WINAPI LdrQueryImageFileExecutionOptions(const UNICODE_STRING*,LPCWSTR,ULONG,void*,ULONG,ULONG*);
NTSYSAPI NTSTATUS WINAPI LdrQueryProcessModuleInformation(SYSTEM_MODULE_INFORMATION*, ULONG, ULONG*); NTSYSAPI NTSTATUS WINAPI LdrQueryProcessModuleInformation(SYSTEM_MODULE_INFORMATION*, ULONG, ULONG*);
NTSYSAPI void WINAPI LdrShutdownProcess(void); NTSYSAPI void WINAPI LdrShutdownProcess(void);
NTSYSAPI void WINAPI LdrShutdownThread(void); NTSYSAPI void WINAPI LdrShutdownThread(void);
NTSYSAPI NTSTATUS WINAPI LdrUnloadDll(HMODULE); NTSYSAPI NTSTATUS WINAPI LdrUnloadDll(HMODULE);
NTSYSAPI NTSTATUS WINAPI LdrUnlockLoaderLock(ULONG,ULONG); NTSYSAPI NTSTATUS WINAPI LdrUnlockLoaderLock(ULONG,ULONG_PTR);
NTSYSAPI NTSTATUS WINAPI NtAcceptConnectPort(PHANDLE,ULONG,PLPC_MESSAGE,BOOLEAN,PLPC_SECTION_WRITE,PLPC_SECTION_READ); NTSYSAPI NTSTATUS WINAPI NtAcceptConnectPort(PHANDLE,ULONG,PLPC_MESSAGE,BOOLEAN,PLPC_SECTION_WRITE,PLPC_SECTION_READ);
NTSYSAPI NTSTATUS WINAPI NtAccessCheck(PSECURITY_DESCRIPTOR,HANDLE,ACCESS_MASK,PGENERIC_MAPPING,PPRIVILEGE_SET,PULONG,PULONG,NTSTATUS*); NTSYSAPI NTSTATUS WINAPI NtAccessCheck(PSECURITY_DESCRIPTOR,HANDLE,ACCESS_MASK,PGENERIC_MAPPING,PPRIVILEGE_SET,PULONG,PULONG,NTSTATUS*);
NTSYSAPI NTSTATUS WINAPI NtAccessCheckAndAuditAlarm(PUNICODE_STRING,HANDLE,PUNICODE_STRING,PUNICODE_STRING,PSECURITY_DESCRIPTOR,ACCESS_MASK,PGENERIC_MAPPING,BOOLEAN,PACCESS_MASK,PBOOLEAN,PBOOLEAN); NTSYSAPI NTSTATUS WINAPI NtAccessCheckAndAuditAlarm(PUNICODE_STRING,HANDLE,PUNICODE_STRING,PUNICODE_STRING,PSECURITY_DESCRIPTOR,ACCESS_MASK,PGENERIC_MAPPING,BOOLEAN,PACCESS_MASK,PBOOLEAN,PBOOLEAN);
......
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