Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
07fdd503
Commit
07fdd503
authored
Apr 05, 2021
by
Hugh McMaster
Committed by
Alexandre Julliard
Apr 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: Only call get_long_key() when operations require it.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b1eba226
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
12 deletions
+17
-12
add.c
programs/reg/add.c
+2
-2
delete.c
programs/reg/delete.c
+3
-1
export.c
programs/reg/export.c
+5
-3
query.c
programs/reg/query.c
+3
-1
reg.c
programs/reg/reg.c
+2
-4
reg.h
programs/reg/reg.h
+2
-1
No files found.
programs/reg/add.c
View file @
07fdd503
...
...
@@ -213,11 +213,11 @@ static int run_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty,
int
reg_add
(
int
argc
,
WCHAR
*
argvW
[])
{
HKEY
root
;
WCHAR
*
path
,
*
key_name
,
*
value_name
=
NULL
,
*
type
=
NULL
,
*
data
=
NULL
,
separator
=
'\0'
;
WCHAR
*
path
,
*
value_name
=
NULL
,
*
type
=
NULL
,
*
data
=
NULL
,
separator
=
'\0'
;
BOOL
value_empty
=
FALSE
,
force
=
FALSE
;
int
i
;
if
(
!
parse_registry_key
(
argvW
[
2
],
&
root
,
&
path
,
&
key_name
))
if
(
!
parse_registry_key
(
argvW
[
2
],
&
root
,
&
path
))
return
1
;
for
(
i
=
3
;
i
<
argc
;
i
++
)
...
...
programs/reg/delete.c
View file @
07fdd503
...
...
@@ -113,7 +113,7 @@ int reg_delete(int argc, WCHAR *argvW[])
BOOL
value_all
=
FALSE
,
value_empty
=
FALSE
,
force
=
FALSE
;
int
i
;
if
(
!
parse_registry_key
(
argvW
[
2
],
&
root
,
&
path
,
&
key_name
))
if
(
!
parse_registry_key
(
argvW
[
2
],
&
root
,
&
path
))
return
1
;
for
(
i
=
3
;
i
<
argc
;
i
++
)
...
...
@@ -158,6 +158,8 @@ int reg_delete(int argc, WCHAR *argvW[])
if
((
value_name
&&
value_empty
)
||
(
value_name
&&
value_all
)
||
(
value_empty
&&
value_all
))
goto
invalid
;
key_name
=
get_long_key
(
root
,
path
);
return
run_delete
(
root
,
path
,
key_name
,
value_name
,
value_empty
,
value_all
,
force
);
invalid:
...
...
programs/reg/export.c
View file @
07fdd503
...
...
@@ -347,14 +347,14 @@ static HANDLE get_file_handle(WCHAR *filename, BOOL overwrite_file)
int
reg_export
(
int
argc
,
WCHAR
*
argvW
[])
{
HKEY
root
,
hkey
;
WCHAR
*
path
,
*
long_key
;
WCHAR
*
path
,
*
key_name
;
BOOL
overwrite_file
=
FALSE
;
HANDLE
hFile
;
int
i
,
ret
;
if
(
argc
<
4
)
goto
invalid
;
if
(
!
parse_registry_key
(
argvW
[
2
],
&
root
,
&
path
,
&
long_key
))
if
(
!
parse_registry_key
(
argvW
[
2
],
&
root
,
&
path
))
return
1
;
for
(
i
=
4
;
i
<
argc
;
i
++
)
...
...
@@ -378,9 +378,11 @@ int reg_export(int argc, WCHAR *argvW[])
return
1
;
}
key_name
=
get_long_key
(
root
,
path
);
hFile
=
get_file_handle
(
argvW
[
3
],
overwrite_file
);
export_file_header
(
hFile
);
ret
=
export_registry_data
(
hFile
,
hkey
,
long_key
);
ret
=
export_registry_data
(
hFile
,
hkey
,
key_name
);
export_newline
(
hFile
);
CloseHandle
(
hFile
);
...
...
programs/reg/query.c
View file @
07fdd503
...
...
@@ -329,7 +329,7 @@ int reg_query(int argc, WCHAR *argvW[])
BOOL
value_empty
=
FALSE
,
recurse
=
FALSE
;
int
i
;
if
(
!
parse_registry_key
(
argvW
[
2
],
&
root
,
&
path
,
&
key_name
))
if
(
!
parse_registry_key
(
argvW
[
2
],
&
root
,
&
path
))
return
1
;
for
(
i
=
3
;
i
<
argc
;
i
++
)
...
...
@@ -368,6 +368,8 @@ int reg_query(int argc, WCHAR *argvW[])
if
(
value_name
&&
value_empty
)
goto
invalid
;
key_name
=
get_long_key
(
root
,
path
);
return
run_query
(
root
,
path
,
key_name
,
value_name
,
value_empty
,
recurse
);
invalid:
...
...
programs/reg/reg.c
View file @
07fdd503
...
...
@@ -203,7 +203,7 @@ WCHAR *build_subkey_path(WCHAR *path, DWORD path_len, WCHAR *subkey_name, DWORD
return
subkey_path
;
}
static
WCHAR
*
get_long_key
(
HKEY
root
,
WCHAR
*
path
)
WCHAR
*
get_long_key
(
HKEY
root
,
WCHAR
*
path
)
{
DWORD
i
,
array_size
=
ARRAY_SIZE
(
root_rels
),
len
;
WCHAR
*
long_key
;
...
...
@@ -229,7 +229,7 @@ static WCHAR *get_long_key(HKEY root, WCHAR *path)
return
long_key
;
}
BOOL
parse_registry_key
(
const
WCHAR
*
key
,
HKEY
*
root
,
WCHAR
**
path
,
WCHAR
**
long_key
)
BOOL
parse_registry_key
(
const
WCHAR
*
key
,
HKEY
*
root
,
WCHAR
**
path
)
{
if
(
!
sane_path
(
key
))
return
FALSE
;
...
...
@@ -245,8 +245,6 @@ BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long
return
FALSE
;
}
*
long_key
=
get_long_key
(
*
root
,
*
path
);
return
TRUE
;
}
...
...
programs/reg/reg.h
View file @
07fdd503
...
...
@@ -39,7 +39,8 @@ void WINAPIV output_string(const WCHAR *fmt, ...);
BOOL
ask_confirm
(
unsigned
int
msgid
,
WCHAR
*
reg_info
);
HKEY
path_get_rootkey
(
const
WCHAR
*
path
);
WCHAR
*
build_subkey_path
(
WCHAR
*
path
,
DWORD
path_len
,
WCHAR
*
subkey_name
,
DWORD
subkey_len
);
BOOL
parse_registry_key
(
const
WCHAR
*
key
,
HKEY
*
root
,
WCHAR
**
path
,
WCHAR
**
long_key
);
WCHAR
*
get_long_key
(
HKEY
root
,
WCHAR
*
path
);
BOOL
parse_registry_key
(
const
WCHAR
*
key
,
HKEY
*
root
,
WCHAR
**
path
);
BOOL
is_char
(
const
WCHAR
s
,
const
WCHAR
c
);
BOOL
is_switch
(
const
WCHAR
*
s
,
const
WCHAR
c
);
...
...
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