diff --git a/reactos/tools/mkhive/registry.h b/reactos/tools/mkhive/registry.h index 3105eb4223f..4aed67278ab 100644 --- a/reactos/tools/mkhive/registry.h +++ b/reactos/tools/mkhive/registry.h @@ -213,8 +213,8 @@ typedef struct _REG_VALUE * Type = Type of the whole structure * Field = Name of the field whose address is none */ -#define CONTAINING_RECORD(Address,Type,Field) \ - (Type *)(((LONG)Address) - FIELD_OFFSET(Type,Field)) +#define CONTAINING_RECORD(address, type, field) \ + ((type *)(((ULONG_PTR)address) - (ULONG_PTR)(&(((type *)0)->field)))) #define REG_NONE 0 diff --git a/reactos/w32api/include/ddk/winddk.h b/reactos/w32api/include/ddk/winddk.h index 6e73231aa1d..79aa6f56cb8 100644 --- a/reactos/w32api/include/ddk/winddk.h +++ b/reactos/w32api/include/ddk/winddk.h @@ -4744,8 +4744,8 @@ KfReleaseSpinLock( * IN PCHAR Field); */ #ifndef CONTAINING_RECORD -#define CONTAINING_RECORD(Address, Type, Field) \ - ((Type *) (((ULONG_PTR) Address) - FIELD_OFFSET(Type, Field))) +#define CONTAINING_RECORD(address, type, field) \ + ((type *)(((ULONG_PTR)address) - (ULONG_PTR)(&(((type *)0)->field)))) #endif /* LONG diff --git a/reactos/w32api/include/winnt.h b/reactos/w32api/include/winnt.h index 58ccc560581..9f929a13c01 100644 --- a/reactos/w32api/include/winnt.h +++ b/reactos/w32api/include/winnt.h @@ -890,7 +890,7 @@ typedef enum #define FIELD_OFFSET(t,f) ((LONG)&(((t*)0)->f)) #ifndef CONTAINING_RECORD #define CONTAINING_RECORD(address, type, field) \ - ((type*)((PCHAR)(address) - (PCHAR)(&((type *)0)->field))) + ((type *)(((ULONG_PTR)address) - (ULONG_PTR)(&(((type *)0)->field)))) #endif /* end winddk.h */ #define IMAGE_SIZEOF_FILE_HEADER 20