Paul Gofman : advapi32: Improve PerfSetCounterRefValue() stub.
Alexandre Julliard
julliard at winehq.org
Mon Nov 22 16:05:18 CST 2021
Module: wine
Branch: master
Commit: 8cfbb1772481db3ff2f615a7706aa503a92d3f71
URL: https://source.winehq.org/git/wine.git/?a=commit;h=8cfbb1772481db3ff2f615a7706aa503a92d3f71
Author: Paul Gofman <pgofman at codeweavers.com>
Date: Mon Nov 22 17:07:59 2021 +0300
advapi32: Improve PerfSetCounterRefValue() stub.
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/advapi32/tests/perf.c | 10 +++++-----
dlls/kernelbase/main.c | 24 +++++++++++++++++++++---
2 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/dlls/advapi32/tests/perf.c b/dlls/advapi32/tests/perf.c
index 9236ea8bb75..a0862e65ea4 100644
--- a/dlls/advapi32/tests/perf.c
+++ b/dlls/advapi32/tests/perf.c
@@ -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);
diff --git a/dlls/kernelbase/main.c b/dlls/kernelbase/main.c
index d90bedcc637..775c1c2ac07 100644
--- a/dlls/kernelbase/main.c
+++ b/dlls/kernelbase/main.c
@@ -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;
}
/***********************************************************************
More information about the wine-cvs
mailing list