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
c809f946
Commit
c809f946
authored
Apr 28, 2021
by
Hugh McMaster
Committed by
Alexandre Julliard
Apr 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: Consistently use 'hkey' for HKEY variables.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
22a7059f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
34 deletions
+34
-34
add.c
programs/reg/add.c
+9
-9
delete.c
programs/reg/delete.c
+8
-8
export.c
programs/reg/export.c
+4
-4
query.c
programs/reg/query.c
+13
-13
No files found.
programs/reg/add.c
View file @
c809f946
...
...
@@ -152,10 +152,10 @@ static LPBYTE get_regdata(const WCHAR *data, DWORD reg_type, WCHAR separator, DW
static
int
run_add
(
HKEY
root
,
WCHAR
*
path
,
WCHAR
*
value_name
,
BOOL
value_empty
,
WCHAR
*
type
,
WCHAR
separator
,
WCHAR
*
data
,
BOOL
force
)
{
HKEY
key
;
HKEY
h
key
;
if
(
RegCreateKeyExW
(
root
,
path
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_READ
|
KEY_WRITE
,
NULL
,
&
key
,
NULL
))
KEY_READ
|
KEY_WRITE
,
NULL
,
&
h
key
,
NULL
))
{
output_message
(
STRING_INVALID_KEY
);
return
1
;
...
...
@@ -169,11 +169,11 @@ static int run_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty,
if
(
!
force
)
{
if
(
RegQueryValueExW
(
key
,
value_name
,
NULL
,
NULL
,
NULL
,
NULL
)
==
ERROR_SUCCESS
)
if
(
RegQueryValueExW
(
h
key
,
value_name
,
NULL
,
NULL
,
NULL
,
NULL
)
==
ERROR_SUCCESS
)
{
if
(
!
ask_confirm
(
STRING_OVERWRITE_VALUE
,
value_name
))
{
RegCloseKey
(
key
);
RegCloseKey
(
h
key
);
output_message
(
STRING_CANCELLED
);
return
0
;
}
...
...
@@ -183,28 +183,28 @@ static int run_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty,
reg_type
=
wchar_get_type
(
type
);
if
(
reg_type
==
~
0u
)
{
RegCloseKey
(
key
);
RegCloseKey
(
h
key
);
output_message
(
STRING_UNSUPPORTED_TYPE
,
type
);
return
1
;
}
if
((
reg_type
==
REG_DWORD
||
reg_type
==
REG_DWORD_BIG_ENDIAN
)
&&
!
data
)
{
RegCloseKey
(
key
);
RegCloseKey
(
h
key
);
output_message
(
STRING_INVALID_CMDLINE
);
return
1
;
}
if
(
!
(
reg_data
=
get_regdata
(
data
,
reg_type
,
separator
,
&
reg_count
)))
{
RegCloseKey
(
key
);
RegCloseKey
(
h
key
);
return
1
;
}
RegSetValueExW
(
key
,
value_name
,
0
,
reg_type
,
reg_data
,
reg_count
);
RegSetValueExW
(
h
key
,
value_name
,
0
,
reg_type
,
reg_data
,
reg_count
);
free
(
reg_data
);
}
RegCloseKey
(
key
);
RegCloseKey
(
h
key
);
output_message
(
STRING_SUCCESS
);
return
0
;
...
...
programs/reg/delete.c
View file @
c809f946
...
...
@@ -21,7 +21,7 @@
static
int
run_delete
(
HKEY
root
,
WCHAR
*
path
,
WCHAR
*
key_name
,
WCHAR
*
value_name
,
BOOL
value_empty
,
BOOL
value_all
,
BOOL
force
)
{
HKEY
key
;
HKEY
h
key
;
if
(
!
force
)
{
...
...
@@ -53,7 +53,7 @@ static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name
return
0
;
}
if
(
RegOpenKeyExW
(
root
,
path
,
0
,
KEY_READ
|
KEY_SET_VALUE
,
&
key
))
if
(
RegOpenKeyExW
(
root
,
path
,
0
,
KEY_READ
|
KEY_SET_VALUE
,
&
h
key
))
{
output_message
(
STRING_KEY_NONEXIST
);
return
1
;
...
...
@@ -70,14 +70,14 @@ static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name
while
(
1
)
{
value_len
=
max_value_len
;
rc
=
RegEnumValueW
(
key
,
0
,
value_name
,
&
value_len
,
NULL
,
NULL
,
NULL
,
NULL
);
rc
=
RegEnumValueW
(
h
key
,
0
,
value_name
,
&
value_len
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
rc
==
ERROR_SUCCESS
)
{
rc
=
RegDeleteValueW
(
key
,
value_name
);
rc
=
RegDeleteValueW
(
h
key
,
value_name
);
if
(
rc
!=
ERROR_SUCCESS
)
{
free
(
value_name
);
RegCloseKey
(
key
);
RegCloseKey
(
h
key
);
output_message
(
STRING_VALUEALL_FAILED
,
key_name
);
return
1
;
}
...
...
@@ -93,15 +93,15 @@ static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name
}
else
if
(
value_name
||
value_empty
)
{
if
(
RegDeleteValueW
(
key
,
value_name
))
if
(
RegDeleteValueW
(
h
key
,
value_name
))
{
RegCloseKey
(
key
);
RegCloseKey
(
h
key
);
output_message
(
STRING_VALUE_NONEXIST
);
return
1
;
}
}
RegCloseKey
(
key
);
RegCloseKey
(
h
key
);
output_message
(
STRING_SUCCESS
);
return
0
;
}
...
...
programs/reg/export.c
View file @
c809f946
...
...
@@ -225,7 +225,7 @@ static void export_key_name(HANDLE hFile, WCHAR *name)
free
(
buf
);
}
static
int
export_registry_data
(
HANDLE
hFile
,
HKEY
key
,
WCHAR
*
path
)
static
int
export_registry_data
(
HANDLE
hFile
,
HKEY
h
key
,
WCHAR
*
path
)
{
LONG
rc
;
DWORD
max_value_len
=
256
,
value_len
;
...
...
@@ -246,7 +246,7 @@ static int export_registry_data(HANDLE hFile, HKEY key, WCHAR *path)
{
value_len
=
max_value_len
;
data_size
=
max_data_bytes
;
rc
=
RegEnumValueW
(
key
,
i
,
value_name
,
&
value_len
,
NULL
,
&
type
,
data
,
&
data_size
);
rc
=
RegEnumValueW
(
h
key
,
i
,
value_name
,
&
value_len
,
NULL
,
&
type
,
data
,
&
data_size
);
if
(
rc
==
ERROR_SUCCESS
)
{
...
...
@@ -280,11 +280,11 @@ static int export_registry_data(HANDLE hFile, HKEY key, WCHAR *path)
for
(;;)
{
subkey_len
=
MAX_SUBKEY_LEN
;
rc
=
RegEnumKeyExW
(
key
,
i
,
subkey_name
,
&
subkey_len
,
NULL
,
NULL
,
NULL
,
NULL
);
rc
=
RegEnumKeyExW
(
h
key
,
i
,
subkey_name
,
&
subkey_len
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
rc
==
ERROR_SUCCESS
)
{
subkey_path
=
build_subkey_path
(
path
,
path_len
,
subkey_name
,
subkey_len
);
if
(
!
RegOpenKeyExW
(
key
,
subkey_name
,
0
,
KEY_READ
,
&
subkey
))
if
(
!
RegOpenKeyExW
(
h
key
,
subkey_name
,
0
,
KEY_READ
,
&
subkey
))
{
export_registry_data
(
hFile
,
subkey
,
subkey_path
);
RegCloseKey
(
subkey
);
...
...
programs/reg/query.c
View file @
c809f946
...
...
@@ -133,7 +133,7 @@ static void output_value(const WCHAR *value_name, DWORD type, BYTE *data, DWORD
static
unsigned
int
num_values_found
=
0
;
static
int
query_value
(
HKEY
key
,
WCHAR
*
value_name
,
WCHAR
*
path
,
BOOL
recurse
)
static
int
query_value
(
HKEY
h
key
,
WCHAR
*
value_name
,
WCHAR
*
path
,
BOOL
recurse
)
{
LONG
rc
;
DWORD
max_data_bytes
=
2048
,
data_size
;
...
...
@@ -149,7 +149,7 @@ static int query_value(HKEY key, WCHAR *value_name, WCHAR *path, BOOL recurse)
for
(;;)
{
data_size
=
max_data_bytes
;
rc
=
RegQueryValueExW
(
key
,
value_name
,
NULL
,
&
type
,
data
,
&
data_size
);
rc
=
RegQueryValueExW
(
h
key
,
value_name
,
NULL
,
&
type
,
data
,
&
data_size
);
if
(
rc
==
ERROR_MORE_DATA
)
{
max_data_bytes
=
data_size
;
...
...
@@ -191,11 +191,11 @@ static int query_value(HKEY key, WCHAR *value_name, WCHAR *path, BOOL recurse)
for
(;;)
{
subkey_len
=
MAX_SUBKEY_LEN
;
rc
=
RegEnumKeyExW
(
key
,
i
,
subkey_name
,
&
subkey_len
,
NULL
,
NULL
,
NULL
,
NULL
);
rc
=
RegEnumKeyExW
(
h
key
,
i
,
subkey_name
,
&
subkey_len
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
rc
==
ERROR_SUCCESS
)
{
subkey_path
=
build_subkey_path
(
path
,
path_len
,
subkey_name
,
subkey_len
);
if
(
!
RegOpenKeyExW
(
key
,
subkey_name
,
0
,
KEY_READ
,
&
subkey
))
if
(
!
RegOpenKeyExW
(
h
key
,
subkey_name
,
0
,
KEY_READ
,
&
subkey
))
{
query_value
(
subkey
,
value_name
,
subkey_path
,
recurse
);
RegCloseKey
(
subkey
);
...
...
@@ -210,7 +210,7 @@ static int query_value(HKEY key, WCHAR *value_name, WCHAR *path, BOOL recurse)
return
0
;
}
static
int
query_all
(
HKEY
key
,
WCHAR
*
path
,
BOOL
recurse
)
static
int
query_all
(
HKEY
h
key
,
WCHAR
*
path
,
BOOL
recurse
)
{
LONG
rc
;
DWORD
max_value_len
=
256
,
value_len
;
...
...
@@ -231,7 +231,7 @@ static int query_all(HKEY key, WCHAR *path, BOOL recurse)
{
value_len
=
max_value_len
;
data_size
=
max_data_bytes
;
rc
=
RegEnumValueW
(
key
,
i
,
value_name
,
&
value_len
,
NULL
,
&
type
,
data
,
&
data_size
);
rc
=
RegEnumValueW
(
h
key
,
i
,
value_name
,
&
value_len
,
NULL
,
&
type
,
data
,
&
data_size
);
if
(
rc
==
ERROR_SUCCESS
)
{
output_value
(
value_name
,
type
,
data
,
data_size
);
...
...
@@ -267,13 +267,13 @@ static int query_all(HKEY key, WCHAR *path, BOOL recurse)
for
(;;)
{
subkey_len
=
MAX_SUBKEY_LEN
;
rc
=
RegEnumKeyExW
(
key
,
i
,
subkey_name
,
&
subkey_len
,
NULL
,
NULL
,
NULL
,
NULL
);
rc
=
RegEnumKeyExW
(
h
key
,
i
,
subkey_name
,
&
subkey_len
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
rc
==
ERROR_SUCCESS
)
{
if
(
recurse
)
{
subkey_path
=
build_subkey_path
(
path
,
path_len
,
subkey_name
,
subkey_len
);
if
(
!
RegOpenKeyExW
(
key
,
subkey_name
,
0
,
KEY_READ
,
&
subkey
))
if
(
!
RegOpenKeyExW
(
h
key
,
subkey_name
,
0
,
KEY_READ
,
&
subkey
))
{
query_all
(
subkey
,
subkey_path
,
recurse
);
RegCloseKey
(
subkey
);
...
...
@@ -297,10 +297,10 @@ static int query_all(HKEY key, WCHAR *path, BOOL recurse)
static
int
run_query
(
HKEY
root
,
WCHAR
*
path
,
WCHAR
*
key_name
,
WCHAR
*
value_name
,
BOOL
value_empty
,
BOOL
recurse
)
{
HKEY
key
;
HKEY
h
key
;
int
ret
;
if
(
RegOpenKeyExW
(
root
,
path
,
0
,
KEY_READ
,
&
key
)
!=
ERROR_SUCCESS
)
if
(
RegOpenKeyExW
(
root
,
path
,
0
,
KEY_READ
,
&
h
key
)
!=
ERROR_SUCCESS
)
{
output_message
(
STRING_KEY_NONEXIST
);
return
1
;
...
...
@@ -310,14 +310,14 @@ static int run_query(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name,
if
(
value_name
||
value_empty
)
{
ret
=
query_value
(
key
,
value_name
,
key_name
,
recurse
);
ret
=
query_value
(
h
key
,
value_name
,
key_name
,
recurse
);
if
(
recurse
)
output_message
(
STRING_MATCHES_FOUND
,
num_values_found
);
}
else
ret
=
query_all
(
key
,
key_name
,
recurse
);
ret
=
query_all
(
h
key
,
key_name
,
recurse
);
RegCloseKey
(
key
);
RegCloseKey
(
h
key
);
return
ret
;
}
...
...
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