On Mon Apr 7 08:50:18 2025 +0000, Lorenzo Ferrillo wrote:
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
I uploaded the last version, with however the set part removed and reinserted into the main function. It's the only way I can pass a -Werror compilation. (using memcpy give the same stringop-overflow warning ) The fact it works on top level but not inside a function make it seems to me like a compiler (maybe the static analyzer part) bug.
p.s for simplicity I added a new commit to show modification. If you prefers, once the code is ok, I can rework the commit history.