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
3ea31cb2
Commit
3ea31cb2
authored
Jul 09, 2007
by
Hans Leidekker
Committed by
Alexandre Julliard
Jul 10, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pdh: Implement and test PdhGetCounterInfo{A, W} and PdhGetCounterTimeBase.
parent
754ac8c4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
167 additions
and
3 deletions
+167
-3
pdh.spec
dlls/pdh/pdh.spec
+3
-3
pdh_main.c
dlls/pdh/pdh_main.c
+79
-0
pdh.c
dlls/pdh/tests/pdh.c
+85
-0
No files found.
dlls/pdh/pdh.spec
View file @
3ea31cb2
...
@@ -40,9 +40,9 @@
...
@@ -40,9 +40,9 @@
@ stub PdhExpandWildCardPathHW
@ stub PdhExpandWildCardPathHW
@ stub PdhExpandWildCardPathW
@ stub PdhExpandWildCardPathW
@ stub PdhFormatFromRawValue
@ stub PdhFormatFromRawValue
@ st
ub PdhGetCounterInfoA
@ st
dcall PdhGetCounterInfoA(ptr long ptr ptr)
@ st
ub PdhGetCounterInfoW
@ st
dcall PdhGetCounterInfoW(ptr long ptr ptr)
@ st
ub PdhGetCounterTimeBase
@ st
dcall PdhGetCounterTimeBase(ptr ptr)
@ stub PdhGetDataSourceTimeRangeA
@ stub PdhGetDataSourceTimeRangeA
@ stub PdhGetDataSourceTimeRangeH
@ stub PdhGetDataSourceTimeRangeH
@ stub PdhGetDataSourceTimeRangeW
@ stub PdhGetDataSourceTimeRangeW
...
...
dlls/pdh/pdh_main.c
View file @
3ea31cb2
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
* Performance Data Helper (pdh.dll)
* Performance Data Helper (pdh.dll)
*
*
* Copyright 2007 Andrey Turkin
* Copyright 2007 Andrey Turkin
* Copyright 2007 Hans Leidekker
*
*
* This library is free software; you can redistribute it and/or
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* modify it under the terms of the GNU Lesser General Public
...
@@ -284,6 +285,84 @@ PDH_STATUS WINAPI PdhCollectQueryData( PDH_HQUERY handle )
...
@@ -284,6 +285,84 @@ PDH_STATUS WINAPI PdhCollectQueryData( PDH_HQUERY handle )
}
}
/***********************************************************************
/***********************************************************************
* PdhGetCounterInfoA (PDH.@)
*/
PDH_STATUS
WINAPI
PdhGetCounterInfoA
(
PDH_HCOUNTER
handle
,
BOOLEAN
text
,
LPDWORD
size
,
PPDH_COUNTER_INFO_A
info
)
{
struct
counter
*
counter
=
handle
;
TRACE
(
"%p %d %p %p
\n
"
,
handle
,
text
,
size
,
info
);
if
(
!
counter
)
return
PDH_INVALID_HANDLE
;
if
(
!
size
)
return
PDH_INVALID_ARGUMENT
;
if
(
*
size
<
sizeof
(
PDH_COUNTER_INFO_A
))
{
*
size
=
sizeof
(
PDH_COUNTER_INFO_A
);
return
PDH_MORE_DATA
;
}
memset
(
info
,
0
,
sizeof
(
PDH_COUNTER_INFO_A
)
);
info
->
dwType
=
counter
->
type
;
info
->
CStatus
=
counter
->
status
;
info
->
lScale
=
counter
->
scale
;
info
->
lDefaultScale
=
counter
->
defaultscale
;
info
->
dwUserData
=
counter
->
user
;
info
->
dwQueryUserData
=
counter
->
queryuser
;
*
size
=
sizeof
(
PDH_COUNTER_INFO_A
);
return
ERROR_SUCCESS
;
}
/***********************************************************************
* PdhGetCounterInfoW (PDH.@)
*/
PDH_STATUS
WINAPI
PdhGetCounterInfoW
(
PDH_HCOUNTER
handle
,
BOOLEAN
text
,
LPDWORD
size
,
PPDH_COUNTER_INFO_W
info
)
{
struct
counter
*
counter
=
handle
;
TRACE
(
"%p %d %p %p
\n
"
,
handle
,
text
,
size
,
info
);
if
(
!
size
)
return
PDH_INVALID_ARGUMENT
;
if
(
!
counter
)
return
PDH_INVALID_HANDLE
;
if
(
*
size
<
sizeof
(
PDH_COUNTER_INFO_W
))
{
*
size
=
sizeof
(
PDH_COUNTER_INFO_W
);
return
PDH_MORE_DATA
;
}
memset
(
info
,
0
,
sizeof
(
PDH_COUNTER_INFO_W
)
);
info
->
dwType
=
counter
->
type
;
info
->
CStatus
=
counter
->
status
;
info
->
lScale
=
counter
->
scale
;
info
->
lDefaultScale
=
counter
->
defaultscale
;
info
->
dwUserData
=
counter
->
user
;
info
->
dwQueryUserData
=
counter
->
queryuser
;
*
size
=
sizeof
(
PDH_COUNTER_INFO_A
);
return
ERROR_SUCCESS
;
}
/***********************************************************************
* PdhGetCounterTimeBase (PDH.@)
*/
PDH_STATUS
WINAPI
PdhGetCounterTimeBase
(
PDH_HCOUNTER
handle
,
LONGLONG
*
base
)
{
struct
counter
*
counter
=
handle
;
TRACE
(
"%p %p
\n
"
,
handle
,
base
);
if
(
!
base
)
return
PDH_INVALID_ARGUMENT
;
if
(
!
counter
)
return
PDH_INVALID_HANDLE
;
*
base
=
counter
->
base
;
return
ERROR_SUCCESS
;
}
/***********************************************************************
* PdhGetFormattedCounterValue (PDH.@)
* PdhGetFormattedCounterValue (PDH.@)
*/
*/
PDH_STATUS
WINAPI
PdhGetFormattedCounterValue
(
PDH_HCOUNTER
handle
,
DWORD
format
,
PDH_STATUS
WINAPI
PdhGetFormattedCounterValue
(
PDH_HCOUNTER
handle
,
DWORD
format
,
...
...
dlls/pdh/tests/pdh.c
View file @
3ea31cb2
...
@@ -213,6 +213,89 @@ static void test_PdhSetCounterScaleFactor( void )
...
@@ -213,6 +213,89 @@ static void test_PdhSetCounterScaleFactor( void )
ok
(
ret
==
ERROR_SUCCESS
,
"PdhCloseQuery failed 0x%08x
\n
"
,
ret
);
ok
(
ret
==
ERROR_SUCCESS
,
"PdhCloseQuery failed 0x%08x
\n
"
,
ret
);
}
}
static
void
test_PdhGetCounterTimeBase
(
void
)
{
PDH_STATUS
ret
;
PDH_HQUERY
query
;
PDH_HCOUNTER
counter
;
LONGLONG
base
;
ret
=
PdhOpenQueryA
(
NULL
,
0
,
&
query
);
ok
(
ret
==
ERROR_SUCCESS
,
"PdhOpenQueryA failed 0x%08x
\n
"
,
ret
);
ret
=
PdhAddCounterA
(
query
,
"
\\
System
\\
System Up Time"
,
0
,
&
counter
);
ok
(
ret
==
ERROR_SUCCESS
,
"PdhAddCounterA failed 0x%08x
\n
"
,
ret
);
ret
=
PdhGetCounterTimeBase
(
NULL
,
NULL
);
ok
(
ret
==
PDH_INVALID_ARGUMENT
,
"PdhGetCounterTimeBase failed 0x%08x
\n
"
,
ret
);
ret
=
PdhGetCounterTimeBase
(
NULL
,
&
base
);
ok
(
ret
==
PDH_INVALID_HANDLE
,
"PdhGetCounterTimeBase failed 0x%08x
\n
"
,
ret
);
ret
=
PdhGetCounterTimeBase
(
counter
,
NULL
);
ok
(
ret
==
PDH_INVALID_ARGUMENT
,
"PdhGetCounterTimeBase failed 0x%08x
\n
"
,
ret
);
ret
=
PdhGetCounterTimeBase
(
counter
,
&
base
);
ok
(
ret
==
ERROR_SUCCESS
,
"PdhGetCounterTimeBase failed 0x%08x
\n
"
,
ret
);
ret
=
PdhCloseQuery
(
query
);
ok
(
ret
==
ERROR_SUCCESS
,
"PdhCloseQuery failed 0x%08x
\n
"
,
ret
);
}
static
void
test_PdhGetCounterInfo
(
void
)
{
PDH_STATUS
ret
;
PDH_HQUERY
query
;
PDH_HCOUNTER
counter
;
PDH_COUNTER_INFO_A
info
;
DWORD
size
;
ret
=
PdhOpenQueryA
(
NULL
,
0
,
&
query
);
ok
(
ret
==
ERROR_SUCCESS
,
"PdhOpenQueryA failed 0x%08x
\n
"
,
ret
);
ret
=
PdhAddCounterA
(
query
,
"
\\
System
\\
System Up Time"
,
0
,
&
counter
);
ok
(
ret
==
ERROR_SUCCESS
,
"PdhAddCounterA failed 0x%08x
\n
"
,
ret
);
ret
=
PdhGetCounterInfoA
(
NULL
,
0
,
NULL
,
NULL
);
ok
(
ret
==
PDH_INVALID_HANDLE
,
"PdhGetCounterInfoA failed 0x%08x
\n
"
,
ret
);
ret
=
PdhGetCounterInfoA
(
counter
,
0
,
NULL
,
NULL
);
ok
(
ret
==
PDH_INVALID_ARGUMENT
,
"PdhGetCounterInfoA failed 0x%08x
\n
"
,
ret
);
ret
=
PdhGetCounterInfoA
(
counter
,
0
,
NULL
,
&
info
);
ok
(
ret
==
PDH_INVALID_ARGUMENT
,
"PdhGetCounterInfoA failed 0x%08x
\n
"
,
ret
);
size
=
sizeof
(
info
)
-
1
;
ret
=
PdhGetCounterInfoA
(
counter
,
0
,
&
size
,
NULL
);
ok
(
ret
==
PDH_MORE_DATA
,
"PdhGetCounterInfoA failed 0x%08x
\n
"
,
ret
);
size
=
sizeof
(
info
);
ret
=
PdhGetCounterInfoA
(
counter
,
0
,
&
size
,
&
info
);
ok
(
ret
==
ERROR_SUCCESS
,
"PdhGetCounterInfoA failed 0x%08x
\n
"
,
ret
);
ok
(
size
==
sizeof
(
info
),
"PdhGetCounterInfoA failed %d
\n
"
,
size
);
ret
=
PdhGetCounterInfoA
(
counter
,
0
,
&
size
,
&
info
);
ok
(
ret
==
ERROR_SUCCESS
,
"PdhGetCounterInfoA failed 0x%08x
\n
"
,
ret
);
ok
(
info
.
lScale
==
0
,
"lScale %d
\n
"
,
info
.
lScale
);
ret
=
PdhSetCounterScaleFactor
(
counter
,
0
);
ok
(
ret
==
ERROR_SUCCESS
,
"PdhSetCounterScaleFactor failed 0x%08x
\n
"
,
ret
);
ret
=
PdhGetCounterInfoA
(
counter
,
0
,
&
size
,
&
info
);
ok
(
ret
==
ERROR_SUCCESS
,
"PdhGetCounterInfoA failed 0x%08x
\n
"
,
ret
);
ok
(
info
.
lScale
==
0
,
"lScale %d
\n
"
,
info
.
lScale
);
ret
=
PdhSetCounterScaleFactor
(
counter
,
-
5
);
ok
(
ret
==
ERROR_SUCCESS
,
"PdhSetCounterScaleFactor failed 0x%08x
\n
"
,
ret
);
ret
=
PdhGetCounterInfoA
(
counter
,
0
,
&
size
,
&
info
);
ok
(
ret
==
ERROR_SUCCESS
,
"PdhGetCounterInfoA failed 0x%08x
\n
"
,
ret
);
ok
(
info
.
lScale
==
-
5
,
"lScale %d
\n
"
,
info
.
lScale
);
ret
=
PdhCloseQuery
(
query
);
ok
(
ret
==
ERROR_SUCCESS
,
"PdhCloseQuery failed 0x%08x
\n
"
,
ret
);
}
START_TEST
(
pdh
)
START_TEST
(
pdh
)
{
{
test_open_close_query
();
test_open_close_query
();
...
@@ -220,4 +303,6 @@ START_TEST(pdh)
...
@@ -220,4 +303,6 @@ START_TEST(pdh)
test_PdhGetFormattedCounterValue
();
test_PdhGetFormattedCounterValue
();
test_PdhGetRawCounterValue
();
test_PdhGetRawCounterValue
();
test_PdhSetCounterScaleFactor
();
test_PdhSetCounterScaleFactor
();
test_PdhGetCounterTimeBase
();
test_PdhGetCounterInfo
();
}
}
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