winetest: Also check for builtin dll signature.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-04-22 19:47:56 +02:00
parent 510e746718
commit 3a02bc2ecd
1 changed files with 6 additions and 2 deletions

View File

@ -295,6 +295,7 @@ static int running_elevated (void)
/* check for native dll when running under wine */
static BOOL is_native_dll( HMODULE module )
{
static const char builtin_signature[] = "Wine builtin DLL";
static const char fakedll_signature[] = "Wine placeholder DLL";
const IMAGE_DOS_HEADER *dos;
@ -303,8 +304,11 @@ static BOOL is_native_dll( HMODULE module )
/* builtin dlls can't be loaded as datafile, so we must have native or fake dll */
dos = (const IMAGE_DOS_HEADER *)((const char *)module - 1);
if (dos->e_magic != IMAGE_DOS_SIGNATURE) return FALSE;
if (dos->e_lfanew >= sizeof(*dos) + sizeof(fakedll_signature) &&
!memcmp( dos + 1, fakedll_signature, sizeof(fakedll_signature) )) return FALSE;
if (dos->e_lfanew >= sizeof(*dos) + 32)
{
if (!memcmp( dos + 1, builtin_signature, sizeof(builtin_signature) )) return FALSE;
if (!memcmp( dos + 1, fakedll_signature, sizeof(fakedll_signature) )) return FALSE;
}
return TRUE;
}