advapi32: Improve PerfSetCounterRefValue() stub.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2021-11-22 17:07:59 +03:00 committed by Alexandre Julliard
parent eec443afc2
commit 8cfbb17724
2 changed files with 26 additions and 8 deletions

View File

@ -155,16 +155,16 @@ void test_provider_init(void)
ok(size == instance->dwSize, "Got unexpected size %u, instance->dwSize %u.\n", size, instance->dwSize);
ret = PerfSetCounterRefValue(prov, instance, 1, &counter1);
todo_wine ok(!ret, "Got unexpected ret %u.\n", ret);
ok(!ret, "Got unexpected ret %u.\n", ret);
ret = PerfSetCounterRefValue(prov, instance, 2, &counter2);
todo_wine ok(!ret, "Got unexpected ret %u.\n", ret);
ok(!ret, "Got unexpected ret %u.\n", ret);
ret = PerfSetCounterRefValue(prov, instance, 0, &counter2);
todo_wine ok(ret == ERROR_NOT_FOUND, "Got unexpected ret %u.\n", ret);
ok(ret == ERROR_NOT_FOUND, "Got unexpected ret %u.\n", ret);
todo_wine ok(*(void **)(instance + 1) == &counter1, "Got unexpected counter value %p.\n",
ok(*(void **)(instance + 1) == &counter1, "Got unexpected counter value %p.\n",
*(void **)(instance + 1));
todo_wine ok(*(void **)((BYTE *)instance + sizeof(*instance) + sizeof(UINT64)) == &counter2,
ok(*(void **)((BYTE *)instance + sizeof(*instance) + sizeof(UINT64)) == &counter2,
"Got unexpected counter value %p.\n", *(void **)(instance + 1));
ret = PerfDeleteInstance(prov, instance);

View File

@ -312,11 +312,29 @@ ULONG WINAPI PerfSetCounterSetInfo( HANDLE handle, PERF_COUNTERSET_INFO *templat
/***********************************************************************
* PerfSetCounterRefValue (KERNELBASE.@)
*/
ULONG WINAPI PerfSetCounterRefValue(HANDLE provider, PPERF_COUNTERSET_INSTANCE instance,
ULONG WINAPI PerfSetCounterRefValue(HANDLE provider, PERF_COUNTERSET_INSTANCE *instance,
ULONG counterid, void *address)
{
FIXME("%p %p %u %p: stub\n", provider, instance, counterid, address);
return ERROR_CALL_NOT_IMPLEMENTED;
struct perf_provider *prov = perf_provider_from_handle( provider );
struct counterset_template *template;
struct counterset_instance *inst;
unsigned int i;
FIXME( "provider %p, instance %p, counterid %u, address %p semi-stub.\n",
provider, instance, counterid, address );
if (!prov || !instance || !address) return ERROR_INVALID_PARAMETER;
inst = CONTAINING_RECORD(instance, struct counterset_instance, instance);
template = inst->template;
for (i = 0; i < template->counterset.NumCounters; ++i)
if (template->counter[i].CounterId == counterid) break;
if (i == template->counterset.NumCounters) return ERROR_NOT_FOUND;
*(void **)((BYTE *)&inst->instance + sizeof(PERF_COUNTERSET_INSTANCE) + template->counter[i].Offset) = address;
return STATUS_SUCCESS;
}
/***********************************************************************