[DEVMGR] Add DYNAMIC_FIELD_OFFSET macro

This replaces the usage of FIELD_OFFSET for dynamic indexing into array fields.
Sadly GCC has broken __builtin_offsetof and they don't seem to intend to fix it.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95942
This commit is contained in:
Timo Kreuzer 2024-03-09 18:32:08 +02:00
parent f5e54015ee
commit bedc16d46d
2 changed files with 5 additions and 3 deletions

View file

@ -76,6 +76,8 @@ OUT LPDWORD lpReboot);
#include <devmgr/devmgr.h> #include <devmgr/devmgr.h>
#include <wine/debug.h> #include <wine/debug.h>
#define DYNAMIC_FIELD_OFFSET(Type, Field) ((LONG)(LONG_PTR)&(((Type*) 0)->Field))
//WINE_DEFAULT_DEBUG_CHANNEL(devmgr); //WINE_DEFAULT_DEBUG_CHANNEL(devmgr);
#endif #endif

View file

@ -1030,8 +1030,8 @@ DeviceCreateHardwarePageEx(IN HWND hWndParent,
failure cases! */ failure cases! */
hpd = (PHARDWARE_PAGE_DATA)HeapAlloc(GetProcessHeap(), hpd = (PHARDWARE_PAGE_DATA)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
FIELD_OFFSET(HARDWARE_PAGE_DATA, DYNAMIC_FIELD_OFFSET(HARDWARE_PAGE_DATA,
ClassDevInfo[uNumberOfGuids])); ClassDevInfo[uNumberOfGuids]));
if (hpd != NULL) if (hpd != NULL)
{ {
HWND hWnd; HWND hWnd;