866ed76
--- dlls/mshtml/install.c.orig	2010-03-28 23:48:50.000000000 +0200
866ed76
+++ dlls/mshtml/install.c	2010-03-29 20:43:54.000000000 +0200
866ed76
@@ -284,6 +284,103 @@
866ed76
     return ret;
866ed76
 }
866ed76
 
866ed76
+static BOOL install_from_fedora_mingw32_wine_gecko(void) {
866ed76
+    const char *data_dir, *subdir;
866ed76
+    BOOL res;
866ed76
+
866ed76
+    LPWSTR dos_dir_name;
866ed76
+    LPSTR dos_dir_name_a;
866ed76
+    static WCHAR *(*wine_get_dos_file_name)(const char*);
866ed76
+    static const WCHAR kernel32W[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0};
866ed76
+
866ed76
+    char install_dir[MAX_PATH];
866ed76
+    char gecko_dir[MAX_PATH];
866ed76
+
866ed76
+    SHFILEOPSTRUCTA sf;
866ed76
+
866ed76
+    TRACE("()\n");
866ed76
+
866ed76
+    if((data_dir = wine_get_data_dir()))
866ed76
+        subdir = "/gecko/";
866ed76
+    else if((data_dir = wine_get_build_dir()))
866ed76
+        subdir = "/../gecko/";
866ed76
+    else
866ed76
+        return FALSE;
866ed76
+
866ed76
+    TRACE("data_dir=%s\n",data_dir);
866ed76
+    TRACE("subdir=%s\n",subdir);
866ed76
+
866ed76
+    memcpy(gecko_dir, data_dir, MAX_PATH);
866ed76
+    strncat(gecko_dir, subdir, MAX_PATH-strlen(gecko_dir));
866ed76
+    strncat(gecko_dir, GECKO_VERSION, MAX_PATH-strlen(gecko_dir));
866ed76
+    strncat(gecko_dir, "/", MAX_PATH-strlen(gecko_dir));
866ed76
+
866ed76
+    if(!wine_get_dos_file_name)
866ed76
+        wine_get_dos_file_name = (void*)GetProcAddress(GetModuleHandleW(kernel32W), "wine_get_dos_file_name");
866ed76
+
866ed76
+    if(wine_get_dos_file_name) { /* Wine UNIX mode */
866ed76
+        dos_dir_name = wine_get_dos_file_name(gecko_dir);
866ed76
+        if(!dos_dir_name) {
866ed76
+            ERR("Could not get dos file name of %s\n", debugstr_a(gecko_dir));
866ed76
+            return FALSE;
866ed76
+        }
866ed76
+    } else {
866ed76
+        return FALSE;
866ed76
+    }
866ed76
+
866ed76
+    TRACE("gecko_dir=%s\n", debugstr_a(gecko_dir));
866ed76
+    TRACE("dos_dir_name=%s\n", debugstr_w(dos_dir_name));
866ed76
+
866ed76
+
866ed76
+    if(GetFileAttributesW(dos_dir_name) == INVALID_FILE_ATTRIBUTES) {
866ed76
+        TRACE("mingw32-wine-gecko package not installed\n");
866ed76
+        return FALSE;
866ed76
+    }
866ed76
+
866ed76
+    GetSystemDirectoryA(install_dir, sizeof(install_dir));
866ed76
+    strncat(install_dir, "\\gecko\\",MAX_PATH-strlen(install_dir));
866ed76
+    res = CreateDirectoryA(install_dir, NULL);
866ed76
+    if(!res && GetLastError() != ERROR_ALREADY_EXISTS) {
866ed76
+        ERR("Could not create directory: %08u\n", GetLastError());
866ed76
+        return FALSE;
866ed76
+    }
866ed76
+
866ed76
+    strncat(install_dir, GECKO_VERSION, MAX_PATH-strlen(install_dir));
866ed76
+    res = CreateDirectoryA(install_dir, NULL);
866ed76
+    if(!res && GetLastError() != ERROR_ALREADY_EXISTS) {
866ed76
+        ERR("Could not create directory: %08u\n", GetLastError());
866ed76
+        return FALSE;
866ed76
+    }
866ed76
+
866ed76
+    TRACE("install_dir=%s\n",debugstr_a(install_dir));
866ed76
+
866ed76
+    dos_dir_name_a = heap_strdupWtoA(dos_dir_name);
866ed76
+
866ed76
+    lstrcatA(dos_dir_name_a,"*.*");
866ed76
+    TRACE("dos_dir_name_a=%s\n",debugstr_a(dos_dir_name_a));
866ed76
+
866ed76
+    memset(&sf,0,sizeof(sf));
866ed76
+    sf.hwnd = 0;
866ed76
+    sf.wFunc = FO_COPY;
866ed76
+    sf.pFrom = dos_dir_name_a;
866ed76
+    sf.pTo = install_dir;
866ed76
+    sf.fFlags = FOF_NOCONFIRMATION, FOF_NOCONFIRMMKDIR | FOF_NOERRORUI | FOF_SILENT;
866ed76
+    res = SHFileOperationA(&sf);
866ed76
+
866ed76
+    heap_free(dos_dir_name_a);
866ed76
+
866ed76
+    if(res != 0) {
866ed76
+        ERR("Could not copy files: %08u\n", GetLastError());
866ed76
+        return FALSE;
866ed76
+    }
866ed76
+
866ed76
+    set_registry(install_dir);
866ed76
+
866ed76
+    clean_up();
866ed76
+
866ed76
+    return TRUE;
866ed76
+}
866ed76
+
866ed76
 static HRESULT WINAPI InstallCallback_QueryInterface(IBindStatusCallback *iface,
866ed76
                                                      REFIID riid, void **ppv)
866ed76
 {
866ed76
@@ -541,7 +638,8 @@
866ed76
          * - $datadir/gecko
866ed76
          * - download from URL stored in GeckoUrl value of HKCU/Software/MSHTML key
866ed76
          */
866ed76
-        if(!install_from_registered_dir()
866ed76
+        if ( !install_from_fedora_mingw32_wine_gecko()
866ed76
+           && !install_from_registered_dir()
866ed76
            && !install_from_default_dir()
866ed76
            && !silent && (url = get_url()))
866ed76
             DialogBoxW(hInst, MAKEINTRESOURCEW(ID_DWL_DIALOG), 0, installer_proc);
866ed76
--- dlls/mshtml/Makefile.in.orig	2010-03-29 15:13:47.000000000 +0200
866ed76
+++ dlls/mshtml/Makefile.in	2010-03-29 15:49:55.000000000 +0200
866ed76
@@ -4,7 +4,7 @@
866ed76
 VPATH     = @srcdir@
866ed76
 MODULE    = mshtml.dll
866ed76
 IMPORTLIB = mshtml
866ed76
-IMPORTS   = strmiids uuid urlmon shlwapi ole32 oleaut32 user32 gdi32 advapi32 kernel32
866ed76
+IMPORTS   = strmiids uuid urlmon shlwapi ole32 oleaut32 user32 gdi32 advapi32 kernel32 shell32
866ed76
 EXTRADEFS = -DCOM_NO_WINDOWS_H
866ed76
 DELAYIMPORTS = wininet
866ed76