#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
+*/
+
+struct _IRP;
+struct _MDL;
+struct _KAPC;
+struct _KDPC;
+struct _FILE_OBJECT;
+struct _DMA_ADAPTER;
+struct _DEVICE_OBJECT;
+struct _DRIVER_OBJECT;
+struct _IO_STATUS_BLOCK;
+struct _DEVICE_DESCRIPTION;
+struct _SCATTER_GATHER_LIST;
+struct _DRIVE_LAYOUT_INFORMATION;
+
+typedef PVOID PSID;
+
+/*
+** Simple structures
+*/
+
+typedef UCHAR KIRQL, *PKIRQL;
+
+typedef enum _MODE {
+ KernelMode,
+ UserMode,
+ MaximumMode
+} MODE;
+
+/* Constants */
+#define NtCurrentProcess() ( (HANDLE)(LONG_PTR) -1 )
+#define ZwCurrentProcess() NtCurrentProcess()
+#define NtCurrentThread() ( (HANDLE)(LONG_PTR) -2 )
+#define ZwCurrentThread() NtCurrentThread()
+
+#if (_M_IX86)
+#define KIP0PCRADDRESS 0xffdff000
+#endif
+
+#if defined(_WIN64)
+#define MAXIMUM_PROCESSORS 64
+#else
+#define MAXIMUM_PROCESSORS 32
+#endif
+
+#define MAXIMUM_WAIT_OBJECTS 64
+
+#define EX_RUNDOWN_ACTIVE 0x1
+#define EX_RUNDOWN_COUNT_SHIFT 0x1
+#define EX_RUNDOWN_COUNT_INC (1 << EX_RUNDOWN_COUNT_SHIFT)
+
+#define METHOD_BUFFERED 0
+#define METHOD_IN_DIRECT 1
+#define METHOD_OUT_DIRECT 2
+#define METHOD_NEITHER 3
+
+#define LOW_PRIORITY 0
+#define LOW_REALTIME_PRIORITY 16
+#define HIGH_PRIORITY 31
+#define MAXIMUM_PRIORITY 32
+
+#define MAXIMUM_SUSPEND_COUNT MAXCHAR
+
+#define MAXIMUM_FILENAME_LENGTH 256
+
+#define FILE_SUPERSEDED 0x00000000
+#define FILE_OPENED 0x00000001
+#define FILE_CREATED 0x00000002
+#define FILE_OVERWRITTEN 0x00000003
+#define FILE_EXISTS 0x00000004
+#define FILE_DOES_NOT_EXIST 0x00000005
+
+#define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
+#define FILE_WRITE_TO_END_OF_FILE 0xffffffff
+
/* Simple types */
typedef UCHAR KPROCESSOR_MODE;
typedef LONG KPRIORITY;
} Interrupt;
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
struct {
- union {
+ __GNU_EXTENSION union {
struct {
USHORT Reserved;
USHORT MessageCount;
typedef struct _DISPATCHER_HEADER
{
- union
+ __GNU_EXTENSION union
{
- struct
+ __GNU_EXTENSION struct
{
UCHAR Type;
- union
+ __GNU_EXTENSION union
{
UCHAR Absolute;
UCHAR NpxIrql;
};
- union
+ __GNU_EXTENSION union
{
UCHAR Size;
UCHAR Hand;
};
- union
+ __GNU_EXTENSION union
{
UCHAR Inserted;
BOOLEAN DebugActive;
ULONG ContentionCount;
ULONG NumberOfSharedWaiters;
ULONG NumberOfExclusiveWaiters;
- union
+ __GNU_EXTENSION union
{
PVOID Address;
ULONG_PTR CreatorBackTraceIndex;
//} LOOKASIDE_LIST_EX, *PLOOKASIDE_LIST_EX;
typedef struct _EX_RUNDOWN_REF {
- union {
+ __GNU_EXTENSION union {
volatile ULONG_PTR Count;
volatile PVOID Ptr;
};