2007-06-02 00:28:45 +02:00
|
|
|
/*
|
|
|
|
* Performance Data Helper (pdh.dll)
|
|
|
|
*
|
|
|
|
* Copyright 2007 Andrey Turkin
|
2007-07-09 20:55:33 +02:00
|
|
|
* Copyright 2007 Hans Leidekker
|
2007-06-02 00:28:45 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2007-07-09 20:55:13 +02:00
|
|
|
#include <math.h>
|
2007-06-02 00:28:45 +02:00
|
|
|
|
2007-06-25 21:10:11 +02:00
|
|
|
#define NONAMELESSUNION
|
2015-03-18 08:19:17 +01:00
|
|
|
|
2007-06-02 00:28:45 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2007-06-25 21:10:11 +02:00
|
|
|
|
|
|
|
#include "pdh.h"
|
|
|
|
#include "pdhmsg.h"
|
|
|
|
#include "winperf.h"
|
|
|
|
|
2007-06-02 00:28:45 +02:00
|
|
|
#include "wine/debug.h"
|
2018-02-03 00:17:50 +01:00
|
|
|
#include "wine/heap.h"
|
2007-06-25 21:10:11 +02:00
|
|
|
#include "wine/list.h"
|
2007-06-02 00:28:45 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(pdh);
|
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
static CRITICAL_SECTION pdh_handle_cs;
|
|
|
|
static CRITICAL_SECTION_DEBUG pdh_handle_cs_debug =
|
|
|
|
{
|
|
|
|
0, 0, &pdh_handle_cs,
|
|
|
|
{ &pdh_handle_cs_debug.ProcessLocksList,
|
|
|
|
&pdh_handle_cs_debug.ProcessLocksList },
|
|
|
|
0, 0, { (DWORD_PTR)(__FILE__ ": pdh_handle_cs") }
|
|
|
|
};
|
|
|
|
static CRITICAL_SECTION pdh_handle_cs = { &pdh_handle_cs_debug, -1, 0, 0, 0, 0 };
|
|
|
|
|
2007-06-25 21:10:11 +02:00
|
|
|
static inline WCHAR *pdh_strdup( const WCHAR *src )
|
|
|
|
{
|
|
|
|
WCHAR *dst;
|
|
|
|
|
|
|
|
if (!src) return NULL;
|
2019-06-18 09:05:33 +02:00
|
|
|
if ((dst = heap_alloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) ))) lstrcpyW( dst, src );
|
2007-06-25 21:10:11 +02:00
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline WCHAR *pdh_strdup_aw( const char *src )
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
WCHAR *dst;
|
|
|
|
|
|
|
|
if (!src) return NULL;
|
|
|
|
len = MultiByteToWideChar( CP_ACP, 0, src, -1, NULL, 0 );
|
2007-12-09 16:30:15 +01:00
|
|
|
if ((dst = heap_alloc( len * sizeof(WCHAR) ))) MultiByteToWideChar( CP_ACP, 0, src, -1, dst, len );
|
2007-06-25 21:10:11 +02:00
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
2007-09-29 21:06:49 +02:00
|
|
|
union value
|
|
|
|
{
|
|
|
|
LONG longvalue;
|
|
|
|
double doublevalue;
|
|
|
|
LONGLONG largevalue;
|
|
|
|
};
|
|
|
|
|
2007-06-25 21:10:11 +02:00
|
|
|
struct counter
|
|
|
|
{
|
2007-09-29 21:06:23 +02:00
|
|
|
DWORD magic; /* signature */
|
|
|
|
struct list entry; /* list entry */
|
2007-06-25 21:10:11 +02:00
|
|
|
WCHAR *path; /* identifier */
|
|
|
|
DWORD type; /* counter type */
|
|
|
|
DWORD status; /* update status */
|
|
|
|
LONG scale; /* scale factor */
|
|
|
|
LONG defaultscale; /* default scale factor */
|
|
|
|
DWORD_PTR user; /* user data */
|
|
|
|
DWORD_PTR queryuser; /* query user data */
|
|
|
|
LONGLONG base; /* samples per second */
|
|
|
|
FILETIME stamp; /* time stamp */
|
|
|
|
void (CALLBACK *collect)( struct counter * ); /* collect callback */
|
2007-09-29 21:06:49 +02:00
|
|
|
union value one; /* first value */
|
|
|
|
union value two; /* second value */
|
2007-06-25 21:10:11 +02:00
|
|
|
};
|
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
#define PDH_MAGIC_COUNTER 0x50444831 /* 'PDH1' */
|
|
|
|
|
2007-06-25 21:10:19 +02:00
|
|
|
static struct counter *create_counter( void )
|
|
|
|
{
|
|
|
|
struct counter *counter;
|
|
|
|
|
2007-12-09 16:30:15 +01:00
|
|
|
if ((counter = heap_alloc_zero( sizeof(struct counter) )))
|
2007-09-29 21:06:23 +02:00
|
|
|
{
|
|
|
|
counter->magic = PDH_MAGIC_COUNTER;
|
|
|
|
return counter;
|
|
|
|
}
|
2007-06-25 21:10:19 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
static void destroy_counter( struct counter *counter )
|
|
|
|
{
|
|
|
|
counter->magic = 0;
|
2007-12-09 16:30:15 +01:00
|
|
|
heap_free( counter->path );
|
|
|
|
heap_free( counter );
|
2007-09-29 21:06:23 +02:00
|
|
|
}
|
|
|
|
|
2007-06-25 21:10:11 +02:00
|
|
|
#define PDH_MAGIC_QUERY 0x50444830 /* 'PDH0' */
|
|
|
|
|
|
|
|
struct query
|
|
|
|
{
|
|
|
|
DWORD magic; /* signature */
|
|
|
|
DWORD_PTR user; /* user data */
|
2007-09-29 21:06:35 +02:00
|
|
|
HANDLE thread; /* collect thread */
|
|
|
|
DWORD interval; /* collect interval */
|
|
|
|
HANDLE wait; /* wait event */
|
|
|
|
HANDLE stop; /* stop event */
|
2007-06-25 21:10:11 +02:00
|
|
|
struct list counters; /* counter list */
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct query *create_query( void )
|
|
|
|
{
|
|
|
|
struct query *query;
|
|
|
|
|
2007-12-09 16:30:15 +01:00
|
|
|
if ((query = heap_alloc_zero( sizeof(struct query) )))
|
2007-06-25 21:10:11 +02:00
|
|
|
{
|
|
|
|
query->magic = PDH_MAGIC_QUERY;
|
|
|
|
list_init( &query->counters );
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
static void destroy_query( struct query *query )
|
|
|
|
{
|
|
|
|
query->magic = 0;
|
2007-12-09 16:30:15 +01:00
|
|
|
heap_free( query );
|
2007-09-29 21:06:23 +02:00
|
|
|
}
|
|
|
|
|
2007-06-25 21:10:11 +02:00
|
|
|
struct source
|
|
|
|
{
|
2007-07-21 15:08:01 +02:00
|
|
|
DWORD index; /* name index */
|
2007-06-25 21:10:11 +02:00
|
|
|
const WCHAR *path; /* identifier */
|
|
|
|
void (CALLBACK *collect)( struct counter * ); /* collect callback */
|
|
|
|
DWORD type; /* counter type */
|
|
|
|
LONG scale; /* default scale factor */
|
|
|
|
LONGLONG base; /* samples per second */
|
|
|
|
};
|
|
|
|
|
2007-07-21 15:07:35 +02:00
|
|
|
static void CALLBACK collect_processor_time( struct counter *counter )
|
|
|
|
{
|
|
|
|
counter->two.largevalue = 500000; /* FIXME */
|
|
|
|
counter->status = PDH_CSTATUS_VALID_DATA;
|
|
|
|
}
|
|
|
|
|
2007-07-09 20:54:48 +02:00
|
|
|
static void CALLBACK collect_uptime( struct counter *counter )
|
|
|
|
{
|
2007-07-11 22:07:11 +02:00
|
|
|
counter->two.largevalue = GetTickCount64();
|
2007-07-09 20:54:48 +02:00
|
|
|
counter->status = PDH_CSTATUS_VALID_DATA;
|
|
|
|
}
|
|
|
|
|
2007-07-21 15:07:35 +02:00
|
|
|
#define TYPE_PROCESSOR_TIME \
|
|
|
|
(PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | PERF_TIMER_100NS | PERF_DELTA_COUNTER | \
|
|
|
|
PERF_INVERSE_COUNTER | PERF_DISPLAY_PERCENT)
|
|
|
|
|
2007-07-09 20:54:48 +02:00
|
|
|
#define TYPE_UPTIME \
|
|
|
|
(PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_ELAPSED | PERF_OBJECT_TIMER | PERF_DISPLAY_SECONDS)
|
|
|
|
|
2007-06-25 21:10:19 +02:00
|
|
|
/* counter source registry */
|
|
|
|
static const struct source counter_sources[] =
|
|
|
|
{
|
2020-11-05 02:07:33 +01:00
|
|
|
{ 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 }
|
2007-06-25 21:10:19 +02:00
|
|
|
};
|
|
|
|
|
2012-12-21 13:56:23 +01:00
|
|
|
static BOOL is_local_machine( const WCHAR *name, DWORD len )
|
|
|
|
{
|
|
|
|
WCHAR buf[MAX_COMPUTERNAME_LENGTH + 1];
|
2018-07-11 22:06:14 +02:00
|
|
|
DWORD buflen = ARRAY_SIZE(buf);
|
2012-12-21 13:56:23 +01:00
|
|
|
|
|
|
|
if (!GetComputerNameW( buf, &buflen )) return FALSE;
|
2019-06-18 09:05:33 +02:00
|
|
|
return len == buflen && !wcsnicmp( name, buf, buflen );
|
2012-12-21 13:56:23 +01:00
|
|
|
}
|
|
|
|
|
2007-07-21 15:08:01 +02:00
|
|
|
static BOOL pdh_match_path( LPCWSTR fullpath, LPCWSTR path )
|
|
|
|
{
|
|
|
|
const WCHAR *p;
|
|
|
|
|
2019-06-18 09:05:33 +02:00
|
|
|
if (path[0] == '\\' && path[1] == '\\' && (p = wcschr( path + 2, '\\' )) &&
|
2012-12-21 13:56:23 +01:00
|
|
|
is_local_machine( path + 2, p - path - 2 ))
|
|
|
|
{
|
|
|
|
path += p - path;
|
|
|
|
}
|
2019-06-18 09:05:33 +02:00
|
|
|
if (wcschr( path, '\\' )) p = fullpath;
|
|
|
|
else p = wcsrchr( fullpath, '\\' ) + 1;
|
|
|
|
return !wcscmp( p, path );
|
2007-07-21 15:08:01 +02:00
|
|
|
}
|
|
|
|
|
2007-06-25 21:10:19 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* 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 );
|
|
|
|
|
2007-12-09 16:30:15 +01:00
|
|
|
heap_free( pathW );
|
2007-06-25 21:10:19 +02:00
|
|
|
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;
|
2007-09-29 21:06:23 +02:00
|
|
|
|
|
|
|
EnterCriticalSection( &pdh_handle_cs );
|
|
|
|
if (!query || query->magic != PDH_MAGIC_QUERY)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_HANDLE;
|
|
|
|
}
|
2007-06-25 21:10:19 +02:00
|
|
|
|
|
|
|
*hcounter = NULL;
|
2018-07-11 22:06:14 +02:00
|
|
|
for (i = 0; i < ARRAY_SIZE(counter_sources); i++)
|
2007-06-25 21:10:19 +02:00
|
|
|
{
|
2007-07-21 15:08:01 +02:00
|
|
|
if (pdh_match_path( counter_sources[i].path, path ))
|
2007-06-25 21:10:19 +02:00
|
|
|
{
|
|
|
|
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;
|
2007-09-29 21:06:23 +02:00
|
|
|
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
2007-06-25 21:10:19 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2007-09-29 21:06:23 +02:00
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
2007-06-25 21:10:19 +02:00
|
|
|
return PDH_MEMORY_ALLOCATION_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
2007-09-29 21:06:23 +02:00
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
2007-06-25 21:10:19 +02:00
|
|
|
return PDH_CSTATUS_NO_COUNTER;
|
|
|
|
}
|
2007-06-25 21:10:11 +02:00
|
|
|
|
2007-07-21 15:08:15 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* PdhAddEnglishCounterA (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhAddEnglishCounterA( PDH_HQUERY query, LPCSTR path,
|
|
|
|
DWORD_PTR userdata, PDH_HCOUNTER *counter )
|
|
|
|
{
|
2007-09-29 21:07:01 +02:00
|
|
|
TRACE("%p %s %lx %p\n", query, debugstr_a(path), userdata, counter);
|
|
|
|
|
|
|
|
if (!query) return PDH_INVALID_ARGUMENT;
|
2007-07-21 15:08:15 +02:00
|
|
|
return PdhAddCounterA( query, path, userdata, counter );
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhAddEnglishCounterW (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhAddEnglishCounterW( PDH_HQUERY query, LPCWSTR path,
|
|
|
|
DWORD_PTR userdata, PDH_HCOUNTER *counter )
|
|
|
|
{
|
2007-09-29 21:07:01 +02:00
|
|
|
TRACE("%p %s %lx %p\n", query, debugstr_w(path), userdata, counter);
|
|
|
|
|
|
|
|
if (!query) return PDH_INVALID_ARGUMENT;
|
2007-07-21 15:08:15 +02:00
|
|
|
return PdhAddCounterW( query, path, userdata, counter );
|
|
|
|
}
|
|
|
|
|
2007-09-29 21:06:49 +02:00
|
|
|
/* caller must hold counter lock */
|
|
|
|
static PDH_STATUS format_value( struct counter *counter, DWORD format, union value *raw1,
|
|
|
|
union value *raw2, PDH_FMT_COUNTERVALUE *value )
|
|
|
|
{
|
|
|
|
LONG factor;
|
|
|
|
|
|
|
|
factor = counter->scale ? counter->scale : counter->defaultscale;
|
|
|
|
if (format & PDH_FMT_LONG)
|
|
|
|
{
|
|
|
|
if (format & PDH_FMT_1000) value->u.longValue = raw2->longvalue * 1000;
|
|
|
|
else value->u.longValue = raw2->longvalue * pow( 10, factor );
|
|
|
|
}
|
|
|
|
else if (format & PDH_FMT_LARGE)
|
|
|
|
{
|
|
|
|
if (format & PDH_FMT_1000) value->u.largeValue = raw2->largevalue * 1000;
|
|
|
|
else value->u.largeValue = raw2->largevalue * pow( 10, factor );
|
|
|
|
}
|
|
|
|
else if (format & PDH_FMT_DOUBLE)
|
|
|
|
{
|
|
|
|
if (format & PDH_FMT_1000) value->u.doubleValue = raw2->doublevalue * 1000;
|
|
|
|
else value->u.doubleValue = raw2->doublevalue * pow( 10, factor );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WARN("unknown format %x\n", format);
|
|
|
|
return PDH_INVALID_ARGUMENT;
|
|
|
|
}
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhCalculateCounterFromRawValue (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhCalculateCounterFromRawValue( PDH_HCOUNTER handle, DWORD format,
|
|
|
|
PPDH_RAW_COUNTER raw1, PPDH_RAW_COUNTER raw2,
|
|
|
|
PPDH_FMT_COUNTERVALUE value )
|
|
|
|
{
|
|
|
|
PDH_STATUS ret;
|
|
|
|
struct counter *counter = handle;
|
|
|
|
|
|
|
|
TRACE("%p 0x%08x %p %p %p\n", handle, format, raw1, raw2, value);
|
|
|
|
|
|
|
|
if (!value) return PDH_INVALID_ARGUMENT;
|
|
|
|
|
|
|
|
EnterCriticalSection( &pdh_handle_cs );
|
|
|
|
if (!counter || counter->magic != PDH_MAGIC_COUNTER)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = format_value( counter, format, (union value *)&raw1->SecondValue,
|
|
|
|
(union value *)&raw2->SecondValue, value );
|
|
|
|
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-09-29 21:06:35 +02:00
|
|
|
|
2007-06-25 21:10:11 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* PdhCloseQuery (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhCloseQuery( PDH_HQUERY handle )
|
|
|
|
{
|
|
|
|
struct query *query = handle;
|
2007-07-21 15:07:50 +02:00
|
|
|
struct list *item, *next;
|
2007-06-25 21:10:11 +02:00
|
|
|
|
|
|
|
TRACE("%p\n", handle);
|
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
EnterCriticalSection( &pdh_handle_cs );
|
|
|
|
if (!query || query->magic != PDH_MAGIC_QUERY)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_HANDLE;
|
|
|
|
}
|
2007-06-25 21:10:11 +02:00
|
|
|
|
2007-10-30 13:04:23 +01:00
|
|
|
if (query->thread)
|
|
|
|
{
|
|
|
|
HANDLE thread = query->thread;
|
|
|
|
SetEvent( query->stop );
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
|
|
|
|
WaitForSingleObject( thread, INFINITE );
|
|
|
|
|
|
|
|
EnterCriticalSection( &pdh_handle_cs );
|
2007-10-30 21:10:09 +01:00
|
|
|
if (query->magic != PDH_MAGIC_QUERY)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2007-10-30 13:04:23 +01:00
|
|
|
CloseHandle( query->stop );
|
|
|
|
CloseHandle( query->thread );
|
|
|
|
query->thread = NULL;
|
|
|
|
}
|
2007-09-29 21:06:35 +02:00
|
|
|
|
2007-07-21 15:07:50 +02:00
|
|
|
LIST_FOR_EACH_SAFE( item, next, &query->counters )
|
2007-06-25 21:10:11 +02:00
|
|
|
{
|
|
|
|
struct counter *counter = LIST_ENTRY( item, struct counter, entry );
|
|
|
|
|
|
|
|
list_remove( &counter->entry );
|
2007-09-29 21:06:23 +02:00
|
|
|
destroy_counter( counter );
|
2007-06-25 21:10:11 +02:00
|
|
|
}
|
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
destroy_query( query );
|
2007-07-21 15:07:50 +02:00
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
2007-06-25 21:10:11 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
/* caller must hold query lock */
|
|
|
|
static void collect_query_data( struct query *query )
|
2007-06-25 21:11:02 +02:00
|
|
|
{
|
|
|
|
struct list *item;
|
|
|
|
|
|
|
|
LIST_FOR_EACH( item, &query->counters )
|
|
|
|
{
|
|
|
|
SYSTEMTIME time;
|
|
|
|
struct counter *counter = LIST_ENTRY( item, struct counter, entry );
|
|
|
|
|
|
|
|
counter->collect( counter );
|
|
|
|
|
|
|
|
GetLocalTime( &time );
|
|
|
|
SystemTimeToFileTime( &time, &counter->stamp );
|
|
|
|
}
|
2007-09-29 21:06:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhCollectQueryData (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhCollectQueryData( PDH_HQUERY handle )
|
|
|
|
{
|
|
|
|
struct query *query = handle;
|
|
|
|
|
|
|
|
TRACE("%p\n", handle);
|
|
|
|
|
|
|
|
EnterCriticalSection( &pdh_handle_cs );
|
|
|
|
if (!query || query->magic != PDH_MAGIC_QUERY)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (list_empty( &query->counters ))
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_NO_DATA;
|
|
|
|
}
|
|
|
|
|
|
|
|
collect_query_data( query );
|
|
|
|
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
2007-06-25 21:11:02 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2007-09-29 21:06:35 +02:00
|
|
|
static DWORD CALLBACK collect_query_thread( void *arg )
|
|
|
|
{
|
|
|
|
struct query *query = arg;
|
|
|
|
DWORD interval = query->interval;
|
|
|
|
HANDLE stop = query->stop;
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
if (WaitForSingleObject( stop, interval ) != WAIT_TIMEOUT) ExitThread( 0 );
|
|
|
|
|
|
|
|
EnterCriticalSection( &pdh_handle_cs );
|
2007-10-02 11:32:37 +02:00
|
|
|
if (query->magic != PDH_MAGIC_QUERY)
|
2007-09-29 21:06:35 +02:00
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
ExitThread( PDH_INVALID_HANDLE );
|
|
|
|
}
|
|
|
|
|
|
|
|
collect_query_data( query );
|
|
|
|
|
|
|
|
if (!SetEvent( query->wait ))
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
ExitThread( 0 );
|
|
|
|
}
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhCollectQueryDataEx (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhCollectQueryDataEx( PDH_HQUERY handle, DWORD interval, HANDLE event )
|
|
|
|
{
|
|
|
|
PDH_STATUS ret;
|
|
|
|
struct query *query = handle;
|
|
|
|
|
|
|
|
TRACE("%p %d %p\n", handle, interval, event);
|
|
|
|
|
|
|
|
EnterCriticalSection( &pdh_handle_cs );
|
|
|
|
if (!query || query->magic != PDH_MAGIC_QUERY)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
if (list_empty( &query->counters ))
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_NO_DATA;
|
|
|
|
}
|
2007-10-30 13:04:23 +01:00
|
|
|
if (query->thread)
|
|
|
|
{
|
|
|
|
HANDLE thread = query->thread;
|
|
|
|
SetEvent( query->stop );
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
|
|
|
|
WaitForSingleObject( thread, INFINITE );
|
|
|
|
|
|
|
|
EnterCriticalSection( &pdh_handle_cs );
|
2007-10-30 21:10:09 +01:00
|
|
|
if (query->magic != PDH_MAGIC_QUERY)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_HANDLE;
|
|
|
|
}
|
2007-10-30 13:04:23 +01:00
|
|
|
CloseHandle( query->thread );
|
|
|
|
query->thread = NULL;
|
|
|
|
}
|
|
|
|
else if (!(query->stop = CreateEventW( NULL, FALSE, FALSE, NULL )))
|
2007-09-29 21:06:35 +02:00
|
|
|
{
|
|
|
|
ret = GetLastError();
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
query->wait = event;
|
|
|
|
query->interval = interval * 1000;
|
|
|
|
if (!(query->thread = CreateThread( NULL, 0, collect_query_thread, query, 0, NULL )))
|
|
|
|
{
|
|
|
|
ret = GetLastError();
|
|
|
|
CloseHandle( query->stop );
|
|
|
|
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2007-07-21 15:08:15 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* PdhCollectQueryDataWithTime (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhCollectQueryDataWithTime( PDH_HQUERY handle, LONGLONG *timestamp )
|
|
|
|
{
|
|
|
|
struct query *query = handle;
|
2007-09-29 21:07:01 +02:00
|
|
|
struct counter *counter;
|
|
|
|
struct list *item;
|
2007-07-21 15:08:15 +02:00
|
|
|
|
|
|
|
TRACE("%p %p\n", handle, timestamp);
|
|
|
|
|
2007-09-29 21:07:01 +02:00
|
|
|
if (!timestamp) return PDH_INVALID_ARGUMENT;
|
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
EnterCriticalSection( &pdh_handle_cs );
|
|
|
|
if (!query || query->magic != PDH_MAGIC_QUERY)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
if (list_empty( &query->counters ))
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_NO_DATA;
|
|
|
|
}
|
2007-07-21 15:08:15 +02:00
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
collect_query_data( query );
|
2007-07-21 15:08:15 +02:00
|
|
|
|
2007-09-29 21:07:01 +02:00
|
|
|
item = list_head( &query->counters );
|
|
|
|
counter = LIST_ENTRY( item, struct counter, entry );
|
|
|
|
|
|
|
|
*timestamp = ((LONGLONG)counter->stamp.dwHighDateTime << 32) | counter->stamp.dwLowDateTime;
|
2007-07-21 15:08:15 +02:00
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return ERROR_SUCCESS;
|
2007-07-21 15:08:15 +02:00
|
|
|
}
|
|
|
|
|
2009-11-22 19:28:33 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* PdhExpandWildCardPathA (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhExpandWildCardPathA( LPCSTR szDataSource, LPCSTR szWildCardPath, LPSTR mszExpandedPathList, LPDWORD pcchPathListLength, DWORD dwFlags )
|
|
|
|
{
|
|
|
|
FIXME("%s, %s, %p, %p, 0x%x: stub\n", debugstr_a(szDataSource), debugstr_a(szWildCardPath), mszExpandedPathList, pcchPathListLength, dwFlags);
|
|
|
|
return PDH_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhExpandWildCardPathW (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhExpandWildCardPathW( LPCWSTR szDataSource, LPCWSTR szWildCardPath, LPWSTR mszExpandedPathList, LPDWORD pcchPathListLength, DWORD dwFlags )
|
|
|
|
{
|
|
|
|
FIXME("%s, %s, %p, %p, 0x%x: stub\n", debugstr_w(szDataSource), debugstr_w(szWildCardPath), mszExpandedPathList, pcchPathListLength, dwFlags);
|
|
|
|
return PDH_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2014-06-04 19:00:50 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* PdhExpandCounterPathA (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhExpandCounterPathA( LPCSTR szWildCardPath, LPSTR mszExpandedPathList, LPDWORD pcchPathListLength )
|
|
|
|
{
|
|
|
|
FIXME("%s, %p, %p: stub\n", debugstr_a(szWildCardPath), mszExpandedPathList, pcchPathListLength);
|
|
|
|
return PdhExpandWildCardPathA(NULL, szWildCardPath, mszExpandedPathList, pcchPathListLength, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhExpandCounterPathW (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhExpandCounterPathW( LPCWSTR szWildCardPath, LPWSTR mszExpandedPathList, LPDWORD pcchPathListLength )
|
|
|
|
{
|
|
|
|
FIXME("%s, %p, %p: stub\n", debugstr_w(szWildCardPath), mszExpandedPathList, pcchPathListLength);
|
|
|
|
return PdhExpandWildCardPathW(NULL, szWildCardPath, mszExpandedPathList, pcchPathListLength, 0);
|
|
|
|
}
|
|
|
|
|
2007-07-09 20:55:33 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* 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);
|
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
EnterCriticalSection( &pdh_handle_cs );
|
|
|
|
if (!counter || counter->magic != PDH_MAGIC_COUNTER)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
if (!size)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_ARGUMENT;
|
|
|
|
}
|
2007-07-09 20:55:33 +02:00
|
|
|
if (*size < sizeof(PDH_COUNTER_INFO_A))
|
|
|
|
{
|
|
|
|
*size = sizeof(PDH_COUNTER_INFO_A);
|
2007-09-29 21:06:23 +02:00
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
2007-07-09 20:55:33 +02:00
|
|
|
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);
|
2007-09-29 21:06:23 +02:00
|
|
|
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
2007-07-09 20:55:33 +02:00
|
|
|
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);
|
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
EnterCriticalSection( &pdh_handle_cs );
|
|
|
|
if (!counter || counter->magic != PDH_MAGIC_COUNTER)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
if (!size)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_ARGUMENT;
|
|
|
|
}
|
2007-07-09 20:55:33 +02:00
|
|
|
if (*size < sizeof(PDH_COUNTER_INFO_W))
|
|
|
|
{
|
|
|
|
*size = sizeof(PDH_COUNTER_INFO_W);
|
2007-09-29 21:06:23 +02:00
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
2007-07-09 20:55:33 +02:00
|
|
|
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;
|
|
|
|
|
2007-07-21 15:07:50 +02:00
|
|
|
*size = sizeof(PDH_COUNTER_INFO_W);
|
2007-09-29 21:06:23 +02:00
|
|
|
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
2007-07-09 20:55:33 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhGetCounterTimeBase (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhGetCounterTimeBase( PDH_HCOUNTER handle, LONGLONG *base )
|
|
|
|
{
|
|
|
|
struct counter *counter = handle;
|
|
|
|
|
|
|
|
TRACE("%p %p\n", handle, base);
|
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
if (!base) return PDH_INVALID_ARGUMENT;
|
|
|
|
|
|
|
|
EnterCriticalSection( &pdh_handle_cs );
|
|
|
|
if (!counter || counter->magic != PDH_MAGIC_COUNTER)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_HANDLE;
|
|
|
|
}
|
2007-07-09 20:55:33 +02:00
|
|
|
|
|
|
|
*base = counter->base;
|
2007-09-29 21:06:23 +02:00
|
|
|
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
2007-07-09 20:55:33 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2010-01-31 01:24:52 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* PdhGetDllVersion (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhGetDllVersion( LPDWORD version )
|
|
|
|
{
|
|
|
|
if (!version)
|
|
|
|
return PDH_INVALID_ARGUMENT;
|
|
|
|
|
|
|
|
*version = PDH_VERSION;
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2007-07-09 20:55:13 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* PdhGetFormattedCounterValue (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhGetFormattedCounterValue( PDH_HCOUNTER handle, DWORD format,
|
|
|
|
LPDWORD type, PPDH_FMT_COUNTERVALUE value )
|
|
|
|
{
|
2007-09-29 21:06:49 +02:00
|
|
|
PDH_STATUS ret;
|
2007-07-09 20:55:13 +02:00
|
|
|
struct counter *counter = handle;
|
|
|
|
|
|
|
|
TRACE("%p %x %p %p\n", handle, format, type, value);
|
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
if (!value) return PDH_INVALID_ARGUMENT;
|
2007-07-09 20:55:13 +02:00
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
EnterCriticalSection( &pdh_handle_cs );
|
|
|
|
if (!counter || counter->magic != PDH_MAGIC_COUNTER)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
if (counter->status)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_DATA;
|
|
|
|
}
|
2007-09-29 21:06:49 +02:00
|
|
|
if (!(ret = format_value( counter, format, &counter->one, &counter->two, value )))
|
2007-07-09 20:55:13 +02:00
|
|
|
{
|
2007-09-29 21:06:49 +02:00
|
|
|
value->CStatus = ERROR_SUCCESS;
|
|
|
|
if (type) *type = counter->type;
|
2007-07-09 20:55:13 +02:00
|
|
|
}
|
2007-09-29 21:06:23 +02:00
|
|
|
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
2007-09-29 21:06:49 +02:00
|
|
|
return ret;
|
2007-07-09 20:55:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhGetRawCounterValue (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhGetRawCounterValue( PDH_HCOUNTER handle, LPDWORD type,
|
|
|
|
PPDH_RAW_COUNTER value )
|
|
|
|
{
|
|
|
|
struct counter *counter = handle;
|
|
|
|
|
|
|
|
TRACE("%p %p %p\n", handle, type, value);
|
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
if (!value) return PDH_INVALID_ARGUMENT;
|
|
|
|
|
|
|
|
EnterCriticalSection( &pdh_handle_cs );
|
|
|
|
if (!counter || counter->magic != PDH_MAGIC_COUNTER)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_HANDLE;
|
|
|
|
}
|
2007-07-09 20:55:25 +02:00
|
|
|
|
|
|
|
value->CStatus = counter->status;
|
|
|
|
value->TimeStamp.dwLowDateTime = counter->stamp.dwLowDateTime;
|
|
|
|
value->TimeStamp.dwHighDateTime = counter->stamp.dwHighDateTime;
|
2007-07-11 22:07:11 +02:00
|
|
|
value->FirstValue = counter->one.largevalue;
|
2007-07-09 20:55:25 +02:00
|
|
|
value->SecondValue = counter->two.largevalue;
|
|
|
|
value->MultiCount = 1; /* FIXME */
|
|
|
|
|
2007-07-09 20:55:13 +02:00
|
|
|
if (type) *type = counter->type;
|
2007-09-29 21:06:23 +02:00
|
|
|
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
2007-07-09 20:55:13 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2007-07-21 15:08:01 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* PdhLookupPerfIndexByNameA (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhLookupPerfIndexByNameA( LPCSTR machine, LPCSTR name, LPDWORD index )
|
|
|
|
{
|
|
|
|
PDH_STATUS ret;
|
2008-02-19 11:17:19 +01:00
|
|
|
WCHAR *machineW = NULL;
|
2007-07-21 15:08:01 +02:00
|
|
|
WCHAR *nameW;
|
|
|
|
|
|
|
|
TRACE("%s %s %p\n", debugstr_a(machine), debugstr_a(name), index);
|
|
|
|
|
2008-02-19 11:17:19 +01:00
|
|
|
if (!name) return PDH_INVALID_ARGUMENT;
|
|
|
|
|
|
|
|
if (machine && !(machineW = pdh_strdup_aw( machine ))) return PDH_MEMORY_ALLOCATION_FAILURE;
|
2007-07-21 15:08:01 +02:00
|
|
|
|
|
|
|
if (!(nameW = pdh_strdup_aw( name )))
|
|
|
|
return PDH_MEMORY_ALLOCATION_FAILURE;
|
|
|
|
|
2008-02-19 11:17:19 +01:00
|
|
|
ret = PdhLookupPerfIndexByNameW( machineW, nameW, index );
|
2007-07-21 15:08:01 +02:00
|
|
|
|
2007-12-09 16:30:15 +01:00
|
|
|
heap_free( nameW );
|
2008-02-19 11:17:19 +01:00
|
|
|
heap_free( machineW );
|
2007-07-21 15:08:01 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhLookupPerfIndexByNameW (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhLookupPerfIndexByNameW( LPCWSTR machine, LPCWSTR name, LPDWORD index )
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("%s %s %p\n", debugstr_w(machine), debugstr_w(name), index);
|
|
|
|
|
|
|
|
if (!name || !index) return PDH_INVALID_ARGUMENT;
|
|
|
|
|
|
|
|
if (machine)
|
|
|
|
{
|
|
|
|
FIXME("remote machine not supported\n");
|
|
|
|
return PDH_CSTATUS_NO_MACHINE;
|
|
|
|
}
|
2018-07-11 22:06:14 +02:00
|
|
|
for (i = 0; i < ARRAY_SIZE(counter_sources); i++)
|
2007-07-21 15:08:01 +02:00
|
|
|
{
|
|
|
|
if (pdh_match_path( counter_sources[i].path, name ))
|
|
|
|
{
|
|
|
|
*index = counter_sources[i].index;
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return PDH_STRING_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhLookupPerfNameByIndexA (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhLookupPerfNameByIndexA( LPCSTR machine, DWORD index, LPSTR buffer, LPDWORD size )
|
|
|
|
{
|
|
|
|
PDH_STATUS ret;
|
2008-02-18 10:32:04 +01:00
|
|
|
WCHAR *machineW = NULL;
|
2007-07-21 15:08:01 +02:00
|
|
|
WCHAR bufferW[PDH_MAX_COUNTER_NAME];
|
2018-07-11 22:06:14 +02:00
|
|
|
DWORD sizeW = ARRAY_SIZE(bufferW);
|
2007-07-21 15:08:01 +02:00
|
|
|
|
|
|
|
TRACE("%s %d %p %p\n", debugstr_a(machine), index, buffer, size);
|
|
|
|
|
2008-02-18 10:31:58 +01:00
|
|
|
if (!buffer || !size) return PDH_INVALID_ARGUMENT;
|
2007-07-21 15:08:01 +02:00
|
|
|
|
2008-02-18 10:32:04 +01:00
|
|
|
if (machine && !(machineW = pdh_strdup_aw( machine ))) return PDH_MEMORY_ALLOCATION_FAILURE;
|
|
|
|
|
|
|
|
if (!(ret = PdhLookupPerfNameByIndexW( machineW, index, bufferW, &sizeW )))
|
2007-07-21 15:08:01 +02:00
|
|
|
{
|
|
|
|
int required = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL );
|
|
|
|
|
2019-02-28 00:50:35 +01:00
|
|
|
if (*size < required) ret = PDH_MORE_DATA;
|
2007-07-21 15:08:01 +02:00
|
|
|
else WideCharToMultiByte( CP_ACP, 0, bufferW, -1, buffer, required, NULL, NULL );
|
2019-02-28 00:50:35 +01:00
|
|
|
*size = required;
|
2007-07-21 15:08:01 +02:00
|
|
|
}
|
2008-02-18 10:32:04 +01:00
|
|
|
heap_free( machineW );
|
2007-07-21 15:08:01 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhLookupPerfNameByIndexW (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhLookupPerfNameByIndexW( LPCWSTR machine, DWORD index, LPWSTR buffer, LPDWORD size )
|
|
|
|
{
|
|
|
|
PDH_STATUS ret;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("%s %d %p %p\n", debugstr_w(machine), index, buffer, size);
|
|
|
|
|
|
|
|
if (machine)
|
|
|
|
{
|
|
|
|
FIXME("remote machine not supported\n");
|
|
|
|
return PDH_CSTATUS_NO_MACHINE;
|
|
|
|
}
|
|
|
|
|
2008-01-26 09:43:10 +01:00
|
|
|
if (!buffer || !size) return PDH_INVALID_ARGUMENT;
|
2007-07-21 15:08:01 +02:00
|
|
|
if (!index) return ERROR_SUCCESS;
|
|
|
|
|
2018-07-11 22:06:14 +02:00
|
|
|
for (i = 0; i < ARRAY_SIZE(counter_sources); i++)
|
2007-07-21 15:08:01 +02:00
|
|
|
{
|
|
|
|
if (counter_sources[i].index == index)
|
|
|
|
{
|
2019-06-18 09:05:33 +02:00
|
|
|
WCHAR *p = wcsrchr( counter_sources[i].path, '\\' ) + 1;
|
|
|
|
unsigned int required = lstrlenW( p ) + 1;
|
2007-07-21 15:08:01 +02:00
|
|
|
|
|
|
|
if (*size < required) ret = PDH_MORE_DATA;
|
|
|
|
else
|
|
|
|
{
|
2019-06-18 09:05:33 +02:00
|
|
|
lstrcpyW( buffer, p );
|
2007-07-21 15:08:01 +02:00
|
|
|
ret = ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
*size = required;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return PDH_INVALID_ARGUMENT;
|
|
|
|
}
|
|
|
|
|
2007-06-25 21:10:11 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* PdhOpenQueryA (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhOpenQueryA( LPCSTR source, DWORD_PTR userdata, PDH_HQUERY *query )
|
|
|
|
{
|
|
|
|
PDH_STATUS ret;
|
|
|
|
WCHAR *sourceW = NULL;
|
|
|
|
|
|
|
|
TRACE("%s %lx %p\n", debugstr_a(source), userdata, query);
|
|
|
|
|
|
|
|
if (source && !(sourceW = pdh_strdup_aw( source ))) return PDH_MEMORY_ALLOCATION_FAILURE;
|
|
|
|
|
|
|
|
ret = PdhOpenQueryW( sourceW, userdata, query );
|
2007-12-09 16:30:15 +01:00
|
|
|
heap_free( sourceW );
|
2007-06-25 21:10:11 +02:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhOpenQueryW (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhOpenQueryW( LPCWSTR source, DWORD_PTR userdata, PDH_HQUERY *handle )
|
|
|
|
{
|
|
|
|
struct query *query;
|
|
|
|
|
|
|
|
TRACE("%s %lx %p\n", debugstr_w(source), userdata, handle);
|
|
|
|
|
|
|
|
if (!handle) return PDH_INVALID_ARGUMENT;
|
|
|
|
|
|
|
|
if (source)
|
|
|
|
{
|
|
|
|
FIXME("log file data source not supported\n");
|
|
|
|
return PDH_INVALID_ARGUMENT;
|
|
|
|
}
|
|
|
|
if ((query = create_query()))
|
|
|
|
{
|
|
|
|
query->user = userdata;
|
|
|
|
*handle = query;
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
return PDH_MEMORY_ALLOCATION_FAILURE;
|
|
|
|
}
|
2007-06-25 21:10:19 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhRemoveCounter (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhRemoveCounter( PDH_HCOUNTER handle )
|
|
|
|
{
|
|
|
|
struct counter *counter = handle;
|
|
|
|
|
|
|
|
TRACE("%p\n", handle);
|
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
EnterCriticalSection( &pdh_handle_cs );
|
|
|
|
if (!counter || counter->magic != PDH_MAGIC_COUNTER)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_HANDLE;
|
|
|
|
}
|
2007-06-25 21:10:19 +02:00
|
|
|
|
|
|
|
list_remove( &counter->entry );
|
2007-09-29 21:06:23 +02:00
|
|
|
destroy_counter( counter );
|
2007-06-25 21:10:19 +02:00
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
2007-06-25 21:10:19 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2007-07-09 20:55:13 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhSetCounterScaleFactor (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhSetCounterScaleFactor( PDH_HCOUNTER handle, LONG factor )
|
|
|
|
{
|
|
|
|
struct counter *counter = handle;
|
|
|
|
|
|
|
|
TRACE("%p\n", handle);
|
|
|
|
|
2007-09-29 21:06:23 +02:00
|
|
|
EnterCriticalSection( &pdh_handle_cs );
|
|
|
|
if (!counter || counter->magic != PDH_MAGIC_COUNTER)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
if (factor < PDH_MIN_SCALE || factor > PDH_MAX_SCALE)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
|
|
|
return PDH_INVALID_ARGUMENT;
|
|
|
|
}
|
2007-07-09 20:55:13 +02:00
|
|
|
|
|
|
|
counter->scale = factor;
|
2007-09-29 21:06:23 +02:00
|
|
|
|
|
|
|
LeaveCriticalSection( &pdh_handle_cs );
|
2007-07-09 20:55:13 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2007-09-29 21:05:53 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhValidatePathA (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhValidatePathA( LPCSTR path )
|
|
|
|
{
|
|
|
|
PDH_STATUS ret;
|
|
|
|
WCHAR *pathW;
|
|
|
|
|
|
|
|
TRACE("%s\n", debugstr_a(path));
|
|
|
|
|
|
|
|
if (!path) return PDH_INVALID_ARGUMENT;
|
|
|
|
if (!(pathW = pdh_strdup_aw( path ))) return PDH_MEMORY_ALLOCATION_FAILURE;
|
|
|
|
|
|
|
|
ret = PdhValidatePathW( pathW );
|
|
|
|
|
2007-12-09 16:30:15 +01:00
|
|
|
heap_free( pathW );
|
2007-09-29 21:05:53 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PDH_STATUS validate_path( LPCWSTR path )
|
|
|
|
{
|
|
|
|
if (!path || !*path) return PDH_INVALID_ARGUMENT;
|
2019-06-18 09:05:33 +02:00
|
|
|
if (*path++ != '\\' || !wcschr( path, '\\' )) return PDH_CSTATUS_BAD_COUNTERNAME;
|
2007-09-29 21:05:53 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhValidatePathW (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhValidatePathW( LPCWSTR path )
|
|
|
|
{
|
|
|
|
PDH_STATUS ret;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("%s\n", debugstr_w(path));
|
|
|
|
|
|
|
|
if ((ret = validate_path( path ))) return ret;
|
|
|
|
|
2018-07-11 22:06:14 +02:00
|
|
|
for (i = 0; i < ARRAY_SIZE(counter_sources); i++)
|
2007-09-29 21:05:53 +02:00
|
|
|
if (pdh_match_path( counter_sources[i].path, path )) return ERROR_SUCCESS;
|
|
|
|
|
|
|
|
return PDH_CSTATUS_NO_COUNTER;
|
|
|
|
}
|
|
|
|
|
2018-11-13 17:41:49 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* PdhVbAddCounter (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhVbAddCounter( PDH_HQUERY query, LPCSTR path, PDH_HCOUNTER *counter )
|
|
|
|
{
|
|
|
|
FIXME("%p, %s, %p: stub!\n", query, debugstr_a(path), counter);
|
|
|
|
|
|
|
|
if (!path) return PDH_INVALID_ARGUMENT;
|
|
|
|
|
|
|
|
return PDH_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2007-09-29 21:05:53 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* PdhValidatePathExA (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhValidatePathExA( PDH_HLOG source, LPCSTR path )
|
|
|
|
{
|
|
|
|
TRACE("%p %s\n", source, debugstr_a(path));
|
|
|
|
|
|
|
|
if (source)
|
|
|
|
{
|
|
|
|
FIXME("log file data source not supported\n");
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
return PdhValidatePathA( path );
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhValidatePathExW (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhValidatePathExW( PDH_HLOG source, LPCWSTR path )
|
|
|
|
{
|
|
|
|
TRACE("%p %s\n", source, debugstr_w(path));
|
|
|
|
|
|
|
|
if (source)
|
|
|
|
{
|
|
|
|
FIXME("log file data source not supported\n");
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
return PdhValidatePathW( path );
|
|
|
|
}
|
2009-01-27 17:39:32 +01:00
|
|
|
|
2009-05-08 11:17:15 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* PdhMakeCounterPathA (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhMakeCounterPathA( PDH_COUNTER_PATH_ELEMENTS_A *e, LPSTR buffer,
|
|
|
|
LPDWORD buflen, DWORD flags )
|
|
|
|
{
|
|
|
|
PDH_STATUS ret = PDH_MEMORY_ALLOCATION_FAILURE;
|
|
|
|
PDH_COUNTER_PATH_ELEMENTS_W eW;
|
|
|
|
WCHAR *bufferW;
|
|
|
|
DWORD buflenW;
|
|
|
|
|
|
|
|
TRACE("%p %p %p 0x%08x\n", e, buffer, buflen, flags);
|
|
|
|
|
|
|
|
if (!e || !buflen) return PDH_INVALID_ARGUMENT;
|
|
|
|
|
|
|
|
memset( &eW, 0, sizeof(eW) );
|
|
|
|
if (e->szMachineName && !(eW.szMachineName = pdh_strdup_aw( e->szMachineName ))) goto done;
|
|
|
|
if (e->szObjectName && !(eW.szObjectName = pdh_strdup_aw( e->szObjectName ))) goto done;
|
|
|
|
if (e->szInstanceName && !(eW.szInstanceName = pdh_strdup_aw( e->szInstanceName ))) goto done;
|
|
|
|
if (e->szParentInstance && !(eW.szParentInstance = pdh_strdup_aw( e->szParentInstance ))) goto done;
|
|
|
|
if (e->szCounterName && !(eW.szCounterName = pdh_strdup_aw( e->szCounterName ))) goto done;
|
|
|
|
eW.dwInstanceIndex = e->dwInstanceIndex;
|
|
|
|
|
|
|
|
buflenW = 0;
|
|
|
|
ret = PdhMakeCounterPathW( &eW, NULL, &buflenW, flags );
|
|
|
|
if (ret == PDH_MORE_DATA)
|
|
|
|
{
|
|
|
|
if ((bufferW = heap_alloc( buflenW * sizeof(WCHAR) )))
|
|
|
|
{
|
|
|
|
if (!(ret = PdhMakeCounterPathW( &eW, bufferW, &buflenW, flags )))
|
|
|
|
{
|
|
|
|
int len = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL);
|
|
|
|
if (*buflen >= len) WideCharToMultiByte(CP_ACP, 0, bufferW, -1, buffer, *buflen, NULL, NULL);
|
|
|
|
else ret = PDH_MORE_DATA;
|
|
|
|
*buflen = len;
|
|
|
|
}
|
|
|
|
heap_free( bufferW );
|
|
|
|
}
|
2009-05-10 21:27:12 +02:00
|
|
|
else
|
|
|
|
ret = PDH_MEMORY_ALLOCATION_FAILURE;
|
2009-05-08 11:17:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
heap_free( eW.szMachineName );
|
|
|
|
heap_free( eW.szObjectName );
|
|
|
|
heap_free( eW.szInstanceName );
|
|
|
|
heap_free( eW.szParentInstance );
|
|
|
|
heap_free( eW.szCounterName );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhMakeCounterPathW (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhMakeCounterPathW( PDH_COUNTER_PATH_ELEMENTS_W *e, LPWSTR buffer,
|
|
|
|
LPDWORD buflen, DWORD flags )
|
|
|
|
{
|
|
|
|
WCHAR path[PDH_MAX_COUNTER_NAME], instance[12];
|
|
|
|
PDH_STATUS ret = ERROR_SUCCESS;
|
|
|
|
DWORD len;
|
|
|
|
|
|
|
|
TRACE("%p %p %p 0x%08x\n", e, buffer, buflen, flags);
|
|
|
|
|
|
|
|
if (flags) FIXME("unimplemented flags 0x%08x\n", flags);
|
|
|
|
|
|
|
|
if (!e || !e->szCounterName || !e->szObjectName || !buflen)
|
|
|
|
return PDH_INVALID_ARGUMENT;
|
|
|
|
|
|
|
|
path[0] = 0;
|
|
|
|
if (e->szMachineName)
|
|
|
|
{
|
2020-11-05 02:07:33 +01:00
|
|
|
lstrcatW(path, L"\\\\");
|
2019-06-18 09:05:33 +02:00
|
|
|
lstrcatW(path, e->szMachineName);
|
2009-05-08 11:17:15 +02:00
|
|
|
}
|
2020-11-05 02:07:33 +01:00
|
|
|
lstrcatW(path, L"\\");
|
2019-06-18 09:05:33 +02:00
|
|
|
lstrcatW(path, e->szObjectName);
|
2009-05-08 11:17:15 +02:00
|
|
|
if (e->szInstanceName)
|
|
|
|
{
|
2020-11-05 02:07:33 +01:00
|
|
|
lstrcatW(path, L"(");
|
2009-05-08 11:17:15 +02:00
|
|
|
if (e->szParentInstance)
|
|
|
|
{
|
2019-06-18 09:05:33 +02:00
|
|
|
lstrcatW(path, e->szParentInstance);
|
2020-11-05 02:07:33 +01:00
|
|
|
lstrcatW(path, L"/");
|
2009-05-08 11:17:15 +02:00
|
|
|
}
|
2019-06-18 09:05:33 +02:00
|
|
|
lstrcatW(path, e->szInstanceName);
|
2020-11-05 02:07:33 +01:00
|
|
|
swprintf(instance, ARRAY_SIZE(instance), L"#%u", e->dwInstanceIndex);
|
2019-06-18 09:05:33 +02:00
|
|
|
lstrcatW(path, instance);
|
2020-11-05 02:07:33 +01:00
|
|
|
lstrcatW(path, L")");
|
2009-05-08 11:17:15 +02:00
|
|
|
}
|
2020-11-05 02:07:33 +01:00
|
|
|
lstrcatW(path, L"\\");
|
2019-06-18 09:05:33 +02:00
|
|
|
lstrcatW(path, e->szCounterName);
|
2009-05-08 11:17:15 +02:00
|
|
|
|
2019-06-18 09:05:33 +02:00
|
|
|
len = lstrlenW(path) + 1;
|
|
|
|
if (*buflen >= len) lstrcpyW(buffer, path);
|
2009-05-08 11:17:15 +02:00
|
|
|
else ret = PDH_MORE_DATA;
|
|
|
|
*buflen = len;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-01-27 17:39:32 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* PdhEnumObjectItemsA (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhEnumObjectItemsA(LPCSTR szDataSource, LPCSTR szMachineName, LPCSTR szObjectName,
|
|
|
|
LPSTR mszCounterList, LPDWORD pcchCounterListLength, LPSTR mszInstanceList,
|
|
|
|
LPDWORD pcchInstanceListLength, DWORD dwDetailLevel, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
FIXME("%s, %s, %s, %p, %p, %p, %p, %d, 0x%x: stub\n", debugstr_a(szDataSource), debugstr_a(szMachineName),
|
|
|
|
debugstr_a(szObjectName), mszCounterList, pcchCounterListLength, mszInstanceList,
|
|
|
|
pcchInstanceListLength, dwDetailLevel, dwFlags);
|
|
|
|
|
|
|
|
return PDH_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhEnumObjectItemsW (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhEnumObjectItemsW(LPCWSTR szDataSource, LPCWSTR szMachineName, LPCWSTR szObjectName,
|
|
|
|
LPWSTR mszCounterList, LPDWORD pcchCounterListLength, LPWSTR mszInstanceList,
|
|
|
|
LPDWORD pcchInstanceListLength, DWORD dwDetailLevel, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
FIXME("%s, %s, %s, %p, %p, %p, %p, %d, 0x%x: stub\n", debugstr_w(szDataSource), debugstr_w(szMachineName),
|
|
|
|
debugstr_w(szObjectName), mszCounterList, pcchCounterListLength, mszInstanceList,
|
|
|
|
pcchInstanceListLength, dwDetailLevel, dwFlags);
|
|
|
|
|
|
|
|
return PDH_NOT_IMPLEMENTED;
|
|
|
|
}
|
2010-01-25 12:25:47 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhSetDefaultRealTimeDataSource (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhSetDefaultRealTimeDataSource( DWORD source )
|
|
|
|
{
|
|
|
|
FIXME("%u\n", source);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2015-12-23 07:31:20 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhGetLogFileTypeA (PDH.@)
|
|
|
|
*/
|
2015-12-24 23:08:08 +01:00
|
|
|
PDH_STATUS WINAPI PdhGetLogFileTypeA(const char *log, DWORD *type)
|
2015-12-23 07:31:20 +01:00
|
|
|
{
|
2015-12-24 23:08:08 +01:00
|
|
|
FIXME("%s, %p: stub\n", debugstr_a(log), type);
|
2015-12-23 07:31:20 +01:00
|
|
|
return PDH_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhGetLogFileTypeW (PDH.@)
|
|
|
|
*/
|
2015-12-24 23:08:08 +01:00
|
|
|
PDH_STATUS WINAPI PdhGetLogFileTypeW(const WCHAR *log, DWORD *type)
|
2015-12-23 07:31:20 +01:00
|
|
|
{
|
2015-12-24 23:08:08 +01:00
|
|
|
FIXME("%s, %p: stub\n", debugstr_w(log), type);
|
2015-12-23 07:31:20 +01:00
|
|
|
return PDH_NOT_IMPLEMENTED;
|
|
|
|
}
|
2015-12-27 05:44:02 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhBindInputDataSourceA (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhBindInputDataSourceA(PDH_HLOG *source, const char *filenamelist)
|
|
|
|
{
|
|
|
|
FIXME("%p %s: stub\n", source, debugstr_a(filenamelist));
|
|
|
|
return PDH_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PdhBindInputDataSourceW (PDH.@)
|
|
|
|
*/
|
|
|
|
PDH_STATUS WINAPI PdhBindInputDataSourceW(PDH_HLOG *source, const WCHAR *filenamelist)
|
|
|
|
{
|
|
|
|
FIXME("%p %s: stub\n", source, debugstr_w(filenamelist));
|
|
|
|
return PDH_NOT_IMPLEMENTED;
|
|
|
|
}
|