#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
# 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
*/
ULONG SystemCall;
ULONG SystemCallReturn;
ULONGLONG SystemCallPad[3];
- union {
+ __GNU_EXTENSION union {
volatile KSYSTEM_TIME TickCount;
volatile ULONG64 TickCountQuad;
};
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;
PKTHREAD Owner;
ULONG Contention;
KGATE Gate;
- union
+ __GNU_EXTENSION union
{
- struct
+ __GNU_EXTENSION struct
{
SHORT KernelApcDisable;
SHORT SpecialApcDisable;
ULONG StackBase;
ULONG StackLimit;
ULONG SubSystemTib;
- union {
+ __GNU_EXTENSION union {
ULONG FiberData;
ULONG Version;
};
ULONG64 StackBase;
ULONG64 StackLimit;
ULONG64 SubSystemTib;
- union {
+ __GNU_EXTENSION union {
ULONG64 FiberData;
ULONG Version;
};
typedef struct _PROCESS_DEVICEMAP_INFORMATION
{
- union
+ __GNU_EXTENSION union
{
struct
{
typedef struct _KPCR
{
- union
+ __GNU_EXTENSION union
{
NT_TIB NtTib;
- struct
+ __GNU_EXTENSION struct
{
union _KGDTENTRY64 *GdtBase;
struct _KTSS64 *TssBase;