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
aaf66e57
Commit
aaf66e57
authored
Aug 11, 2021
by
Zebediah Figura
Committed by
Alexandre Julliard
Aug 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Implement reading performance counter name strings.
Signed-off-by:
Zebediah Figura
<
zfigura@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a8367f1d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
9 deletions
+39
-9
registry.c
dlls/advapi32/tests/registry.c
+12
-6
registry.c
dlls/kernelbase/registry.c
+27
-3
No files found.
dlls/advapi32/tests/registry.c
View file @
aaf66e57
...
...
@@ -3785,7 +3785,7 @@ static void test_performance_keys(void)
size
=
0xdeadbeef
;
ret
=
RegQueryValueExA
(
keys
[
i
],
"cOuNtEr"
,
NULL
,
NULL
,
NULL
,
&
size
);
todo_wine
todo_wine
_if
(
keys
[
i
]
!=
HKEY_PERFORMANCE_DATA
)
{
ok
(
!
ret
,
"got %u
\n
"
,
ret
);
ok
(
size
>
0
&&
size
<
0xdeadbeef
,
"got size %u
\n
"
,
size
);
...
...
@@ -3795,15 +3795,19 @@ static void test_performance_keys(void)
size
=
0
;
ret
=
RegQueryValueExA
(
keys
[
i
],
"cOuNtEr"
,
NULL
,
&
type
,
buffer
,
&
size
);
todo_wine_if
(
keys
[
i
]
!=
HKEY_PERFORMANCE_DATA
)
{
ok
(
ret
==
ERROR_MORE_DATA
,
"got %u
\n
"
,
ret
);
todo_wine
ok
(
size
>
0
,
"got size %u
\n
"
,
size
);
ok
(
size
>
0
,
"got size %u
\n
"
,
size
);
}
type
=
0xdeadbeef
;
size
=
buffer_size
;
ret
=
RegQueryValueExA
(
keys
[
i
],
"cOuNtEr"
,
NULL
,
&
type
,
buffer
,
&
size
);
todo_wine_if
(
keys
[
i
]
!=
HKEY_PERFORMANCE_DATA
)
{
ok
(
!
ret
,
"got %u
\n
"
,
ret
);
todo_wine
ok
(
type
==
REG_MULTI_SZ
,
"got type %u
\n
"
,
type
);
ok
(
type
==
REG_MULTI_SZ
,
"got type %u
\n
"
,
type
);
}
if
(
type
==
REG_MULTI_SZ
)
test_counter_values
(
buffer
,
keys
[
i
]);
...
...
@@ -3811,14 +3815,16 @@ static void test_performance_keys(void)
size
=
buffer_size
;
ret
=
RegQueryValueExA
(
keys
[
i
],
"cOuNtErwine"
,
NULL
,
&
type
,
buffer
,
&
size
);
todo_wine_if
(
keys
[
i
]
!=
HKEY_PERFORMANCE_DATA
)
{
ok
(
!
ret
,
"got %u
\n
"
,
ret
);
todo_wine
ok
(
type
==
REG_MULTI_SZ
,
"got type %u
\n
"
,
type
);
ok
(
type
==
REG_MULTI_SZ
,
"got type %u
\n
"
,
type
);
}
if
(
type
==
REG_MULTI_SZ
)
test_counter_values
(
buffer
,
keys
[
i
]);
size
=
0
;
ret
=
RegQueryValueExW
(
keys
[
i
],
L"cOuNtEr"
,
NULL
,
NULL
,
NULL
,
&
size
);
todo_wine
todo_wine
_if
(
keys
[
i
]
!=
HKEY_PERFORMANCE_DATA
)
{
ok
(
!
ret
,
"got %u
\n
"
,
ret
);
ok
(
size
>
0
,
"got size %u
\n
"
,
size
);
...
...
@@ -3828,7 +3834,7 @@ static void test_performance_keys(void)
type
=
0xdeadbeef
;
ret
=
RegQueryValueExW
(
keys
[
i
],
L"cOuNtEr"
,
NULL
,
&
type
,
bufferW
,
&
size
);
todo_wine
todo_wine
_if
(
keys
[
i
]
!=
HKEY_PERFORMANCE_DATA
)
{
ok
(
!
ret
,
"got %u
\n
"
,
ret
);
ok
(
type
==
REG_MULTI_SZ
,
"got type %u
\n
"
,
type
);
...
...
dlls/kernelbase/registry.c
View file @
aaf66e57
...
...
@@ -1204,6 +1204,27 @@ LONG WINAPI RegSetKeyValueA( HKEY hkey, LPCSTR subkey, LPCSTR name, DWORD type,
return
ret
;
}
/* FIXME: we should read data from system32/perf009c.dat (or perf###c depending
* on locale) instead */
static
DWORD
query_perf_names
(
DWORD
*
type
,
void
*
data
,
DWORD
*
ret_size
,
BOOL
unicode
)
{
static
const
WCHAR
names
[]
=
L"1
\0
"
"1847
\0
"
"1846
\0
End Marker
\0
"
;
DWORD
size
=
*
ret_size
;
if
(
type
)
*
type
=
REG_MULTI_SZ
;
*
ret_size
=
sizeof
(
names
);
if
(
!
unicode
)
*
ret_size
/=
sizeof
(
WCHAR
);
if
(
!
data
)
return
ERROR_SUCCESS
;
if
(
size
<
*
ret_size
)
return
ERROR_MORE_DATA
;
if
(
unicode
)
memcpy
(
data
,
names
,
sizeof
(
names
)
);
else
RtlUnicodeToMultiByteN
(
data
,
size
,
NULL
,
names
,
sizeof
(
names
)
);
return
ERROR_SUCCESS
;
}
struct
perf_provider
{
HMODULE
perflib
;
...
...
@@ -1338,7 +1359,7 @@ static DWORD collect_data(struct perf_provider *provider, const WCHAR *query, vo
#define MAX_SERVICE_NAME 260
static
DWORD
query_perf_data
(
const
WCHAR
*
query
,
DWORD
*
type
,
void
*
data
,
DWORD
*
ret_size
)
static
DWORD
query_perf_data
(
const
WCHAR
*
query
,
DWORD
*
type
,
void
*
data
,
DWORD
*
ret_size
,
BOOL
unicode
)
{
DWORD
err
,
i
,
data_size
;
HKEY
root
;
...
...
@@ -1347,6 +1368,9 @@ static DWORD query_perf_data(const WCHAR *query, DWORD *type, void *data, DWORD
if
(
!
ret_size
)
return
ERROR_INVALID_PARAMETER
;
if
(
!
wcsnicmp
(
query
,
L"counter"
,
7
))
return
query_perf_names
(
type
,
data
,
ret_size
,
unicode
);
data_size
=
*
ret_size
;
*
ret_size
=
0
;
...
...
@@ -1480,7 +1504,7 @@ LSTATUS WINAPI DECLSPEC_HOTPATCH RegQueryValueExW( HKEY hkey, LPCWSTR name, LPDW
if
((
data
&&
!
count
)
||
reserved
)
return
ERROR_INVALID_PARAMETER
;
if
(
hkey
==
HKEY_PERFORMANCE_DATA
)
return
query_perf_data
(
name
,
type
,
data
,
count
);
return
query_perf_data
(
name
,
type
,
data
,
count
,
TRUE
);
if
(
!
(
hkey
=
get_special_root_hkey
(
hkey
,
0
)))
return
ERROR_INVALID_HANDLE
;
...
...
@@ -1587,7 +1611,7 @@ LSTATUS WINAPI DECLSPEC_HOTPATCH RegQueryValueExA( HKEY hkey, LPCSTR name, LPDWO
if
(
hkey
==
HKEY_PERFORMANCE_DATA
)
{
DWORD
ret
=
query_perf_data
(
nameW
.
Buffer
,
type
,
data
,
count
);
DWORD
ret
=
query_perf_data
(
nameW
.
Buffer
,
type
,
data
,
count
,
FALSE
);
RtlFreeUnicodeString
(
&
nameW
);
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