On Mon Apr 7 07:55:52 2025 +0000, Alexandre Julliard wrote:
It looks good, you could probably improve it by returning a counter pointer instead of an index. Also you could have a set function doing a memcpy instead of returning a pointer and casting it.
Hi, I did try your suggestions, and I like returning the pointer directly more. However It seems I'm not able to make the setter works:
I did try this:
``` static void set_performance_counter_value(PERF_COUNTER_INFO* counter, struct counterset_instance* instance, void* new_value, size_t size) { void* address = ((BYTE*) &instance->instance + sizeof(PERF_COUNTERSET_INSTANCE) + counter->Offset); memcpy(address, new_value, size); } ``` However compilation is still failing with ../wine/dlls/kernelbase/main.c:325:5: error: writing 8 bytes into a region of size 0 [-Werror=stringop-overflow=] 325 | memcpy(address, new_value, size);
Using memcpy, this error happens in all cases, while using the direct assignment with casting, it seems to happen only when the byte pointer is calculated inside an inner function (if I put pointer calculation and assignment inside the top function works) Do you have any idea? @julliard