Partially implemented LdrLock/UnlockLoaderLock.
This commit is contained in:
parent
114a31a2a8
commit
500a2f95f7
|
@ -210,6 +210,40 @@ WINE_MODREF *MODULE_FindModule(LPCSTR path)
|
|||
return wm;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************
|
||||
* LdrLockLoaderLock (NTDLL.@)
|
||||
*
|
||||
* Note: flags are not implemented.
|
||||
* Flag 0x01 is used to raise exceptions on errors.
|
||||
* Flag 0x02 is used to avoid waiting on the section (does RtlTryEnterCriticalSection instead).
|
||||
*/
|
||||
NTSTATUS WINAPI LdrLockLoaderLock( ULONG flags, ULONG *result, ULONG *magic )
|
||||
{
|
||||
if (flags) FIXME( "flags %lx not supported\n", flags );
|
||||
|
||||
if (result) *result = 1;
|
||||
if (!magic) return STATUS_INVALID_PARAMETER_3;
|
||||
RtlEnterCriticalSection( &loader_section );
|
||||
*magic = GetCurrentThreadId();
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************
|
||||
* LdrUnlockLoaderUnlock (NTDLL.@)
|
||||
*/
|
||||
NTSTATUS WINAPI LdrUnlockLoaderLock( ULONG flags, ULONG magic )
|
||||
{
|
||||
if (magic)
|
||||
{
|
||||
if (magic != GetCurrentThreadId()) return STATUS_INVALID_PARAMETER_2;
|
||||
RtlLeaveCriticalSection( &loader_section );
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************
|
||||
* LdrGetDllHandle (NTDLL.@)
|
||||
*
|
||||
|
|
|
@ -43,12 +43,14 @@
|
|||
@ stdcall LdrGetProcedureAddress(ptr ptr long ptr)
|
||||
@ stub LdrInitializeThunk
|
||||
@ stdcall LdrLoadDll(wstr long ptr ptr)
|
||||
@ stdcall LdrLockLoaderLock(long ptr ptr)
|
||||
@ stub LdrProcessRelocationBlock
|
||||
@ stub LdrQueryImageFileExecutionOptions
|
||||
@ stub LdrQueryProcessModuleInformation
|
||||
@ stdcall LdrShutdownProcess()
|
||||
@ stdcall LdrShutdownThread()
|
||||
@ stdcall LdrUnloadDll(ptr)
|
||||
@ stdcall LdrUnlockLoaderLock(long long)
|
||||
@ stub LdrVerifyImageMatchesChecksum
|
||||
@ stub NPXEMULATORTABLE
|
||||
@ extern NlsAnsiCodePage
|
||||
|
|
|
@ -1204,19 +1204,21 @@ typedef struct _LDR_RESOURCE_INFO
|
|||
ULONG Language;
|
||||
} LDR_RESOURCE_INFO, *PLDR_RESOURCE_INFO;
|
||||
|
||||
NTSTATUS WINAPI LdrAccessResource(HMODULE, PIMAGE_RESOURCE_DATA_ENTRY, void**, PULONG);
|
||||
NTSTATUS WINAPI LdrDisableThreadCalloutsForDll(HMODULE);
|
||||
NTSTATUS WINAPI LdrFindEntryForAddress(const void*, PLDR_MODULE*);
|
||||
NTSTATUS WINAPI LdrGetDllHandle(ULONG, ULONG, PUNICODE_STRING, HMODULE*);
|
||||
NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE, PANSI_STRING, ULONG, void**);
|
||||
NTSTATUS WINAPI LdrLoadDll(LPCWSTR, DWORD, PUNICODE_STRING, HMODULE*);
|
||||
NTSTATUS WINAPI LdrShutdownThread(void);
|
||||
NTSTATUS WINAPI LdrShutdownProcess(void);
|
||||
NTSTATUS WINAPI LdrUnloadDll(HMODULE);
|
||||
NTSTATUS WINAPI LdrAccessResource(HMODULE, PIMAGE_RESOURCE_DATA_ENTRY, void**, PULONG);
|
||||
NTSTATUS WINAPI LdrFindResourceDirectory_U(HMODULE,PLDR_RESOURCE_INFO, DWORD,
|
||||
PIMAGE_RESOURCE_DIRECTORY_ENTRY*);
|
||||
NTSTATUS WINAPI LdrFindResource_U(HMODULE, PLDR_RESOURCE_INFO, ULONG,
|
||||
PIMAGE_RESOURCE_DATA_ENTRY*);
|
||||
NTSTATUS WINAPI LdrGetDllHandle(ULONG, ULONG, PUNICODE_STRING, HMODULE*);
|
||||
NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE, PANSI_STRING, ULONG, void**);
|
||||
NTSTATUS WINAPI LdrLoadDll(LPCWSTR, DWORD, PUNICODE_STRING, HMODULE*);
|
||||
NTSTATUS WINAPI LdrLockLoaderLock(ULONG,ULONG*,ULONG*);
|
||||
NTSTATUS WINAPI LdrShutdownProcess(void);
|
||||
NTSTATUS WINAPI LdrShutdownThread(void);
|
||||
NTSTATUS WINAPI LdrUnloadDll(HMODULE);
|
||||
NTSTATUS WINAPI LdrUnlockLoaderLock(ULONG,ULONG);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
@ -948,9 +948,11 @@ DWORD WINAPI GetModuleFileNameA(
|
|||
*/
|
||||
DWORD WINAPI GetModuleFileNameW( HMODULE hModule, LPWSTR lpFileName, DWORD size )
|
||||
{
|
||||
ULONG magic;
|
||||
|
||||
lpFileName[0] = 0;
|
||||
|
||||
RtlEnterCriticalSection( &loader_section );
|
||||
LdrLockLoaderLock( 0, NULL, &magic );
|
||||
if (!hModule && !(NtCurrentTeb()->tibflags & TEBF_WIN32))
|
||||
{
|
||||
/* 16-bit task - get current NE module name */
|
||||
|
@ -974,7 +976,7 @@ DWORD WINAPI GetModuleFileNameW( HMODULE hModule, LPWSTR lpFileName, DWORD size
|
|||
else SetLastError( RtlNtStatusToDosError( nts ) );
|
||||
|
||||
}
|
||||
RtlLeaveCriticalSection( &loader_section );
|
||||
LdrUnlockLoaderLock( 0, magic );
|
||||
|
||||
TRACE( "%s\n", debugstr_w(lpFileName) );
|
||||
return strlenW(lpFileName);
|
||||
|
|
Loading…
Reference in New Issue