winetest: Skip over stub dll if detected.

This commit is contained in:
Alistair Leslie-Hughes 2014-11-10 12:44:05 +11:00 committed by Alexandre Julliard
parent 0ab2311cd5
commit 8885a4a2b9
1 changed files with 40 additions and 0 deletions

View File

@ -308,6 +308,35 @@ static BOOL is_native_dll( HMODULE module )
return TRUE;
}
/*
* Windows 8 has a concept of stub DLLs. When DLLMain is called the user is prompted
* to install that component. To bypass this check we need to look at the version resource.
*/
static BOOL is_stub_dll(const char *filename)
{
DWORD size, ver;
BOOL isstub = FALSE;
char *p, *data;
size = GetFileVersionInfoSizeA(filename, &ver);
if (!size) return FALSE;
data = HeapAlloc(GetProcessHeap(), 0, size);
if (!data) return FALSE;
if (GetFileVersionInfoA(filename, ver, size, data))
{
char buf[256];
sprintf(buf, "\\StringFileInfo\\%04x%04x\\OriginalFilename", MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 1200);
if (VerQueryValueA(data, buf, (void**)&p, &size))
isstub = !lstrcmpiA("wcodstub.dll", p);
}
HeapFree(GetProcessHeap(), 0, data);
return isstub;
}
static void print_version (void)
{
#ifdef __i386__
@ -911,6 +940,17 @@ extract_test_proc (HMODULE hModule, LPCSTR lpszType, LPSTR lpszName, LONG_PTR lP
}
return TRUE;
}
if(is_stub_dll(dllname))
{
FreeLibrary(dll);
xprintf (" %s=dll is a stub\n", dllname);
if (actctx != INVALID_HANDLE_VALUE)
{
pDeactivateActCtx(0, cookie);
pReleaseActCtx(actctx);
}
return TRUE;
}
if (is_native_dll(dll))
{
FreeLibrary(dll);