Mike Hearn wrote:

Actually we pretty much have to "statically link" the ActiveX control as it must be built as Win32 code. In fact the easiest thing to do is simply download the prebuilt version from Adams webpage, as compiling Mozilla is sort of a pain, then drop the PE DLL into c:\windows\system.

If it weren't for Alexandres dislike of binaries in CVS I'd have asked

I think a good solution would be to add code to wine to offer to download it and install when it is needed.


That should be only a few lines of code using MessageBox() and URLDownloadToFileW()... something like the following patch, but perhaps with a progress bar, and internationalized messages?

Mike
Index: dlls/shdocvw/shdocvw_main.c
===================================================================
RCS file: /home/wine/wine/dlls/shdocvw/shdocvw_main.c,v
retrieving revision 1.20
diff -u -r1.20 shdocvw_main.c
--- dlls/shdocvw/shdocvw_main.c 25 Aug 2004 17:33:47 -0000      1.20
+++ dlls/shdocvw/shdocvw_main.c 20 Sep 2004 09:53:28 -0000
@@ -45,6 +45,10 @@
 #define MOZILLA_ACTIVEX_MESSAGE "You need to install the Mozilla ActiveX control 
to\n" \
                                 "use Wine's builtin CLSID_WebBrowser from SHDOCVW.DLL"
 
+#define MOZILLA_ACTIVEX_DOWNLOAD "This application is requesting an ActiveX browser 
object\n" \
+                                 "but the Mozilla Active X control is currently not 
installed." \
+                                 "Do you wish to download and install it?"
+
 DEFINE_GUID( CLSID_MozillaBrowser, 
0x1339B54C,0x3453,0x11D2,0x93,0xB9,0x00,0x00,0x00,0x00,0x00,0x00);
 
 typedef HRESULT (WINAPI *fnGetClassObject)(REFCLSID rclsid, REFIID iid, LPVOID *ppv);
@@ -125,6 +129,47 @@
     return S_FALSE;
 }
 
+static BOOL SHDOCVW_TryDownloadMozillaControl()
+{
+    char *szUrl = "http://www.iol.ie/~locka/mozilla/MozillaControl16.exe";;
+    char *szProg = "%TEMP%\\MozillaControl16.exe";
+    char path[MAX_PATH];
+    typeof(URLDownloadToFileA) *df;
+    HMODULE hUrlMon;
+    DWORD r;
+    STARTUPINFOA si;
+    PROCESS_INFORMATION pi;
+    MESSAGE(MOZILLA_ACTIVEX_DOWNLOAD "\n");
+
+    hUrlMon = LoadLibraryA("urlmon");
+    if( !hUrlMon )
+        return FALSE;
+
+    df = (typeof(URLDownloadToFileA)*) GetProcAddress( hUrlMon, "URLDownloadToFileA" 
);
+    if( !df )
+        return FALSE;
+
+    r = MessageBoxA(NULL, MOZILLA_ACTIVEX_DOWNLOAD, "Wine", MB_YESNO | 
MB_ICONQUESTION);
+    if( r != IDYES )
+        return FALSE;
+
+    r = ExpandEnvironmentStringsA( szProg, path, MAX_PATH );
+    if( !r )
+        return FALSE;
+    
+    r = df( NULL, szUrl, path, 0, NULL );
+    if( r != S_OK )
+        return FALSE;
+
+    memset( &si, 0, sizeof si );
+    si.cb = sizeof si;
+    r = CreateProcessA( path, NULL, NULL, NULL, 0, 0, NULL, NULL, &si, &pi );
+    if( !r )
+        return FALSE;
+
+    WaitForSingleObject( pi.hProcess, INFINITE );
+    return TRUE;
+}
 
 static BOOL SHDOCVW_TryLoadMozillaControl()
 {
@@ -134,6 +179,9 @@
         return hMozCtl ? TRUE : FALSE;
 
     if( !SHDOCVW_GetMozctlPath( szPath, sizeof szPath ) )
+        SHDOCVW_TryDownloadMozillaControl();
+
+    if( !SHDOCVW_GetMozctlPath( szPath, sizeof szPath ) )
     {
         MESSAGE(MOZILLA_ACTIVEX_MESSAGE "\n");
         MessageBoxA(NULL, MOZILLA_ACTIVEX_MESSAGE, "Wine", MB_OK | 
MB_ICONEXCLAMATION);
@@ -143,7 +191,7 @@
     hMozCtl = LoadLibraryExW(szPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
     if( !hMozCtl )
     {
-        ERR("Can't load the Mozilla ActiveX control\n");
+        ERR("Can't load the Mozilla ActiveX control from %s\n", debugstr_w(szPath));
         return FALSE;
     }
     return TRUE;

Reply via email to