Commit 6e92d382 authored by Alexandre Julliard's avatar Alexandre Julliard

Changed registry access functions to use more meaningful names.

parent f231ef56
......@@ -40,7 +40,7 @@ static void update_comboboxes(HWND dialog)
char *winver;
/* retrieve the registry values */
winver = get(keypath("Version"), "Windows", "");
winver = get_reg_key(keypath("Version"), "Windows", "");
/* empty winver means use automatic mode (ie the builtin dll linkage heuristics) */
WINE_TRACE("winver is %s\n", *winver != '\0' ? winver : "null (automatic mode)");
......@@ -279,7 +279,7 @@ static void on_remove_app_click(HWND dialog)
assert( selection != 0 ); /* user cannot click this button when "default settings" is selected */
section[strlen(section)] = '\0'; /* remove last backslash */
set(section, NULL, NULL); /* delete the section */
set_reg_key(section, NULL, NULL); /* delete the section */
ListView_DeleteItem(listview, selection);
ListView_SetItemState(listview, selection - 1, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
......@@ -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(keypath("Version"), "Windows", NULL);
set_reg_key(keypath("Version"), "Windows", NULL);
}
else
{
WINE_TRACE("setting Version\\Windows key to value '%s'\n", ver[selection - 1].szVersion);
set(keypath("Version"), "Windows", ver[selection - 1].szVersion);
set_reg_key(keypath("Version"), "Windows", ver[selection - 1].szVersion);
}
/* enable the apply button */
......
......@@ -55,7 +55,7 @@ static void selectAudioDriver(HWND hDlg, const char *drivername)
{
if (!strcmp (pAudioDrv->szDriver, drivername))
{
set("Winmm", "Drivers", (char *) pAudioDrv->szDriver);
set_reg_key("Winmm", "Drivers", (char *) pAudioDrv->szDriver);
SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM) hDlg, 0); /* enable apply button */
SendDlgItemMessage(hDlg, IDC_AUDIO_DRIVER, CB_SETCURSEL,
(WPARAM) i, 0);
......@@ -66,7 +66,7 @@ static void selectAudioDriver(HWND hDlg, const char *drivername)
static void initAudioDlg (HWND hDlg)
{
char *curAudioDriver = get("Winmm", "Drivers", "winealsa.drv");
char *curAudioDriver = get_reg_key("Winmm", "Drivers", "winealsa.drv");
const AUDIO_DRIVER *pAudioDrv = NULL;
int i;
......
......@@ -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("wine", "ShowDirSymLinks", "Y");
set_reg_key("wine", "ShowDirSymLinks", "Y");
else
set("wine", "ShowDIrSymLinks", "N");
set_reg_key("wine", "ShowDIrSymLinks", "N");
if (IsDlgButtonChecked(dialog, IDC_SHOW_DOT_FILES) == BST_CHECKED)
set("wine", "ShowDotFiles", "Y");
set_reg_key("wine", "ShowDotFiles", "Y");
else
set("wine", "ShowDotFiles", "N");
set_reg_key("wine", "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("wine", "ShowDirSymLinks", "N"), "Y"))
if (!strcmp(get_reg_key("wine", "ShowDirSymLinks", "N"), "Y"))
CheckDlgButton(dialog, IDC_SHOW_DIRSYM_LINK, BST_CHECKED);
if (!strcmp(get("wine", "ShowDotFiles", "N"), "Y"))
if (!strcmp(get_reg_key("wine", "ShowDotFiles", "N"), "Y"))
CheckDlgButton(dialog, IDC_SHOW_DOT_FILES, BST_CHECKED);
}
......
......@@ -201,7 +201,7 @@ static void load_library_settings(HWND dialog)
const char *label;
struct dll *dll;
value = get(keypath("DllOverrides"), *p, NULL);
value = get_reg_key(keypath("DllOverrides"), *p, NULL);
label = mode_to_label(string_to_mode(value));
......@@ -273,7 +273,7 @@ static void set_dllmode(HWND dialog, DWORD id)
WINE_TRACE("Setting %s to %s\n", dll->name, str);
SendMessage(GetParent(dialog), PSM_CHANGED, 0, 0);
set(keypath("DllOverrides"), dll->name, str);
set_reg_key(keypath("DllOverrides"), dll->name, str);
load_library_settings(dialog); /* ... and refresh */
}
......@@ -292,7 +292,7 @@ static void on_add_click(HWND dialog)
WINE_TRACE("Adding %s as native, builtin", buffer);
SendMessage(GetParent(dialog), PSM_CHANGED, 0, 0);
set(keypath("DllOverrides"), buffer, "native,builtin");
set_reg_key(keypath("DllOverrides"), buffer, "native,builtin");
load_library_settings(dialog);
......@@ -313,7 +313,7 @@ static void on_remove_click(HWND dialog)
SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_DELETESTRING, sel, 0);
SendMessage(GetParent(dialog), PSM_CHANGED, 0, 0);
set(keypath("DllOverrides"), dll->name, NULL);
set_reg_key(keypath("DllOverrides"), dll->name, NULL);
HeapFree(GetProcessHeap(), 0, dll->name);
HeapFree(GetProcessHeap(), 0, dll);
......
......@@ -236,7 +236,7 @@ static void free_setting(struct setting *setting)
* If already in the list, the contents as given there will be
* returned. You are expected to HeapFree the result.
*/
char *get(const char *path, const char *name, const char *def)
char *get_reg_key(const char *path, const char *name, const char *def)
{
struct list *cursor;
struct setting *s;
......@@ -277,7 +277,7 @@ char *get(const char *path, const char *name, const char *def)
*
* These values will be copied when necessary.
*/
void set(const char *path, const char *name, const char *value)
void set_reg_key(const char *path, const char *name, const char *value)
{
struct list *cursor;
struct setting *s;
......@@ -440,9 +440,9 @@ char **enumerate_values(char *path)
* returns true if the given key/value pair exists in the registry or
* has been written to.
*/
BOOL exists(const char *path, const char *name)
BOOL reg_key_exists(const char *path, const char *name)
{
char *val = get(path, name, NULL);
char *val = get_reg_key(path, name, NULL);
if (val)
{
......
......@@ -40,17 +40,17 @@
extern char *current_app; /* NULL means editing global settings */
/* Use get and set to alter registry settings. The changes made through set
won't be committed to the registry until process_all_settings is called,
however get will still return accurate information.
/* Use get_reg_key and set_reg_key to alter registry settings. The changes made through
set_reg_key won't be committed to the registry until process_all_settings is called,
however get_reg_key will still return accurate information.
You are expected to release the result of get. The parameters to set will
be copied, so release them too when necessary.
You are expected to HeapFree the result of get_reg_key. The parameters to set_reg_key will
be copied, so free them too when necessary.
*/
void set(const char *path, const char *name, const char *value);
char *get(const char *path, const char *name, const char *def);
BOOL exists(const char *path, const char *name);
void set_reg_key(const char *path, const char *name, const char *value);
char *get_reg_key(const char *path, const char *name, const char *def);
BOOL reg_key_exists(const char *path, const char *name);
void apply(void);
char **enumerate_values(char *path);
......
......@@ -44,7 +44,7 @@ static void update_gui_for_desktop_mode(HWND dialog) {
updating_ui = TRUE;
/* do we have desktop mode enabled? */
if (exists(keypath("x11drv"), "Desktop"))
if (reg_key_exists(keypath("x11drv"), "Desktop"))
{
char* buf, *bufindex;
CheckDlgButton(dialog, IDC_ENABLE_DESKTOP, BST_CHECKED);
......@@ -54,7 +54,7 @@ static void update_gui_for_desktop_mode(HWND dialog) {
enable(IDC_DESKTOP_SIZE);
enable(IDC_DESKTOP_BY);
buf = get(keypath("x11drv"), "Desktop", "640x480");
buf = get_reg_key(keypath("x11drv"), "Desktop", "640x480");
bufindex = strchr(buf, 'x');
if (bufindex) {
*bufindex = 0;
......@@ -99,7 +99,7 @@ static void init_dialog (HWND dialog)
SendDlgItemMessage(dialog, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "24 bit");
SendDlgItemMessage(dialog, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "32 bit"); /* is this valid? */
buf = get(keypath("x11drv"), "ScreenDepth", "24");
buf = get_reg_key(keypath("x11drv"), "ScreenDepth", "24");
if (strcmp(buf, "8") == 0)
SendDlgItemMessage(dialog, IDC_SCREEN_DEPTH, CB_SETCURSEL, 0, 0);
else if (strcmp(buf, "16") == 0)
......@@ -115,14 +115,14 @@ static void init_dialog (HWND dialog)
SendDlgItemMessage(dialog, IDC_DESKTOP_WIDTH, EM_LIMITTEXT, RES_MAXLEN, 0);
SendDlgItemMessage(dialog, IDC_DESKTOP_HEIGHT, EM_LIMITTEXT, RES_MAXLEN, 0);
buf = get(keypath("x11drv"), "DXGrab", "Y");
buf = get_reg_key(keypath("x11drv"), "DXGrab", "Y");
if (IS_OPTION_TRUE(*buf))
CheckDlgButton(dialog, IDC_DX_MOUSE_GRAB, BST_CHECKED);
else
CheckDlgButton(dialog, IDC_DX_MOUSE_GRAB, BST_UNCHECKED);
HeapFree(GetProcessHeap(), 0, buf);
buf = get(keypath("x11drv"), "DesktopDoubleBuffered", "Y");
buf = get_reg_key(keypath("x11drv"), "DesktopDoubleBuffered", "Y");
if (IS_OPTION_TRUE(*buf))
CheckDlgButton(dialog, IDC_DOUBLE_BUFFER, BST_CHECKED);
else
......@@ -154,7 +154,7 @@ static void set_from_desktop_edits(HWND dialog) {
new = HeapAlloc(GetProcessHeap(), 0, strlen(width) + strlen(height) + 2 /* x + terminator */);
sprintf(new, "%sx%s", width, height);
set(keypath("x11drv"), "Desktop", new);
set_reg_key(keypath("x11drv"), "Desktop", new);
HeapFree(GetProcessHeap(), 0, width);
HeapFree(GetProcessHeap(), 0, height);
......@@ -167,7 +167,7 @@ static void on_enable_desktop_clicked(HWND dialog) {
if (IsDlgButtonChecked(dialog, IDC_ENABLE_DESKTOP) == BST_CHECKED) {
set_from_desktop_edits(dialog);
} else {
set(keypath("x11drv"), "Desktop", NULL);
set_reg_key(keypath("x11drv"), "Desktop", NULL);
}
update_gui_for_desktop_mode(dialog);
......@@ -181,23 +181,23 @@ static void on_screen_depth_changed(HWND dialog) {
if (updating_ui) return;
*spaceIndex = '\0';
set(keypath("x11drv"), "ScreenDepth", newvalue);
set_reg_key(keypath("x11drv"), "ScreenDepth", newvalue);
HeapFree(GetProcessHeap(), 0, newvalue);
}
static void on_dx_mouse_grab_clicked(HWND dialog) {
if (IsDlgButtonChecked(dialog, IDC_DX_MOUSE_GRAB) == BST_CHECKED)
set(keypath("x11drv"), "DXGrab", "Y");
set_reg_key(keypath("x11drv"), "DXGrab", "Y");
else
set(keypath("x11drv"), "DXGrab", "N");
set_reg_key(keypath("x11drv"), "DXGrab", "N");
}
static void on_double_buffer_clicked(HWND dialog) {
if (IsDlgButtonChecked(dialog, IDC_DOUBLE_BUFFER) == BST_CHECKED)
set(keypath("x11drv"), "DesktopDoubleBuffered", "Y");
set_reg_key(keypath("x11drv"), "DesktopDoubleBuffered", "Y");
else
set(keypath("x11drv"), "DesktopDoubleBuffered", "N");
set_reg_key(keypath("x11drv"), "DesktopDoubleBuffered", "N");
}
INT_PTR CALLBACK
......
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