Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3bbb7fd2
Commit
3bbb7fd2
authored
Jun 23, 2005
by
Michael Jung
Committed by
Alexandre Julliard
Jun 23, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made the registry cache more general.
parent
f192bb60
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
62 additions
and
55 deletions
+62
-55
appdefaults.c
programs/winecfg/appdefaults.c
+4
-4
audio.c
programs/winecfg/audio.c
+2
-2
driveui.c
programs/winecfg/driveui.c
+6
-6
libraries.c
programs/winecfg/libraries.c
+5
-5
winecfg.c
programs/winecfg/winecfg.c
+26
-22
winecfg.h
programs/winecfg/winecfg.h
+7
-4
x11drvdlg.c
programs/winecfg/x11drvdlg.c
+12
-12
No files found.
programs/winecfg/appdefaults.c
View file @
3bbb7fd2
...
@@ -40,7 +40,7 @@ static void update_comboboxes(HWND dialog)
...
@@ -40,7 +40,7 @@ static void update_comboboxes(HWND dialog)
char
*
winver
;
char
*
winver
;
/* retrieve the registry values */
/* retrieve the registry values */
winver
=
get_reg_key
(
keypath
(
""
),
"Version"
,
""
);
winver
=
get_reg_key
(
config_key
,
keypath
(
""
),
"Version"
,
""
);
/* empty winver means use automatic mode (ie the builtin dll linkage heuristics) */
/* empty winver means use automatic mode (ie the builtin dll linkage heuristics) */
WINE_TRACE
(
"winver is %s
\n
"
,
*
winver
!=
'\0'
?
winver
:
"null (automatic mode)"
);
WINE_TRACE
(
"winver is %s
\n
"
,
*
winver
!=
'\0'
?
winver
:
"null (automatic mode)"
);
...
@@ -279,7 +279,7 @@ static void on_remove_app_click(HWND dialog)
...
@@ -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 */
assert
(
selection
!=
0
);
/* user cannot click this button when "default settings" is selected */
section
[
strlen
(
section
)]
=
'\0'
;
/* remove last backslash */
section
[
strlen
(
section
)]
=
'\0'
;
/* remove last backslash */
set_reg_key
(
section
,
NULL
,
NULL
);
/* delete the section */
set_reg_key
(
config_key
,
section
,
NULL
,
NULL
);
/* delete the section */
ListView_DeleteItem
(
listview
,
selection
);
ListView_DeleteItem
(
listview
,
selection
);
ListView_SetItemState
(
listview
,
selection
-
1
,
LVIS_SELECTED
|
LVIS_FOCUSED
,
LVIS_SELECTED
|
LVIS_FOCUSED
);
ListView_SetItemState
(
listview
,
selection
-
1
,
LVIS_SELECTED
|
LVIS_FOCUSED
,
LVIS_SELECTED
|
LVIS_FOCUSED
);
...
@@ -296,12 +296,12 @@ static void on_winver_change(HWND dialog)
...
@@ -296,12 +296,12 @@ static void on_winver_change(HWND dialog)
if
(
selection
==
0
)
if
(
selection
==
0
)
{
{
WINE_TRACE
(
"automatic/default selected so removing current setting
\n
"
);
WINE_TRACE
(
"automatic/default selected so removing current setting
\n
"
);
set_reg_key
(
keypath
(
""
),
"Version"
,
NULL
);
set_reg_key
(
config_key
,
keypath
(
""
),
"Version"
,
NULL
);
}
}
else
else
{
{
WINE_TRACE
(
"setting Version key to value '%s'
\n
"
,
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
);
set_reg_key
(
config_key
,
keypath
(
""
),
"Version"
,
ver
[
selection
-
1
].
szVersion
);
}
}
/* enable the apply button */
/* enable the apply button */
...
...
programs/winecfg/audio.c
View file @
3bbb7fd2
...
@@ -55,7 +55,7 @@ static void selectAudioDriver(HWND hDlg, const char *drivername)
...
@@ -55,7 +55,7 @@ static void selectAudioDriver(HWND hDlg, const char *drivername)
{
{
if
(
!
strcmp
(
pAudioDrv
->
szDriver
,
drivername
))
if
(
!
strcmp
(
pAudioDrv
->
szDriver
,
drivername
))
{
{
set_reg_key
(
"Drivers"
,
"Audio"
,
(
char
*
)
pAudioDrv
->
szDriver
);
set_reg_key
(
config_key
,
"Drivers"
,
"Audio"
,
(
char
*
)
pAudioDrv
->
szDriver
);
SendMessage
(
GetParent
(
hDlg
),
PSM_CHANGED
,
(
WPARAM
)
hDlg
,
0
);
/* enable apply button */
SendMessage
(
GetParent
(
hDlg
),
PSM_CHANGED
,
(
WPARAM
)
hDlg
,
0
);
/* enable apply button */
SendDlgItemMessage
(
hDlg
,
IDC_AUDIO_DRIVER
,
CB_SETCURSEL
,
SendDlgItemMessage
(
hDlg
,
IDC_AUDIO_DRIVER
,
CB_SETCURSEL
,
(
WPARAM
)
i
,
0
);
(
WPARAM
)
i
,
0
);
...
@@ -66,7 +66,7 @@ static void selectAudioDriver(HWND hDlg, const char *drivername)
...
@@ -66,7 +66,7 @@ static void selectAudioDriver(HWND hDlg, const char *drivername)
static
void
initAudioDlg
(
HWND
hDlg
)
static
void
initAudioDlg
(
HWND
hDlg
)
{
{
char
*
curAudioDriver
=
get_reg_key
(
"Drivers"
,
"Audio"
,
"alsa"
);
char
*
curAudioDriver
=
get_reg_key
(
config_key
,
"Drivers"
,
"Audio"
,
"alsa"
);
const
AUDIO_DRIVER
*
pAudioDrv
=
NULL
;
const
AUDIO_DRIVER
*
pAudioDrv
=
NULL
;
int
i
;
int
i
;
...
...
programs/winecfg/driveui.c
View file @
3bbb7fd2
...
@@ -310,14 +310,14 @@ static int fill_drives_list(HWND dialog)
...
@@ -310,14 +310,14 @@ static int fill_drives_list(HWND dialog)
static
void
on_options_click
(
HWND
dialog
)
static
void
on_options_click
(
HWND
dialog
)
{
{
if
(
IsDlgButtonChecked
(
dialog
,
IDC_SHOW_DIRSYM_LINK
)
==
BST_CHECKED
)
if
(
IsDlgButtonChecked
(
dialog
,
IDC_SHOW_DIRSYM_LINK
)
==
BST_CHECKED
)
set_reg_key
(
""
,
"ShowDirSymLinks"
,
"Y"
);
set_reg_key
(
config_key
,
""
,
"ShowDirSymLinks"
,
"Y"
);
else
else
set_reg_key
(
""
,
"ShowDirSymLinks"
,
"N"
);
set_reg_key
(
config_key
,
""
,
"ShowDirSymLinks"
,
"N"
);
if
(
IsDlgButtonChecked
(
dialog
,
IDC_SHOW_DOT_FILES
)
==
BST_CHECKED
)
if
(
IsDlgButtonChecked
(
dialog
,
IDC_SHOW_DOT_FILES
)
==
BST_CHECKED
)
set_reg_key
(
""
,
"ShowDotFiles"
,
"Y"
);
set_reg_key
(
config_key
,
""
,
"ShowDotFiles"
,
"Y"
);
else
else
set_reg_key
(
""
,
"ShowDotFiles"
,
"N"
);
set_reg_key
(
config_key
,
""
,
"ShowDotFiles"
,
"N"
);
}
}
static
void
on_add_click
(
HWND
dialog
)
static
void
on_add_click
(
HWND
dialog
)
...
@@ -684,10 +684,10 @@ static void init_listview_columns(HWND dialog)
...
@@ -684,10 +684,10 @@ static void init_listview_columns(HWND dialog)
static
void
load_drive_options
(
HWND
dialog
)
static
void
load_drive_options
(
HWND
dialog
)
{
{
if
(
!
strcmp
(
get_reg_key
(
""
,
"ShowDirSymLinks"
,
"N"
),
"Y"
))
if
(
!
strcmp
(
get_reg_key
(
config_key
,
""
,
"ShowDirSymLinks"
,
"N"
),
"Y"
))
CheckDlgButton
(
dialog
,
IDC_SHOW_DIRSYM_LINK
,
BST_CHECKED
);
CheckDlgButton
(
dialog
,
IDC_SHOW_DIRSYM_LINK
,
BST_CHECKED
);
if
(
!
strcmp
(
get_reg_key
(
""
,
"ShowDotFiles"
,
"N"
),
"Y"
))
if
(
!
strcmp
(
get_reg_key
(
config_key
,
""
,
"ShowDotFiles"
,
"N"
),
"Y"
))
CheckDlgButton
(
dialog
,
IDC_SHOW_DOT_FILES
,
BST_CHECKED
);
CheckDlgButton
(
dialog
,
IDC_SHOW_DOT_FILES
,
BST_CHECKED
);
}
}
...
...
programs/winecfg/libraries.c
View file @
3bbb7fd2
...
@@ -174,7 +174,7 @@ static void clear_settings(HWND dialog)
...
@@ -174,7 +174,7 @@ static void clear_settings(HWND dialog)
static
void
load_library_settings
(
HWND
dialog
)
static
void
load_library_settings
(
HWND
dialog
)
{
{
char
**
overrides
=
enumerate_values
(
keypath
(
"DllOverrides"
));
char
**
overrides
=
enumerate_values
(
config_key
,
keypath
(
"DllOverrides"
));
char
**
p
;
char
**
p
;
int
sel
,
count
=
0
;
int
sel
,
count
=
0
;
...
@@ -201,7 +201,7 @@ static void load_library_settings(HWND dialog)
...
@@ -201,7 +201,7 @@ static void load_library_settings(HWND dialog)
const
char
*
label
;
const
char
*
label
;
struct
dll
*
dll
;
struct
dll
*
dll
;
value
=
get_reg_key
(
keypath
(
"DllOverrides"
),
*
p
,
NULL
);
value
=
get_reg_key
(
config_key
,
keypath
(
"DllOverrides"
),
*
p
,
NULL
);
label
=
mode_to_label
(
string_to_mode
(
value
));
label
=
mode_to_label
(
string_to_mode
(
value
));
...
@@ -273,7 +273,7 @@ static void set_dllmode(HWND dialog, DWORD id)
...
@@ -273,7 +273,7 @@ static void set_dllmode(HWND dialog, DWORD id)
WINE_TRACE
(
"Setting %s to %s
\n
"
,
dll
->
name
,
str
);
WINE_TRACE
(
"Setting %s to %s
\n
"
,
dll
->
name
,
str
);
SendMessage
(
GetParent
(
dialog
),
PSM_CHANGED
,
0
,
0
);
SendMessage
(
GetParent
(
dialog
),
PSM_CHANGED
,
0
,
0
);
set_reg_key
(
keypath
(
"DllOverrides"
),
dll
->
name
,
str
);
set_reg_key
(
config_key
,
keypath
(
"DllOverrides"
),
dll
->
name
,
str
);
load_library_settings
(
dialog
);
/* ... and refresh */
load_library_settings
(
dialog
);
/* ... and refresh */
}
}
...
@@ -292,7 +292,7 @@ static void on_add_click(HWND dialog)
...
@@ -292,7 +292,7 @@ static void on_add_click(HWND dialog)
WINE_TRACE
(
"Adding %s as native, builtin"
,
buffer
);
WINE_TRACE
(
"Adding %s as native, builtin"
,
buffer
);
SendMessage
(
GetParent
(
dialog
),
PSM_CHANGED
,
0
,
0
);
SendMessage
(
GetParent
(
dialog
),
PSM_CHANGED
,
0
,
0
);
set_reg_key
(
keypath
(
"DllOverrides"
),
buffer
,
"native,builtin"
);
set_reg_key
(
config_key
,
keypath
(
"DllOverrides"
),
buffer
,
"native,builtin"
);
load_library_settings
(
dialog
);
load_library_settings
(
dialog
);
...
@@ -313,7 +313,7 @@ static void on_remove_click(HWND dialog)
...
@@ -313,7 +313,7 @@ static void on_remove_click(HWND dialog)
SendDlgItemMessage
(
dialog
,
IDC_DLLS_LIST
,
LB_DELETESTRING
,
sel
,
0
);
SendDlgItemMessage
(
dialog
,
IDC_DLLS_LIST
,
LB_DELETESTRING
,
sel
,
0
);
SendMessage
(
GetParent
(
dialog
),
PSM_CHANGED
,
0
,
0
);
SendMessage
(
GetParent
(
dialog
),
PSM_CHANGED
,
0
,
0
);
set_reg_key
(
keypath
(
"DllOverrides"
),
dll
->
name
,
NULL
);
set_reg_key
(
config_key
,
keypath
(
"DllOverrides"
),
dll
->
name
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
dll
->
name
);
HeapFree
(
GetProcessHeap
(),
0
,
dll
->
name
);
HeapFree
(
GetProcessHeap
(),
0
,
dll
);
HeapFree
(
GetProcessHeap
(),
0
,
dll
);
...
...
programs/winecfg/winecfg.c
View file @
3bbb7fd2
...
@@ -81,7 +81,7 @@ void set_window_title(HWND dialog)
...
@@ -81,7 +81,7 @@ void set_window_title(HWND dialog)
* not. Caller is responsible for releasing the result.
* not. Caller is responsible for releasing the result.
*
*
*/
*/
static
char
*
get_config_key
(
const
char
*
subkey
,
const
char
*
name
,
const
char
*
def
)
static
char
*
get_config_key
(
HKEY
root
,
const
char
*
subkey
,
const
char
*
name
,
const
char
*
def
)
{
{
LPBYTE
buffer
=
NULL
;
LPBYTE
buffer
=
NULL
;
DWORD
len
;
DWORD
len
;
...
@@ -90,7 +90,7 @@ static char *get_config_key (const char *subkey, const char *name, const char *d
...
@@ -90,7 +90,7 @@ static char *get_config_key (const char *subkey, const char *name, const char *d
WINE_TRACE
(
"subkey=%s, name=%s, def=%s
\n
"
,
subkey
,
name
,
def
);
WINE_TRACE
(
"subkey=%s, name=%s, def=%s
\n
"
,
subkey
,
name
,
def
);
res
=
RegOpenKey
(
config_key
,
subkey
,
&
hSubKey
);
res
=
RegOpenKey
(
root
,
subkey
,
&
hSubKey
);
if
(
res
!=
ERROR_SUCCESS
)
if
(
res
!=
ERROR_SUCCESS
)
{
{
if
(
res
==
ERROR_FILE_NOT_FOUND
)
if
(
res
==
ERROR_FILE_NOT_FOUND
)
...
@@ -123,7 +123,7 @@ static char *get_config_key (const char *subkey, const char *name, const char *d
...
@@ -123,7 +123,7 @@ static char *get_config_key (const char *subkey, const char *name, const char *d
WINE_TRACE
(
"buffer=%s
\n
"
,
buffer
);
WINE_TRACE
(
"buffer=%s
\n
"
,
buffer
);
end:
end:
if
(
hSubKey
&&
hSubKey
!=
config_key
)
RegCloseKey
(
hSubKey
);
if
(
hSubKey
&&
hSubKey
!=
root
)
RegCloseKey
(
hSubKey
);
return
(
char
*
)
buffer
;
return
(
char
*
)
buffer
;
}
}
...
@@ -139,7 +139,7 @@ end:
...
@@ -139,7 +139,7 @@ end:
*
*
* If valueName or value is NULL, an empty section will be created
* If valueName or value is NULL, an empty section will be created
*/
*/
static
int
set_config_key
(
const
char
*
subkey
,
const
char
*
name
,
const
char
*
value
)
{
static
int
set_config_key
(
HKEY
root
,
const
char
*
subkey
,
const
char
*
name
,
const
char
*
value
)
{
DWORD
res
=
1
;
DWORD
res
=
1
;
HKEY
key
=
NULL
;
HKEY
key
=
NULL
;
...
@@ -149,10 +149,10 @@ static int set_config_key(const char *subkey, const char *name, const char *valu
...
@@ -149,10 +149,10 @@ static int set_config_key(const char *subkey, const char *name, const char *valu
if
(
subkey
[
0
])
if
(
subkey
[
0
])
{
{
res
=
RegCreateKey
(
config_key
,
subkey
,
&
key
);
res
=
RegCreateKey
(
root
,
subkey
,
&
key
);
if
(
res
!=
ERROR_SUCCESS
)
goto
end
;
if
(
res
!=
ERROR_SUCCESS
)
goto
end
;
}
}
else
key
=
config_key
;
else
key
=
root
;
if
(
name
==
NULL
||
value
==
NULL
)
goto
end
;
if
(
name
==
NULL
||
value
==
NULL
)
goto
end
;
res
=
RegSetValueEx
(
key
,
name
,
0
,
REG_SZ
,
value
,
strlen
(
value
)
+
1
);
res
=
RegSetValueEx
(
key
,
name
,
0
,
REG_SZ
,
value
,
strlen
(
value
)
+
1
);
...
@@ -160,7 +160,7 @@ static int set_config_key(const char *subkey, const char *name, const char *valu
...
@@ -160,7 +160,7 @@ static int set_config_key(const char *subkey, const char *name, const char *valu
res
=
0
;
res
=
0
;
end:
end:
if
(
key
&&
key
!=
config_key
)
RegCloseKey
(
key
);
if
(
key
&&
key
!=
root
)
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
);
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
;
return
res
;
}
}
...
@@ -168,14 +168,14 @@ end:
...
@@ -168,14 +168,14 @@ end:
/* removes the requested value from the registry, however, does not
/* removes the requested value from the registry, however, does not
* remove the section if empty. Returns S_OK (0) on success.
* remove the section if empty. Returns S_OK (0) on success.
*/
*/
static
HRESULT
remove_value
(
const
char
*
subkey
,
const
char
*
name
)
static
HRESULT
remove_value
(
HKEY
root
,
const
char
*
subkey
,
const
char
*
name
)
{
{
HRESULT
hr
;
HRESULT
hr
;
HKEY
key
;
HKEY
key
;
WINE_TRACE
(
"subkey=%s, name=%s
\n
"
,
subkey
,
name
);
WINE_TRACE
(
"subkey=%s, name=%s
\n
"
,
subkey
,
name
);
hr
=
RegOpenKey
(
config_key
,
subkey
,
&
key
);
hr
=
RegOpenKey
(
root
,
subkey
,
&
key
);
if
(
hr
!=
S_OK
)
return
hr
;
if
(
hr
!=
S_OK
)
return
hr
;
hr
=
RegDeleteValue
(
key
,
name
);
hr
=
RegDeleteValue
(
key
,
name
);
...
@@ -185,10 +185,10 @@ static HRESULT remove_value(const char *subkey, const char *name)
...
@@ -185,10 +185,10 @@ static HRESULT remove_value(const char *subkey, const char *name)
}
}
/* removes the requested subkey from the registry, assuming it exists */
/* removes the requested subkey from the registry, assuming it exists */
static
HRESULT
remove_path
(
char
*
section
)
{
static
HRESULT
remove_path
(
HKEY
root
,
char
*
section
)
{
WINE_TRACE
(
"section=%s
\n
"
,
section
);
WINE_TRACE
(
"section=%s
\n
"
,
section
);
return
RegDeleteKey
(
config_key
,
section
);
return
RegDeleteKey
(
root
,
section
);
}
}
...
@@ -209,7 +209,8 @@ static HRESULT remove_path(char *section) {
...
@@ -209,7 +209,8 @@ static HRESULT remove_path(char *section) {
struct
setting
struct
setting
{
{
struct
list
entry
;
struct
list
entry
;
char
*
path
;
/* path in the registry rooted at the config key */
HKEY
root
;
/* the key on which path is rooted */
char
*
path
;
/* path in the registry rooted at root */
char
*
name
;
/* name of the registry value. if null, this means delete the key */
char
*
name
;
/* name of the registry value. if null, this means delete the key */
char
*
value
;
/* contents of the registry value. if null, this means delete the value */
char
*
value
;
/* contents of the registry value. if null, this means delete the value */
};
};
...
@@ -240,7 +241,7 @@ static void free_setting(struct setting *setting)
...
@@ -240,7 +241,7 @@ static void free_setting(struct setting *setting)
* If already in the list, the contents as given there will be
* If already in the list, the contents as given there will be
* returned. You are expected to HeapFree the result.
* returned. You are expected to HeapFree the result.
*/
*/
char
*
get_reg_key
(
const
char
*
path
,
const
char
*
name
,
const
char
*
def
)
char
*
get_reg_key
(
HKEY
root
,
const
char
*
path
,
const
char
*
name
,
const
char
*
def
)
{
{
struct
list
*
cursor
;
struct
list
*
cursor
;
struct
setting
*
s
;
struct
setting
*
s
;
...
@@ -253,6 +254,7 @@ char *get_reg_key(const char *path, const char *name, const char *def)
...
@@ -253,6 +254,7 @@ char *get_reg_key(const char *path, const char *name, const char *def)
{
{
s
=
LIST_ENTRY
(
cursor
,
struct
setting
,
entry
);
s
=
LIST_ENTRY
(
cursor
,
struct
setting
,
entry
);
if
(
root
!=
s
->
root
)
continue
;
if
(
strcasecmp
(
path
,
s
->
path
)
!=
0
)
continue
;
if
(
strcasecmp
(
path
,
s
->
path
)
!=
0
)
continue
;
if
(
strcasecmp
(
name
,
s
->
name
)
!=
0
)
continue
;
if
(
strcasecmp
(
name
,
s
->
name
)
!=
0
)
continue
;
...
@@ -261,7 +263,7 @@ char *get_reg_key(const char *path, const char *name, const char *def)
...
@@ -261,7 +263,7 @@ char *get_reg_key(const char *path, const char *name, const char *def)
}
}
/* no, so get from the registry */
/* no, so get from the registry */
val
=
get_config_key
(
path
,
name
,
def
);
val
=
get_config_key
(
root
,
path
,
name
,
def
);
WINE_TRACE
(
"returning %s
\n
"
,
val
);
WINE_TRACE
(
"returning %s
\n
"
,
val
);
...
@@ -281,7 +283,7 @@ char *get_reg_key(const char *path, const char *name, const char *def)
...
@@ -281,7 +283,7 @@ char *get_reg_key(const char *path, const char *name, const char *def)
*
*
* These values will be copied when necessary.
* These values will be copied when necessary.
*/
*/
void
set_reg_key
(
const
char
*
path
,
const
char
*
name
,
const
char
*
value
)
void
set_reg_key
(
HKEY
root
,
const
char
*
path
,
const
char
*
name
,
const
char
*
value
)
{
{
struct
list
*
cursor
;
struct
list
*
cursor
;
struct
setting
*
s
;
struct
setting
*
s
;
...
@@ -295,6 +297,7 @@ void set_reg_key(const char *path, const char *name, const char *value)
...
@@ -295,6 +297,7 @@ void set_reg_key(const char *path, const char *name, const char *value)
{
{
struct
setting
*
s
=
LIST_ENTRY
(
cursor
,
struct
setting
,
entry
);
struct
setting
*
s
=
LIST_ENTRY
(
cursor
,
struct
setting
,
entry
);
if
(
root
!=
s
->
root
)
continue
;
if
(
strcasecmp
(
s
->
path
,
path
)
!=
0
)
continue
;
if
(
strcasecmp
(
s
->
path
,
path
)
!=
0
)
continue
;
if
((
s
->
name
&&
name
)
&&
strcasecmp
(
s
->
name
,
name
)
!=
0
)
continue
;
if
((
s
->
name
&&
name
)
&&
strcasecmp
(
s
->
name
,
name
)
!=
0
)
continue
;
...
@@ -323,6 +326,7 @@ void set_reg_key(const char *path, const char *name, const char *value)
...
@@ -323,6 +326,7 @@ void set_reg_key(const char *path, const char *name, const char *value)
/* otherwise add a new setting for it */
/* otherwise add a new setting for it */
s
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
setting
));
s
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
setting
));
s
->
root
=
root
;
s
->
path
=
strdupA
(
path
);
s
->
path
=
strdupA
(
path
);
s
->
name
=
name
?
strdupA
(
name
)
:
NULL
;
s
->
name
=
name
?
strdupA
(
name
)
:
NULL
;
s
->
value
=
value
?
strdupA
(
value
)
:
NULL
;
s
->
value
=
value
?
strdupA
(
value
)
:
NULL
;
...
@@ -337,7 +341,7 @@ void set_reg_key(const char *path, const char *name, const char *value)
...
@@ -337,7 +341,7 @@ void set_reg_key(const char *path, const char *name, const char *value)
* you are expected to HeapFree each element of the array, which is null
* you are expected to HeapFree each element of the array, which is null
* terminated, as well as the array itself.
* terminated, as well as the array itself.
*/
*/
char
**
enumerate_values
(
char
*
path
)
char
**
enumerate_values
(
HKEY
root
,
char
*
path
)
{
{
HKEY
key
;
HKEY
key
;
DWORD
res
,
i
=
0
;
DWORD
res
,
i
=
0
;
...
@@ -345,7 +349,7 @@ char **enumerate_values(char *path)
...
@@ -345,7 +349,7 @@ char **enumerate_values(char *path)
int
valueslen
=
0
;
int
valueslen
=
0
;
struct
list
*
cursor
;
struct
list
*
cursor
;
res
=
RegOpenKey
(
config_key
,
path
,
&
key
);
res
=
RegOpenKey
(
root
,
path
,
&
key
);
if
(
res
==
ERROR_SUCCESS
)
if
(
res
==
ERROR_SUCCESS
)
{
{
while
(
TRUE
)
while
(
TRUE
)
...
@@ -444,9 +448,9 @@ char **enumerate_values(char *path)
...
@@ -444,9 +448,9 @@ char **enumerate_values(char *path)
* returns true if the given key/value pair exists in the registry or
* returns true if the given key/value pair exists in the registry or
* has been written to.
* has been written to.
*/
*/
BOOL
reg_key_exists
(
const
char
*
path
,
const
char
*
name
)
BOOL
reg_key_exists
(
HKEY
root
,
const
char
*
path
,
const
char
*
name
)
{
{
char
*
val
=
get_reg_key
(
path
,
name
,
NULL
);
char
*
val
=
get_reg_key
(
root
,
path
,
name
,
NULL
);
if
(
val
)
if
(
val
)
{
{
...
@@ -462,13 +466,13 @@ static void process_setting(struct setting *s)
...
@@ -462,13 +466,13 @@ static void process_setting(struct setting *s)
if
(
s
->
value
)
if
(
s
->
value
)
{
{
WINE_TRACE
(
"Setting %s:%s to '%s'
\n
"
,
s
->
path
,
s
->
name
,
s
->
value
);
WINE_TRACE
(
"Setting %s:%s to '%s'
\n
"
,
s
->
path
,
s
->
name
,
s
->
value
);
set_config_key
(
s
->
path
,
s
->
name
,
s
->
value
);
set_config_key
(
s
->
root
,
s
->
path
,
s
->
name
,
s
->
value
);
}
}
else
else
{
{
/* NULL name means remove that path/section entirely */
/* NULL name means remove that path/section entirely */
if
(
s
->
path
&&
s
->
name
)
remove_value
(
s
->
path
,
s
->
name
);
if
(
s
->
path
&&
s
->
name
)
remove_value
(
s
->
root
,
s
->
path
,
s
->
name
);
else
if
(
s
->
path
&&
!
s
->
name
)
remove_path
(
s
->
path
);
else
if
(
s
->
path
&&
!
s
->
name
)
remove_path
(
s
->
root
,
s
->
path
);
}
}
}
}
...
...
programs/winecfg/winecfg.h
View file @
3bbb7fd2
...
@@ -44,15 +44,18 @@ extern char *current_app; /* NULL means editing global settings */
...
@@ -44,15 +44,18 @@ extern char *current_app; /* NULL means editing global settings */
set_reg_key won't be committed to the registry until process_all_settings is called,
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.
however get_reg_key will still return accurate information.
The root HKEY has to be non-ambiguous. So only the registry roots (HKCU, HKLM, ...) or
the global config_key are allowed here.
You are expected to HeapFree the result of get_reg_key. The parameters to set_reg_key will
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.
be copied, so free them too when necessary.
*/
*/
void
set_reg_key
(
const
char
*
path
,
const
char
*
name
,
const
char
*
value
);
void
set_reg_key
(
HKEY
root
,
const
char
*
path
,
const
char
*
name
,
const
char
*
value
);
char
*
get_reg_key
(
const
char
*
path
,
const
char
*
name
,
const
char
*
def
);
char
*
get_reg_key
(
HKEY
root
,
const
char
*
path
,
const
char
*
name
,
const
char
*
def
);
BOOL
reg_key_exists
(
const
char
*
path
,
const
char
*
name
);
BOOL
reg_key_exists
(
HKEY
root
,
const
char
*
path
,
const
char
*
name
);
void
apply
(
void
);
void
apply
(
void
);
char
**
enumerate_values
(
char
*
path
);
char
**
enumerate_values
(
HKEY
root
,
char
*
path
);
/* returns a string of the form "AppDefaults\\appname.exe\\section", or just "section" if
/* returns a string of the form "AppDefaults\\appname.exe\\section", or just "section" if
the user is editing the global settings.
the user is editing the global settings.
...
...
programs/winecfg/x11drvdlg.c
View file @
3bbb7fd2
...
@@ -44,7 +44,7 @@ static void update_gui_for_desktop_mode(HWND dialog) {
...
@@ -44,7 +44,7 @@ static void update_gui_for_desktop_mode(HWND dialog) {
updating_ui
=
TRUE
;
updating_ui
=
TRUE
;
/* do we have desktop mode enabled? */
/* do we have desktop mode enabled? */
if
(
reg_key_exists
(
keypath
(
"X11 Driver"
),
"Desktop"
))
if
(
reg_key_exists
(
config_key
,
keypath
(
"X11 Driver"
),
"Desktop"
))
{
{
char
*
buf
,
*
bufindex
;
char
*
buf
,
*
bufindex
;
CheckDlgButton
(
dialog
,
IDC_ENABLE_DESKTOP
,
BST_CHECKED
);
CheckDlgButton
(
dialog
,
IDC_ENABLE_DESKTOP
,
BST_CHECKED
);
...
@@ -54,7 +54,7 @@ static void update_gui_for_desktop_mode(HWND dialog) {
...
@@ -54,7 +54,7 @@ static void update_gui_for_desktop_mode(HWND dialog) {
enable
(
IDC_DESKTOP_SIZE
);
enable
(
IDC_DESKTOP_SIZE
);
enable
(
IDC_DESKTOP_BY
);
enable
(
IDC_DESKTOP_BY
);
buf
=
get_reg_key
(
keypath
(
"X11 Driver"
),
"Desktop"
,
"640x480"
);
buf
=
get_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"Desktop"
,
"640x480"
);
bufindex
=
strchr
(
buf
,
'x'
);
bufindex
=
strchr
(
buf
,
'x'
);
if
(
bufindex
)
{
if
(
bufindex
)
{
*
bufindex
=
0
;
*
bufindex
=
0
;
...
@@ -99,7 +99,7 @@ static void init_dialog (HWND dialog)
...
@@ -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
)
"24 bit"
);
SendDlgItemMessage
(
dialog
,
IDC_SCREEN_DEPTH
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
"32 bit"
);
/* is this valid? */
SendDlgItemMessage
(
dialog
,
IDC_SCREEN_DEPTH
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
"32 bit"
);
/* is this valid? */
buf
=
get_reg_key
(
keypath
(
"X11 Driver"
),
"ScreenDepth"
,
"24"
);
buf
=
get_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"ScreenDepth"
,
"24"
);
if
(
strcmp
(
buf
,
"8"
)
==
0
)
if
(
strcmp
(
buf
,
"8"
)
==
0
)
SendDlgItemMessage
(
dialog
,
IDC_SCREEN_DEPTH
,
CB_SETCURSEL
,
0
,
0
);
SendDlgItemMessage
(
dialog
,
IDC_SCREEN_DEPTH
,
CB_SETCURSEL
,
0
,
0
);
else
if
(
strcmp
(
buf
,
"16"
)
==
0
)
else
if
(
strcmp
(
buf
,
"16"
)
==
0
)
...
@@ -115,14 +115,14 @@ static void init_dialog (HWND dialog)
...
@@ -115,14 +115,14 @@ static void init_dialog (HWND dialog)
SendDlgItemMessage
(
dialog
,
IDC_DESKTOP_WIDTH
,
EM_LIMITTEXT
,
RES_MAXLEN
,
0
);
SendDlgItemMessage
(
dialog
,
IDC_DESKTOP_WIDTH
,
EM_LIMITTEXT
,
RES_MAXLEN
,
0
);
SendDlgItemMessage
(
dialog
,
IDC_DESKTOP_HEIGHT
,
EM_LIMITTEXT
,
RES_MAXLEN
,
0
);
SendDlgItemMessage
(
dialog
,
IDC_DESKTOP_HEIGHT
,
EM_LIMITTEXT
,
RES_MAXLEN
,
0
);
buf
=
get_reg_key
(
keypath
(
"X11 Driver"
),
"DXGrab"
,
"Y"
);
buf
=
get_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"DXGrab"
,
"Y"
);
if
(
IS_OPTION_TRUE
(
*
buf
))
if
(
IS_OPTION_TRUE
(
*
buf
))
CheckDlgButton
(
dialog
,
IDC_DX_MOUSE_GRAB
,
BST_CHECKED
);
CheckDlgButton
(
dialog
,
IDC_DX_MOUSE_GRAB
,
BST_CHECKED
);
else
else
CheckDlgButton
(
dialog
,
IDC_DX_MOUSE_GRAB
,
BST_UNCHECKED
);
CheckDlgButton
(
dialog
,
IDC_DX_MOUSE_GRAB
,
BST_UNCHECKED
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
buf
=
get_reg_key
(
keypath
(
"X11 Driver"
),
"DesktopDoubleBuffered"
,
"Y"
);
buf
=
get_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"DesktopDoubleBuffered"
,
"Y"
);
if
(
IS_OPTION_TRUE
(
*
buf
))
if
(
IS_OPTION_TRUE
(
*
buf
))
CheckDlgButton
(
dialog
,
IDC_DOUBLE_BUFFER
,
BST_CHECKED
);
CheckDlgButton
(
dialog
,
IDC_DOUBLE_BUFFER
,
BST_CHECKED
);
else
else
...
@@ -154,7 +154,7 @@ static void set_from_desktop_edits(HWND dialog) {
...
@@ -154,7 +154,7 @@ static void set_from_desktop_edits(HWND dialog) {
new
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
width
)
+
strlen
(
height
)
+
2
/* x + terminator */
);
new
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
width
)
+
strlen
(
height
)
+
2
/* x + terminator */
);
sprintf
(
new
,
"%sx%s"
,
width
,
height
);
sprintf
(
new
,
"%sx%s"
,
width
,
height
);
set_reg_key
(
keypath
(
"X11 Driver"
),
"Desktop"
,
new
);
set_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"Desktop"
,
new
);
HeapFree
(
GetProcessHeap
(),
0
,
width
);
HeapFree
(
GetProcessHeap
(),
0
,
width
);
HeapFree
(
GetProcessHeap
(),
0
,
height
);
HeapFree
(
GetProcessHeap
(),
0
,
height
);
...
@@ -167,7 +167,7 @@ static void on_enable_desktop_clicked(HWND dialog) {
...
@@ -167,7 +167,7 @@ static void on_enable_desktop_clicked(HWND dialog) {
if
(
IsDlgButtonChecked
(
dialog
,
IDC_ENABLE_DESKTOP
)
==
BST_CHECKED
)
{
if
(
IsDlgButtonChecked
(
dialog
,
IDC_ENABLE_DESKTOP
)
==
BST_CHECKED
)
{
set_from_desktop_edits
(
dialog
);
set_from_desktop_edits
(
dialog
);
}
else
{
}
else
{
set_reg_key
(
keypath
(
"X11 Driver"
),
"Desktop"
,
NULL
);
set_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"Desktop"
,
NULL
);
}
}
update_gui_for_desktop_mode
(
dialog
);
update_gui_for_desktop_mode
(
dialog
);
...
@@ -181,23 +181,23 @@ static void on_screen_depth_changed(HWND dialog) {
...
@@ -181,23 +181,23 @@ static void on_screen_depth_changed(HWND dialog) {
if
(
updating_ui
)
return
;
if
(
updating_ui
)
return
;
*
spaceIndex
=
'\0'
;
*
spaceIndex
=
'\0'
;
set_reg_key
(
keypath
(
"X11 Driver"
),
"ScreenDepth"
,
newvalue
);
set_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"ScreenDepth"
,
newvalue
);
HeapFree
(
GetProcessHeap
(),
0
,
newvalue
);
HeapFree
(
GetProcessHeap
(),
0
,
newvalue
);
}
}
static
void
on_dx_mouse_grab_clicked
(
HWND
dialog
)
{
static
void
on_dx_mouse_grab_clicked
(
HWND
dialog
)
{
if
(
IsDlgButtonChecked
(
dialog
,
IDC_DX_MOUSE_GRAB
)
==
BST_CHECKED
)
if
(
IsDlgButtonChecked
(
dialog
,
IDC_DX_MOUSE_GRAB
)
==
BST_CHECKED
)
set_reg_key
(
keypath
(
"X11 Driver"
),
"DXGrab"
,
"Y"
);
set_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"DXGrab"
,
"Y"
);
else
else
set_reg_key
(
keypath
(
"X11 Driver"
),
"DXGrab"
,
"N"
);
set_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"DXGrab"
,
"N"
);
}
}
static
void
on_double_buffer_clicked
(
HWND
dialog
)
{
static
void
on_double_buffer_clicked
(
HWND
dialog
)
{
if
(
IsDlgButtonChecked
(
dialog
,
IDC_DOUBLE_BUFFER
)
==
BST_CHECKED
)
if
(
IsDlgButtonChecked
(
dialog
,
IDC_DOUBLE_BUFFER
)
==
BST_CHECKED
)
set_reg_key
(
keypath
(
"X11 Driver"
),
"DesktopDoubleBuffered"
,
"Y"
);
set_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"DesktopDoubleBuffered"
,
"Y"
);
else
else
set_reg_key
(
keypath
(
"X11 Driver"
),
"DesktopDoubleBuffered"
,
"N"
);
set_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"DesktopDoubleBuffered"
,
"N"
);
}
}
INT_PTR
CALLBACK
INT_PTR
CALLBACK
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment