Alexandre Julliard (@julliard) commented about dlls/kernelbase/main.c:
+ if (!prov || !instance) 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; + if (template->counter[i].Attrib & PERF_ATTRIB_BY_REFERENCE) return ERROR_INVALID_PARAMETER; + if (template->counter[i].Type & PERF_SIZE_LARGE) return ERROR_INVALID_PARAMETER; + + *(ULONG*)((BYTE *)&inst->instance + sizeof(PERF_COUNTERSET_INSTANCE) + template->counter[i].Offset) = value; + + return STATUS_SUCCESS; +} This could use some kind of helper function.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3799#note_99422