Module: wine Branch: refs/heads/master Commit: 2f2819466bbc551ae37d72c7c9a759bd82d5e003 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=2f2819466bbc551ae37d72c7...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Mar 21 11:31:23 2006 +0100
ntdll: Detect the fake dlls created by setupapi and refuse to load them.
---
dlls/ntdll/loader.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index efc2bed..967c298 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -1202,6 +1202,22 @@ NTSTATUS WINAPI LdrGetProcedureAddress(H
/*********************************************************************** + * 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 * * Build the full pathname for a builtin dll. @@ -1371,6 +1387,13 @@ static NTSTATUS load_native_dll( LPCWSTR 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;