Alistair Leslie-Hughes : winetest: Skip over stub dll if detected.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Dec 3 15:43:25 CST 2014


Module: wine
Branch: master
Commit: 8885a4a2b9cdd78b8d067a80d6d95db1d2032203
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8885a4a2b9cdd78b8d067a80d6d95db1d2032203

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Mon Nov 10 12:44:05 2014 +1100

winetest: Skip over stub dll if detected.

---

 programs/winetest/main.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/programs/winetest/main.c b/programs/winetest/main.c
index 2afa813..0149377 100644
--- a/programs/winetest/main.c
+++ b/programs/winetest/main.c
@@ -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);




More information about the wine-cvs mailing list