1 /* Version definitions */ 2 #undef NTDDI_VERSION 3 #define NTDDI_VERSION NTDDI_WS03SP1 4 #undef _WIN32_WINNT 5 #define _WIN32_WINNT _WIN32_WINNT_WS03 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, 0x010, LIST_ENTRY, MutantListHead) 17 C_ASSERT_FIELD(KTHREAD, 0x018, PVOID, InitialStack) 18 C_ASSERT_FIELD(KTHREAD, 0x01C, PVOID, StackLimit) 19 C_ASSERT_FIELD(KTHREAD, 0x020, PVOID, KernelStack) 20 C_ASSERT_FIELD(KTHREAD, 0x024, ULONG, ThreadLock) 21 C_ASSERT_FIELD(KTHREAD, 0x028, KAPC_STATE, ApcState) 22 C_ASSERT_FIELD(KTHREAD, 0x028, UCHAR[23], ApcStateFill) 23 C_ASSERT_FIELD(KTHREAD, 0x03F, UCHAR, ApcQueueable) 24 C_ASSERT_FIELD(KTHREAD, 0x040, UCHAR, NextProcessor) 25 C_ASSERT_FIELD(KTHREAD, 0x041, UCHAR, DeferredProcessor) 26 C_ASSERT_FIELD(KTHREAD, 0x042, UCHAR, AdjustReason) 27 C_ASSERT_FIELD(KTHREAD, 0x043, CHAR, AdjustIncrement) 28 C_ASSERT_FIELD(KTHREAD, 0x044, ULONG, ApcQueueLock) 29 C_ASSERT_FIELD(KTHREAD, 0x048, ULONG, ContextSwitches) 30 C_ASSERT_FIELD(KTHREAD, 0x04C, UCHAR, State) 31 C_ASSERT_FIELD(KTHREAD, 0x04D, UCHAR, NpxState) 32 C_ASSERT_FIELD(KTHREAD, 0x04E, UCHAR, WaitIrql) 33 C_ASSERT_FIELD(KTHREAD, 0x04F, CHAR, WaitMode) 34 C_ASSERT_FIELD(KTHREAD, 0x050, LONG, WaitStatus) 35 C_ASSERT_FIELD(KTHREAD, 0x054, PKWAIT_BLOCK, WaitBlockList) 36 C_ASSERT_FIELD(KTHREAD, 0x054, PKGATE, GateObject) 37 C_ASSERT_FIELD(KTHREAD, 0x058, UCHAR, Alertable) 38 C_ASSERT_FIELD(KTHREAD, 0x059, UCHAR, WaitNext) 39 C_ASSERT_FIELD(KTHREAD, 0x05A, UCHAR, WaitReason) 40 C_ASSERT_FIELD(KTHREAD, 0x05B, CHAR, Priority) 41 C_ASSERT_FIELD(KTHREAD, 0x05C, UCHAR, EnableStackSwap) 42 C_ASSERT_FIELD(KTHREAD, 0x05D, UCHAR, SwapBusy) 43 C_ASSERT_FIELD(KTHREAD, 0x05E, UCHAR[2], Alerted) 44 C_ASSERT_FIELD(KTHREAD, 0x060, LIST_ENTRY, WaitListEntry) 45 C_ASSERT_FIELD(KTHREAD, 0x060, SINGLE_LIST_ENTRY, SwapListEntry) 46 C_ASSERT_FIELD(KTHREAD, 0x068, KQUEUE*, Queue) 47 C_ASSERT_FIELD(KTHREAD, 0x06C, ULONG, WaitTime) 48 C_ASSERT_FIELD(KTHREAD, 0x070, SHORT, KernelApcDisable) 49 C_ASSERT_FIELD(KTHREAD, 0x072, SHORT, SpecialApcDisable) 50 C_ASSERT_FIELD(KTHREAD, 0x070, ULONG, CombinedApcDisable) 51 C_ASSERT_FIELD(KTHREAD, 0x074, PVOID, Teb) 52 C_ASSERT_FIELD(KTHREAD, 0x078, KTIMER, Timer) 53 C_ASSERT_FIELD(KTHREAD, 0x078, UCHAR[40], TimerFill) 54 C_ASSERT_FIELD(KTHREAD, 0x0A0, LONG, ThreadFlags) 55 C_ASSERT_FIELD(KTHREAD, 0x0A8, KWAIT_BLOCK[4], WaitBlock) 56 C_ASSERT_FIELD(KTHREAD, 0x0A8, UCHAR[23], WaitBlockFill0) 57 C_ASSERT_FIELD(KTHREAD, 0x0BF, UCHAR, SystemAffinityActive) 58 C_ASSERT_FIELD(KTHREAD, 0x0A8, UCHAR[47], WaitBlockFill1) 59 C_ASSERT_FIELD(KTHREAD, 0x0D7, CHAR, PreviousMode) 60 C_ASSERT_FIELD(KTHREAD, 0x0A8, UCHAR[71], WaitBlockFill2) 61 C_ASSERT_FIELD(KTHREAD, 0x0EF, UCHAR, ResourceIndex) 62 C_ASSERT_FIELD(KTHREAD, 0x0A8, UCHAR[95], WaitBlockFill3) 63 C_ASSERT_FIELD(KTHREAD, 0x107, UCHAR, LargeStack) 64 C_ASSERT_FIELD(KTHREAD, 0x108, LIST_ENTRY, QueueListEntry) 65 C_ASSERT_FIELD(KTHREAD, 0x110, PKTRAP_FRAME, TrapFrame) 66 C_ASSERT_FIELD(KTHREAD, 0x114, PVOID, CallbackStack) 67 C_ASSERT_FIELD(KTHREAD, 0x118, PVOID, ServiceTable) 68 C_ASSERT_FIELD(KTHREAD, 0x11C, UCHAR, ApcStateIndex) 69 C_ASSERT_FIELD(KTHREAD, 0x11D, UCHAR, IdealProcessor) 70 C_ASSERT_FIELD(KTHREAD, 0x11E, UCHAR, Preempted) 71 C_ASSERT_FIELD(KTHREAD, 0x11F, UCHAR, ProcessReadyQueue) 72 C_ASSERT_FIELD(KTHREAD, 0x120, UCHAR, KernelStackResident) 73 C_ASSERT_FIELD(KTHREAD, 0x121, CHAR, BasePriority) 74 C_ASSERT_FIELD(KTHREAD, 0x122, CHAR, PriorityDecrement) 75 C_ASSERT_FIELD(KTHREAD, 0x123, CHAR, Saturation) 76 C_ASSERT_FIELD(KTHREAD, 0x124, ULONG, UserAffinity) 77 C_ASSERT_FIELD(KTHREAD, 0x128, PKPROCESS, Process) 78 C_ASSERT_FIELD(KTHREAD, 0x12C, ULONG, Affinity) 79 C_ASSERT_FIELD(KTHREAD, 0x130, PKAPC_STATE[2], ApcStatePointer) 80 C_ASSERT_FIELD(KTHREAD, 0x138, KAPC_STATE, SavedApcState) 81 C_ASSERT_FIELD(KTHREAD, 0x138, UCHAR[23], SavedApcStateFill) 82 C_ASSERT_FIELD(KTHREAD, 0x14F, CHAR, FreezeCount) 83 C_ASSERT_FIELD(KTHREAD, 0x150, CHAR, SuspendCount) 84 C_ASSERT_FIELD(KTHREAD, 0x151, UCHAR, UserIdealProcessor) 85 C_ASSERT_FIELD(KTHREAD, 0x152, UCHAR, CalloutActive) 86 C_ASSERT_FIELD(KTHREAD, 0x153, UCHAR, Iopl) 87 88 /* TEB */ 89 C_ASSERT_FIELD(TEB, 0x000, NT_TIB, NtTib) 90 C_ASSERT_FIELD(TEB, 0x01C, PVOID, EnvironmentPointer) 91 C_ASSERT_FIELD(TEB, 0x020, CLIENT_ID, ClientId) 92 C_ASSERT_FIELD(TEB, 0x028, PVOID, ActiveRpcHandle) 93 C_ASSERT_FIELD(TEB, 0x02C, PVOID, ThreadLocalStoragePointer) 94 C_ASSERT_FIELD(TEB, 0x030, PPEB, ProcessEnvironmentBlock) 95 C_ASSERT_FIELD(TEB, 0x034, ULONG, LastErrorValue) 96 C_ASSERT_FIELD(TEB, 0x038, ULONG, CountOfOwnedCriticalSections) 97 C_ASSERT_FIELD(TEB, 0x03C, PVOID, CsrClientThread) 98 C_ASSERT_FIELD(TEB, 0x040, PVOID, Win32ThreadInfo) 99 C_ASSERT_FIELD(TEB, 0x044, ULONG[26], User32Reserved) 100 C_ASSERT_FIELD(TEB, 0x0AC, ULONG[5], UserReserved) 101 C_ASSERT_FIELD(TEB, 0x0C0, PVOID, WOW32Reserved) 102 C_ASSERT_FIELD(TEB, 0x0C4, ULONG, CurrentLocale) 103 C_ASSERT_FIELD(TEB, 0x0C8, ULONG, FpSoftwareStatusRegister) 104 C_ASSERT_FIELD(TEB, 0x0CC, PVOID[54], SystemReserved1) 105 C_ASSERT_FIELD(TEB, 0x1A4, LONG, ExceptionCode) 106 C_ASSERT_FIELD(TEB, 0x1A8, PACTIVATION_CONTEXT_STACK, ActivationContextStackPointer) 107 C_ASSERT_FIELD(TEB, 0x1AC, UCHAR[40], SpareBytes1) 108 C_ASSERT_FIELD(TEB, 0x1D4, GDI_TEB_BATCH, GdiTebBatch) 109 C_ASSERT_FIELD(TEB, 0x6B4, CLIENT_ID, RealClientId) 110 C_ASSERT_FIELD(TEB, 0x6BC, PVOID, GdiCachedProcessHandle) 111 C_ASSERT_FIELD(TEB, 0x6C0, ULONG, GdiClientPID) 112 C_ASSERT_FIELD(TEB, 0x6C4, ULONG, GdiClientTID) 113 C_ASSERT_FIELD(TEB, 0x6C8, PVOID, GdiThreadLocalInfo) 114 C_ASSERT_FIELD(TEB, 0x6CC, ULONG[62], Win32ClientInfo) 115 C_ASSERT_FIELD(TEB, 0x7C4, PVOID[233], glDispatchTable) 116 C_ASSERT_FIELD(TEB, 0xB68, ULONG[29], glReserved1) 117 C_ASSERT_FIELD(TEB, 0xBDC, PVOID, glReserved2) 118 C_ASSERT_FIELD(TEB, 0xBE0, PVOID, glSectionInfo) 119 C_ASSERT_FIELD(TEB, 0xBE4, PVOID, glSection) 120 C_ASSERT_FIELD(TEB, 0xBE8, PVOID, glTable) 121 C_ASSERT_FIELD(TEB, 0xBEC, PVOID, glCurrentRC) 122 C_ASSERT_FIELD(TEB, 0xBF0, PVOID, glContext) 123 C_ASSERT_FIELD(TEB, 0xBF4, ULONG, LastStatusValue) 124 C_ASSERT_FIELD(TEB, 0xBF8, UNICODE_STRING, StaticUnicodeString) 125 C_ASSERT_FIELD(TEB, 0xC00, WCHAR[261], StaticUnicodeBuffer) 126 C_ASSERT_FIELD(TEB, 0xE0C, PVOID, DeallocationStack) 127 C_ASSERT_FIELD(TEB, 0xE10, PVOID[64], TlsSlots) 128 C_ASSERT_FIELD(TEB, 0xF10, LIST_ENTRY, TlsLinks) 129 C_ASSERT_FIELD(TEB, 0xF18, PVOID, Vdm) 130 C_ASSERT_FIELD(TEB, 0xF1C, PVOID, ReservedForNtRpc) 131 C_ASSERT_FIELD(TEB, 0xF20, PVOID[2], DbgSsReserved) 132 C_ASSERT_FIELD(TEB, 0xF28, ULONG, HardErrorMode) 133 C_ASSERT_FIELD(TEB, 0xF2C, PVOID[14], Instrumentation) 134 C_ASSERT_FIELD(TEB, 0xF64, PVOID, SubProcessTag) 135 C_ASSERT_FIELD(TEB, 0xF68, PVOID, EtwTraceData) 136 C_ASSERT_FIELD(TEB, 0xF6C, PVOID, WinSockData) 137 C_ASSERT_FIELD(TEB, 0xF70, ULONG, GdiBatchCount) 138 C_ASSERT_FIELD(TEB, 0xF74, UCHAR, InDbgPrint) 139 C_ASSERT_FIELD(TEB, 0xF75, UCHAR, FreeStackOnTermination) 140 C_ASSERT_FIELD(TEB, 0xF76, UCHAR, HasFiberData) 141 C_ASSERT_FIELD(TEB, 0xF77, UCHAR, IdealProcessor) 142 C_ASSERT_FIELD(TEB, 0xF78, ULONG, GuaranteedStackBytes) 143 C_ASSERT_FIELD(TEB, 0xF7C, PVOID, ReservedForPerf) 144 C_ASSERT_FIELD(TEB, 0xF80, PVOID, ReservedForOle) 145 C_ASSERT_FIELD(TEB, 0xF84, ULONG, WaitingOnLoaderLock) 146 C_ASSERT_FIELD(TEB, 0xF88, ULONG, SparePointer1) 147 C_ASSERT_FIELD(TEB, 0xF8C, ULONG, SoftPatchPtr1) 148 C_ASSERT_FIELD(TEB, 0xF90, ULONG, SoftPatchPtr2) 149 C_ASSERT_FIELD(TEB, 0xF94, PVOID*, TlsExpansionSlots) 150 C_ASSERT_FIELD(TEB, 0xF98, ULONG, ImpersonationLocale) 151 C_ASSERT_FIELD(TEB, 0xF9C, ULONG, IsImpersonating) 152 C_ASSERT_FIELD(TEB, 0xFA0, PVOID, NlsCache) 153 C_ASSERT_FIELD(TEB, 0xFA4, PVOID, pShimData) 154 C_ASSERT_FIELD(TEB, 0xFA8, ULONG, HeapVirtualAffinity) 155 C_ASSERT_FIELD(TEB, 0xFAC, PVOID, CurrentTransactionHandle) 156 C_ASSERT_FIELD(TEB, 0xFB0, PTEB_ACTIVE_FRAME, ActiveFrame) 157 C_ASSERT_FIELD(TEB, 0xFB4, PVOID, FlsData) 158 C_ASSERT_FIELD(TEB, 0xFB8, UCHAR, SafeThunkCall) 159 C_ASSERT_FIELD(TEB, 0xFB9, UCHAR[3], BooleanSpare) 160