From 0d3bddc57cc5ae3067df76da779899c3964f41e1 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 17 Jun 2005 21:09:07 +0000 Subject: [PATCH] Updated paths of ShowDirSymlinks, ShowDotFiles and Version options. --- programs/winecfg/appdefaults.c | 8 ++++---- programs/winecfg/driveui.c | 12 ++++++------ programs/winecfg/winecfg.c | 15 ++++++++++----- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/programs/winecfg/appdefaults.c b/programs/winecfg/appdefaults.c index 18ef9ba1f5a..23d2225d44a 100644 --- a/programs/winecfg/appdefaults.c +++ b/programs/winecfg/appdefaults.c @@ -40,7 +40,7 @@ static void update_comboboxes(HWND dialog) char *winver; /* retrieve the registry values */ - winver = get_reg_key(keypath("Version"), "Windows", ""); + winver = get_reg_key(keypath(""), "Version", ""); /* empty winver means use automatic mode (ie the builtin dll linkage heuristics) */ WINE_TRACE("winver is %s\n", *winver != '\0' ? winver : "null (automatic mode)"); @@ -296,12 +296,12 @@ static void on_winver_change(HWND dialog) if (selection == 0) { WINE_TRACE("automatic/default selected so removing current setting\n"); - set_reg_key(keypath("Version"), "Windows", NULL); + set_reg_key(keypath(""), "Version", NULL); } else { - WINE_TRACE("setting Version\\Windows key to value '%s'\n", ver[selection - 1].szVersion); - set_reg_key(keypath("Version"), "Windows", ver[selection - 1].szVersion); + WINE_TRACE("setting Version key to value '%s'\n", ver[selection - 1].szVersion); + set_reg_key(keypath(""), "Version", ver[selection - 1].szVersion); } /* enable the apply button */ diff --git a/programs/winecfg/driveui.c b/programs/winecfg/driveui.c index 4e23aaa8832..f3b98115c54 100644 --- a/programs/winecfg/driveui.c +++ b/programs/winecfg/driveui.c @@ -310,14 +310,14 @@ static int fill_drives_list(HWND dialog) static void on_options_click(HWND dialog) { if (IsDlgButtonChecked(dialog, IDC_SHOW_DIRSYM_LINK) == BST_CHECKED) - set_reg_key("wine", "ShowDirSymLinks", "Y"); + set_reg_key("", "ShowDirSymLinks", "Y"); else - set_reg_key("wine", "ShowDIrSymLinks", "N"); + set_reg_key("", "ShowDirSymLinks", "N"); if (IsDlgButtonChecked(dialog, IDC_SHOW_DOT_FILES) == BST_CHECKED) - set_reg_key("wine", "ShowDotFiles", "Y"); + set_reg_key("", "ShowDotFiles", "Y"); else - set_reg_key("wine", "ShowDotFiles", "N"); + set_reg_key("", "ShowDotFiles", "N"); } static void on_add_click(HWND dialog) @@ -684,10 +684,10 @@ static void init_listview_columns(HWND dialog) static void load_drive_options(HWND dialog) { - if (!strcmp(get_reg_key("wine", "ShowDirSymLinks", "N"), "Y")) + if (!strcmp(get_reg_key("", "ShowDirSymLinks", "N"), "Y")) CheckDlgButton(dialog, IDC_SHOW_DIRSYM_LINK, BST_CHECKED); - if (!strcmp(get_reg_key("wine", "ShowDotFiles", "N"), "Y")) + if (!strcmp(get_reg_key("", "ShowDotFiles", "N"), "Y")) CheckDlgButton(dialog, IDC_SHOW_DOT_FILES, BST_CHECKED); } diff --git a/programs/winecfg/winecfg.c b/programs/winecfg/winecfg.c index 490da0d63da..6773d68932c 100644 --- a/programs/winecfg/winecfg.c +++ b/programs/winecfg/winecfg.c @@ -123,7 +123,7 @@ static char *get_config_key (const char *subkey, const char *name, const char *d WINE_TRACE("buffer=%s\n", buffer); end: - if (hSubKey) RegCloseKey(hSubKey); + if (hSubKey && hSubKey != config_key) RegCloseKey(hSubKey); return (char*)buffer; } @@ -147,8 +147,12 @@ static int set_config_key(const char *subkey, const char *name, const char *valu assert( subkey != NULL ); - res = RegCreateKey(config_key, subkey, &key); - if (res != ERROR_SUCCESS) goto end; + if (subkey[0]) + { + res = RegCreateKey(config_key, subkey, &key); + if (res != ERROR_SUCCESS) goto end; + } + else key = config_key; if (name == NULL || value == NULL) goto end; res = RegSetValueEx(key, name, 0, REG_SZ, value, strlen(value) + 1); @@ -156,7 +160,7 @@ static int set_config_key(const char *subkey, const char *name, const char *valu res = 0; end: - if (key) RegCloseKey(key); + if (key && key != config_key) RegCloseKey(key); if (res != 0) WINE_ERR("Unable to set configuration key %s in section %s to %s, res=%ld\n", name, subkey, value, res); return res; } @@ -496,7 +500,8 @@ char *keypath(const char *section) if (current_app) { result = HeapAlloc(GetProcessHeap(), 0, strlen("AppDefaults\\") + strlen(current_app) + 2 /* \\ */ + strlen(section) + 1 /* terminator */); - sprintf(result, "AppDefaults\\%s\\%s", current_app, section); + sprintf(result, "AppDefaults\\%s", current_app); + if (section[0]) sprintf( result + strlen(result), "\\%s", section ); } else { -- 2.11.4.GIT