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
3035599a
Commit
3035599a
authored
Apr 21, 2016
by
Hugh McMaster
Committed by
Alexandre Julliard
Apr 22, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: Output value names when querying a registry key.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3f62729b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
3 deletions
+65
-3
reg.c
programs/reg/reg.c
+65
-3
No files found.
programs/reg/reg.c
View file @
3035599a
...
...
@@ -537,12 +537,60 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
return
0
;
}
static
int
query_all
(
HKEY
key
,
WCHAR
*
path
)
{
LONG
rc
;
DWORD
num_values
,
max_value_len
,
value_len
;
DWORD
i
;
WCHAR
fmt
[]
=
{
'%'
,
'1'
,
'\n'
,
0
};
WCHAR
fmt_value
[]
=
{
' '
,
' '
,
' '
,
' '
,
'%'
,
'1'
,
0
};
WCHAR
*
value_name
;
WCHAR
newlineW
[]
=
{
'\n'
,
0
};
rc
=
RegQueryInfoKeyW
(
key
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
&
num_values
,
&
max_value_len
,
NULL
,
NULL
,
NULL
);
if
(
rc
)
{
ERR
(
"RegQueryInfoKey failed: %d
\n
"
,
rc
);
return
1
;
}
output_string
(
fmt
,
path
);
max_value_len
++
;
value_name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
max_value_len
*
sizeof
(
WCHAR
));
if
(
!
value_name
)
{
ERR
(
"Failed to allocate memory for value_name
\n
"
);
return
1
;
}
for
(
i
=
0
;
i
<
num_values
;
i
++
)
{
value_len
=
max_value_len
;
rc
=
RegEnumValueW
(
key
,
i
,
value_name
,
&
value_len
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
rc
==
ERROR_SUCCESS
)
{
output_string
(
fmt_value
,
value_name
);
output_string
(
newlineW
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
value_name
);
if
(
num_values
)
output_string
(
newlineW
);
return
0
;
}
static
int
reg_query
(
WCHAR
*
key_name
,
WCHAR
*
value_name
,
BOOL
value_empty
,
BOOL
recurse
)
{
WCHAR
*
p
;
HKEY
root
;
HKEY
root
,
key
;
static
const
WCHAR
stubW
[]
=
{
'S'
,
'T'
,
'U'
,
'B'
,
' '
,
'Q'
,
'U'
,
'E'
,
'R'
,
'Y'
,
' '
,
'-'
,
' '
,
'%'
,
'1'
,
' '
,
'%'
,
'2'
,
' '
,
'%'
,
'3'
,
'!'
,
'd'
,
'!'
,
' '
,
'%'
,
'4'
,
'!'
,
'd'
,
'!'
,
'\n'
,
0
};
int
ret
;
if
(
!
sane_path
(
key_name
))
return
1
;
...
...
@@ -563,9 +611,23 @@ static int reg_query(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, BOOL
p
=
strchrW
(
key_name
,
'\\'
);
if
(
p
)
p
++
;
output_string
(
stubW
,
key_name
,
value_name
,
value_empty
,
recurse
);
if
(
RegOpenKeyExW
(
root
,
p
,
0
,
KEY_READ
,
&
key
)
!=
ERROR_SUCCESS
)
{
output_message
(
STRING_CANNOT_FIND
);
return
1
;
}
if
(
value_name
||
value_empty
||
recurse
)
{
output_string
(
stubW
,
key_name
,
value_name
,
value_empty
,
recurse
);
return
1
;
}
ret
=
query_all
(
key
,
key_name
);
RegCloseKey
(
key
);
return
1
;
return
ret
;
}
int
wmain
(
int
argc
,
WCHAR
*
argvW
[])
...
...
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