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
7fb6c7a0
Commit
7fb6c7a0
authored
Nov 05, 2020
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Nov 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pdh: Use wide-char string literals.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b793799d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
47 deletions
+20
-47
pdh_main.c
dlls/pdh/pdh_main.c
+9
-22
pdh.c
dlls/pdh/tests/pdh.c
+11
-25
No files found.
dlls/pdh/pdh_main.c
View file @
7fb6c7a0
...
...
@@ -174,12 +174,6 @@ struct source
LONGLONG
base
;
/* samples per second */
};
static
const
WCHAR
path_processor_time
[]
=
{
'\\'
,
'P'
,
'r'
,
'o'
,
'c'
,
'e'
,
's'
,
's'
,
'o'
,
'r'
,
'('
,
'_'
,
'T'
,
'o'
,
't'
,
'a'
,
'l'
,
')'
,
'\\'
,
'%'
,
' '
,
'P'
,
'r'
,
'o'
,
'c'
,
'e'
,
's'
,
's'
,
'o'
,
'r'
,
' '
,
'T'
,
'i'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
path_uptime
[]
=
{
'\\'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'\\'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
' '
,
'U'
,
'p'
,
' '
,
'T'
,
'i'
,
'm'
,
'e'
,
0
};
static
void
CALLBACK
collect_processor_time
(
struct
counter
*
counter
)
{
counter
->
two
.
largevalue
=
500000
;
/* FIXME */
...
...
@@ -202,8 +196,8 @@ static void CALLBACK collect_uptime( struct counter *counter )
/* counter source registry */
static
const
struct
source
counter_sources
[]
=
{
{
6
,
path_processor_time
,
collect_processor_time
,
TYPE_PROCESSOR_TIME
,
-
5
,
10000000
},
{
674
,
path_uptime
,
collect_uptime
,
TYPE_UPTIME
,
-
3
,
1000
}
{
6
,
L"
\\
Processor(_Total)
\\
% Processor Time"
,
collect_processor_time
,
TYPE_PROCESSOR_TIME
,
-
5
,
10000000
},
{
674
,
L"
\\
System
\\
System Up Time"
,
collect_uptime
,
TYPE_UPTIME
,
-
3
,
1000
}
};
static
BOOL
is_local_machine
(
const
WCHAR
*
name
,
DWORD
len
)
...
...
@@ -1181,12 +1175,6 @@ done:
PDH_STATUS
WINAPI
PdhMakeCounterPathW
(
PDH_COUNTER_PATH_ELEMENTS_W
*
e
,
LPWSTR
buffer
,
LPDWORD
buflen
,
DWORD
flags
)
{
static
const
WCHAR
bslash
[]
=
{
'\\'
,
0
};
static
const
WCHAR
fslash
[]
=
{
'/'
,
0
};
static
const
WCHAR
lparen
[]
=
{
'('
,
0
};
static
const
WCHAR
rparen
[]
=
{
')'
,
0
};
static
const
WCHAR
fmt
[]
=
{
'#'
,
'%'
,
'u'
,
0
};
WCHAR
path
[
PDH_MAX_COUNTER_NAME
],
instance
[
12
];
PDH_STATUS
ret
=
ERROR_SUCCESS
;
DWORD
len
;
...
...
@@ -1201,26 +1189,25 @@ PDH_STATUS WINAPI PdhMakeCounterPathW( PDH_COUNTER_PATH_ELEMENTS_W *e, LPWSTR bu
path
[
0
]
=
0
;
if
(
e
->
szMachineName
)
{
lstrcatW
(
path
,
bslash
);
lstrcatW
(
path
,
bslash
);
lstrcatW
(
path
,
L"
\\\\
"
);
lstrcatW
(
path
,
e
->
szMachineName
);
}
lstrcatW
(
path
,
bslash
);
lstrcatW
(
path
,
L"
\\
"
);
lstrcatW
(
path
,
e
->
szObjectName
);
if
(
e
->
szInstanceName
)
{
lstrcatW
(
path
,
lparen
);
lstrcatW
(
path
,
L"("
);
if
(
e
->
szParentInstance
)
{
lstrcatW
(
path
,
e
->
szParentInstance
);
lstrcatW
(
path
,
fslash
);
lstrcatW
(
path
,
L"/"
);
}
lstrcatW
(
path
,
e
->
szInstanceName
);
swprintf
(
instance
,
ARRAY_SIZE
(
instance
),
fmt
,
e
->
dwInstanceIndex
);
swprintf
(
instance
,
ARRAY_SIZE
(
instance
),
L"#%u"
,
e
->
dwInstanceIndex
);
lstrcatW
(
path
,
instance
);
lstrcatW
(
path
,
rparen
);
lstrcatW
(
path
,
L")"
);
}
lstrcatW
(
path
,
bslash
);
lstrcatW
(
path
,
L"
\\
"
);
lstrcatW
(
path
,
e
->
szCounterName
);
len
=
lstrlenW
(
path
)
+
1
;
...
...
dlls/pdh/tests/pdh.c
View file @
7fb6c7a0
...
...
@@ -71,18 +71,12 @@ static void init_function_ptrs( void )
GETFUNCPTR
(
PdhValidatePathExW
)
}
static
const
WCHAR
processor_time
[]
=
{
'%'
,
' '
,
'P'
,
'r'
,
'o'
,
'c'
,
'e'
,
's'
,
's'
,
'o'
,
'r'
,
' '
,
'T'
,
'i'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
uptime
[]
=
{
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
' '
,
'U'
,
'p'
,
' '
,
'T'
,
'i'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
system_uptime
[]
=
{
'\\'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'\\'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
' '
,
'U'
,
'p'
,
' '
,
'T'
,
'i'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
nonexistent_counter
[]
=
{
'\\'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'\\'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
' '
,
'D'
,
'o'
,
'w'
,
'n'
,
' '
,
'T'
,
'i'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
percentage_processor_time
[]
=
{
'\\'
,
'P'
,
'r'
,
'o'
,
'c'
,
'e'
,
's'
,
's'
,
'o'
,
'r'
,
'('
,
'_'
,
'T'
,
'o'
,
't'
,
'a'
,
'l'
,
')'
,
'\\'
,
'%'
,
' '
,
'P'
,
'r'
,
'o'
,
'c'
,
'e'
,
's'
,
's'
,
'o'
,
'r'
,
' '
,
'T'
,
'i'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
processor_time
[]
=
L"% Processor Time"
;
static
const
WCHAR
uptime
[]
=
L"System Up Time"
;
static
const
WCHAR
system_uptime
[]
=
L"
\\
System
\\
System Up Time"
;
static
const
WCHAR
nonexistent_counter
[]
=
L"
\\
System
\\
System Down Time"
;
static
const
WCHAR
percentage_processor_time
[]
=
L"
\\
Processor(_Total)
\\
% Processor Time"
;
static
void
test_PdhOpenQueryA
(
void
)
{
...
...
@@ -630,15 +624,13 @@ static void test_PdhLookupPerfIndexByNameW( void )
PDH_STATUS
ret
;
DWORD
index
;
static
const
WCHAR
no_counter
[]
=
{
'N'
,
'o'
,
' '
,
'C'
,
'o'
,
'u'
,
'n'
,
't'
,
'e'
,
'r'
,
0
};
ret
=
PdhLookupPerfIndexByNameW
(
NULL
,
NULL
,
NULL
);
ok
(
ret
==
PDH_INVALID_ARGUMENT
,
"PdhLookupPerfIndexByNameW failed 0x%08x
\n
"
,
ret
);
ret
=
PdhLookupPerfIndexByNameW
(
NULL
,
NULL
,
&
index
);
ok
(
ret
==
PDH_INVALID_ARGUMENT
,
"PdhLookupPerfIndexByNameW failed 0x%08x
\n
"
,
ret
);
ret
=
PdhLookupPerfIndexByNameW
(
NULL
,
no_counter
,
&
index
);
ret
=
PdhLookupPerfIndexByNameW
(
NULL
,
L"No Counter"
,
&
index
);
ok
(
ret
==
PDH_STRING_NOT_FOUND
,
"PdhLookupPerfIndexByNameW failed 0x%08x
\n
"
,
ret
);
ret
=
PdhLookupPerfIndexByNameW
(
NULL
,
processor_time
,
NULL
);
...
...
@@ -744,16 +736,13 @@ static void test_PdhValidatePathW( void )
{
PDH_STATUS
ret
;
static
const
WCHAR
empty
[]
=
{
0
};
static
const
WCHAR
system
[]
=
{
'\\'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
0
};
ret
=
PdhValidatePathW
(
NULL
);
ok
(
ret
==
PDH_INVALID_ARGUMENT
,
"PdhValidatePathW failed 0x%08x
\n
"
,
ret
);
ret
=
PdhValidatePathW
(
empty
);
ret
=
PdhValidatePathW
(
L""
);
ok
(
ret
==
PDH_INVALID_ARGUMENT
,
"PdhValidatePathW failed 0x%08x
\n
"
,
ret
);
ret
=
PdhValidatePathW
(
system
);
ret
=
PdhValidatePathW
(
L"
\\
System"
);
ok
(
ret
==
PDH_CSTATUS_BAD_COUNTERNAME
,
"PdhValidatePathW failed 0x%08x
\n
"
,
ret
);
ret
=
PdhValidatePathW
(
uptime
);
...
...
@@ -793,16 +782,13 @@ static void test_PdhValidatePathExW( void )
{
PDH_STATUS
ret
;
static
const
WCHAR
empty
[]
=
{
0
};
static
const
WCHAR
system
[]
=
{
'\\'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
0
};
ret
=
pPdhValidatePathExW
(
NULL
,
NULL
);
ok
(
ret
==
PDH_INVALID_ARGUMENT
,
"PdhValidatePathExW failed 0x%08x
\n
"
,
ret
);
ret
=
pPdhValidatePathExW
(
NULL
,
empty
);
ret
=
pPdhValidatePathExW
(
NULL
,
L""
);
ok
(
ret
==
PDH_INVALID_ARGUMENT
,
"PdhValidatePathExW failed 0x%08x
\n
"
,
ret
);
ret
=
pPdhValidatePathExW
(
NULL
,
system
);
ret
=
pPdhValidatePathExW
(
NULL
,
L"
\\
System"
);
ok
(
ret
==
PDH_CSTATUS_BAD_COUNTERNAME
,
"PdhValidatePathExW failed 0x%08x
\n
"
,
ret
);
ret
=
pPdhValidatePathExW
(
NULL
,
uptime
);
...
...
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