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
8eef4a87
Commit
8eef4a87
authored
Jul 02, 2021
by
Hugh McMaster
Committed by
Alexandre Julliard
Jul 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: Support use of registry views in the 'query' operation.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
48c73868
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
17 deletions
+31
-17
query.c
programs/reg/query.c
+19
-5
query.c
programs/reg/tests/query.c
+12
-12
No files found.
programs/reg/query.c
View file @
8eef4a87
...
...
@@ -140,6 +140,7 @@ static void output_value(const WCHAR *value_name, DWORD type, BYTE *data, DWORD
}
static
unsigned
int
num_values_found
=
0
;
static
REGSAM
sam
=
0
;
static
int
query_value
(
HKEY
hkey
,
WCHAR
*
value_name
,
WCHAR
*
path
,
BOOL
recurse
)
{
...
...
@@ -203,7 +204,7 @@ static int query_value(HKEY hkey, WCHAR *value_name, WCHAR *path, BOOL recurse)
if
(
rc
==
ERROR_SUCCESS
)
{
subkey_path
=
build_subkey_path
(
path
,
path_len
,
subkey_name
,
subkey_len
);
if
(
!
RegOpenKeyExW
(
hkey
,
subkey_name
,
0
,
KEY_READ
,
&
subkey
))
if
(
!
RegOpenKeyExW
(
hkey
,
subkey_name
,
0
,
KEY_READ
|
sam
,
&
subkey
))
{
query_value
(
subkey
,
value_name
,
subkey_path
,
recurse
);
RegCloseKey
(
subkey
);
...
...
@@ -290,7 +291,7 @@ static int query_all(HKEY hkey, WCHAR *path, BOOL recurse, BOOL recursing)
if
(
recurse
)
{
subkey_path
=
build_subkey_path
(
path
,
path_len
,
subkey_name
,
subkey_len
);
if
(
!
RegOpenKeyExW
(
hkey
,
subkey_name
,
0
,
KEY_READ
,
&
subkey
))
if
(
!
RegOpenKeyExW
(
hkey
,
subkey_name
,
0
,
KEY_READ
|
sam
,
&
subkey
))
{
query_all
(
subkey
,
subkey_path
,
recurse
,
TRUE
);
RegCloseKey
(
subkey
);
...
...
@@ -308,12 +309,12 @@ static int query_all(HKEY hkey, WCHAR *path, BOOL recurse, BOOL recursing)
}
static
int
run_query
(
HKEY
root
,
WCHAR
*
path
,
WCHAR
*
key_name
,
WCHAR
*
value_name
,
BOOL
value_empty
,
BOOL
recurse
)
BOOL
value_empty
,
BOOL
recurse
)
{
HKEY
hkey
;
int
ret
;
if
(
RegOpenKeyExW
(
root
,
path
,
0
,
KEY_READ
,
&
hkey
)
!=
ERROR_SUCCESS
)
if
(
RegOpenKeyExW
(
root
,
path
,
0
,
KEY_READ
|
sam
,
&
hkey
)
)
{
output_message
(
STRING_KEY_NONEXIST
);
return
1
;
...
...
@@ -360,8 +361,18 @@ int reg_query(int argc, WCHAR *argvW[])
value_empty
=
TRUE
;
continue
;
}
else
if
(
!
lstrcmpiW
(
str
,
L"reg:32"
)
||
!
lstrcmpiW
(
str
,
L"reg:64"
))
else
if
(
!
lstrcmpiW
(
str
,
L"reg:32"
))
{
if
(
sam
&
KEY_WOW64_32KEY
)
goto
invalid
;
sam
|=
KEY_WOW64_32KEY
;
continue
;
}
else
if
(
!
lstrcmpiW
(
str
,
L"reg:64"
))
{
if
(
sam
&
KEY_WOW64_64KEY
)
goto
invalid
;
sam
|=
KEY_WOW64_64KEY
;
continue
;
}
else
if
(
!
str
[
0
]
||
str
[
1
])
goto
invalid
;
...
...
@@ -383,6 +394,9 @@ int reg_query(int argc, WCHAR *argvW[])
if
(
value_name
&&
value_empty
)
goto
invalid
;
if
(
sam
==
(
KEY_WOW64_32KEY
|
KEY_WOW64_64KEY
))
goto
invalid
;
key_name
=
get_long_key
(
root
,
path
);
return
run_query
(
root
,
path
,
key_name
,
value_name
,
value_empty
,
recurse
);
...
...
programs/reg/tests/query.c
View file @
8eef4a87
...
...
@@ -414,16 +414,16 @@ static void test_registry_view_win64(void)
create_test_key
(
KEY_WOW64_32KEY
);
read_reg_output
(
"reg query HKLM
\\
"
KEY_BASE
" /reg:32"
,
buf
,
sizeof
(
buf
),
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
compare_query
(
buf
,
test9a
,
FALSE
,
TODO_REG_COMPARE
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
compare_query
(
buf
,
test9a
,
FALSE
,
0
);
read_reg_output
(
"reg query HKLM
\\
"
KEY_BASE
" /s /reg:32"
,
buf
,
sizeof
(
buf
),
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
compare_query
(
buf
,
test9b
,
FALSE
,
TODO_REG_COMPARE
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
compare_query
(
buf
,
test9b
,
FALSE
,
0
);
read_reg_output
(
"reg query HKLM
\\
"
KEY_BASE
" /v Wine /s /reg:32"
,
buf
,
sizeof
(
buf
),
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
compare_query
(
buf
,
test9c
,
TRUE
,
TODO_REG_COMPARE
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
compare_query
(
buf
,
test9c
,
TRUE
,
0
);
delete_tree
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_32KEY
);
delete_tree
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_64KEY
);
...
...
@@ -480,16 +480,16 @@ static void test_registry_view_wow64(void)
create_test_key
(
KEY_WOW64_64KEY
);
read_reg_output
(
"reg query HKLM
\\
"
KEY_BASE
" /reg:64"
,
buf
,
sizeof
(
buf
),
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
compare_query
(
buf
,
test9a
,
FALSE
,
TODO_REG_COMPARE
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
compare_query
(
buf
,
test9a
,
FALSE
,
0
);
read_reg_output
(
"reg query HKLM
\\
"
KEY_BASE
" /s /reg:64"
,
buf
,
sizeof
(
buf
),
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
compare_query
(
buf
,
test9b
,
FALSE
,
TODO_REG_COMPARE
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
compare_query
(
buf
,
test9b
,
FALSE
,
0
);
read_reg_output
(
"reg query HKLM
\\
"
KEY_BASE
" /v Wine /s /reg:64"
,
buf
,
sizeof
(
buf
),
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
compare_query
(
buf
,
test9c
,
TRUE
,
TODO_REG_COMPARE
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
compare_query
(
buf
,
test9c
,
TRUE
,
0
);
delete_tree
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_64KEY
);
}
...
...
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