Move GUID comparison macro to wdm.h
[reactos.git] / include / ddk / winddk.h
index a2bbeb1..27bc4f1 100644 (file)
 #ifndef __WINDDK_H
 #define __WINDDK_H
 
+/* Helper macro to enable gcc's extension.  */
+#ifndef __GNU_EXTENSION
+#ifdef __GNUC__
+#define __GNU_EXTENSION __extension__
+#else
+#define __GNU_EXTENSION
+#endif
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -65,38 +74,6 @@ extern "C" {
 # define _DDK_DUMMYUNION_N_MEMBER(n, name) name
 #endif
 
-/*
- * Alignment Macros
- */
-#define ALIGN_DOWN(s, t) \
-    ((ULONG)(s) & ~(sizeof(t) - 1))
-
-#define ALIGN_UP(s, t) \
-    (ALIGN_DOWN(((ULONG)(s) + sizeof(t) - 1), t))
-
-#define ALIGN_DOWN_POINTER(p, t) \
-    ((PVOID)((ULONG_PTR)(p) & ~((ULONG_PTR)sizeof(t) - 1)))
-
-#define ALIGN_UP_POINTER(p, t) \
-    (ALIGN_DOWN_POINTER(((ULONG_PTR)(p) + sizeof(t) - 1), t))
-
-/*
- * GUID Comparison
- */
-
-#ifndef __IID_ALIGNED__
-    #define __IID_ALIGNED__
-    #ifdef __cplusplus
-        inline int IsEqualGUIDAligned(REFGUID guid1, REFGUID guid2)
-        {
-            return ((*(PLONGLONG)(&guid1) == *(PLONGLONG)(&guid2)) && (*((PLONGLONG)(&guid1) + 1) == *((PLONGLONG)(&guid2) + 1)));
-        }
-    #else
-        #define IsEqualGUIDAligned(guid1, guid2) \
-            ((*(PLONGLONG)(guid1) == *(PLONGLONG)(guid2)) && (*((PLONGLONG)(guid1) + 1) == *((PLONGLONG)(guid2) + 1)))
-    #endif 
-#endif
-
 /*
 ** Forward declarations
 */
@@ -556,7 +533,7 @@ typedef struct _KUSER_SHARED_DATA
     ULONG SystemCall;
     ULONG SystemCallReturn;
     ULONGLONG SystemCallPad[3];
-    union {
+    __GNU_EXTENSION union {
         volatile KSYSTEM_TIME TickCount;
         volatile ULONG64 TickCountQuad;
     };
@@ -569,10 +546,10 @@ typedef struct _KUSER_SHARED_DATA
     USHORT UserModeGlobalLogger[8];
     ULONG HeapTracingPid[2];
     ULONG CritSecTracingPid[2];
-    union
+    __GNU_EXTENSION union
     {
         ULONG SharedDataFlags;
-        struct
+        __GNU_EXTENSION struct
         {
             ULONG DbgErrorPortPresent:1;
             ULONG DbgElevationEnabled:1;
@@ -1276,9 +1253,9 @@ typedef struct _KGUARDED_MUTEX
     PKTHREAD Owner;
     ULONG Contention;
     KGATE Gate;
-    union
+    __GNU_EXTENSION union
     {
-        struct
+        __GNU_EXTENSION struct
         {
             SHORT KernelApcDisable;
             SHORT SpecialApcDisable;
@@ -4591,7 +4568,7 @@ typedef struct _NT_TIB32 {
        ULONG StackBase;
        ULONG StackLimit;
        ULONG SubSystemTib;
-       union {
+       __GNU_EXTENSION union {
                ULONG FiberData;
                ULONG Version;
        };
@@ -4604,7 +4581,7 @@ typedef struct _NT_TIB64 {
        ULONG64 StackBase;
        ULONG64 StackLimit;
        ULONG64 SubSystemTib;
-       union {
+       __GNU_EXTENSION union {
                ULONG64 FiberData;
                ULONG Version;
        };
@@ -4705,7 +4682,7 @@ typedef struct _PROCESS_WS_WATCH_INFORMATION
 
 typedef struct _PROCESS_DEVICEMAP_INFORMATION
 {
-    union
+    __GNU_EXTENSION union
     {
         struct
         {
@@ -5382,10 +5359,10 @@ extern NTKERNELAPI ULONG_PTR MmUserProbeAddress;
 
 typedef struct _KPCR
 {
-    union
+    __GNU_EXTENSION union
     {
         NT_TIB NtTib;
-        struct
+        __GNU_EXTENSION struct
         {
             union _KGDTENTRY64 *GdtBase;
             struct _KTSS64 *TssBase;