Commit 7e758014 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

advapi32: Add stub for PerfAddCounters().

parent a5921e71
......@@ -331,3 +331,13 @@ ULONG WINAPI PerfOpenQueryHandle( const WCHAR *machine, HANDLE *query )
return ERROR_SUCCESS;
}
ULONG WINAPI PerfAddCounters( HANDLE query, PERF_COUNTER_IDENTIFIER *id, DWORD size )
{
FIXME( "query %p, id %p, size %lu stub.\n", query, id, size );
if (!id || size < sizeof(*id) || id->Size < sizeof(*id)) return ERROR_INVALID_PARAMETER;
id->Status = ERROR_WMI_GUID_NOT_FOUND;
return ERROR_SUCCESS;
}
......@@ -553,7 +553,7 @@
@ stdcall -ret64 -import OpenTraceW(ptr)
# @ stub OperationEnd
# @ stub OperationStart
# @ stub PerfAddCounters
@ stdcall PerfAddCounters(long ptr long)
@ stdcall PerfCloseQueryHandle(long)
@ stdcall -import PerfCreateInstance(long ptr wstr long)
# @ stub PerfDecrementULongCounterValue
......
......@@ -28,9 +28,12 @@
#include "wine/test.h"
#include "initguid.h"
#define DEFINE_FUNCTION(name) static typeof(name) *p##name;
DEFINE_FUNCTION(PerfCloseQueryHandle);
DEFINE_FUNCTION(PerfOpenQueryHandle);
DEFINE_FUNCTION(PerfAddCounters);
#undef DEFINE_FUNCTION
static void init_functions(void)
......@@ -40,6 +43,7 @@ static void init_functions(void)
#define GET_FUNCTION(name) p##name = (void *)GetProcAddress(hadvapi, #name)
GET_FUNCTION(PerfCloseQueryHandle);
GET_FUNCTION(PerfOpenQueryHandle);
GET_FUNCTION(PerfAddCounters);
#undef GET_FUNCTION
}
......@@ -203,8 +207,12 @@ void test_provider_init(void)
ok(!ret, "Got unexpected ret %lu.\n", ret);
}
DEFINE_GUID(TestCounterGUID, 0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x11, 0x11, 0x22, 0x22, 0x33, 0x33);
static void test_perf_counters(void)
{
char buffer[sizeof(PERF_COUNTER_IDENTIFIER) + 8];
PERF_COUNTER_IDENTIFIER *counter_id;
HANDLE query;
ULONG ret;
......@@ -219,6 +227,23 @@ static void test_perf_counters(void)
ret = pPerfOpenQueryHandle(NULL, &query);
ok(!ret, "got ret %lu.\n", ret);
counter_id = (PERF_COUNTER_IDENTIFIER *)buffer;
memset(buffer, 0, sizeof(buffer));
counter_id->CounterSetGuid = TestCounterGUID;
counter_id->CounterId = PERF_WILDCARD_COUNTER;
counter_id->InstanceId = PERF_WILDCARD_COUNTER;
ret = pPerfAddCounters(query, counter_id, sizeof(*counter_id));
ok(ret == ERROR_INVALID_PARAMETER, "got ret %lu.\n", ret);
counter_id->Size = sizeof(*counter_id);
ret = pPerfAddCounters(query, counter_id, 8);
ok(ret == ERROR_INVALID_PARAMETER, "got ret %lu.\n", ret);
ret = pPerfAddCounters(query, counter_id, sizeof(*counter_id));
ok(!ret, "got ret %lu.\n", ret);
ok(counter_id->Status == ERROR_WMI_GUID_NOT_FOUND, "got Status %#lx.\n", counter_id->Status);
ret = pPerfCloseQueryHandle(query);
ok(!ret, "got ret %lu.\n", ret);
}
......
......@@ -81,6 +81,19 @@ typedef struct _PROVIDER_CONTEXT {
LPVOID pMemContext;
} PERF_PROVIDER_CONTEXT, * PPERF_PROVIDER_CONTEXT;
typedef struct _PERF_COUNTER_IDENTIFIER {
GUID CounterSetGuid;
ULONG Status;
ULONG Size;
ULONG CounterId;
ULONG InstanceId;
ULONG Index;
ULONG Reserved;
} PERF_COUNTER_IDENTIFIER, *PPERF_COUNTER_IDENTIFIER;
#define PERF_WILDCARD_COUNTER 0xFFFFFFFF
#define PERF_WILDCARD_INSTANCE L"*"
PERF_COUNTERSET_INSTANCE WINAPI *PerfCreateInstance(HANDLE, const GUID *, const WCHAR *, ULONG);
ULONG WINAPI PerfDeleteInstance(HANDLE, PERF_COUNTERSET_INSTANCE *);
ULONG WINAPI PerfSetCounterRefValue(HANDLE, PERF_COUNTERSET_INSTANCE *, ULONG, void *);
......@@ -89,6 +102,7 @@ ULONG WINAPI PerfStartProvider(GUID *, PERFLIBREQUEST, HANDLE *);
ULONG WINAPI PerfStartProviderEx(GUID *, PERF_PROVIDER_CONTEXT *, HANDLE *);
ULONG WINAPI PerfStopProvider(HANDLE);
ULONG WINAPI PerfAddCounters(HANDLE, PERF_COUNTER_IDENTIFIER *, DWORD);
ULONG WINAPI PerfCloseQueryHandle(HANDLE);
ULONG WINAPI PerfOpenQueryHandle(const WCHAR *, HANDLE *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment