winetest: Skip over stub dll if detected
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Wed Nov 26 21:11:59 CST 2014
Hi,
Changelog:
winetest: Skip over stub dll if detected
Best Regards
Alistair Leslie-Hughes
-------------- next part --------------
>From a217e4fc63d47da273ed1b78ccf35ae71d2df7a2 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Mon, 10 Nov 2014 12:44:05 +1100
Subject: [PATCH] Skip over stub dll if detected
To: wine-patches <wine-patches at winehq.org>
---
programs/winetest/main.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/programs/winetest/main.c b/programs/winetest/main.c
index 2afa813..6854f17 100644
--- a/programs/winetest/main.c
+++ b/programs/winetest/main.c
@@ -308,6 +308,44 @@ static BOOL is_native_dll( HMODULE module )
return TRUE;
}
+/*
+ * Windows 8 has a concept of stub DLL's. 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;
+
+ size = GetFileVersionInfoSizeA(filename, &ver);
+ if(size != 0)
+ {
+ LPSTR data = HeapAlloc(GetProcessHeap(), 0, size);
+ char *p;
+
+ if(!data)
+ return isstub;
+
+ 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, (LPVOID*)&p, &size))
+ {
+ if(lstrcmpiA("wcodstub.dll", p) == 0)
+ {
+ isstub = TRUE;
+ }
+ }
+ }
+
+ HeapFree(GetProcessHeap(), 0, data);
+ }
+
+ return isstub;
+}
+
static void print_version (void)
{
#ifdef __i386__
@@ -911,6 +949,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);
--
1.9.1
More information about the wine-patches
mailing list