forked from Mirrors/wine-wine
ntdll: Detect the fake dlls created by setupapi and refuse to load them.
parent
8b478a70ec
commit
2f2819466b
|
@ -1201,6 +1201,22 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name,
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* is_fake_dll
|
||||
*
|
||||
* Check if a loaded native dll is a Wine fake dll.
|
||||
*/
|
||||
static BOOL is_fake_dll( const void *base )
|
||||
{
|
||||
static const char fakedll_signature[] = "Wine placeholder DLL";
|
||||
const IMAGE_DOS_HEADER *dos = base;
|
||||
|
||||
if (dos->e_lfanew >= sizeof(*dos) + sizeof(fakedll_signature) &&
|
||||
!memcmp( dos + 1, fakedll_signature, sizeof(fakedll_signature) )) return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* get_builtin_fullname
|
||||
*
|
||||
|
@ -1371,6 +1387,13 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
|
|||
NtClose( mapping );
|
||||
if (status != STATUS_SUCCESS) return status;
|
||||
|
||||
if (is_fake_dll( module ))
|
||||
{
|
||||
TRACE( "%s is a fake dll, not loading it\n", debugstr_w(name) );
|
||||
NtUnmapViewOfSection( NtCurrentProcess(), module );
|
||||
return STATUS_DLL_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* create the MODREF */
|
||||
|
||||
if (!(wm = alloc_module( module, name ))) return STATUS_NO_MEMORY;
|
||||
|
|
Loading…
Reference in New Issue