Commit 5779ce28 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

appwiz.cpl: Moved config_key value to addon_info_t.

parent 87538c62
......@@ -69,6 +69,9 @@ typedef struct {
const char *file_name;
const char *subdir_name;
const char *sha;
const char *config_key;
const char *url_config_key;
const char *dir_config_key;
} addon_info_t;
static const addon_info_t addons_info[] = {
......@@ -76,17 +79,13 @@ static const addon_info_t addons_info[] = {
GECKO_VERSION,
"wine_gecko-" GECKO_VERSION "-" ARCH_STRING ".msi",
"gecko",
GECKO_SHA
GECKO_SHA,
"MSHTML", "GeckoUrl", "GeckoCabDir"
}
};
static const addon_info_t *addon = &addons_info[0];
static const WCHAR mshtml_keyW[] =
{'S','o','f','t','w','a','r','e',
'\\','W','i','n','e',
'\\','M','S','H','T','M','L',0};
static HWND install_dialog = NULL;
static LPWSTR url = NULL;
......@@ -233,6 +232,23 @@ static BOOL install_from_unix_file(const char *dir, const char *subdir, const ch
return ret;
}
static HKEY open_config_key(void)
{
HKEY hkey, ret;
DWORD res;
static const WCHAR wine_keyW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e',0};
/* @@ Wine registry key: HKCU\Software\Wine\$config_key */
res = RegOpenKeyW(HKEY_CURRENT_USER, wine_keyW, &hkey);
if(res != ERROR_SUCCESS)
return NULL;
res = RegOpenKeyA(hkey, addon->config_key, &ret);
RegCloseKey(hkey);
return res == ERROR_SUCCESS ? ret : NULL;
}
static BOOL install_from_registered_dir(void)
{
char *package_dir;
......@@ -240,16 +256,15 @@ static BOOL install_from_registered_dir(void)
DWORD res, type, size = MAX_PATH;
BOOL ret;
/* @@ Wine registry key: HKCU\Software\Wine\MSHTML */
res = RegOpenKeyW(HKEY_CURRENT_USER, mshtml_keyW, &hkey);
if(res != ERROR_SUCCESS)
hkey = open_config_key();
if(!hkey)
return FALSE;
package_dir = heap_alloc(size);
res = RegGetValueA(hkey, NULL, "GeckoCabDir", RRF_RT_ANY, &type, (PBYTE)package_dir, &size);
res = RegGetValueA(hkey, NULL, addon->dir_config_key, RRF_RT_ANY, &type, (PBYTE)package_dir, &size);
if(res == ERROR_MORE_DATA) {
package_dir = heap_realloc(package_dir, size);
res = RegGetValueA(hkey, NULL, "GeckoCabDir", RRF_RT_ANY, &type, (PBYTE)package_dir, &size);
res = RegGetValueA(hkey, NULL, addon->dir_config_key, RRF_RT_ANY, &type, (PBYTE)package_dir, &size);
}
RegCloseKey(hkey);
if(res != ERROR_SUCCESS || (type != REG_SZ && type != REG_EXPAND_SZ)) {
......@@ -399,26 +414,26 @@ static IBindStatusCallback InstallCallback = { &InstallCallbackVtbl };
static LPWSTR get_url(void)
{
DWORD size = INTERNET_MAX_URL_LENGTH*sizeof(WCHAR);
WCHAR *url, *config_key;
HKEY hkey;
DWORD res, type;
DWORD size = INTERNET_MAX_URL_LENGTH*sizeof(WCHAR);
DWORD returned_size;
LPWSTR url;
static const WCHAR wszGeckoUrl[] = {'G','e','c','k','o','U','r','l',0};
static const WCHAR httpW[] = {'h','t','t','p'};
static const WCHAR arch_formatW[] = {'?','a','r','c','h','='};
static const WCHAR v_formatW[] = {'&','v','='};
/* @@ Wine registry key: HKCU\Software\Wine\MSHTML */
res = RegOpenKeyW(HKEY_CURRENT_USER, mshtml_keyW, &hkey);
if(res != ERROR_SUCCESS)
hkey = open_config_key();
if(!hkey)
return NULL;
url = heap_alloc(size);
returned_size = size;
res = RegQueryValueExW(hkey, wszGeckoUrl, NULL, &type, (LPBYTE)url, &returned_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);
......
......@@ -34,3 +34,19 @@ static inline BOOL heap_free(void *mem)
{
return HeapFree(GetProcessHeap(), 0, mem);
}
static inline WCHAR *heap_strdupAtoW(const char *str)
{
WCHAR *ret = NULL;
if(str) {
size_t len;
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
ret = heap_alloc(len*sizeof(WCHAR));
if(ret)
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
}
return ret;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment