Alexandre Julliard : winetest: Don' t run tests on native dlls when running under Wine.

Alexandre Julliard julliard at winehq.org
Tue Sep 29 11:09:07 CDT 2009


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Sep 29 13:28:15 2009 +0200

winetest: Don't run tests on native dlls when running under Wine.

---

 programs/winetest/main.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/programs/winetest/main.c b/programs/winetest/main.c
index f43b7de..b16b9cf 100644
--- a/programs/winetest/main.c
+++ b/programs/winetest/main.c
@@ -155,6 +155,20 @@ static int running_on_visible_desktop (void)
     return IsWindowVisible(desktop);
 }
 
+/* check for wine fake dll module */
+static BOOL is_fake_dll( HMODULE module )
+{
+    static const char fakedll_signature[] = "Wine placeholder DLL";
+    const IMAGE_DOS_HEADER *dos;
+
+    if (!((ULONG_PTR)module & 1)) return FALSE;  /* not loaded as datafile */
+    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 TRUE;
+    return FALSE;
+}
+
 /* check if Gecko is present, trying to trigger the install if not */
 static BOOL gecko_check(void)
 {
@@ -639,6 +653,17 @@ extract_test_proc (HMODULE hModule, LPCTSTR lpszType,
 
     if (!dll) dll = load_com_dll(dllname, &wine_tests[nr_of_files].maindllpath, filename);
 
+    if (dll && running_under_wine() && ((ULONG_PTR)dll & 1))
+    {
+        /* builtin dlls can't be loaded as datafile, so we must have native or fake dll */
+        if (!is_fake_dll(dll))
+        {
+            FreeLibrary(dll);
+            xprintf ("    %s=load error Configured as native\n", dllname);
+            return TRUE;
+        }
+    }
+
     if (!dll && pLoadLibraryShim)
     {
         MultiByteToWideChar(CP_ACP, 0, dllname, -1, dllnameW, MAX_PATH);




More information about the wine-cvs mailing list