1 /* Version definitions */ 2 #undef NTDDI_VERSION 3 #define NTDDI_VERSION NTDDI_WIN7 4 #undef _WIN32_WINNT 5 #define _WIN32_WINNT _WIN32_WINNT_WIN7 6 7 #include <ntifs.h> 8 #include <ndk/ntndk.h> 9 10 #define C_ASSERT_FIELD(Type, Offset, MemberType, MemberName) \ 11 C_ASSERT(FIELD_OFFSET(Type, MemberName) == Offset); \ 12 C_ASSERT(FIELD_SIZE(Type, MemberName) == sizeof(MemberType)); 13 14 /* KTHREAD */ 15 C_ASSERT_FIELD(KTHREAD, 0x000, DISPATCHER_HEADER, Header) 16 C_ASSERT_FIELD(KTHREAD, 0x018, ULONG64, CycleTime) 17 C_ASSERT_FIELD(KTHREAD, 0x020, ULONG64, QuantumTarget) 18 C_ASSERT_FIELD(KTHREAD, 0x028, PVOID, InitialStack) 19 C_ASSERT_FIELD(KTHREAD, 0x030, PVOID, StackLimit) 20 C_ASSERT_FIELD(KTHREAD, 0x038, PVOID, KernelStack) 21 C_ASSERT_FIELD(KTHREAD, 0x040, ULONG64, ThreadLock) 22 C_ASSERT_FIELD(KTHREAD, 0x048, KWAIT_STATUS_REGISTER, WaitRegister) 23 C_ASSERT_FIELD(KTHREAD, 0x049, UCHAR, Running) 24 C_ASSERT_FIELD(KTHREAD, 0x04A, UCHAR[2], Alerted) // type is UCHAR[2] 25 C_ASSERT_FIELD(KTHREAD, 0x04C, LONG, MiscFlags) 26 C_ASSERT_FIELD(KTHREAD, 0x050, KAPC_STATE, ApcState) 27 //C_ASSERT_FIELD(KTHREAD, 0x050, UCHAR[23], ApcStateFill) // type is UCHAR[23] 28 C_ASSERT_FIELD(KTHREAD, 0x07B, CHAR, Priority) 29 C_ASSERT_FIELD(KTHREAD, 0x07C, ULONG, NextProcessor) 30 C_ASSERT_FIELD(KTHREAD, 0x080, ULONG, DeferredProcessor) 31 C_ASSERT_FIELD(KTHREAD, 0x088, ULONG64, ApcQueueLock) 32 C_ASSERT_FIELD(KTHREAD, 0x090, LONG64, WaitStatus) 33 C_ASSERT_FIELD(KTHREAD, 0x098, KWAIT_BLOCK*, WaitBlockList) 34 C_ASSERT_FIELD(KTHREAD, 0x0A0, LIST_ENTRY, WaitListEntry) 35 C_ASSERT_FIELD(KTHREAD, 0x0A0, SINGLE_LIST_ENTRY, SwapListEntry) 36 C_ASSERT_FIELD(KTHREAD, 0x0B0, PKQUEUE, Queue) 37 C_ASSERT_FIELD(KTHREAD, 0x0B8, PVOID, Teb) 38 C_ASSERT_FIELD(KTHREAD, 0x0C0, KTIMER, Timer) 39 C_ASSERT_FIELD(KTHREAD, 0x100, LONG, ThreadFlags) 40 C_ASSERT_FIELD(KTHREAD, 0x104, ULONG, Spare0) 41 //C_ASSERT_FIELD(KTHREAD, 0x108, KWAIT_BLOCK, WaitBlock) // type is KWAITBLOCK[4] 42 //C_ASSERT_FIELD(KTHREAD, 0x108, UCHAR, WaitBlockFill4) // type is UCHAR[44] 43 C_ASSERT_FIELD(KTHREAD, 0x134, ULONG, ContextSwitches) 44 //(KTHREAD, 0x108, UCHAR, WaitBlockFill5) // type is UCHAR[92] 45 C_ASSERT_FIELD(KTHREAD, 0x164, UCHAR, State) 46 C_ASSERT_FIELD(KTHREAD, 0x165, CHAR, NpxState) 47 C_ASSERT_FIELD(KTHREAD, 0x166, UCHAR, WaitIrql) 48 C_ASSERT_FIELD(KTHREAD, 0x167, CHAR, WaitMode) 49 //C_ASSERT_FIELD(KTHREAD, 0x108, UCHAR, WaitBlockFill6) // type is UCHAR[140] 50 C_ASSERT_FIELD(KTHREAD, 0x194, ULONG, WaitTime) 51 //C_ASSERT_FIELD(KTHREAD, 0x108, UCHAR, WaitBlockFill7) 52 C_ASSERT_FIELD(KTHREAD, 0x1B0, PVOID, TebMappedLowVa) 53 C_ASSERT_FIELD(KTHREAD, 0x1B8, struct _UMS_CONTROL_BLOCK*, Ucb) 54 //C_ASSERT_FIELD(KTHREAD, 0x108, UCHAR, WaitBlockFill8) 55 C_ASSERT_FIELD(KTHREAD, 0x1C4, SHORT, KernelApcDisable) 56 C_ASSERT_FIELD(KTHREAD, 0x1C6, SHORT, SpecialApcDisable) 57 C_ASSERT_FIELD(KTHREAD, 0x1C4, ULONG, CombinedApcDisable) 58 C_ASSERT_FIELD(KTHREAD, 0x1C8, LIST_ENTRY, QueueListEntry) 59 C_ASSERT_FIELD(KTHREAD, 0x1D8, PKTRAP_FRAME, TrapFrame) 60 C_ASSERT_FIELD(KTHREAD, 0x1E0, PVOID, FirstArgument) 61 C_ASSERT_FIELD(KTHREAD, 0x1E8, PVOID, CallbackStack) 62 C_ASSERT_FIELD(KTHREAD, 0x1E8, ULONG64, CallbackDepth) 63 C_ASSERT_FIELD(KTHREAD, 0x1F0, UCHAR, ApcStateIndex) 64 C_ASSERT_FIELD(KTHREAD, 0x1F1, CHAR, BasePriority) 65 C_ASSERT_FIELD(KTHREAD, 0x1F2, CHAR, PriorityDecrement) 66 C_ASSERT_FIELD(KTHREAD, 0x1F3, UCHAR, Preempted) 67 C_ASSERT_FIELD(KTHREAD, 0x1F4, UCHAR, AdjustReason) 68 C_ASSERT_FIELD(KTHREAD, 0x1F5, CHAR, AdjustIncrement) 69 C_ASSERT_FIELD(KTHREAD, 0x1F6, CHAR, PreviousMode) 70 C_ASSERT_FIELD(KTHREAD, 0x1F7, CHAR, Saturation) 71 C_ASSERT_FIELD(KTHREAD, 0x1F8, ULONG, SystemCallNumber) 72 C_ASSERT_FIELD(KTHREAD, 0x1FC, ULONG, FreezeCount) 73 C_ASSERT_FIELD(KTHREAD, 0x200, GROUP_AFFINITY, UserAffinity) 74 C_ASSERT_FIELD(KTHREAD, 0x210, KPROCESS*, Process) 75 C_ASSERT_FIELD(KTHREAD, 0x218, GROUP_AFFINITY, Affinity) 76 C_ASSERT_FIELD(KTHREAD, 0x228, ULONG, IdealProcessor) 77 C_ASSERT_FIELD(KTHREAD, 0x22C, ULONG, UserIdealProcessor) 78 //C_ASSERT_FIELD(KTHREAD, 0x230, KAPC_STATE*, ApcStatePointer) // type is PKAPC_STATE[2] 79 C_ASSERT_FIELD(KTHREAD, 0x240, KAPC_STATE, SavedApcState) 80 //C_ASSERT_FIELD(KTHREAD, 0x240, UCHAR, SavedApcStateFill) 81 C_ASSERT_FIELD(KTHREAD, 0x26B, UCHAR, WaitReason) 82 C_ASSERT_FIELD(KTHREAD, 0x26C, CHAR, SuspendCount) 83 C_ASSERT_FIELD(KTHREAD, 0x26D, CHAR, Spare1) 84 C_ASSERT_FIELD(KTHREAD, 0x26E, UCHAR, CodePatchInProgress) 85 C_ASSERT_FIELD(KTHREAD, 0x270, PVOID, Win32Thread) 86 C_ASSERT_FIELD(KTHREAD, 0x278, PVOID, StackBase) 87 C_ASSERT_FIELD(KTHREAD, 0x280, KAPC, SuspendApc) 88 C_ASSERT_FIELD(KTHREAD, 0x280, UCHAR, SuspendApcFill0) 89 C_ASSERT_FIELD(KTHREAD, 0x281, UCHAR, ResourceIndex) 90 //C_ASSERT_FIELD(KTHREAD, 0x280, UCHAR, SuspendApcFill1) 91 C_ASSERT_FIELD(KTHREAD, 0x283, UCHAR, QuantumReset) 92 //C_ASSERT_FIELD(KTHREAD, 0x280, UCHAR, SuspendApcFill2) 93 C_ASSERT_FIELD(KTHREAD, 0x284, ULONG, KernelTime) 94 //C_ASSERT_FIELD(KTHREAD, 0x280, UCHAR, SuspendApcFill3) 95 C_ASSERT_FIELD(KTHREAD, 0x2C0, KPRCB*, WaitPrcb) 96 //C_ASSERT_FIELD(KTHREAD, 0x280, UCHAR, SuspendApcFill4) 97 C_ASSERT_FIELD(KTHREAD, 0x2C8, PVOID, LegoData) 98 //C_ASSERT_FIELD(KTHREAD, 0x280, UCHAR, SuspendApcFill5) 99 C_ASSERT_FIELD(KTHREAD, 0x2D3, UCHAR, LargeStack) 100 C_ASSERT_FIELD(KTHREAD, 0x2D4, ULONG, UserTime) 101 C_ASSERT_FIELD(KTHREAD, 0x2D8, KSEMAPHORE, SuspendSemaphore) 102 //C_ASSERT_FIELD(KTHREAD, 0x2D8, UCHAR, SuspendSemaphorefill) 103 C_ASSERT_FIELD(KTHREAD, 0x2F4, ULONG, SListFaultCount) 104 C_ASSERT_FIELD(KTHREAD, 0x2F8, LIST_ENTRY, ThreadListEntry) 105 C_ASSERT_FIELD(KTHREAD, 0x308, LIST_ENTRY, MutantListHead) 106 C_ASSERT_FIELD(KTHREAD, 0x318, PVOID, SListFaultAddress) 107 C_ASSERT_FIELD(KTHREAD, 0x320, LONG64, ReadOperationCount) 108 C_ASSERT_FIELD(KTHREAD, 0x328, LONG64, WriteOperationCount) 109 C_ASSERT_FIELD(KTHREAD, 0x330, LONG64, OtherOperationCount) 110 C_ASSERT_FIELD(KTHREAD, 0x338, LONG64, ReadTransferCount) 111 C_ASSERT_FIELD(KTHREAD, 0x340, LONG64, WriteTransferCount) 112 C_ASSERT_FIELD(KTHREAD, 0x348, LONG64, OtherTransferCount) 113 C_ASSERT_FIELD(KTHREAD, 0x350, KTHREAD_COUNTERS*, ThreadCounters) 114 C_ASSERT_FIELD(KTHREAD, 0x358, XSTATE_SAVE*, XStateSave) 115