Alexandre Julliard : winetest: Try to trigger the Gecko install for mshtml tests, and skip them otherwise .

Alexandre Julliard julliard at winehq.org
Thu Feb 19 09:18:44 CST 2009


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Feb 19 12:55:23 2009 +0100

winetest: Try to trigger the Gecko install for mshtml tests, and skip them otherwise.

---

 programs/winetest/Makefile.in |    2 +-
 programs/winetest/main.c      |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in
index d50284a..05427e7 100644
--- a/programs/winetest/Makefile.in
+++ b/programs/winetest/Makefile.in
@@ -4,7 +4,7 @@ SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = winetest.exe
 APPMODE   = -mconsole
-IMPORTS   = comctl32 version user32 gdi32 advapi32 wsock32 kernel32
+IMPORTS   = uuid comctl32 version user32 gdi32 advapi32 wsock32 kernel32
 
 EXTRARCFLAGS = -DBUILD_SHA1=\"`GIT_DIR=$(TOPSRCDIR)/.git git rev-parse HEAD 2>/dev/null`\"
 
diff --git a/programs/winetest/main.c b/programs/winetest/main.c
index 211ec2e..ab9c79e 100644
--- a/programs/winetest/main.c
+++ b/programs/winetest/main.c
@@ -28,9 +28,11 @@
 #include "config.h"
 #include "wine/port.h"
 
+#define COBJMACROS
 #include <stdio.h>
 #include <assert.h>
 #include <windows.h>
+#include <mshtml.h>
 
 #include "winetest.h"
 #include "resource.h"
@@ -149,6 +151,34 @@ static int running_on_visible_desktop (void)
     return IsWindowVisible(desktop);
 }
 
+/* check if Gecko is present, trying to trigger the install if not */
+static BOOL gecko_check(void)
+{
+    HMODULE mshtml;
+    HRESULT (WINAPI *pDllGetClassObject)(REFCLSID rclsid, REFIID riid, LPVOID *ppv);
+    IClassFactory *factory = NULL;
+    IHTMLDocument2 *doc = NULL;
+    IHTMLElement *body;
+    BOOL ret = FALSE;
+
+    if (!(mshtml = LoadLibraryA( "mshtml.dll" ))) return FALSE;
+    if (!(pDllGetClassObject = (void *)GetProcAddress( mshtml, "DllGetClassObject" )))
+        goto done;
+    if (FAILED(pDllGetClassObject( &CLSID_HTMLDocument, &IID_IClassFactory, (void **)&factory )))
+        goto done;
+    if (FAILED(IClassFactory_CreateInstance( factory, NULL, &IID_IHTMLDocument2, (void **)&doc )))
+        goto done;
+    if (FAILED(IHTMLDocument2_get_body( doc, &body )))
+        goto done;
+    IHTMLElement_Release( body );
+    ret = TRUE;
+done:
+    if (doc) IHTMLDocument_Release( doc );
+    if (factory) IClassFactory_Release( factory );
+    FreeLibrary( mshtml );
+    return ret;
+}
+
 static void print_version (void)
 {
 #ifdef __i386__
@@ -520,6 +550,12 @@ extract_test_proc (HMODULE hModule, LPCTSTR lpszType,
         xprintf ("    %s=dll is missing\n", dllname);
         return TRUE;
     }
+    if (!strcmp( dllname, "mshtml" ) && running_under_wine() && !gecko_check())
+    {
+        FreeLibrary(dll);
+        xprintf ("    %s=load error Gecko is not installed\n", dllname);
+        return TRUE;
+    }
     GetModuleFileNameA(dll, filename, MAX_PATH);
     FreeLibrary(dll);
 




More information about the wine-cvs mailing list