Fetch the exe module directly from the PDB instead of calling
LdrGetDllHandle.
This commit is contained in:
parent
fa13d013e8
commit
5980477dcc
|
@ -47,10 +47,8 @@ WINE_DECLARE_DEBUG_CHANNEL(loaddll);
|
||||||
|
|
||||||
inline static HMODULE get_exe_module(void)
|
inline static HMODULE get_exe_module(void)
|
||||||
{
|
{
|
||||||
HMODULE mod;
|
HANDLE *pdb = (HANDLE *)NtCurrentTeb()->process;
|
||||||
/* FIXME: should look into PEB */
|
return pdb[0x08 / sizeof(HANDLE)]; /* get dword at offset 0x08 in pdb */
|
||||||
LdrGetDllHandle( 0, 0, NULL, &mod );
|
|
||||||
return mod;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -676,23 +674,18 @@ HMODULE WINAPI GetModuleHandleA(LPCSTR module)
|
||||||
{
|
{
|
||||||
NTSTATUS nts;
|
NTSTATUS nts;
|
||||||
HMODULE ret;
|
HMODULE ret;
|
||||||
|
|
||||||
if (module)
|
|
||||||
{
|
|
||||||
UNICODE_STRING wstr;
|
UNICODE_STRING wstr;
|
||||||
|
|
||||||
|
if (!module) return get_exe_module();
|
||||||
|
|
||||||
RtlCreateUnicodeStringFromAsciiz(&wstr, module);
|
RtlCreateUnicodeStringFromAsciiz(&wstr, module);
|
||||||
nts = LdrGetDllHandle(0, 0, &wstr, &ret);
|
nts = LdrGetDllHandle(0, 0, &wstr, &ret);
|
||||||
RtlFreeUnicodeString( &wstr );
|
RtlFreeUnicodeString( &wstr );
|
||||||
}
|
|
||||||
else
|
|
||||||
nts = LdrGetDllHandle(0, 0, NULL, &ret);
|
|
||||||
if (nts != STATUS_SUCCESS)
|
if (nts != STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
ret = 0;
|
ret = 0;
|
||||||
SetLastError( RtlNtStatusToDosError( nts ) );
|
SetLastError( RtlNtStatusToDosError( nts ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -703,17 +696,12 @@ HMODULE WINAPI GetModuleHandleW(LPCWSTR module)
|
||||||
{
|
{
|
||||||
NTSTATUS nts;
|
NTSTATUS nts;
|
||||||
HMODULE ret;
|
HMODULE ret;
|
||||||
|
|
||||||
if (module)
|
|
||||||
{
|
|
||||||
UNICODE_STRING wstr;
|
UNICODE_STRING wstr;
|
||||||
|
|
||||||
|
if (!module) return get_exe_module();
|
||||||
|
|
||||||
RtlInitUnicodeString( &wstr, module );
|
RtlInitUnicodeString( &wstr, module );
|
||||||
nts = LdrGetDllHandle( 0, 0, &wstr, &ret);
|
nts = LdrGetDllHandle( 0, 0, &wstr, &ret);
|
||||||
}
|
|
||||||
else
|
|
||||||
nts = LdrGetDllHandle( 0, 0, NULL, &ret);
|
|
||||||
|
|
||||||
if (nts != STATUS_SUCCESS)
|
if (nts != STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
SetLastError( RtlNtStatusToDosError( nts ) );
|
SetLastError( RtlNtStatusToDosError( nts ) );
|
||||||
|
|
Loading…
Reference in New Issue