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
0718c11e
Commit
0718c11e
authored
Jun 25, 2007
by
Hans Leidekker
Committed by
Alexandre Julliard
Jun 28, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pdh: Implement PdhAddCounter{A, W} and PdhRemoveCounter.
parent
3f1142e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
3 deletions
+98
-3
pdh.spec
dlls/pdh/pdh.spec
+3
-3
pdh_main.c
dlls/pdh/pdh_main.c
+95
-0
No files found.
dlls/pdh/pdh.spec
View file @
0718c11e
1 stub PdhPlaGetLogFileNameA
@ stub PdhAdd009CounterA
@ stub PdhAdd009CounterW
@ st
ub PdhAddCounterA
@ st
ub PdhAddCounterW
@ st
dcall PdhAddCounterA(ptr str long ptr)
@ st
dcall PdhAddCounterW(ptr wstr long ptr)
@ stub PdhBindInputDataSourceA
@ stub PdhBindInputDataSourceW
@ stub PdhBrowseCountersA
...
...
@@ -120,7 +120,7 @@
@ stub PdhReadRawLogRecord
@ stub PdhRelogA
@ stub PdhRelogW
@ st
ub PdhRemoveCounter
@ st
dcall PdhRemoveCounter(ptr)
@ stub PdhSelectDataSourceA
@ stub PdhSelectDataSourceW
@ stub PdhSetCounterScaleFactor
...
...
dlls/pdh/pdh_main.c
View file @
0718c11e
...
...
@@ -111,6 +111,14 @@ struct counter
}
two
;
/* second value */
};
static
struct
counter
*
create_counter
(
void
)
{
struct
counter
*
counter
;
if
((
counter
=
pdh_alloc_zero
(
sizeof
(
struct
counter
)
)))
return
counter
;
return
NULL
;
}
#define PDH_MAGIC_QUERY 0x50444830
/* 'PDH0' */
struct
query
...
...
@@ -142,6 +150,74 @@ struct source
LONGLONG
base
;
/* samples per second */
};
/* counter source registry */
static
const
struct
source
counter_sources
[]
=
{
{
NULL
,
NULL
,
0
,
0
,
0
}
};
/***********************************************************************
* PdhAddCounterA (PDH.@)
*/
PDH_STATUS
WINAPI
PdhAddCounterA
(
PDH_HQUERY
query
,
LPCSTR
path
,
DWORD_PTR
userdata
,
PDH_HCOUNTER
*
counter
)
{
PDH_STATUS
ret
;
WCHAR
*
pathW
;
TRACE
(
"%p %s %lx %p
\n
"
,
query
,
debugstr_a
(
path
),
userdata
,
counter
);
if
(
!
path
)
return
PDH_INVALID_ARGUMENT
;
if
(
!
(
pathW
=
pdh_strdup_aw
(
path
)))
return
PDH_MEMORY_ALLOCATION_FAILURE
;
ret
=
PdhAddCounterW
(
query
,
pathW
,
userdata
,
counter
);
pdh_free
(
pathW
);
return
ret
;
}
/***********************************************************************
* PdhAddCounterW (PDH.@)
*/
PDH_STATUS
WINAPI
PdhAddCounterW
(
PDH_HQUERY
hquery
,
LPCWSTR
path
,
DWORD_PTR
userdata
,
PDH_HCOUNTER
*
hcounter
)
{
struct
query
*
query
=
hquery
;
struct
counter
*
counter
;
unsigned
int
i
;
TRACE
(
"%p %s %lx %p
\n
"
,
hquery
,
debugstr_w
(
path
),
userdata
,
hcounter
);
if
(
!
path
||
!
hcounter
)
return
PDH_INVALID_ARGUMENT
;
if
(
!
query
||
(
query
->
magic
!=
PDH_MAGIC_QUERY
))
return
PDH_INVALID_HANDLE
;
*
hcounter
=
NULL
;
for
(
i
=
0
;
i
<
sizeof
(
counter_sources
)
/
sizeof
(
counter_sources
[
0
]);
i
++
)
{
if
(
strstrW
(
path
,
counter_sources
[
i
].
path
))
{
if
((
counter
=
create_counter
()))
{
counter
->
path
=
pdh_strdup
(
counter_sources
[
i
].
path
);
counter
->
collect
=
counter_sources
[
i
].
collect
;
counter
->
type
=
counter_sources
[
i
].
type
;
counter
->
defaultscale
=
counter_sources
[
i
].
scale
;
counter
->
base
=
counter_sources
[
i
].
base
;
counter
->
queryuser
=
query
->
user
;
counter
->
user
=
userdata
;
list_add_tail
(
&
query
->
counters
,
&
counter
->
entry
);
*
hcounter
=
counter
;
return
ERROR_SUCCESS
;
}
return
PDH_MEMORY_ALLOCATION_FAILURE
;
}
}
return
PDH_CSTATUS_NO_COUNTER
;
}
/***********************************************************************
* PdhCloseQuery (PDH.@)
...
...
@@ -212,3 +288,22 @@ PDH_STATUS WINAPI PdhOpenQueryW( LPCWSTR source, DWORD_PTR userdata, PDH_HQUERY
}
return
PDH_MEMORY_ALLOCATION_FAILURE
;
}
/***********************************************************************
* PdhRemoveCounter (PDH.@)
*/
PDH_STATUS
WINAPI
PdhRemoveCounter
(
PDH_HCOUNTER
handle
)
{
struct
counter
*
counter
=
handle
;
TRACE
(
"%p
\n
"
,
handle
);
if
(
!
counter
)
return
PDH_INVALID_HANDLE
;
list_remove
(
&
counter
->
entry
);
pdh_free
(
counter
->
path
);
pdh_free
(
counter
);
return
ERROR_SUCCESS
;
}
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