Alexandre Julliard : appwiz.cpl: Specify a default download URL for add-ons .

Alexandre Julliard julliard at winehq.org
Wed May 30 13:18:52 CDT 2012


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed May 30 13:22:46 2012 +0200

appwiz.cpl: Specify a default download URL for add-ons.

---

 dlls/appwiz.cpl/addons.c |   53 ++++++++++++++++++++++++++--------------------
 dlls/mshtml/mshtml.inf   |    6 +----
 tools/wine.inf.in        |    2 -
 3 files changed, 31 insertions(+), 30 deletions(-)

diff --git a/dlls/appwiz.cpl/addons.c b/dlls/appwiz.cpl/addons.c
index 4a5acba..fd48487 100644
--- a/dlls/appwiz.cpl/addons.c
+++ b/dlls/appwiz.cpl/addons.c
@@ -72,6 +72,7 @@ typedef struct {
     const char *file_name;
     const char *subdir_name;
     const char *sha;
+    const char *url_default;
     const char *config_key;
     const char *url_config_key;
     const char *dir_config_key;
@@ -84,6 +85,7 @@ static const addon_info_t addons_info[] = {
         "wine_gecko-" GECKO_VERSION "-" ARCH_STRING ".msi",
         "gecko",
         GECKO_SHA,
+        "http://source.winehq.org/winegecko.php",
         "MSHTML", "GeckoUrl", "GeckoCabDir",
         MAKEINTRESOURCEW(ID_DWL_GECKO_DIALOG)
     },
@@ -92,6 +94,7 @@ static const addon_info_t addons_info[] = {
         "wine-mono-" MONO_VERSION ".msi",
         "mono",
         MONO_SHA,
+        "http://source.winehq.org/winemono.php",
         "Dotnet", "MonoUrl", "MonoCabDir",
         MAKEINTRESOURCEW(ID_DWL_MONO_DIALOG)
     }
@@ -425,6 +428,22 @@ static const IBindStatusCallbackVtbl InstallCallbackVtbl = {
 
 static IBindStatusCallback InstallCallback = { &InstallCallbackVtbl };
 
+static void append_url_params( WCHAR *url )
+{
+    static const WCHAR arch_formatW[] = {'?','a','r','c','h','='};
+    static const WCHAR v_formatW[] = {'&','v','='};
+    DWORD size = INTERNET_MAX_URL_LENGTH * sizeof(WCHAR);
+    DWORD len = strlenW(url);
+
+    memcpy(url+len, arch_formatW, sizeof(arch_formatW));
+    len += sizeof(arch_formatW)/sizeof(WCHAR);
+    len += MultiByteToWideChar(CP_ACP, 0, ARCH_STRING, sizeof(ARCH_STRING),
+                               url+len, size/sizeof(WCHAR)-len)-1;
+    memcpy(url+len, v_formatW, sizeof(v_formatW));
+    len += sizeof(v_formatW)/sizeof(WCHAR);
+    MultiByteToWideChar(CP_ACP, 0, addon->version, -1, url+len, size/sizeof(WCHAR)-len);
+}
+
 static LPWSTR get_url(void)
 {
     DWORD size = INTERNET_MAX_URL_LENGTH*sizeof(WCHAR);
@@ -434,36 +453,24 @@ static LPWSTR get_url(void)
     DWORD returned_size;
 
     static const WCHAR httpW[] = {'h','t','t','p'};
-    static const WCHAR arch_formatW[] = {'?','a','r','c','h','='};
-    static const WCHAR v_formatW[] = {'&','v','='};
-
-    hkey = open_config_key();
-    if(!hkey)
-        return NULL;
 
     url = heap_alloc(size);
     returned_size = size;
 
-    config_key = heap_strdupAtoW(addon->url_config_key);
-    res = RegQueryValueExW(hkey, config_key, NULL, &type, (LPBYTE)url, &returned_size);
-    heap_free(config_key);
-    RegCloseKey(hkey);
-    if(res != ERROR_SUCCESS || type != REG_SZ) {
-        heap_free(url);
-        return NULL;
+    hkey = open_config_key();
+    if (hkey)
+    {
+        config_key = heap_strdupAtoW(addon->url_config_key);
+        res = RegQueryValueExW(hkey, config_key, NULL, &type, (LPBYTE)url, &returned_size);
+        heap_free(config_key);
+        RegCloseKey(hkey);
+        if(res == ERROR_SUCCESS && type == REG_SZ) goto found;
     }
 
-    if(returned_size > sizeof(httpW) && !memcmp(url, httpW, sizeof(httpW))) {
-        DWORD len;
+    MultiByteToWideChar( CP_ACP, 0, addon->url_default, -1, url, size / sizeof(WCHAR) );
 
-        len = strlenW(url);
-        memcpy(url+len, arch_formatW, sizeof(arch_formatW));
-        len += sizeof(arch_formatW)/sizeof(WCHAR);
-        len += MultiByteToWideChar(CP_ACP, 0, ARCH_STRING, sizeof(ARCH_STRING), url+len, size/sizeof(WCHAR)-len)-1;
-        memcpy(url+len, v_formatW, sizeof(v_formatW));
-        len += sizeof(v_formatW)/sizeof(WCHAR);
-        MultiByteToWideChar(CP_ACP, 0, addon->version, -1, url+len, size/sizeof(WCHAR)-len);
-    }
+found:
+    if (returned_size > sizeof(httpW) && !memcmp(url, httpW, sizeof(httpW))) append_url_params( url );
 
     TRACE("Got URL %s\n", debugstr_w(url));
     return url;
diff --git a/dlls/mshtml/mshtml.inf b/dlls/mshtml/mshtml.inf
index 8186c2d..4a650b4 100644
--- a/dlls/mshtml/mshtml.inf
+++ b/dlls/mshtml/mshtml.inf
@@ -3,7 +3,7 @@ Signature="$CHICAGO$"
 
 
 [RegisterDll]
-AddReg=Classes.Reg, Protocols.Reg, IE.Reg, FileAssoc.Reg, WineGecko.Reg
+AddReg=Classes.Reg, Protocols.Reg, IE.Reg, FileAssoc.Reg
 
 
 [UnregisterDll]
@@ -69,10 +69,6 @@ HKLM,"Software\Microsoft\Internet Explorer\Default Behaviors","TIME",, "CLSID:47
 HKLM,"Software\Microsoft\Internet Explorer\ActiveX Compatibility","Version",,"6.17"
 
 
-[WineGecko.Reg]
-HKCU,Software\Wine\MSHTML,"GeckoUrl",,"http://source.winehq.org/winegecko.php"
-
-
 [FileAssoc.Reg]
 
 ;; AVI
diff --git a/tools/wine.inf.in b/tools/wine.inf.in
index b182953..f95d9dc 100644
--- a/tools/wine.inf.in
+++ b/tools/wine.inf.in
@@ -712,8 +712,6 @@ HKLM,SOFTWARE\Microsoft\Active Setup\Installed Components\{de5aed00-a4bf-11d1-99
 HKLM,SOFTWARE\Microsoft\Active Setup\Installed Components\{de5aed00-a4bf-11d1-9948-00c04f98bbc9},"Locale",2,"*"
 HKLM,SOFTWARE\Microsoft\Active Setup\Installed Components\{de5aed00-a4bf-11d1-9948-00c04f98bbc9},"Version",2,"4,74,9273,0"
 
-HKCU,SOFTWARE\Wine\Dotnet,"MonoUrl",,"http://source.winehq.org/winemono.php"
-
 [Nls]
 HKLM,System\CurrentControlSet\Control\Nls\Codepage,"37",,""
 HKLM,System\CurrentControlSet\Control\Nls\Language,"0401",,""




More information about the wine-cvs mailing list