PageRenderTime 46ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 1ms

/python/helpers/pydev/pydevd_attach_to_process/winappdbg/win32/peb_teb.py

http://github.com/JetBrains/intellij-community
Python | 3435 lines | 1692 code | 72 blank | 1671 comment | 47 complexity | 6d56e5b1c3a1d599fb5dd8695c77f236 MD5 | raw file
Possible License(s): BSD-3-Clause, Apache-2.0, MPL-2.0-no-copyleft-exception, MIT, EPL-1.0, AGPL-1.0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # Copyright (c) 2009-2014, Mario Vilas
  4. # All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted provided that the following conditions are met:
  8. #
  9. # * Redistributions of source code must retain the above copyright notice,
  10. # this list of conditions and the following disclaimer.
  11. # * Redistributions in binary form must reproduce the above copyright
  12. # notice,this list of conditions and the following disclaimer in the
  13. # documentation and/or other materials provided with the distribution.
  14. # * Neither the name of the copyright holder nor the names of its
  15. # contributors may be used to endorse or promote products derived from
  16. # this software without specific prior written permission.
  17. #
  18. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  19. # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  22. # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  23. # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  24. # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  25. # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  26. # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  27. # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  28. # POSSIBILITY OF SUCH DAMAGE.
  29. """
  30. PEB and TEB structures, constants and data types.
  31. """
  32. __revision__ = "$Id$"
  33. from winappdbg.win32.defines import *
  34. from winappdbg.win32.version import os
  35. #==============================================================================
  36. # This is used later on to calculate the list of exported symbols.
  37. _all = None
  38. _all = set(vars().keys())
  39. #==============================================================================
  40. #--- PEB and TEB structures, constants and data types -------------------------
  41. # From http://www.nirsoft.net/kernel_struct/vista/CLIENT_ID.html
  42. #
  43. # typedef struct _CLIENT_ID
  44. # {
  45. # PVOID UniqueProcess;
  46. # PVOID UniqueThread;
  47. # } CLIENT_ID, *PCLIENT_ID;
  48. class CLIENT_ID(Structure):
  49. _fields_ = [
  50. ("UniqueProcess", PVOID),
  51. ("UniqueThread", PVOID),
  52. ]
  53. # From MSDN:
  54. #
  55. # typedef struct _LDR_DATA_TABLE_ENTRY {
  56. # BYTE Reserved1[2];
  57. # LIST_ENTRY InMemoryOrderLinks;
  58. # PVOID Reserved2[2];
  59. # PVOID DllBase;
  60. # PVOID EntryPoint;
  61. # PVOID Reserved3;
  62. # UNICODE_STRING FullDllName;
  63. # BYTE Reserved4[8];
  64. # PVOID Reserved5[3];
  65. # union {
  66. # ULONG CheckSum;
  67. # PVOID Reserved6;
  68. # };
  69. # ULONG TimeDateStamp;
  70. # } LDR_DATA_TABLE_ENTRY, *PLDR_DATA_TABLE_ENTRY;
  71. ##class LDR_DATA_TABLE_ENTRY(Structure):
  72. ## _fields_ = [
  73. ## ("Reserved1", BYTE * 2),
  74. ## ("InMemoryOrderLinks", LIST_ENTRY),
  75. ## ("Reserved2", PVOID * 2),
  76. ## ("DllBase", PVOID),
  77. ## ("EntryPoint", PVOID),
  78. ## ("Reserved3", PVOID),
  79. ## ("FullDllName", UNICODE_STRING),
  80. ## ("Reserved4", BYTE * 8),
  81. ## ("Reserved5", PVOID * 3),
  82. ## ("CheckSum", ULONG),
  83. ## ("TimeDateStamp", ULONG),
  84. ##]
  85. # From MSDN:
  86. #
  87. # typedef struct _PEB_LDR_DATA {
  88. # BYTE Reserved1[8];
  89. # PVOID Reserved2[3];
  90. # LIST_ENTRY InMemoryOrderModuleList;
  91. # } PEB_LDR_DATA,
  92. # *PPEB_LDR_DATA;
  93. ##class PEB_LDR_DATA(Structure):
  94. ## _fields_ = [
  95. ## ("Reserved1", BYTE),
  96. ## ("Reserved2", PVOID),
  97. ## ("InMemoryOrderModuleList", LIST_ENTRY),
  98. ##]
  99. # From http://undocumented.ntinternals.net/UserMode/Structures/RTL_USER_PROCESS_PARAMETERS.html
  100. # typedef struct _RTL_USER_PROCESS_PARAMETERS {
  101. # ULONG MaximumLength;
  102. # ULONG Length;
  103. # ULONG Flags;
  104. # ULONG DebugFlags;
  105. # PVOID ConsoleHandle;
  106. # ULONG ConsoleFlags;
  107. # HANDLE StdInputHandle;
  108. # HANDLE StdOutputHandle;
  109. # HANDLE StdErrorHandle;
  110. # UNICODE_STRING CurrentDirectoryPath;
  111. # HANDLE CurrentDirectoryHandle;
  112. # UNICODE_STRING DllPath;
  113. # UNICODE_STRING ImagePathName;
  114. # UNICODE_STRING CommandLine;
  115. # PVOID Environment;
  116. # ULONG StartingPositionLeft;
  117. # ULONG StartingPositionTop;
  118. # ULONG Width;
  119. # ULONG Height;
  120. # ULONG CharWidth;
  121. # ULONG CharHeight;
  122. # ULONG ConsoleTextAttributes;
  123. # ULONG WindowFlags;
  124. # ULONG ShowWindowFlags;
  125. # UNICODE_STRING WindowTitle;
  126. # UNICODE_STRING DesktopName;
  127. # UNICODE_STRING ShellInfo;
  128. # UNICODE_STRING RuntimeData;
  129. # RTL_DRIVE_LETTER_CURDIR DLCurrentDirectory[0x20];
  130. # } RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
  131. # kd> dt _RTL_USER_PROCESS_PARAMETERS
  132. # ntdll!_RTL_USER_PROCESS_PARAMETERS
  133. # +0x000 MaximumLength : Uint4B
  134. # +0x004 Length : Uint4B
  135. # +0x008 Flags : Uint4B
  136. # +0x00c DebugFlags : Uint4B
  137. # +0x010 ConsoleHandle : Ptr32 Void
  138. # +0x014 ConsoleFlags : Uint4B
  139. # +0x018 StandardInput : Ptr32 Void
  140. # +0x01c StandardOutput : Ptr32 Void
  141. # +0x020 StandardError : Ptr32 Void
  142. # +0x024 CurrentDirectory : _CURDIR
  143. # +0x030 DllPath : _UNICODE_STRING
  144. # +0x038 ImagePathName : _UNICODE_STRING
  145. # +0x040 CommandLine : _UNICODE_STRING
  146. # +0x048 Environment : Ptr32 Void
  147. # +0x04c StartingX : Uint4B
  148. # +0x050 StartingY : Uint4B
  149. # +0x054 CountX : Uint4B
  150. # +0x058 CountY : Uint4B
  151. # +0x05c CountCharsX : Uint4B
  152. # +0x060 CountCharsY : Uint4B
  153. # +0x064 FillAttribute : Uint4B
  154. # +0x068 WindowFlags : Uint4B
  155. # +0x06c ShowWindowFlags : Uint4B
  156. # +0x070 WindowTitle : _UNICODE_STRING
  157. # +0x078 DesktopInfo : _UNICODE_STRING
  158. # +0x080 ShellInfo : _UNICODE_STRING
  159. # +0x088 RuntimeData : _UNICODE_STRING
  160. # +0x090 CurrentDirectores : [32] _RTL_DRIVE_LETTER_CURDIR
  161. # +0x290 EnvironmentSize : Uint4B
  162. ##class RTL_USER_PROCESS_PARAMETERS(Structure):
  163. ## _fields_ = [
  164. ## ("MaximumLength", ULONG),
  165. ## ("Length", ULONG),
  166. ## ("Flags", ULONG),
  167. ## ("DebugFlags", ULONG),
  168. ## ("ConsoleHandle", PVOID),
  169. ## ("ConsoleFlags", ULONG),
  170. ## ("StandardInput", HANDLE),
  171. ## ("StandardOutput", HANDLE),
  172. ## ("StandardError", HANDLE),
  173. ## ("CurrentDirectory", CURDIR),
  174. ## ("DllPath", UNICODE_STRING),
  175. ## ("ImagePathName", UNICODE_STRING),
  176. ## ("CommandLine", UNICODE_STRING),
  177. ## ("Environment", PVOID),
  178. ## ("StartingX", ULONG),
  179. ## ("StartingY", ULONG),
  180. ## ("CountX", ULONG),
  181. ## ("CountY", ULONG),
  182. ## ("CountCharsX", ULONG),
  183. ## ("CountCharsY", ULONG),
  184. ## ("FillAttribute", ULONG),
  185. ## ("WindowFlags", ULONG),
  186. ## ("ShowWindowFlags", ULONG),
  187. ## ("WindowTitle", UNICODE_STRING),
  188. ## ("DesktopInfo", UNICODE_STRING),
  189. ## ("ShellInfo", UNICODE_STRING),
  190. ## ("RuntimeData", UNICODE_STRING),
  191. ## ("CurrentDirectores", RTL_DRIVE_LETTER_CURDIR * 32), # typo here?
  192. ##
  193. ## # Windows 2008 and Vista
  194. ## ("EnvironmentSize", ULONG),
  195. ##]
  196. ## @property
  197. ## def CurrentDirectories(self):
  198. ## return self.CurrentDirectores
  199. # From MSDN:
  200. #
  201. # typedef struct _RTL_USER_PROCESS_PARAMETERS {
  202. # BYTE Reserved1[16];
  203. # PVOID Reserved2[10];
  204. # UNICODE_STRING ImagePathName;
  205. # UNICODE_STRING CommandLine;
  206. # } RTL_USER_PROCESS_PARAMETERS,
  207. # *PRTL_USER_PROCESS_PARAMETERS;
  208. class RTL_USER_PROCESS_PARAMETERS(Structure):
  209. _fields_ = [
  210. ("Reserved1", BYTE * 16),
  211. ("Reserved2", PVOID * 10),
  212. ("ImagePathName", UNICODE_STRING),
  213. ("CommandLine", UNICODE_STRING),
  214. ("Environment", PVOID), # undocumented!
  215. #
  216. # XXX TODO
  217. # This structure should be defined with all undocumented fields for
  218. # each version of Windows, just like it's being done for PEB and TEB.
  219. #
  220. ]
  221. PPS_POST_PROCESS_INIT_ROUTINE = PVOID
  222. #from MSDN:
  223. #
  224. # typedef struct _PEB {
  225. # BYTE Reserved1[2];
  226. # BYTE BeingDebugged;
  227. # BYTE Reserved2[21];
  228. # PPEB_LDR_DATA LoaderData;
  229. # PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
  230. # BYTE Reserved3[520];
  231. # PPS_POST_PROCESS_INIT_ROUTINE PostProcessInitRoutine;
  232. # BYTE Reserved4[136];
  233. # ULONG SessionId;
  234. # } PEB;
  235. ##class PEB(Structure):
  236. ## _fields_ = [
  237. ## ("Reserved1", BYTE * 2),
  238. ## ("BeingDebugged", BYTE),
  239. ## ("Reserved2", BYTE * 21),
  240. ## ("LoaderData", PVOID, # PPEB_LDR_DATA
  241. ## ("ProcessParameters", PVOID, # PRTL_USER_PROCESS_PARAMETERS
  242. ## ("Reserved3", BYTE * 520),
  243. ## ("PostProcessInitRoutine", PPS_POST_PROCESS_INIT_ROUTINE),
  244. ## ("Reserved4", BYTE),
  245. ## ("SessionId", ULONG),
  246. ##]
  247. # from MSDN:
  248. #
  249. # typedef struct _TEB {
  250. # BYTE Reserved1[1952];
  251. # PVOID Reserved2[412];
  252. # PVOID TlsSlots[64];
  253. # BYTE Reserved3[8];
  254. # PVOID Reserved4[26];
  255. # PVOID ReservedForOle;
  256. # PVOID Reserved5[4];
  257. # PVOID TlsExpansionSlots;
  258. # } TEB,
  259. # *PTEB;
  260. ##class TEB(Structure):
  261. ## _fields_ = [
  262. ## ("Reserved1", PVOID * 1952),
  263. ## ("Reserved2", PVOID * 412),
  264. ## ("TlsSlots", PVOID * 64),
  265. ## ("Reserved3", BYTE * 8),
  266. ## ("Reserved4", PVOID * 26),
  267. ## ("ReservedForOle", PVOID),
  268. ## ("Reserved5", PVOID * 4),
  269. ## ("TlsExpansionSlots", PVOID),
  270. ##]
  271. # from http://undocumented.ntinternals.net/UserMode/Structures/LDR_MODULE.html
  272. #
  273. # typedef struct _LDR_MODULE {
  274. # LIST_ENTRY InLoadOrderModuleList;
  275. # LIST_ENTRY InMemoryOrderModuleList;
  276. # LIST_ENTRY InInitializationOrderModuleList;
  277. # PVOID BaseAddress;
  278. # PVOID EntryPoint;
  279. # ULONG SizeOfImage;
  280. # UNICODE_STRING FullDllName;
  281. # UNICODE_STRING BaseDllName;
  282. # ULONG Flags;
  283. # SHORT LoadCount;
  284. # SHORT TlsIndex;
  285. # LIST_ENTRY HashTableEntry;
  286. # ULONG TimeDateStamp;
  287. # } LDR_MODULE, *PLDR_MODULE;
  288. class LDR_MODULE(Structure):
  289. _fields_ = [
  290. ("InLoadOrderModuleList", LIST_ENTRY),
  291. ("InMemoryOrderModuleList", LIST_ENTRY),
  292. ("InInitializationOrderModuleList", LIST_ENTRY),
  293. ("BaseAddress", PVOID),
  294. ("EntryPoint", PVOID),
  295. ("SizeOfImage", ULONG),
  296. ("FullDllName", UNICODE_STRING),
  297. ("BaseDllName", UNICODE_STRING),
  298. ("Flags", ULONG),
  299. ("LoadCount", SHORT),
  300. ("TlsIndex", SHORT),
  301. ("HashTableEntry", LIST_ENTRY),
  302. ("TimeDateStamp", ULONG),
  303. ]
  304. # from http://undocumented.ntinternals.net/UserMode/Structures/PEB_LDR_DATA.html
  305. #
  306. # typedef struct _PEB_LDR_DATA {
  307. # ULONG Length;
  308. # BOOLEAN Initialized;
  309. # PVOID SsHandle;
  310. # LIST_ENTRY InLoadOrderModuleList;
  311. # LIST_ENTRY InMemoryOrderModuleList;
  312. # LIST_ENTRY InInitializationOrderModuleList;
  313. # } PEB_LDR_DATA, *PPEB_LDR_DATA;
  314. class PEB_LDR_DATA(Structure):
  315. _fields_ = [
  316. ("Length", ULONG),
  317. ("Initialized", BOOLEAN),
  318. ("SsHandle", PVOID),
  319. ("InLoadOrderModuleList", LIST_ENTRY),
  320. ("InMemoryOrderModuleList", LIST_ENTRY),
  321. ("InInitializationOrderModuleList", LIST_ENTRY),
  322. ]
  323. # From http://undocumented.ntinternals.net/UserMode/Undocumented%20Functions/NT%20Objects/Process/PEB_FREE_BLOCK.html
  324. #
  325. # typedef struct _PEB_FREE_BLOCK {
  326. # PEB_FREE_BLOCK *Next;
  327. # ULONG Size;
  328. # } PEB_FREE_BLOCK, *PPEB_FREE_BLOCK;
  329. class PEB_FREE_BLOCK(Structure):
  330. pass
  331. ##PPEB_FREE_BLOCK = POINTER(PEB_FREE_BLOCK)
  332. PPEB_FREE_BLOCK = PVOID
  333. PEB_FREE_BLOCK._fields_ = [
  334. ("Next", PPEB_FREE_BLOCK),
  335. ("Size", ULONG),
  336. ]
  337. # From http://undocumented.ntinternals.net/UserMode/Structures/RTL_DRIVE_LETTER_CURDIR.html
  338. #
  339. # typedef struct _RTL_DRIVE_LETTER_CURDIR {
  340. # USHORT Flags;
  341. # USHORT Length;
  342. # ULONG TimeStamp;
  343. # UNICODE_STRING DosPath;
  344. # } RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;
  345. class RTL_DRIVE_LETTER_CURDIR(Structure):
  346. _fields_ = [
  347. ("Flags", USHORT),
  348. ("Length", USHORT),
  349. ("TimeStamp", ULONG),
  350. ("DosPath", UNICODE_STRING),
  351. ]
  352. # From http://www.nirsoft.net/kernel_struct/vista/CURDIR.html
  353. #
  354. # typedef struct _CURDIR
  355. # {
  356. # UNICODE_STRING DosPath;
  357. # PVOID Handle;
  358. # } CURDIR, *PCURDIR;
  359. class CURDIR(Structure):
  360. _fields_ = [
  361. ("DosPath", UNICODE_STRING),
  362. ("Handle", PVOID),
  363. ]
  364. # From http://www.nirsoft.net/kernel_struct/vista/RTL_CRITICAL_SECTION_DEBUG.html
  365. #
  366. # typedef struct _RTL_CRITICAL_SECTION_DEBUG
  367. # {
  368. # WORD Type;
  369. # WORD CreatorBackTraceIndex;
  370. # PRTL_CRITICAL_SECTION CriticalSection;
  371. # LIST_ENTRY ProcessLocksList;
  372. # ULONG EntryCount;
  373. # ULONG ContentionCount;
  374. # ULONG Flags;
  375. # WORD CreatorBackTraceIndexHigh;
  376. # WORD SpareUSHORT;
  377. # } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG;
  378. #
  379. # From http://www.nirsoft.net/kernel_struct/vista/RTL_CRITICAL_SECTION.html
  380. #
  381. # typedef struct _RTL_CRITICAL_SECTION
  382. # {
  383. # PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
  384. # LONG LockCount;
  385. # LONG RecursionCount;
  386. # PVOID OwningThread;
  387. # PVOID LockSemaphore;
  388. # ULONG SpinCount;
  389. # } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
  390. #
  391. class RTL_CRITICAL_SECTION(Structure):
  392. _fields_ = [
  393. ("DebugInfo", PVOID), # PRTL_CRITICAL_SECTION_DEBUG
  394. ("LockCount", LONG),
  395. ("RecursionCount", LONG),
  396. ("OwningThread", PVOID),
  397. ("LockSemaphore", PVOID),
  398. ("SpinCount", ULONG),
  399. ]
  400. class RTL_CRITICAL_SECTION_DEBUG(Structure):
  401. _fields_ = [
  402. ("Type", WORD),
  403. ("CreatorBackTraceIndex", WORD),
  404. ("CriticalSection", PVOID), # PRTL_CRITICAL_SECTION
  405. ("ProcessLocksList", LIST_ENTRY),
  406. ("EntryCount", ULONG),
  407. ("ContentionCount", ULONG),
  408. ("Flags", ULONG),
  409. ("CreatorBackTraceIndexHigh", WORD),
  410. ("SpareUSHORT", WORD),
  411. ]
  412. PRTL_CRITICAL_SECTION = POINTER(RTL_CRITICAL_SECTION)
  413. PRTL_CRITICAL_SECTION_DEBUG = POINTER(RTL_CRITICAL_SECTION_DEBUG)
  414. PPEB_LDR_DATA = POINTER(PEB_LDR_DATA)
  415. PRTL_USER_PROCESS_PARAMETERS = POINTER(RTL_USER_PROCESS_PARAMETERS)
  416. PPEBLOCKROUTINE = PVOID
  417. # BitField
  418. ImageUsesLargePages = 1 << 0
  419. IsProtectedProcess = 1 << 1
  420. IsLegacyProcess = 1 << 2
  421. IsImageDynamicallyRelocated = 1 << 3
  422. SkipPatchingUser32Forwarders = 1 << 4
  423. # CrossProcessFlags
  424. ProcessInJob = 1 << 0
  425. ProcessInitializing = 1 << 1
  426. ProcessUsingVEH = 1 << 2
  427. ProcessUsingVCH = 1 << 3
  428. ProcessUsingFTH = 1 << 4
  429. # TracingFlags
  430. HeapTracingEnabled = 1 << 0
  431. CritSecTracingEnabled = 1 << 1
  432. # NtGlobalFlags
  433. FLG_VALID_BITS = 0x003FFFFF # not a flag
  434. FLG_STOP_ON_EXCEPTION = 0x00000001
  435. FLG_SHOW_LDR_SNAPS = 0x00000002
  436. FLG_DEBUG_INITIAL_COMMAND = 0x00000004
  437. FLG_STOP_ON_HUNG_GUI = 0x00000008
  438. FLG_HEAP_ENABLE_TAIL_CHECK = 0x00000010
  439. FLG_HEAP_ENABLE_FREE_CHECK = 0x00000020
  440. FLG_HEAP_VALIDATE_PARAMETERS = 0x00000040
  441. FLG_HEAP_VALIDATE_ALL = 0x00000080
  442. FLG_POOL_ENABLE_TAIL_CHECK = 0x00000100
  443. FLG_POOL_ENABLE_FREE_CHECK = 0x00000200
  444. FLG_POOL_ENABLE_TAGGING = 0x00000400
  445. FLG_HEAP_ENABLE_TAGGING = 0x00000800
  446. FLG_USER_STACK_TRACE_DB = 0x00001000
  447. FLG_KERNEL_STACK_TRACE_DB = 0x00002000
  448. FLG_MAINTAIN_OBJECT_TYPELIST = 0x00004000
  449. FLG_HEAP_ENABLE_TAG_BY_DLL = 0x00008000
  450. FLG_IGNORE_DEBUG_PRIV = 0x00010000
  451. FLG_ENABLE_CSRDEBUG = 0x00020000
  452. FLG_ENABLE_KDEBUG_SYMBOL_LOAD = 0x00040000
  453. FLG_DISABLE_PAGE_KERNEL_STACKS = 0x00080000
  454. FLG_HEAP_ENABLE_CALL_TRACING = 0x00100000
  455. FLG_HEAP_DISABLE_COALESCING = 0x00200000
  456. FLG_ENABLE_CLOSE_EXCEPTION = 0x00400000
  457. FLG_ENABLE_EXCEPTION_LOGGING = 0x00800000
  458. FLG_ENABLE_HANDLE_TYPE_TAGGING = 0x01000000
  459. FLG_HEAP_PAGE_ALLOCS = 0x02000000
  460. FLG_DEBUG_WINLOGON = 0x04000000
  461. FLG_ENABLE_DBGPRINT_BUFFERING = 0x08000000
  462. FLG_EARLY_CRITICAL_SECTION_EVT = 0x10000000
  463. FLG_DISABLE_DLL_VERIFICATION = 0x80000000
  464. class _PEB_NT(Structure):
  465. _pack_ = 4
  466. _fields_ = [
  467. ("InheritedAddressSpace", BOOLEAN),
  468. ("ReadImageFileExecOptions", UCHAR),
  469. ("BeingDebugged", BOOLEAN),
  470. ("BitField", UCHAR),
  471. ("Mutant", HANDLE),
  472. ("ImageBaseAddress", PVOID),
  473. ("Ldr", PVOID), # PPEB_LDR_DATA
  474. ("ProcessParameters", PVOID), # PRTL_USER_PROCESS_PARAMETERS
  475. ("SubSystemData", PVOID),
  476. ("ProcessHeap", PVOID),
  477. ("FastPebLock", PVOID),
  478. ("FastPebLockRoutine", PVOID), # PPEBLOCKROUTINE
  479. ("FastPebUnlockRoutine", PVOID), # PPEBLOCKROUTINE
  480. ("EnvironmentUpdateCount", ULONG),
  481. ("KernelCallbackTable", PVOID), # Ptr32 Ptr32 Void
  482. ("EventLogSection", PVOID),
  483. ("EventLog", PVOID),
  484. ("FreeList", PVOID), # PPEB_FREE_BLOCK
  485. ("TlsExpansionCounter", ULONG),
  486. ("TlsBitmap", PVOID),
  487. ("TlsBitmapBits", ULONG * 2),
  488. ("ReadOnlySharedMemoryBase", PVOID),
  489. ("ReadOnlySharedMemoryHeap", PVOID),
  490. ("ReadOnlyStaticServerData", PVOID), # Ptr32 Ptr32 Void
  491. ("AnsiCodePageData", PVOID),
  492. ("OemCodePageData", PVOID),
  493. ("UnicodeCaseTableData", PVOID),
  494. ("NumberOfProcessors", ULONG),
  495. ("NtGlobalFlag", ULONG),
  496. ("Spare2", BYTE * 4),
  497. ("CriticalSectionTimeout", LONGLONG), # LARGE_INTEGER
  498. ("HeapSegmentReserve", ULONG),
  499. ("HeapSegmentCommit", ULONG),
  500. ("HeapDeCommitTotalFreeThreshold", ULONG),
  501. ("HeapDeCommitFreeBlockThreshold", ULONG),
  502. ("NumberOfHeaps", ULONG),
  503. ("MaximumNumberOfHeaps", ULONG),
  504. ("ProcessHeaps", PVOID), # Ptr32 Ptr32 Void
  505. ("GdiSharedHandleTable", PVOID),
  506. ("ProcessStarterHelper", PVOID),
  507. ("GdiDCAttributeList", PVOID),
  508. ("LoaderLock", PVOID), # PRTL_CRITICAL_SECTION
  509. ("OSMajorVersion", ULONG),
  510. ("OSMinorVersion", ULONG),
  511. ("OSBuildNumber", ULONG),
  512. ("OSPlatformId", ULONG),
  513. ("ImageSubSystem", ULONG),
  514. ("ImageSubSystemMajorVersion", ULONG),
  515. ("ImageSubSystemMinorVersion", ULONG),
  516. ("ImageProcessAffinityMask", ULONG),
  517. ("GdiHandleBuffer", ULONG * 34),
  518. ("PostProcessInitRoutine", PPS_POST_PROCESS_INIT_ROUTINE),
  519. ("TlsExpansionBitmap", ULONG),
  520. ("TlsExpansionBitmapBits", BYTE * 128),
  521. ("SessionId", ULONG),
  522. ]
  523. # not really, but "dt _PEB" in w2k isn't working for me :(
  524. _PEB_2000 = _PEB_NT
  525. # +0x000 InheritedAddressSpace : UChar
  526. # +0x001 ReadImageFileExecOptions : UChar
  527. # +0x002 BeingDebugged : UChar
  528. # +0x003 SpareBool : UChar
  529. # +0x004 Mutant : Ptr32 Void
  530. # +0x008 ImageBaseAddress : Ptr32 Void
  531. # +0x00c Ldr : Ptr32 _PEB_LDR_DATA
  532. # +0x010 ProcessParameters : Ptr32 _RTL_USER_PROCESS_PARAMETERS
  533. # +0x014 SubSystemData : Ptr32 Void
  534. # +0x018 ProcessHeap : Ptr32 Void
  535. # +0x01c FastPebLock : Ptr32 _RTL_CRITICAL_SECTION
  536. # +0x020 FastPebLockRoutine : Ptr32 Void
  537. # +0x024 FastPebUnlockRoutine : Ptr32 Void
  538. # +0x028 EnvironmentUpdateCount : Uint4B
  539. # +0x02c KernelCallbackTable : Ptr32 Void
  540. # +0x030 SystemReserved : [1] Uint4B
  541. # +0x034 AtlThunkSListPtr32 : Uint4B
  542. # +0x038 FreeList : Ptr32 _PEB_FREE_BLOCK
  543. # +0x03c TlsExpansionCounter : Uint4B
  544. # +0x040 TlsBitmap : Ptr32 Void
  545. # +0x044 TlsBitmapBits : [2] Uint4B
  546. # +0x04c ReadOnlySharedMemoryBase : Ptr32 Void
  547. # +0x050 ReadOnlySharedMemoryHeap : Ptr32 Void
  548. # +0x054 ReadOnlyStaticServerData : Ptr32 Ptr32 Void
  549. # +0x058 AnsiCodePageData : Ptr32 Void
  550. # +0x05c OemCodePageData : Ptr32 Void
  551. # +0x060 UnicodeCaseTableData : Ptr32 Void
  552. # +0x064 NumberOfProcessors : Uint4B
  553. # +0x068 NtGlobalFlag : Uint4B
  554. # +0x070 CriticalSectionTimeout : _LARGE_INTEGER
  555. # +0x078 HeapSegmentReserve : Uint4B
  556. # +0x07c HeapSegmentCommit : Uint4B
  557. # +0x080 HeapDeCommitTotalFreeThreshold : Uint4B
  558. # +0x084 HeapDeCommitFreeBlockThreshold : Uint4B
  559. # +0x088 NumberOfHeaps : Uint4B
  560. # +0x08c MaximumNumberOfHeaps : Uint4B
  561. # +0x090 ProcessHeaps : Ptr32 Ptr32 Void
  562. # +0x094 GdiSharedHandleTable : Ptr32 Void
  563. # +0x098 ProcessStarterHelper : Ptr32 Void
  564. # +0x09c GdiDCAttributeList : Uint4B
  565. # +0x0a0 LoaderLock : Ptr32 Void
  566. # +0x0a4 OSMajorVersion : Uint4B
  567. # +0x0a8 OSMinorVersion : Uint4B
  568. # +0x0ac OSBuildNumber : Uint2B
  569. # +0x0ae OSCSDVersion : Uint2B
  570. # +0x0b0 OSPlatformId : Uint4B
  571. # +0x0b4 ImageSubsystem : Uint4B
  572. # +0x0b8 ImageSubsystemMajorVersion : Uint4B
  573. # +0x0bc ImageSubsystemMinorVersion : Uint4B
  574. # +0x0c0 ImageProcessAffinityMask : Uint4B
  575. # +0x0c4 GdiHandleBuffer : [34] Uint4B
  576. # +0x14c PostProcessInitRoutine : Ptr32 void
  577. # +0x150 TlsExpansionBitmap : Ptr32 Void
  578. # +0x154 TlsExpansionBitmapBits : [32] Uint4B
  579. # +0x1d4 SessionId : Uint4B
  580. # +0x1d8 AppCompatFlags : _ULARGE_INTEGER
  581. # +0x1e0 AppCompatFlagsUser : _ULARGE_INTEGER
  582. # +0x1e8 pShimData : Ptr32 Void
  583. # +0x1ec AppCompatInfo : Ptr32 Void
  584. # +0x1f0 CSDVersion : _UNICODE_STRING
  585. # +0x1f8 ActivationContextData : Ptr32 Void
  586. # +0x1fc ProcessAssemblyStorageMap : Ptr32 Void
  587. # +0x200 SystemDefaultActivationContextData : Ptr32 Void
  588. # +0x204 SystemAssemblyStorageMap : Ptr32 Void
  589. # +0x208 MinimumStackCommit : Uint4B
  590. class _PEB_XP(Structure):
  591. _pack_ = 8
  592. _fields_ = [
  593. ("InheritedAddressSpace", BOOLEAN),
  594. ("ReadImageFileExecOptions", UCHAR),
  595. ("BeingDebugged", BOOLEAN),
  596. ("SpareBool", UCHAR),
  597. ("Mutant", HANDLE),
  598. ("ImageBaseAddress", PVOID),
  599. ("Ldr", PVOID), # PPEB_LDR_DATA
  600. ("ProcessParameters", PVOID), # PRTL_USER_PROCESS_PARAMETERS
  601. ("SubSystemData", PVOID),
  602. ("ProcessHeap", PVOID),
  603. ("FastPebLock", PVOID),
  604. ("FastPebLockRoutine", PVOID),
  605. ("FastPebUnlockRoutine", PVOID),
  606. ("EnvironmentUpdateCount", DWORD),
  607. ("KernelCallbackTable", PVOID),
  608. ("SystemReserved", DWORD),
  609. ("AtlThunkSListPtr32", DWORD),
  610. ("FreeList", PVOID), # PPEB_FREE_BLOCK
  611. ("TlsExpansionCounter", DWORD),
  612. ("TlsBitmap", PVOID),
  613. ("TlsBitmapBits", DWORD * 2),
  614. ("ReadOnlySharedMemoryBase", PVOID),
  615. ("ReadOnlySharedMemoryHeap", PVOID),
  616. ("ReadOnlyStaticServerData", PVOID), # Ptr32 Ptr32 Void
  617. ("AnsiCodePageData", PVOID),
  618. ("OemCodePageData", PVOID),
  619. ("UnicodeCaseTableData", PVOID),
  620. ("NumberOfProcessors", DWORD),
  621. ("NtGlobalFlag", DWORD),
  622. ("CriticalSectionTimeout", LONGLONG), # LARGE_INTEGER
  623. ("HeapSegmentReserve", DWORD),
  624. ("HeapSegmentCommit", DWORD),
  625. ("HeapDeCommitTotalFreeThreshold", DWORD),
  626. ("HeapDeCommitFreeBlockThreshold", DWORD),
  627. ("NumberOfHeaps", DWORD),
  628. ("MaximumNumberOfHeaps", DWORD),
  629. ("ProcessHeaps", PVOID), # Ptr32 Ptr32 Void
  630. ("GdiSharedHandleTable", PVOID),
  631. ("ProcessStarterHelper", PVOID),
  632. ("GdiDCAttributeList", DWORD),
  633. ("LoaderLock", PVOID), # PRTL_CRITICAL_SECTION
  634. ("OSMajorVersion", DWORD),
  635. ("OSMinorVersion", DWORD),
  636. ("OSBuildNumber", WORD),
  637. ("OSCSDVersion", WORD),
  638. ("OSPlatformId", DWORD),
  639. ("ImageSubsystem", DWORD),
  640. ("ImageSubsystemMajorVersion", DWORD),
  641. ("ImageSubsystemMinorVersion", DWORD),
  642. ("ImageProcessAffinityMask", DWORD),
  643. ("GdiHandleBuffer", DWORD * 34),
  644. ("PostProcessInitRoutine", PPS_POST_PROCESS_INIT_ROUTINE),
  645. ("TlsExpansionBitmap", PVOID),
  646. ("TlsExpansionBitmapBits", DWORD * 32),
  647. ("SessionId", DWORD),
  648. ("AppCompatFlags", ULONGLONG), # ULARGE_INTEGER
  649. ("AppCompatFlagsUser", ULONGLONG), # ULARGE_INTEGER
  650. ("pShimData", PVOID),
  651. ("AppCompatInfo", PVOID),
  652. ("CSDVersion", UNICODE_STRING),
  653. ("ActivationContextData", PVOID), # ACTIVATION_CONTEXT_DATA
  654. ("ProcessAssemblyStorageMap", PVOID), # ASSEMBLY_STORAGE_MAP
  655. ("SystemDefaultActivationContextData", PVOID), # ACTIVATION_CONTEXT_DATA
  656. ("SystemAssemblyStorageMap", PVOID), # ASSEMBLY_STORAGE_MAP
  657. ("MinimumStackCommit", DWORD),
  658. ]
  659. # +0x000 InheritedAddressSpace : UChar
  660. # +0x001 ReadImageFileExecOptions : UChar
  661. # +0x002 BeingDebugged : UChar
  662. # +0x003 BitField : UChar
  663. # +0x003 ImageUsesLargePages : Pos 0, 1 Bit
  664. # +0x003 SpareBits : Pos 1, 7 Bits
  665. # +0x008 Mutant : Ptr64 Void
  666. # +0x010 ImageBaseAddress : Ptr64 Void
  667. # +0x018 Ldr : Ptr64 _PEB_LDR_DATA
  668. # +0x020 ProcessParameters : Ptr64 _RTL_USER_PROCESS_PARAMETERS
  669. # +0x028 SubSystemData : Ptr64 Void
  670. # +0x030 ProcessHeap : Ptr64 Void
  671. # +0x038 FastPebLock : Ptr64 _RTL_CRITICAL_SECTION
  672. # +0x040 AtlThunkSListPtr : Ptr64 Void
  673. # +0x048 SparePtr2 : Ptr64 Void
  674. # +0x050 EnvironmentUpdateCount : Uint4B
  675. # +0x058 KernelCallbackTable : Ptr64 Void
  676. # +0x060 SystemReserved : [1] Uint4B
  677. # +0x064 SpareUlong : Uint4B
  678. # +0x068 FreeList : Ptr64 _PEB_FREE_BLOCK
  679. # +0x070 TlsExpansionCounter : Uint4B
  680. # +0x078 TlsBitmap : Ptr64 Void
  681. # +0x080 TlsBitmapBits : [2] Uint4B
  682. # +0x088 ReadOnlySharedMemoryBase : Ptr64 Void
  683. # +0x090 ReadOnlySharedMemoryHeap : Ptr64 Void
  684. # +0x098 ReadOnlyStaticServerData : Ptr64 Ptr64 Void
  685. # +0x0a0 AnsiCodePageData : Ptr64 Void
  686. # +0x0a8 OemCodePageData : Ptr64 Void
  687. # +0x0b0 UnicodeCaseTableData : Ptr64 Void
  688. # +0x0b8 NumberOfProcessors : Uint4B
  689. # +0x0bc NtGlobalFlag : Uint4B
  690. # +0x0c0 CriticalSectionTimeout : _LARGE_INTEGER
  691. # +0x0c8 HeapSegmentReserve : Uint8B
  692. # +0x0d0 HeapSegmentCommit : Uint8B
  693. # +0x0d8 HeapDeCommitTotalFreeThreshold : Uint8B
  694. # +0x0e0 HeapDeCommitFreeBlockThreshold : Uint8B
  695. # +0x0e8 NumberOfHeaps : Uint4B
  696. # +0x0ec MaximumNumberOfHeaps : Uint4B
  697. # +0x0f0 ProcessHeaps : Ptr64 Ptr64 Void
  698. # +0x0f8 GdiSharedHandleTable : Ptr64 Void
  699. # +0x100 ProcessStarterHelper : Ptr64 Void
  700. # +0x108 GdiDCAttributeList : Uint4B
  701. # +0x110 LoaderLock : Ptr64 _RTL_CRITICAL_SECTION
  702. # +0x118 OSMajorVersion : Uint4B
  703. # +0x11c OSMinorVersion : Uint4B
  704. # +0x120 OSBuildNumber : Uint2B
  705. # +0x122 OSCSDVersion : Uint2B
  706. # +0x124 OSPlatformId : Uint4B
  707. # +0x128 ImageSubsystem : Uint4B
  708. # +0x12c ImageSubsystemMajorVersion : Uint4B
  709. # +0x130 ImageSubsystemMinorVersion : Uint4B
  710. # +0x138 ImageProcessAffinityMask : Uint8B
  711. # +0x140 GdiHandleBuffer : [60] Uint4B
  712. # +0x230 PostProcessInitRoutine : Ptr64 void
  713. # +0x238 TlsExpansionBitmap : Ptr64 Void
  714. # +0x240 TlsExpansionBitmapBits : [32] Uint4B
  715. # +0x2c0 SessionId : Uint4B
  716. # +0x2c8 AppCompatFlags : _ULARGE_INTEGER
  717. # +0x2d0 AppCompatFlagsUser : _ULARGE_INTEGER
  718. # +0x2d8 pShimData : Ptr64 Void
  719. # +0x2e0 AppCompatInfo : Ptr64 Void
  720. # +0x2e8 CSDVersion : _UNICODE_STRING
  721. # +0x2f8 ActivationContextData : Ptr64 _ACTIVATION_CONTEXT_DATA
  722. # +0x300 ProcessAssemblyStorageMap : Ptr64 _ASSEMBLY_STORAGE_MAP
  723. # +0x308 SystemDefaultActivationContextData : Ptr64 _ACTIVATION_CONTEXT_DATA
  724. # +0x310 SystemAssemblyStorageMap : Ptr64 _ASSEMBLY_STORAGE_MAP
  725. # +0x318 MinimumStackCommit : Uint8B
  726. # +0x320 FlsCallback : Ptr64 Ptr64 Void
  727. # +0x328 FlsListHead : _LIST_ENTRY
  728. # +0x338 FlsBitmap : Ptr64 Void
  729. # +0x340 FlsBitmapBits : [4] Uint4B
  730. # +0x350 FlsHighIndex : Uint4B
  731. class _PEB_XP_64(Structure):
  732. _pack_ = 8
  733. _fields_ = [
  734. ("InheritedAddressSpace", BOOLEAN),
  735. ("ReadImageFileExecOptions", UCHAR),
  736. ("BeingDebugged", BOOLEAN),
  737. ("BitField", UCHAR),
  738. ("Mutant", HANDLE),
  739. ("ImageBaseAddress", PVOID),
  740. ("Ldr", PVOID), # PPEB_LDR_DATA
  741. ("ProcessParameters", PVOID), # PRTL_USER_PROCESS_PARAMETERS
  742. ("SubSystemData", PVOID),
  743. ("ProcessHeap", PVOID),
  744. ("FastPebLock", PVOID), # PRTL_CRITICAL_SECTION
  745. ("AtlThunkSListPtr", PVOID),
  746. ("SparePtr2", PVOID),
  747. ("EnvironmentUpdateCount", DWORD),
  748. ("KernelCallbackTable", PVOID),
  749. ("SystemReserved", DWORD),
  750. ("SpareUlong", DWORD),
  751. ("FreeList", PVOID), # PPEB_FREE_BLOCK
  752. ("TlsExpansionCounter", DWORD),
  753. ("TlsBitmap", PVOID),
  754. ("TlsBitmapBits", DWORD * 2),
  755. ("ReadOnlySharedMemoryBase", PVOID),
  756. ("ReadOnlySharedMemoryHeap", PVOID),
  757. ("ReadOnlyStaticServerData", PVOID), # Ptr64 Ptr64 Void
  758. ("AnsiCodePageData", PVOID),
  759. ("OemCodePageData", PVOID),
  760. ("UnicodeCaseTableData", PVOID),
  761. ("NumberOfProcessors", DWORD),
  762. ("NtGlobalFlag", DWORD),
  763. ("CriticalSectionTimeout", LONGLONG), # LARGE_INTEGER
  764. ("HeapSegmentReserve", QWORD),
  765. ("HeapSegmentCommit", QWORD),
  766. ("HeapDeCommitTotalFreeThreshold", QWORD),
  767. ("HeapDeCommitFreeBlockThreshold", QWORD),
  768. ("NumberOfHeaps", DWORD),
  769. ("MaximumNumberOfHeaps", DWORD),
  770. ("ProcessHeaps", PVOID), # Ptr64 Ptr64 Void
  771. ("GdiSharedHandleTable", PVOID),
  772. ("ProcessStarterHelper", PVOID),
  773. ("GdiDCAttributeList", DWORD),
  774. ("LoaderLock", PVOID), # PRTL_CRITICAL_SECTION
  775. ("OSMajorVersion", DWORD),
  776. ("OSMinorVersion", DWORD),
  777. ("OSBuildNumber", WORD),
  778. ("OSCSDVersion", WORD),
  779. ("OSPlatformId", DWORD),
  780. ("ImageSubsystem", DWORD),
  781. ("ImageSubsystemMajorVersion", DWORD),
  782. ("ImageSubsystemMinorVersion", DWORD),
  783. ("ImageProcessAffinityMask", QWORD),
  784. ("GdiHandleBuffer", DWORD * 60),
  785. ("PostProcessInitRoutine", PPS_POST_PROCESS_INIT_ROUTINE),
  786. ("TlsExpansionBitmap", PVOID),
  787. ("TlsExpansionBitmapBits", DWORD * 32),
  788. ("SessionId", DWORD),
  789. ("AppCompatFlags", ULONGLONG), # ULARGE_INTEGER
  790. ("AppCompatFlagsUser", ULONGLONG), # ULARGE_INTEGER
  791. ("pShimData", PVOID),
  792. ("AppCompatInfo", PVOID),
  793. ("CSDVersion", UNICODE_STRING),
  794. ("ActivationContextData", PVOID), # ACTIVATION_CONTEXT_DATA
  795. ("ProcessAssemblyStorageMap", PVOID), # ASSEMBLY_STORAGE_MAP
  796. ("SystemDefaultActivationContextData", PVOID), # ACTIVATION_CONTEXT_DATA
  797. ("SystemAssemblyStorageMap", PVOID), # ASSEMBLY_STORAGE_MAP
  798. ("MinimumStackCommit", QWORD),
  799. ("FlsCallback", PVOID), # Ptr64 Ptr64 Void
  800. ("FlsListHead", LIST_ENTRY),
  801. ("FlsBitmap", PVOID),
  802. ("FlsBitmapBits", DWORD * 4),
  803. ("FlsHighIndex", DWORD),
  804. ]
  805. # +0x000 InheritedAddressSpace : UChar
  806. # +0x001 ReadImageFileExecOptions : UChar
  807. # +0x002 BeingDebugged : UChar
  808. # +0x003 BitField : UChar
  809. # +0x003 ImageUsesLargePages : Pos 0, 1 Bit
  810. # +0x003 SpareBits : Pos 1, 7 Bits
  811. # +0x004 Mutant : Ptr32 Void
  812. # +0x008 ImageBaseAddress : Ptr32 Void
  813. # +0x00c Ldr : Ptr32 _PEB_LDR_DATA
  814. # +0x010 ProcessParameters : Ptr32 _RTL_USER_PROCESS_PARAMETERS
  815. # +0x014 SubSystemData : Ptr32 Void
  816. # +0x018 ProcessHeap : Ptr32 Void
  817. # +0x01c FastPebLock : Ptr32 _RTL_CRITICAL_SECTION
  818. # +0x020 AtlThunkSListPtr : Ptr32 Void
  819. # +0x024 SparePtr2 : Ptr32 Void
  820. # +0x028 EnvironmentUpdateCount : Uint4B
  821. # +0x02c KernelCallbackTable : Ptr32 Void
  822. # +0x030 SystemReserved : [1] Uint4B
  823. # +0x034 SpareUlong : Uint4B
  824. # +0x038 FreeList : Ptr32 _PEB_FREE_BLOCK
  825. # +0x03c TlsExpansionCounter : Uint4B
  826. # +0x040 TlsBitmap : Ptr32 Void
  827. # +0x044 TlsBitmapBits : [2] Uint4B
  828. # +0x04c ReadOnlySharedMemoryBase : Ptr32 Void
  829. # +0x050 ReadOnlySharedMemoryHeap : Ptr32 Void
  830. # +0x054 ReadOnlyStaticServerData : Ptr32 Ptr32 Void
  831. # +0x058 AnsiCodePageData : Ptr32 Void
  832. # +0x05c OemCodePageData : Ptr32 Void
  833. # +0x060 UnicodeCaseTableData : Ptr32 Void
  834. # +0x064 NumberOfProcessors : Uint4B
  835. # +0x068 NtGlobalFlag : Uint4B
  836. # +0x070 CriticalSectionTimeout : _LARGE_INTEGER
  837. # +0x078 HeapSegmentReserve : Uint4B
  838. # +0x07c HeapSegmentCommit : Uint4B
  839. # +0x080 HeapDeCommitTotalFreeThreshold : Uint4B
  840. # +0x084 HeapDeCommitFreeBlockThreshold : Uint4B
  841. # +0x088 NumberOfHeaps : Uint4B
  842. # +0x08c MaximumNumberOfHeaps : Uint4B
  843. # +0x090 ProcessHeaps : Ptr32 Ptr32 Void
  844. # +0x094 GdiSharedHandleTable : Ptr32 Void
  845. # +0x098 ProcessStarterHelper : Ptr32 Void
  846. # +0x09c GdiDCAttributeList : Uint4B
  847. # +0x0a0 LoaderLock : Ptr32 _RTL_CRITICAL_SECTION
  848. # +0x0a4 OSMajorVersion : Uint4B
  849. # +0x0a8 OSMinorVersion : Uint4B
  850. # +0x0ac OSBuildNumber : Uint2B
  851. # +0x0ae OSCSDVersion : Uint2B
  852. # +0x0b0 OSPlatformId : Uint4B
  853. # +0x0b4 ImageSubsystem : Uint4B
  854. # +0x0b8 ImageSubsystemMajorVersion : Uint4B
  855. # +0x0bc ImageSubsystemMinorVersion : Uint4B
  856. # +0x0c0 ImageProcessAffinityMask : Uint4B
  857. # +0x0c4 GdiHandleBuffer : [34] Uint4B
  858. # +0x14c PostProcessInitRoutine : Ptr32 void
  859. # +0x150 TlsExpansionBitmap : Ptr32 Void
  860. # +0x154 TlsExpansionBitmapBits : [32] Uint4B
  861. # +0x1d4 SessionId : Uint4B
  862. # +0x1d8 AppCompatFlags : _ULARGE_INTEGER
  863. # +0x1e0 AppCompatFlagsUser : _ULARGE_INTEGER
  864. # +0x1e8 pShimData : Ptr32 Void
  865. # +0x1ec AppCompatInfo : Ptr32 Void
  866. # +0x1f0 CSDVersion : _UNICODE_STRING
  867. # +0x1f8 ActivationContextData : Ptr32 _ACTIVATION_CONTEXT_DATA
  868. # +0x1fc ProcessAssemblyStorageMap : Ptr32 _ASSEMBLY_STORAGE_MAP
  869. # +0x200 SystemDefaultActivationContextData : Ptr32 _ACTIVATION_CONTEXT_DATA
  870. # +0x204 SystemAssemblyStorageMap : Ptr32 _ASSEMBLY_STORAGE_MAP
  871. # +0x208 MinimumStackCommit : Uint4B
  872. # +0x20c FlsCallback : Ptr32 Ptr32 Void
  873. # +0x210 FlsListHead : _LIST_ENTRY
  874. # +0x218 FlsBitmap : Ptr32 Void
  875. # +0x21c FlsBitmapBits : [4] Uint4B
  876. # +0x22c FlsHighIndex : Uint4B
  877. class _PEB_2003(Structure):
  878. _pack_ = 8
  879. _fields_ = [
  880. ("InheritedAddressSpace", BOOLEAN),
  881. ("ReadImageFileExecOptions", UCHAR),
  882. ("BeingDebugged", BOOLEAN),
  883. ("BitField", UCHAR),
  884. ("Mutant", HANDLE),
  885. ("ImageBaseAddress", PVOID),
  886. ("Ldr", PVOID), # PPEB_LDR_DATA
  887. ("ProcessParameters", PVOID), # PRTL_USER_PROCESS_PARAMETERS
  888. ("SubSystemData", PVOID),
  889. ("ProcessHeap", PVOID),
  890. ("FastPebLock", PVOID), # PRTL_CRITICAL_SECTION
  891. ("AtlThunkSListPtr", PVOID),
  892. ("SparePtr2", PVOID),
  893. ("EnvironmentUpdateCount", DWORD),
  894. ("KernelCallbackTable", PVOID),
  895. ("SystemReserved", DWORD),
  896. ("SpareUlong", DWORD),
  897. ("FreeList", PVOID), # PPEB_FREE_BLOCK
  898. ("TlsExpansionCounter", DWORD),
  899. ("TlsBitmap", PVOID),
  900. ("TlsBitmapBits", DWORD * 2),
  901. ("ReadOnlySharedMemoryBase", PVOID),
  902. ("ReadOnlySharedMemoryHeap", PVOID),
  903. ("ReadOnlyStaticServerData", PVOID), # Ptr32 Ptr32 Void
  904. ("AnsiCodePageData", PVOID),
  905. ("OemCodePageData", PVOID),
  906. ("UnicodeCaseTableData", PVOID),
  907. ("NumberOfProcessors", DWORD),
  908. ("NtGlobalFlag", DWORD),
  909. ("CriticalSectionTimeout", LONGLONG), # LARGE_INTEGER
  910. ("HeapSegmentReserve", DWORD),
  911. ("HeapSegmentCommit", DWORD),
  912. ("HeapDeCommitTotalFreeThreshold", DWORD),
  913. ("HeapDeCommitFreeBlockThreshold", DWORD),
  914. ("NumberOfHeaps", DWORD),
  915. ("MaximumNumberOfHeaps", DWORD),
  916. ("ProcessHeaps", PVOID), # Ptr32 Ptr32 Void
  917. ("GdiSharedHandleTable", PVOID),
  918. ("ProcessStarterHelper", PVOID),
  919. ("GdiDCAttributeList", DWORD),
  920. ("LoaderLock", PVOID), # PRTL_CRITICAL_SECTION
  921. ("OSMajorVersion", DWORD),
  922. ("OSMinorVersion", DWORD),
  923. ("OSBuildNumber", WORD),
  924. ("OSCSDVersion", WORD),
  925. ("OSPlatformId", DWORD),
  926. ("ImageSubsystem", DWORD),
  927. ("ImageSubsystemMajorVersion", DWORD),
  928. ("ImageSubsystemMinorVersion", DWORD),
  929. ("ImageProcessAffinityMask", DWORD),
  930. ("GdiHandleBuffer", DWORD * 34),
  931. ("PostProcessInitRoutine", PPS_POST_PROCESS_INIT_ROUTINE),
  932. ("TlsExpansionBitmap", PVOID),
  933. ("TlsExpansionBitmapBits", DWORD * 32),
  934. ("SessionId", DWORD),
  935. ("AppCompatFlags", ULONGLONG), # ULARGE_INTEGER
  936. ("AppCompatFlagsUser", ULONGLONG), # ULARGE_INTEGER
  937. ("pShimData", PVOID),
  938. ("AppCompatInfo", PVOID),
  939. ("CSDVersion", UNICODE_STRING),
  940. ("ActivationContextData", PVOID), # ACTIVATION_CONTEXT_DATA
  941. ("ProcessAssemblyStorageMap", PVOID), # ASSEMBLY_STORAGE_MAP
  942. ("SystemDefaultActivationContextData", PVOID), # ACTIVATION_CONTEXT_DATA
  943. ("SystemAssemblyStorageMap", PVOID), # ASSEMBLY_STORAGE_MAP
  944. ("MinimumStackCommit", QWORD),
  945. ("FlsCallback", PVOID), # Ptr32 Ptr32 Void
  946. ("FlsListHead", LIST_ENTRY),
  947. ("FlsBitmap", PVOID),
  948. ("FlsBitmapBits", DWORD * 4),
  949. ("FlsHighIndex", DWORD),
  950. ]
  951. _PEB_2003_64 = _PEB_XP_64
  952. _PEB_2003_R2 = _PEB_2003
  953. _PEB_2003_R2_64 = _PEB_2003_64
  954. # +0x000 InheritedAddressSpace : UChar
  955. # +0x001 ReadImageFileExecOptions : UChar
  956. # +0x002 BeingDebugged : UChar
  957. # +0x003 BitField : UChar
  958. # +0x003 ImageUsesLargePages : Pos 0, 1 Bit
  959. # +0x003 IsProtectedProcess : Pos 1, 1 Bit
  960. # +0x003 IsLegacyProcess : Pos 2, 1 Bit
  961. # +0x003 IsImageDynamicallyRelocated : Pos 3, 1 Bit
  962. # +0x003 SkipPatchingUser32Forwarders : Pos 4, 1 Bit
  963. # +0x003 SpareBits : Pos 5, 3 Bits
  964. # +0x004 Mutant : Ptr32 Void
  965. # +0x008 ImageBaseAddress : Ptr32 Void
  966. # +0x00c Ldr : Ptr32 _PEB_LDR_DATA
  967. # +0x010 ProcessParameters : Ptr32 _RTL_USER_PROCESS_PARAMETERS
  968. # +0x014 SubSystemData : Ptr32 Void
  969. # +0x018 ProcessHeap : Ptr32 Void
  970. # +0x01c FastPebLock : Ptr32 _RTL_CRITICAL_SECTION
  971. # +0x020 AtlThunkSListPtr : Ptr32 Void
  972. # +0x024 IFEOKey : Ptr32 Void
  973. # +0x028 CrossProcessFlags : Uint4B
  974. # +0x028 ProcessInJob : Pos 0, 1 Bit
  975. # +0x028 ProcessInitializing : Pos 1, 1 Bit
  976. # +0x028 ProcessUsingVEH : Pos 2, 1 Bit
  977. # +0x028 ProcessUsingVCH : Pos 3, 1 Bit
  978. # +0x028 ReservedBits0 : Pos 4, 28 Bits
  979. # +0x02c KernelCallbackTable : Ptr32 Void
  980. # +0x02c UserSharedInfoPtr : Ptr32 Void
  981. # +0x030 SystemReserved : [1] Uint4B
  982. # +0x034 SpareUlong : Uint4B
  983. # +0x038 SparePebPtr0 : Uint4B
  984. # +0x03c TlsExpansionCounter : Uint4B
  985. # +0x040 TlsBitmap : Ptr32 Void
  986. # +0x044 TlsBitmapBits : [2] Uint4B
  987. # +0x04c ReadOnlySharedMemoryBase : Ptr32 Void
  988. # +0x050 HotpatchInformation : Ptr32 Void
  989. # +0x054 ReadOnlyStaticServerData : Ptr32 Ptr32 Void
  990. # +0x058 AnsiCodePageData : Ptr32 Void
  991. # +0x05c OemCodePageData : Ptr32 Void
  992. # +0x060 UnicodeCaseTableData : Ptr32 Void
  993. # +0x064 NumberOfProcessors : Uint4B
  994. # +0x068 NtGlobalFlag : Uint4B
  995. # +0x070 CriticalSectionTimeout : _LARGE_INTEGER
  996. # +0x078 HeapSegmentReserve : Uint4B
  997. # +0x07c HeapSegmentCommit : Uint4B
  998. # +0x080 HeapDeCommitTotalFreeThreshold : Uint4B
  999. # +0x084 HeapDeCommitFreeBlockThreshold : Uint4B
  1000. # +0x088 NumberOfHeaps : Uint4B
  1001. # +0x08c MaximumNumberOfHeaps : Uint4B
  1002. # +0x090 ProcessHeaps : Ptr32 Ptr32 Void
  1003. # +0x094 GdiSharedHandleTable : Ptr32 Void
  1004. # +0x098 ProcessStarterHelper : Ptr32 Void
  1005. # +0x09c GdiDCAttributeList : Uint4B
  1006. # +0x0a0 LoaderLock : Ptr32 _RTL_CRITICAL_SECTION
  1007. # +0x0a4 OSMajorVersion : Uint4B
  1008. # +0x0a8 OSMinorVersion : Uint4B
  1009. # +0x0ac OSBuildNumber : Uint2B
  1010. # +0x0ae OSCSDVersion : Uint2B
  1011. # +0x0b0 OSPlatformId : Uint4B
  1012. # +0x0b4 ImageSubsystem : Uint4B
  1013. # +0x0b8 ImageSubsystemMajorVersion : Uint4B
  1014. # +0x0bc ImageSubsystemMinorVersion : Uint4B
  1015. # +0x0c0 ActiveProcessAffinityMask : Uint4B
  1016. # +0x0c4 GdiHandleBuffer : [34] Uint4B
  1017. # +0x14c PostProcessInitRoutine : Ptr32 void
  1018. # +0x150 TlsExpansionBitmap : Ptr32 Void
  1019. # +0x154 TlsExpansionBitmapBits : [32] Uint4B
  1020. # +0x1d4 SessionId : Uint4B
  1021. # +0x1d8 AppCompatFlags : _ULARGE_INTEGER
  1022. # +0x1e0 AppCompatFlagsUser : _ULARGE_INTEGER
  1023. # +0x1e8 pShimData : Ptr32 Void
  1024. # +0x1ec AppCompatInfo : Ptr32 Void
  1025. # +0x1f0 CSDVersion : _UNICODE_STRING
  1026. # +0x1f8 ActivationContextData : Ptr32 _ACTIVATION_CONTEXT_DATA
  1027. # +0x1fc ProcessAssemblyStorageMap : Ptr32 _ASSEMBLY_STORAGE_MAP
  1028. # +0x200 SystemDefaultActivationContextData : Ptr32 _ACTIVATION_CONTEXT_DATA
  1029. # +0x204 SystemAssemblyStorageMap : Ptr32 _ASSEMBLY_STORAGE_MAP
  1030. # +0x208 MinimumStackCommit : Uint4B
  1031. # +0x20c FlsCallback : Ptr32 _FLS_CALLBACK_INFO
  1032. # +0x210 FlsListHead : _LIST_ENTRY
  1033. # +0x218 FlsBitmap : Ptr32 Void
  1034. # +0x21c FlsBitmapBits : [4] Uint4B
  1035. # +0x22c FlsHighIndex : Uint4B
  1036. # +0x230 WerRegistrationData : Ptr32 Void
  1037. # +0x234 WerShipAssertPtr : Ptr32 Void
  1038. class _PEB_2008(Structure):
  1039. _pack_ = 8
  1040. _fields_ = [
  1041. ("InheritedAddressSpace", BOOLEAN),
  1042. ("ReadImageFileExecOptions", UCHAR),
  1043. ("BeingDebugged", BOOLEAN),
  1044. ("BitField", UCHAR),
  1045. ("Mutant", HANDLE),
  1046. ("ImageBaseAddress", PVOID),
  1047. ("Ldr", PVOID), # PPEB_LDR_DATA
  1048. ("ProcessParameters", PVOID), # PRTL_USER_PROCESS_PARAMETERS
  1049. ("SubSystemData", PVOID),
  1050. ("ProcessHeap", PVOID),
  1051. ("FastPebLock", PVOID), # PRTL_CRITICAL_SECTION
  1052. ("AtlThunkSListPtr", PVOID),
  1053. ("IFEOKey", PVOID),
  1054. ("CrossProcessFlags", DWORD),
  1055. ("KernelCallbackTable", PVOID),
  1056. ("SystemReserved", DWORD),
  1057. ("SpareUlong", DWORD),
  1058. ("SparePebPtr0", PVOID),
  1059. ("TlsExpansionCounter", DWORD),
  1060. ("TlsBitmap", PVOID),
  1061. ("TlsBitmapBits", DWORD * 2),
  1062. ("ReadOnlySharedMemoryBase", PVOID),
  1063. ("HotpatchInformation", PVOID),
  1064. ("ReadOnlyStaticServerData", PVOID), # Ptr32 Ptr32 Void
  1065. ("AnsiCodePageData", PVOID),
  1066. ("OemCodePageData", PVOID),
  1067. ("UnicodeCaseTableData", PVOID),
  1068. ("NumberOfProcessors", DWORD),
  1069. ("NtGlobalFlag", DWORD),
  1070. ("CriticalSectionTimeout", LONGLONG), # LARGE_INTEGER
  1071. ("HeapSegmentReserve", DWORD),
  1072. ("HeapSegmentCommit", DWORD),
  1073. ("HeapDeCommitTotalFreeThreshold", DWORD),
  1074. ("HeapDeCommitFreeBlockThreshold", DWORD),
  1075. ("NumberOfHeaps", DWORD),
  1076. ("MaximumNumberOfHeaps", DWORD),
  1077. ("ProcessHeaps", PVOID), # Ptr32 Ptr32 Void
  1078. ("GdiSharedHandleTable", PVOID),
  1079. ("ProcessStarterHelper", PVOID),
  1080. ("GdiDCAttributeList", DWORD),
  1081. ("LoaderLock", PVOID), # PRTL_CRITICAL_SECTION
  1082. ("OSMajorVersion", DWORD),
  1083. ("OSMinorVersion", DWORD),
  1084. ("OSBuildNumber", WORD),
  1085. ("OSCSDVersion", WORD),
  1086. ("OSPlatformId", DWORD),
  1087. ("ImageSubsystem", DWORD),
  1088. ("ImageSubsystemMajorVersion", DWORD),
  1089. ("ImageSubsystemMinorVersion", DWORD),
  1090. ("ActiveProcessAffinityMask", DWORD),
  1091. ("GdiHandleBuffer", DWORD * 34),
  1092. ("PostProcessInitRoutine", PPS_POST_PROCESS_INIT_ROUTINE),
  1093. ("TlsExpansionBitmap", PVOID),
  1094. ("TlsExpansionBitmapBits", DWORD * 32),
  1095. ("SessionId", DWORD),
  1096. ("AppCompatFlags", ULONGLONG), # ULARGE_INTEGER
  1097. ("AppCompatFlagsUser", ULONGLONG), # ULARGE_INTEGER
  1098. ("pShimData", PVOID),
  1099. ("AppCompatInfo", PVOID),
  1100. ("CSDVersion", UNICODE_STRING),
  1101. ("ActivationContextData", PVOID), # ACTIVATION_CONTEXT_DATA
  1102. ("ProcessAssemblyStorageMap", PVOID), # ASSEMBLY_STORAGE_MAP
  1103. ("SystemDefaultActivationContextData", PVOID), # ACTIVATION_CONTEXT_DATA
  1104. ("SystemAssemblyStorageMap", PVOID), # ASSEMBLY_STORAGE_MAP
  1105. ("MinimumStackCommit", DWORD),
  1106. ("FlsCallback", PVOID), # PFLS_CALLBACK_INFO
  1107. ("FlsListHead", LIST_ENTRY),
  1108. ("FlsBitmap", PVOID),
  1109. ("FlsBitmapBits", DWORD * 4),
  1110. ("FlsHighIndex", DWORD),
  1111. ("WerRegistrationData", PVOID),
  1112. ("WerShipAssertPtr", PVOID),
  1113. ]
  1114. def __get_UserSharedInfoPtr(self):
  1115. return self.KernelCallbackTable
  1116. def __set_UserSharedInfoPtr(self, value):
  1117. self.KernelCallbackTable = value
  1118. UserSharedInfoPtr = property(__get_UserSharedInfoPtr, __set_UserSharedInfoPtr)
  1119. # +0x000 InheritedAddressSpace : UChar
  1120. # +0x001 ReadImageFileExecOptions : UChar
  1121. # +0x002 BeingDebugged : UChar
  1122. # +0x003 BitField : UChar
  1123. # +0x003 ImageUsesLargePages : Pos 0, 1 Bit
  1124. # +0x003 IsProtectedProcess : Pos 1, 1 Bit
  1125. # +0x003 IsLegacyProcess : Pos 2, 1 Bit
  1126. # +0x003 IsImageDynamicallyRelocated : Pos 3, 1 Bit
  1127. # +0x003 SkipPatchingUser32Forwarders : Pos 4, 1 Bit
  1128. # +0x003 SpareBits : Pos 5, 3 Bits
  1129. # +0x008 Mutant : Ptr64 Void
  1130. # +0x010 ImageBaseAddress : Ptr64 Void
  1131. # +0x018 Ldr : Ptr64 _PEB_LDR_DATA
  1132. # +0x020 ProcessParameters : Ptr64 _RTL_USER_PROCESS_PARAMETERS
  1133. # +0x028 SubSystemData : Ptr64 Void
  1134. # +0x030 ProcessHeap : Ptr64 Void
  1135. # +0x038 FastPebLock : Ptr64 _RTL_CRITICAL_SECTION
  1136. # +0x040 AtlThunkSListPtr : Ptr64 Void
  1137. # +0x048 IFEOKey : Ptr64 Void
  1138. # +0x050 CrossProcessFlags : Uint4B
  1139. # +0x050 ProcessInJob : Pos 0, 1 Bit
  1140. # +0x050 ProcessInitializing : Pos 1, 1 Bit
  1141. # +0x050 ProcessUsingVEH : Pos 2, 1 Bit
  1142. # +0x050 ProcessUsingVCH : Pos 3, 1 Bit
  1143. # +0x050 ReservedBits0 : Pos 4, 28 Bits
  1144. # +0x058 KernelCallbackTable : Ptr64 Void
  1145. # +0x058 UserSharedInfoPtr : Ptr64 Void
  1146. # +0x060 SystemReserved : [1] Uint4B
  1147. # +0x064 SpareUlong : Uint4B
  1148. # +0x068 SparePebPtr0 : Uint8B
  1149. # +0x070 TlsExpansionCounter : Uint4B
  1150. # +0x078 TlsBitmap : Ptr64 Void
  1151. # +0x080 TlsBitmapBits : [2] Uint4B
  1152. # +0x088 ReadOnlySharedMemoryBase : Ptr64 Void
  1153. # +0x090 HotpatchInformation : Ptr64 Void
  1154. # +0x098 ReadOnlyStaticServerData : Ptr64 Ptr64 Void
  1155. # +0x0a0 AnsiCodePageData : Ptr64 Void
  1156. # +0x0a8 OemCodePageData : Ptr64 Void
  1157. # +0x0b0 UnicodeCaseTableData : Ptr64 Void
  1158. # +0x0b8 NumberOfProcessors : Uint4B
  1159. # +0x0bc NtGlobalFlag : Uint4B
  1160. # +0x0c0 CriticalSectionTimeout : _LARGE_INTEGER
  1161. # +0x0c8 HeapSegmentReserve : Uint8B
  1162. # +0x0d0 HeapSegmentCommit : Uint8B
  1163. # +0x0d8 HeapDeCommitTotalFreeThreshold : Uint8B
  1164. # +0x0e0 HeapDeCommitFreeBlockThreshold : Uint8B
  1165. # +0x0e8 NumberOfHeaps : Uint4B
  1166. # +0x0ec MaximumNumberOfHeaps : Uint4B
  1167. # +0x0f0 ProcessHeaps : Ptr64 Ptr64 Void
  1168. # +0x0f8 GdiSharedHandleTable : Ptr64 Void
  1169. # +0x100 ProcessStarterHelper : Ptr64 Void
  1170. # +0x108 GdiDCAttributeList : Uint4B
  1171. # +0x110 LoaderLock : Ptr64 _RTL_CRITICAL_SECTION
  1172. # +0x118 OSMajorVersion : Uint4B
  1173. # +0x11c OSMinorVersion : Uint4B
  1174. # +0x120 OSBuildNumber : Uint2B
  1175. # +0x122 OSCSDVersion : Uint2B
  1176. # +0x124 OSPlatformId : Uint4B
  1177. # +0x128 ImageSubsystem : Uint4B
  1178. # +0x12c ImageSubsystemMajorVersion : Uint4B
  1179. # +0x130 ImageSubsystemMinorVersion : Uint4B
  1180. # +0x138 ActiveProcessAffinityMask : Uint8B
  1181. # +0x140 GdiHandleBuffer : [60] Uint4B
  1182. # +0x230 PostProcessInitRoutine : Ptr64 void
  1183. # +0x238 TlsExpansionBitmap : Ptr64 Void
  1184. # +0x240 TlsExpansionBitmapBits : [32] Uint4B
  1185. # +0x2c0 SessionId : Uint4B
  1186. # +0x2c8 AppCompatFlags : _ULARGE_INTEGER
  1187. # +0x2d0 AppCompatFlagsUser : _ULARGE_INTEGER
  1188. # +0x2d8 pShimData : Ptr64 Void
  1189. # +0x2e0 AppCompatInfo : Ptr64 Void
  1190. # +0x2e8 CSDVersion : _UNICODE_STRING
  1191. # +0x2f8 ActivationContextData : Ptr64 _ACTIVATION_CONTEXT_DATA
  1192. # +0x300 ProcessAssemblyStorageMap : Ptr64 _ASSEMBLY_STORAGE_MAP
  1193. # +0x308 SystemDefaultActivationContextData : Ptr64 _ACTIVATION_CONTEXT_DATA
  1194. # +0x310 SystemAssemblyStorageMap : Ptr64 _ASSEMBLY_STORAGE_MAP
  1195. # +0x318 MinimumStackCommit : Uint8B
  1196. # +0x320 FlsCallback : Ptr64 _FLS_CALLBACK_INFO
  1197. # +0x328 FlsListHead : _LIST_ENTRY
  1198. # +0x338 FlsBitmap : Ptr64 Void
  1199. # +0x340 FlsBitmapBits : [4] Uint4B
  1200. # +0x350 FlsHighIndex : Uint4B
  1201. # +0x358 WerRegistrationData : Ptr64 Void
  1202. # +0x360 WerShipAssertPtr : Ptr64 Void
  1203. class _PEB_2008_64(Structure):
  1204. _pack_ = 8
  1205. _fields_ = [
  1206. ("InheritedAddressSpace", BOOLEAN),
  1207. ("ReadImageFileExecOptions", UCHAR),
  1208. ("BeingDebugged", BOOLEAN),
  1209. ("BitField", UCHAR),
  1210. ("Mutant", HANDLE),
  1211. ("ImageBaseAddress", PVOID),
  1212. ("Ldr", PVOID), # PPEB_LDR_DATA
  1213. ("ProcessParameters", PVOID), # PRTL_USER_PROCESS_PARAMETERS
  1214. ("SubSystemData", PVOID),
  1215. ("ProcessHeap", PVOID),
  1216. ("FastPebLock", PVOID), # PRTL_CRITICAL_SECTION
  1217. ("AtlThunkSListPtr", PVOID),
  1218. ("IFEOKey", PVOID),
  1219. ("CrossProcessFlags", DWORD),
  1220. ("KernelCallbackTable", PVOID),
  1221. ("SystemReserved", DWORD),
  1222. ("SpareUlong", DWORD),
  1223. ("SparePebPtr0", PVOID),
  1224. ("TlsExpansionCounter", DWORD),
  1225. ("TlsBitmap", PVOID),
  1226. ("TlsBitmapBits", DWORD * 2),
  1227. ("ReadOnlySharedMemoryBase", PVOID),
  1228. ("HotpatchInformation", PVOID),
  1229. ("ReadOnlyStaticServerData", PVOID), # Ptr64 Ptr64 Void
  1230. ("AnsiCodePageData", PVOID),
  1231. ("OemCodePageData", PVOID),
  1232. ("UnicodeCaseTableData", PVOID),
  1233. ("NumberOfProcessors", DWORD),
  1234. ("NtGlobalFlag", DWORD),
  1235. ("CriticalSectionTimeout", LONGLONG), # LARGE_INTEGER
  1236. ("HeapSegmentReserve", QWORD),
  1237. ("HeapSegmentCommit", QWORD),
  1238. ("HeapDeCommitTotalFreeThreshold", QWORD),
  1239. ("HeapDeCommitFreeBlockThreshold", QWORD),
  1240. ("NumberOfHeaps", DWORD),
  1241. ("MaximumNumberOfHeaps", DWORD),
  1242. ("ProcessHeaps", PVOID), # Ptr64 Ptr64 Void
  1243. ("GdiSharedHandleTable", PVOID),
  1244. ("ProcessStarterHelper", PVOID),
  1245. ("GdiDCAttributeList", DWORD),
  1246. ("LoaderLock", PVOID), # PRTL_CRITICAL_SECTION
  1247. ("OSMajorVersion", DWORD),
  1248. ("OSMinorVersion", DWORD),
  1249. ("OSBuildNumber", WORD),
  1250. ("OSCSDVersion", WORD),
  1251. ("OSPlatformId", DWORD),
  1252. ("ImageSubsystem", DWORD),
  1253. ("ImageSubsystemMajorVersion", DWORD),
  1254. ("ImageSubsystemMinorVersion", DWORD),
  1255. ("ActiveProcessAffinityMask", QWORD),
  1256. ("GdiHandleBuffer", DWORD * 60),
  1257. ("PostProcessInitRoutine", PPS_POST_PROCESS_INIT_ROUTINE),
  1258. ("TlsExpansionBitmap", PVOID),
  1259. ("TlsExpansionBitmapBits", DWORD * 32),
  1260. ("SessionId", DWORD),
  1261. ("AppCompatFlags", ULONGLONG), # ULARGE_INTEGER
  1262. ("AppCompatFlagsUser", ULONGLONG), # ULARGE_INTEGER
  1263. ("pShimData", PVOID),
  1264. ("AppCompatInfo", PVOID),
  1265. ("CSDVersion", UNICODE_STRING),
  1266. ("ActivationContextData", PVOID), # ACTIVATION_CONTEXT_DATA
  1267. ("ProcessAssemblyStorageMap", PVOID), # ASSEMBLY_STORAGE_MAP
  1268. ("SystemDefaultActivationContextData", PVOID), # ACTIVATION_CONTEXT_DATA
  1269. ("SystemAssemblyStorageMap", PVOID), # ASSEMBLY_STORAGE_MAP
  1270. ("MinimumStackCommit", QWORD),
  1271. ("FlsCallback", PVOID), # PFLS_CALLBACK_INFO
  1272. ("FlsListHead", LIST_ENTRY),
  1273. ("FlsBitmap", PVOID),
  1274. ("FlsBitmapBits", DWORD * 4),
  1275. ("FlsHighIndex", DWORD),
  1276. ("WerRegistrationData", PVOID),
  1277. ("WerShipAssertPtr", PVOID),
  1278. ]
  1279. def __get_UserSharedInfoPtr(self):
  1280. return self.KernelCallbackTable
  1281. def __set_UserSharedInfoPtr(self, value):
  1282. self.KernelCallbackTable = value
  1283. UserSharedInfoPtr = property(__get_UserSharedInfoPtr, __set_UserSharedInfoPtr)
  1284. # +0x000 InheritedAddressSpace : UChar
  1285. # +0x001 ReadImageFileExecOptions : UChar
  1286. # +0x002 BeingDebugged : UChar
  1287. # +0x003 BitField : UChar
  1288. # +0x003 ImageUsesLargePages : Pos 0, 1 Bit
  1289. # +0x003 IsProtectedProcess : Pos 1, 1 Bit
  1290. # +0x003 IsLegacyProcess : Pos 2, 1 Bit
  1291. # +0x003 IsImageDynamicallyRelocated : Pos 3, 1 Bit
  1292. # +0x003 SkipPatchingUser32Forwarders : Pos 4, 1 Bit
  1293. # +0x003 SpareBits : Pos 5, 3 Bits
  1294. # +0x004 Mutant : Ptr32 Void
  1295. # +0x008 ImageBaseAddress : Ptr32 Void
  1296. # +0x00c Ldr : Ptr32 _PEB_LDR_DATA
  1297. # +0x010 ProcessParameters : Ptr32 _RTL_USER_PROCESS_PARAMETERS
  1298. # +0x014 SubSystemData : Ptr32 Void
  1299. # +0x018 ProcessHeap : Ptr32 Void
  1300. # +0x01c FastPebLock : Ptr32 _RTL_CRITICAL_SECTION
  1301. # +0x020 AtlThunkSListPtr : Ptr32 Void
  1302. # +0x024 IFEOKey : Ptr32 Void
  1303. # +0x028 CrossProcessFlags : Uint4B
  1304. # +0x028 ProcessInJob : Pos 0, 1 Bit
  1305. # +0x028 ProcessInitializing : Pos 1, 1 Bit
  1306. # +0x028 ProcessUsingVEH : Pos 2, 1 Bit
  1307. # +0x028 ProcessUsingVCH : Pos 3, 1 Bit
  1308. # +0x028 ProcessUsingFTH : Pos 4, 1 Bit
  1309. # +0x028 ReservedBits0 : Pos 5, 27 Bits
  1310. # +0x02c KernelCallbackTable : Ptr32 Void
  1311. # +0x02c UserSharedInfoPtr : Ptr32 Void
  1312. # +0x030 SystemReserved : [1] Uint4B
  1313. # +0x034 AtlThunkSListPtr32 : Uint4B
  1314. # +0x038 ApiSetMap : Ptr32 Void
  1315. # +0x03c TlsExpansionCounter : Uint4B
  1316. # +0x040 TlsBitmap : Ptr32 Void
  1317. # +0x044 TlsBitmapBits : [2] Uint4B
  1318. # +0x04c ReadOnlySharedMemoryBase : Ptr32 Void
  1319. # +0x050 HotpatchInformation : Ptr32 Void
  1320. # +0x054 ReadOnlyStaticServerData : Ptr32 Ptr32 Void
  1321. # +0x058 AnsiCodePageData : Ptr32 Void
  1322. # +0x05c OemCodePageData : Ptr32 Void
  1323. # +0x060 UnicodeCaseTableData : Ptr32 Void
  1324. # +0x064 NumberOfProcessors : Uint4B
  1325. # +0x068 NtGlobalFlag : Uint4B
  1326. # +0x070 CriticalSectionTimeout : _LARGE_INTEGER
  1327. # +0x078 HeapSegmentReserve : Uint4B
  1328. # +0x07c HeapSegmentCommit : Uint4B
  1329. # +0x080 HeapDeCommitTotalFreeThreshold : Uint4B
  1330. # +0x084 HeapDeCommitFreeBlockThreshold : Uint4B
  1331. # +0x088 NumberOfHeaps : Uint4B
  1332. # +0x08c MaximumNumberOfHeaps : Uint4B
  1333. # +0x090 ProcessHeaps : Ptr32 Ptr32 Void
  1334. # +0x094 GdiSharedHandleTable : Ptr32 Void
  1335. # +0x098 ProcessStarterHelper : Ptr32 Void
  1336. # +0x09c GdiDCAttributeList : Uint4B
  1337. # +0x0a0 LoaderLock : Ptr32 _RTL_CRITICAL_SECTION
  1338. # +0x0a4 OSMajorVersion : Uint4B
  1339. # +0x0a8 OSMinorVersion : Uint4B
  1340. # +0x0ac OSBuildNumber : Uint2B
  1341. # +0x0ae OSCSDVersion : Uint2B
  1342. # +0x0b0 OSPlatformId : Uint4B
  1343. # +0x0b4 ImageSubsystem : Uint4B
  1344. # +0x0b8 ImageSubsystemMajorVersion : Uint4B
  1345. # +0x0bc ImageSubsystemMinorVersion : Uint4B
  1346. # +0x0c0 ActiveProcessAffinityMask : Uint4B
  1347. # +0x0c4 GdiHandleBuffer : [34] Uint4B
  1348. # +0x14c PostProcessInitRoutine : Ptr32 void
  1349. # +0x150 TlsExpansionBitmap : Ptr32 Void
  1350. # +0x154 TlsExpansionBitmapBits : [32] Uint4B
  1351. # +0x1d4 SessionId : Uint4B
  1352. # +0x1d8 AppCompatFlags : _ULARGE_INTEGER
  1353. # +0x1e0 AppCompatFlagsUser : _ULARGE_INTEGER
  1354. # +0x1e8 pShimData : Ptr32 Void
  1355. # +0x1ec AppCompatInfo : Ptr32 Void
  1356. # +0x1f0 CSDVersion : _UNICODE_STRING
  1357. # +0x1f8 ActivationContextData : Ptr32 _ACTIVATION_CONTEXT_DATA
  1358. # +0x1fc ProcessAssemblyStorageMap : Ptr32 _ASSEMBLY_STORAGE_MAP
  1359. # +0x200 SystemDefaultActivationContextData : Ptr32 _ACTIVATION_CONTEXT_DATA
  1360. # +0x204 SystemAssemblyStorageMap : Ptr32 _ASSEMBLY_STORAGE_MAP
  1361. # +0x208 MinimumStackCommit : Uint4B
  1362. # +0x20c FlsCallback : Ptr32 _FLS_CALLBACK_INFO
  1363. # +0x210 FlsListHead : _LIST_ENTRY
  1364. # +0x218 FlsBitmap : Ptr32 Void
  1365. # +0x21c FlsBitmapBits : [4] Uint4B
  1366. # +0x22c FlsHighIndex : Uint4B
  1367. # +0x230 WerRegistrationData : Ptr32 Void
  1368. # +0x234 WerShipAssertPtr : Ptr32 Void
  1369. # +0x238 pContextData : Ptr32 Void
  1370. # +0x23c pImageHeaderHash : Ptr32 Void
  1371. # +0x240 TracingFlags : Uint4B
  1372. # +0x240 HeapTracingEnabled : Pos 0, 1 Bit
  1373. # +0x240 CritSecTracingEnabled : Pos 1, 1 Bit
  1374. # +0x240 SpareTracingBits : Pos 2, 30 Bits
  1375. class _PEB_2008_R2(Structure):
  1376. _pack_ = 8
  1377. _fields_ = [
  1378. ("InheritedAddressSpace", BOOLEAN),
  1379. ("ReadImageFileExecOptions", UCHAR),
  1380. ("BeingDebugged", BOOLEAN),
  1381. ("BitField", UCHAR),
  1382. ("Mutant", HANDLE),
  1383. ("ImageBaseAddress", PVOID),
  1384. ("Ldr", PVOID), # PPEB_LDR_DATA
  1385. ("ProcessParameters", PVOID), # PRTL_USER_PROCESS_PARAMETERS
  1386. ("SubSystemData", PVOID),
  1387. ("ProcessHeap", PVOID),
  1388. ("FastPebLock", PVOID), # PRTL_CRITICAL_SECTION
  1389. ("AtlThunkSListPtr", PVOID),
  1390. ("IFEOKey", PVOID),
  1391. ("CrossProcessFlags", DWORD),
  1392. ("KernelCallbackTable", PVOID),
  1393. ("SystemReserved", DWORD),
  1394. ("AtlThunkSListPtr32", PVOID),
  1395. ("ApiSetMap", PVOID),
  1396. ("TlsExpansionCounter", DWORD),
  1397. ("TlsBitmap", PVOID),
  1398. ("TlsBitmapBits", DWORD * 2),
  1399. ("ReadOnlySharedMemoryBase", PVOID),
  1400. ("HotpatchInformation", PVOID),
  1401. ("ReadOnlyStaticServerData", PVOID), # Ptr32 Ptr32 Void
  1402. ("AnsiCodePageData", PVOID),
  1403. ("OemCodePageData", PVOID),
  1404. ("UnicodeCaseTableData", PVOID),
  1405. ("NumberOfProcessors", DWORD),
  1406. ("NtGlobalFlag", DWORD),
  1407. ("CriticalSectionTimeout", LONGLONG), # LARGE_INTEGER
  1408. ("HeapSegmentReserve", DWORD),
  1409. ("HeapSegmentCommit", DWORD),
  1410. ("HeapDeCommitTotalFreeThreshold", DWORD),
  1411. ("HeapDeCommitFreeBlockThreshold", DWORD),
  1412. ("NumberOfHeaps", DWORD),
  1413. ("MaximumNumberOfHeaps", DWORD),
  1414. ("ProcessHeaps", PVOID), # Ptr32 Ptr32 Void
  1415. ("GdiSharedHandleTable", PVOID),
  1416. ("ProcessStarterHelper", PVOID),
  1417. ("GdiDCAttributeList", DWORD),
  1418. ("LoaderLock", PVOID), # PRTL_CRITICAL_SECTION
  1419. ("OSMajorVersion", DWORD),
  1420. ("OSMinorVersion", DWORD),
  1421. ("OSBuildNumber", WORD),
  1422. ("OSCSDVersion", WORD),
  1423. ("OSPlatformId", DWORD),
  1424. ("ImageSubsystem", DWORD),
  1425. ("ImageSubsystemMajorVersion", DWORD),
  1426. ("ImageSubsystemMinorVersion", DWORD),
  1427. ("ActiveProcessAffinityMask", DWORD),
  1428. ("GdiHandleBuffer", DWORD * 34),
  1429. ("PostProcessInitRoutine", PPS_POST_PROCESS_INIT_ROUTINE),
  1430. ("TlsExpansionBitmap", PVOID),
  1431. ("TlsExpansionBitmapBits", DWORD * 32),
  1432. ("SessionId", DWORD),
  1433. ("AppCompatFlags", ULONGLONG), # ULARGE_INTEGER
  1434. ("AppCompatFlagsUser", ULONGLONG), # ULARGE_INTEGER
  1435. ("pShimData", PVOID),
  1436. ("AppCompatInfo", PVOID),
  1437. ("CSDVersion", UNICODE_STRING),
  1438. ("ActivationContextData", PVOID), # ACTIVATION_CONTEXT_DATA
  1439. ("ProcessAssemblyStorageMap", PVOID), # ASSEMBLY_STORAGE_MAP
  1440. ("SystemDefaultActivationContextData", PVOID), # ACTIVATION_CONTEXT_DATA
  1441. ("SystemAssemblyStorageMap", PVOID), # ASSEMBLY_STORAGE_MAP
  1442. ("MinimumStackCommit", DWORD),
  1443. ("FlsCallback", PVOID), # PFLS_CALLBACK_INFO
  1444. ("FlsListHead", LIST_ENTRY),
  1445. ("FlsBitmap", PVOID),
  1446. ("FlsBitmapBits", DWORD * 4),
  1447. ("FlsHighIndex", DWORD),
  1448. ("WerRegistrationData", PVOID),
  1449. ("WerShipAssertPtr", PVOID),
  1450. ("pContextData", PVOID),
  1451. ("pImageHeaderHash", PVOID),
  1452. ("TracingFlags", DWORD),
  1453. ]
  1454. def __get_UserSharedInfoPtr(self):
  1455. return self.KernelCallbackTable
  1456. def __set_UserSharedInfoPtr(self, value):
  1457. self.KernelCallbackTable = value
  1458. UserSharedInfoPtr = property(__get_UserSharedInfoPtr, __set_UserSharedInfoPtr)
  1459. # +0x000 InheritedAddressSpace : UChar
  1460. # +0x001 ReadImageFileExecOptions : UChar
  1461. # +0x002 BeingDebugged : UChar
  1462. # +0x003 BitField : UChar
  1463. # +0x003 ImageUsesLargePages : Pos 0, 1 Bit
  1464. # +0x003 IsProtectedProcess : Pos 1, 1 Bit
  1465. # +0x003 IsLegacyProcess : Pos 2, 1 Bit
  1466. # +0x003 IsImageDynamicallyRelocated : Pos 3, 1 Bit
  1467. # +0x003 SkipPatchingUser32Forwarders : Pos 4, 1 Bit
  1468. # +0x003 SpareBits : Pos 5, 3 Bits
  1469. # +0x008 Mutant : Ptr64 Void
  1470. # +0x010 ImageBaseAddress : Ptr64 Void
  1471. # +0x018 Ldr : Ptr64 _PEB_LDR_DATA
  1472. # +0x020 ProcessParameters : Ptr64 _RTL_USER_PROCESS_PARAMETERS
  1473. # +0x028 SubSystemData : Ptr64 Void
  1474. # +0x030 ProcessHeap : Ptr64 Void
  1475. # +0x038 FastPebLock : Ptr64 _RTL_CRITICAL_SECTION
  1476. # +0x040 AtlThunkSListPtr : Ptr64 Void
  1477. # +0x048 IFEOKey : Ptr64 Void
  1478. # +0x050 CrossProcessFlags : Uint4B
  1479. # +0x050 ProcessInJob : Pos 0, 1 Bit
  1480. # +0x050 ProcessInitializing : Pos 1, 1 Bit
  1481. # +0x050 ProcessUsingVEH : Pos 2, 1 Bit
  1482. # +0x050 ProcessUsingVCH : Pos 3, 1 Bit
  1483. # +0x050 ProcessUsingFTH : Pos 4, 1 Bit
  1484. # +0x050 ReservedBits0 : Pos 5, 27 Bits
  1485. # +0x058 KernelCallbackTable : Ptr64 Void
  1486. # +0x058 UserSharedInfoPtr : Ptr64 Void
  1487. # +0x060 SystemReserved : [1] Uint4B
  1488. # +0x064 AtlThunkSListPtr32 : Uint4B
  1489. # +0x068 ApiSetMap : Ptr64 Void
  1490. # +0x070 TlsExpansionCounter : Uint4B
  1491. # +0x078 TlsBitmap : Ptr64 Void
  1492. # +0x080 TlsBitmapBits : [2] Uint4B
  1493. # +0x088 ReadOnlySharedMemoryBase : Ptr64 Void
  1494. # +0x090 HotpatchInformation : Ptr64 Void
  1495. # +0x098 ReadOnlyStaticServerData : Ptr64 Ptr64 Void
  1496. # +0x0a0 AnsiCodePageData : Ptr64 Void
  1497. # +0x0a8 OemCodePageData : Ptr64 Void
  1498. # +0x0b0 UnicodeCaseTableData : Ptr64 Void
  1499. # +0x0b8 NumberOfProcessors : Uint4B
  1500. # +0x0bc NtGlobalFlag : Uint4B
  1501. # +0x0c0 CriticalSectionTimeout : _LARGE_INTEGER
  1502. # +0x0c8 HeapSegmentReserve : Uint8B
  1503. # +0x0d0 HeapSegmentCommit : Uint8B
  1504. # +0x0d8 HeapDeCommitTotalFreeThreshold : Uint8B
  1505. # +0x0e0 HeapDeCommitFreeBlockThreshold : Uint8B
  1506. # +0x0e8 NumberOfHeaps : Uint4B
  1507. # +0x0ec MaximumNumberOfHeaps : Uint4B
  1508. # +0x0f0 ProcessHeaps : Ptr64 Ptr64 Void
  1509. # +0x0f8 GdiSharedHandleTable : Ptr64 Void
  1510. # +0x100 ProcessStarterHelper : Ptr64 Void
  1511. # +0x108 GdiDCAttributeList : Uint4B
  1512. # +0x110 LoaderLock : Ptr64 _RTL_CRITICAL_SECTION
  1513. # +0x118 OSMajorVersion : Uint4B
  1514. # +0x11c OSMinorVersion : Uint4B
  1515. # +0x120 OSBuildNumber : Uint2B
  1516. # +0x122 OSCSDVersion : Uint2B
  1517. # +0x124 OSPlatformId : Uint4B
  1518. # +0x128 ImageSubsystem : Uint4B
  1519. # +0x12c ImageSubsystemMajorVersion : Uint4B
  1520. # +0x130 ImageSubsystemMinorVersion : Uint4B
  1521. # +0x138 ActiveProcessAffinityMask : Uint8B
  1522. # +0x140 GdiHandleBuffer : [60] Uint4B
  1523. # +0x230 PostProcessInitRoutine : Ptr64 void
  1524. # +0x238 TlsExpansionBitmap : Ptr64 Void
  1525. # +0x240 TlsExpansionBitmapBits : [32] Uint4B
  1526. # +0x2c0 SessionId : Uint4B
  1527. # +0x2c8 AppCompatFlags : _ULARGE_INTEGER
  1528. # +0x2d0 AppCompatFlagsUser : _ULARGE_INTEGER
  1529. # +0x2d8 pShimData : Ptr64 Void
  1530. # +0x2e0 AppCompatInfo : Ptr64 Void
  1531. # +0x2e8 CSDVersion : _UNICODE_STRING
  1532. # +0x2f8 ActivationContextData : Ptr64 _ACTIVATION_CONTEXT_DATA
  1533. # +0x300 ProcessAssemblyStorageMap : Ptr64 _ASSEMBLY_STORAGE_MAP
  1534. # +0x308 SystemDefaultActivationContextData : Ptr64 _ACTIVATION_CONTEXT_DATA
  1535. # +0x310 SystemAssemblyStorageMap : Ptr64 _ASSEMBLY_STORAGE_MAP
  1536. # +0x318 MinimumStackCommit : Uint8B
  1537. # +0x320 FlsCallback : Ptr64 _FLS_CALLBACK_INFO
  1538. # +0x328 FlsListHead : _LIST_ENTRY
  1539. # +0x338 FlsBitmap : Ptr64 Void
  1540. # +0x340 FlsBitmapBits : [4] Uint4B
  1541. # +0x350 FlsHighIndex : Uint4B
  1542. # +0x358 WerRegistrationData : Ptr64 Void
  1543. # +0x360 WerShipAssertPtr : Ptr64 Void
  1544. # +0x368 pContextData : Ptr64 Void
  1545. # +0x370 pImageHeaderHash : Ptr64 Void
  1546. # +0x378 TracingFlags : Uint4B
  1547. # +0x378 HeapTracingEnabled : Pos 0, 1 Bit
  1548. # +0x378 CritSecTracingEnabled : Pos 1, 1 Bit
  1549. # +0x378 SpareTracingBits : Pos 2, 30 Bits
  1550. class _PEB_2008_R2_64(Structure):
  1551. _pack_ = 8
  1552. _fields_ = [
  1553. ("InheritedAddressSpace", BOOLEAN),
  1554. ("ReadImageFileExecOptions", UCHAR),
  1555. ("BeingDebugged", BOOLEAN),
  1556. ("BitField", UCHAR),
  1557. ("Mutant", HANDLE),
  1558. ("ImageBaseAddress", PVOID),
  1559. ("Ldr", PVOID), # PPEB_LDR_DATA
  1560. ("ProcessParameters", PVOID), # PRTL_USER_PROCESS_PARAMETERS
  1561. ("SubSystemData", PVOID),
  1562. ("ProcessHeap", PVOID),
  1563. ("FastPebLock", PVOID), # PRTL_CRITICAL_SECTION
  1564. ("AtlThunkSListPtr", PVOID),
  1565. ("IFEOKey", PVOID),
  1566. ("CrossProcessFlags", DWORD),
  1567. ("KernelCallbackTable", PVOID),
  1568. ("SystemReserved", DWORD),
  1569. ("AtlThunkSListPtr32", DWORD),
  1570. ("ApiSetMap", PVOID),
  1571. ("TlsExpansionCounter", DWORD),
  1572. ("TlsBitmap", PVOID),
  1573. ("TlsBitmapBits", DWORD * 2),
  1574. ("ReadOnlySharedMemoryBase", PVOID),
  1575. ("HotpatchInformation", PVOID),
  1576. ("ReadOnlyStaticServerData", PVOID), # Ptr32 Ptr32 Void
  1577. ("AnsiCodePageData", PVOID),
  1578. ("OemCodePageData", PVOID),
  1579. ("UnicodeCaseTableData", PVOID),
  1580. ("NumberOfProcessors", DWORD),
  1581. ("NtGlobalFlag", DWORD),
  1582. ("CriticalSectionTimeout", LONGLONG), # LARGE_INTEGER
  1583. ("HeapSegmentReserve", QWORD),
  1584. ("HeapSegmentCommit", QWORD),
  1585. ("HeapDeCommitTotalFreeThreshold", QWORD),
  1586. ("HeapDeCommitFreeBlockThreshold", QWORD),
  1587. ("NumberOfHeaps", DWORD),
  1588. ("MaximumNumberOfHeaps", DWORD),
  1589. ("ProcessHeaps", PVOID), # Ptr64 Ptr64 Void
  1590. ("GdiSharedHandleTable", PVOID),
  1591. ("ProcessStarterHelper", PVOID),
  1592. ("GdiDCAttributeList", DWORD),
  1593. ("LoaderLock", PVOID), # PRTL_CRITICAL_SECTION
  1594. ("OSMajorVersion", DWORD),
  1595. ("OSMinorVersion", DWORD),
  1596. ("OSBuildNumber", WORD),
  1597. ("OSCSDVersion", WORD),
  1598. ("OSPlatformId", DWORD),
  1599. ("ImageSubsystem", DWORD),
  1600. ("ImageSubsystemMajorVersion", DWORD),
  1601. ("ImageSubsystemMinorVersion", DWORD),
  1602. ("ActiveProcessAffinityMask", QWORD),
  1603. ("GdiHandleBuffer", DWORD * 60),
  1604. ("PostProcessInitRoutine", PPS_POST_PROCESS_INIT_ROUTINE),
  1605. ("TlsExpansionBitmap", PVOID),
  1606. ("TlsExpansionBitmapBits", DWORD * 32),
  1607. ("SessionId", DWORD),
  1608. ("AppCompatFlags", ULONGLONG), # ULARGE_INTEGER
  1609. ("AppCompatFlagsUser", ULONGLONG), # ULARGE_INTEGER
  1610. ("pShimData", PVOID),
  1611. ("AppCompatInfo", PVOID),
  1612. ("CSDVersion", UNICODE_STRING),
  1613. ("ActivationContextData", PVOID), # ACTIVATION_CONTEXT_DATA
  1614. ("ProcessAssemblyStorageMap", PVOID), # ASSEMBLY_STORAGE_MAP
  1615. ("SystemDefaultActivationContextData", PVOID), # ACTIVATION_CONTEXT_DATA
  1616. ("SystemAssemblyStorageMap", PVOID), # ASSEMBLY_STORAGE_MAP
  1617. ("MinimumStackCommit", QWORD),
  1618. ("FlsCallback", PVOID), # PFLS_CALLBACK_INFO
  1619. ("FlsListHead", LIST_ENTRY),
  1620. ("FlsBitmap", PVOID),
  1621. ("FlsBitmapBits", DWORD * 4),
  1622. ("FlsHighIndex", DWORD),
  1623. ("WerRegistrationData", PVOID),
  1624. ("WerShipAssertPtr", PVOID),
  1625. ("pContextData", PVOID),
  1626. ("pImageHeaderHash", PVOID),
  1627. ("TracingFlags", DWORD),
  1628. ]
  1629. def __get_UserSharedInfoPtr(self):
  1630. return self.KernelCallbackTable
  1631. def __set_UserSharedInfoPtr(self, value):
  1632. self.KernelCallbackTable = value
  1633. UserSharedInfoPtr = property(__get_UserSharedInfoPtr, __set_UserSharedInfoPtr)
  1634. _PEB_Vista = _PEB_2008
  1635. _PEB_Vista_64 = _PEB_2008_64
  1636. _PEB_W7 = _PEB_2008_R2
  1637. _PEB_W7_64 = _PEB_2008_R2_64
  1638. # +0x000 InheritedAddressSpace : UChar
  1639. # +0x001 ReadImageFileExecOptions : UChar
  1640. # +0x002 BeingDebugged : UChar
  1641. # +0x003 BitField : UChar
  1642. # +0x003 ImageUsesLargePages : Pos 0, 1 Bit
  1643. # +0x003 IsProtectedProcess : Pos 1, 1 Bit
  1644. # +0x003 IsLegacyProcess : Pos 2, 1 Bit
  1645. # +0x003 IsImageDynamicallyRelocated : Pos 3, 1 Bit
  1646. # +0x003 SkipPatchingUser32Forwarders : Pos 4, 1 Bit
  1647. # +0x003 SpareBits : Pos 5, 3 Bits
  1648. # +0x004 Mutant : Ptr32 Void
  1649. # +0x008 ImageBaseAddress : Ptr32 Void
  1650. # +0x00c Ldr : Ptr32 _PEB_LDR_DATA
  1651. # +0x010 ProcessParameters : Ptr32 _RTL_USER_PROCESS_PARAMETERS
  1652. # +0x014 SubSystemData : Ptr32 Void
  1653. # +0x018 ProcessHeap : Ptr32 Void
  1654. # +0x01c FastPebLock : Ptr32 _RTL_CRITICAL_SECTION
  1655. # +0x020 AtlThunkSListPtr : Ptr32 Void
  1656. # +0x024 IFEOKey : Ptr32 Void
  1657. # +0x028 CrossProcessFlags : Uint4B
  1658. # +0x028 ProcessInJob : Pos 0, 1 Bit
  1659. # +0x028 ProcessInitializing : Pos 1, 1 Bit
  1660. # +0x028 ProcessUsingVEH : Pos 2, 1 Bit
  1661. # +0x028 ProcessUsingVCH : Pos 3, 1 Bit
  1662. # +0x028 ProcessUsingFTH : Pos 4, 1 Bit
  1663. # +0x028 ReservedBits0 : Pos 5, 27 Bits
  1664. # +0x02c KernelCallbackTable : Ptr32 Void
  1665. # +0x02c UserSharedInfoPtr : Ptr32 Void
  1666. # +0x030 SystemReserved : [1] Uint4B
  1667. # +0x034 TracingFlags : Uint4B
  1668. # +0x034 HeapTracingEnabled : Pos 0, 1 Bit
  1669. # +0x034 CritSecTracingEnabled : Pos 1, 1 Bit
  1670. # +0x034 SpareTracingBits : Pos 2, 30 Bits
  1671. # +0x038 ApiSetMap : Ptr32 Void
  1672. # +0x03c TlsExpansionCounter : Uint4B
  1673. # +0x040 TlsBitmap : Ptr32 Void
  1674. # +0x044 TlsBitmapBits : [2] Uint4B
  1675. # +0x04c ReadOnlySharedMemoryBase : Ptr32 Void
  1676. # +0x050 HotpatchInformation : Ptr32 Void
  1677. # +0x054 ReadOnlyStaticServerData : Ptr32 Ptr32 Void
  1678. # +0x058 AnsiCodePageData : Ptr32 Void
  1679. # +0x05c OemCodePageData : Ptr32 Void
  1680. # +0x060 UnicodeCaseTableData : Ptr32 Void
  1681. # +0x064 NumberOfProcessors : Uint4B
  1682. # +0x068 NtGlobalFlag : Uint4B
  1683. # +0x070 CriticalSectionTimeout : _LARGE_INTEGER
  1684. # +0x078 HeapSegmentReserve : Uint4B
  1685. # +0x07c HeapSegmentCommit : Uint4B
  1686. # +0x080 HeapDeCommitTotalFreeThreshold : Uint4B
  1687. # +0x084 HeapDeCommitFreeBlockThreshold : Uint4B
  1688. # +0x088 NumberOfHeaps : Uint4B
  1689. # +0x08c MaximumNumberOfHeaps : Uint4B
  1690. # +0x090 ProcessHeaps : Ptr32 Ptr32 Void
  1691. # +0x094 GdiSharedHandleTable : Ptr32 Void
  1692. # +0x098 ProcessStarterHelper : Ptr32 Void
  1693. # +0x09c GdiDCAttributeList : Uint4B
  1694. # +0x0a0 LoaderLock : Ptr32 _RTL_CRITICAL_SECTION
  1695. # +0x0a4 OSMajorVersion : Uint4B
  1696. # +0x0a8 OSMinorVersion : Uint4B
  1697. # +0x0ac OSBuildNumber : Uint2B
  1698. # +0x0ae OSCSDVersion : Uint2B
  1699. # +0x0b0 OSPlatformId : Uint4B
  1700. # +0x0b4 ImageSubsystem : Uint4B
  1701. # +0x0b8 ImageSubsystemMajorVersion : Uint4B
  1702. # +0x0bc ImageSubsystemMinorVersion : Uint4B
  1703. # +0x0c0 ActiveProcessAffinityMask : Uint4B
  1704. # +0x0c4 GdiHandleBuffer : [34] Uint4B
  1705. # +0x14c PostProcessInitRoutine : Ptr32 void
  1706. # +0x150 TlsExpansionBitmap : Ptr32 Void
  1707. # +0x154 TlsExpansionBitmapBits : [32] Uint4B
  1708. # +0x1d4 SessionId : Uint4B
  1709. # +0x1d8 AppCompatFlags : _ULARGE_INTEGER
  1710. # +0x1e0 AppCompatFlagsUser : _ULARGE_INTEGER
  1711. # +0x1e8 pShimData : Ptr32 Void
  1712. # +0x1ec AppCompatInfo : Ptr32 Void
  1713. # +0x1f0 CSDVersion : _UNICODE_STRING
  1714. # +0x1f8 ActivationContextData : Ptr32 _ACTIVATION_CONTEXT_DATA
  1715. # +0x1fc ProcessAssemblyStorageMap : Ptr32 _ASSEMBLY_STORAGE_MAP
  1716. # +0x200 SystemDefaultActivationContextData : Ptr32 _ACTIVATION_CONTEXT_DATA
  1717. # +0x204 SystemAssemblyStorageMap : Ptr32 _ASSEMBLY_STORAGE_MAP
  1718. # +0x208 MinimumStackCommit : Uint4B
  1719. # +0x20c FlsCallback : Ptr32 _FLS_CALLBACK_INFO
  1720. # +0x210 FlsListHead : _LIST_ENTRY
  1721. # +0x218 FlsBitmap : Ptr32 Void
  1722. # +0x21c FlsBitmapBits : [4] Uint4B
  1723. # +0x22c FlsHighIndex : Uint4B
  1724. # +0x230 WerRegistrationData : Ptr32 Void
  1725. # +0x234 WerShipAssertPtr : Ptr32 Void
  1726. # +0x238 pContextData : Ptr32 Void
  1727. # +0x23c pImageHeaderHash : Ptr32 Void
  1728. class _PEB_W7_Beta(Structure):
  1729. """
  1730. This definition of the PEB structure is only valid for the beta versions
  1731. of Windows 7. For the final version of Windows 7 use L{_PEB_W7} instead.
  1732. This structure is not chosen automatically.
  1733. """
  1734. _pack_ = 8
  1735. _fields_ = [
  1736. ("InheritedAddressSpace", BOOLEAN),
  1737. ("ReadImageFileExecOptions", UCHAR),
  1738. ("BeingDebugged", BOOLEAN),
  1739. ("BitField", UCHAR),
  1740. ("Mutant", HANDLE),
  1741. ("ImageBaseAddress", PVOID),
  1742. ("Ldr", PVOID), # PPEB_LDR_DATA
  1743. ("ProcessParameters", PVOID), # PRTL_USER_PROCESS_PARAMETERS
  1744. ("SubSystemData", PVOID),
  1745. ("ProcessHeap", PVOID),
  1746. ("FastPebLock", PVOID), # PRTL_CRITICAL_SECTION
  1747. ("AtlThunkSListPtr", PVOID),
  1748. ("IFEOKey", PVOID),
  1749. ("CrossProcessFlags", DWORD),
  1750. ("KernelCallbackTable", PVOID),
  1751. ("SystemReserved", DWORD),
  1752. ("TracingFlags", DWORD),
  1753. ("ApiSetMap", PVOID),
  1754. ("TlsExpansionCounter", DWORD),
  1755. ("TlsBitmap", PVOID),
  1756. ("TlsBitmapBits", DWORD * 2),
  1757. ("ReadOnlySharedMemoryBase", PVOID),
  1758. ("HotpatchInformation", PVOID),
  1759. ("ReadOnlyStaticServerData", PVOID), # Ptr32 Ptr32 Void
  1760. ("AnsiCodePageData", PVOID),
  1761. ("OemCodePageData", PVOID),
  1762. ("UnicodeCaseTableData", PVOID),
  1763. ("NumberOfProcessors", DWORD),
  1764. ("NtGlobalFlag", DWORD),
  1765. ("CriticalSectionTimeout", LONGLONG), # LARGE_INTEGER
  1766. ("HeapSegmentReserve", DWORD),
  1767. ("HeapSegmentCommit", DWORD),
  1768. ("HeapDeCommitTotalFreeThreshold", DWORD),
  1769. ("HeapDeCommitFreeBlockThreshold", DWORD),
  1770. ("NumberOfHeaps", DWORD),
  1771. ("MaximumNumberOfHeaps", DWORD),
  1772. ("ProcessHeaps", PVOID), # Ptr32 Ptr32 Void
  1773. ("GdiSharedHandleTable", PVOID),
  1774. ("ProcessStarterHelper", PVOID),
  1775. ("GdiDCAttributeList", DWORD),
  1776. ("LoaderLock", PVOID), # PRTL_CRITICAL_SECTION
  1777. ("OSMajorVersion", DWORD),
  1778. ("OSMinorVersion", DWORD),
  1779. ("OSBuildNumber", WORD),
  1780. ("OSCSDVersion", WORD),
  1781. ("OSPlatformId", DWORD),
  1782. ("ImageSubsystem", DWORD),
  1783. ("ImageSubsystemMajorVersion", DWORD),
  1784. ("ImageSubsystemMinorVersion", DWORD),
  1785. ("ActiveProcessAffinityMask", DWORD),
  1786. ("GdiHandleBuffer", DWORD * 34),
  1787. ("PostProcessInitRoutine", PPS_POST_PROCESS_INIT_ROUTINE),
  1788. ("TlsExpansionBitmap", PVOID),
  1789. ("TlsExpansionBitmapBits", DWORD * 32),
  1790. ("SessionId", DWORD),
  1791. ("AppCompatFlags", ULONGLONG), # ULARGE_INTEGER
  1792. ("AppCompatFlagsUser", ULONGLONG), # ULARGE_INTEGER
  1793. ("pShimData", PVOID),
  1794. ("AppCompatInfo", PVOID),
  1795. ("CSDVersion", UNICODE_STRING),
  1796. ("ActivationContextData", PVOID), # ACTIVATION_CONTEXT_DATA
  1797. ("ProcessAssemblyStorageMap", PVOID), # ASSEMBLY_STORAGE_MAP
  1798. ("SystemDefaultActivationContextData", PVOID), # ACTIVATION_CONTEXT_DATA
  1799. ("SystemAssemblyStorageMap", PVOID), # ASSEMBLY_STORAGE_MAP
  1800. ("MinimumStackCommit", DWORD),
  1801. ("FlsCallback", PVOID), # PFLS_CALLBACK_INFO
  1802. ("FlsListHead", LIST_ENTRY),
  1803. ("FlsBitmap", PVOID),
  1804. ("FlsBitmapBits", DWORD * 4),
  1805. ("FlsHighIndex", DWORD),
  1806. ("WerRegistrationData", PVOID),
  1807. ("WerShipAssertPtr", PVOID),
  1808. ("pContextData", PVOID),
  1809. ("pImageHeaderHash", PVOID),
  1810. ]
  1811. def __get_UserSharedInfoPtr(self):
  1812. return self.KernelCallbackTable
  1813. def __set_UserSharedInfoPtr(self, value):
  1814. self.KernelCallbackTable = value
  1815. UserSharedInfoPtr = property(__get_UserSharedInfoPtr, __set_UserSharedInfoPtr)
  1816. # Use the correct PEB structure definition.
  1817. # Defaults to the latest Windows version.
  1818. class PEB(Structure):
  1819. _pack_ = 8
  1820. if os == 'Windows NT':
  1821. _pack_ = _PEB_NT._pack_
  1822. _fields_ = _PEB_NT._fields_
  1823. elif os == 'Windows 2000':
  1824. _pack_ = _PEB_2000._pack_
  1825. _fields_ = _PEB_2000._fields_
  1826. elif os == 'Windows XP':
  1827. _fields_ = _PEB_XP._fields_
  1828. elif os == 'Windows XP (64 bits)':
  1829. _fields_ = _PEB_XP_64._fields_
  1830. elif os == 'Windows 2003':
  1831. _fields_ = _PEB_2003._fields_
  1832. elif os == 'Windows 2003 (64 bits)':
  1833. _fields_ = _PEB_2003_64._fields_
  1834. elif os == 'Windows 2003 R2':
  1835. _fields_ = _PEB_2003_R2._fields_
  1836. elif os == 'Windows 2003 R2 (64 bits)':
  1837. _fields_ = _PEB_2003_R2_64._fields_
  1838. elif os == 'Windows 2008':
  1839. _fields_ = _PEB_2008._fields_
  1840. elif os == 'Windows 2008 (64 bits)':
  1841. _fields_ = _PEB_2008_64._fields_
  1842. elif os == 'Windows 2008 R2':
  1843. _fields_ = _PEB_2008_R2._fields_
  1844. elif os == 'Windows 2008 R2 (64 bits)':
  1845. _fields_ = _PEB_2008_R2_64._fields_
  1846. elif os == 'Windows Vista':
  1847. _fields_ = _PEB_Vista._fields_
  1848. elif os == 'Windows Vista (64 bits)':
  1849. _fields_ = _PEB_Vista_64._fields_
  1850. elif os == 'Windows 7':
  1851. _fields_ = _PEB_W7._fields_
  1852. elif os == 'Windows 7 (64 bits)':
  1853. _fields_ = _PEB_W7_64._fields_
  1854. elif sizeof(SIZE_T) == sizeof(DWORD):
  1855. _fields_ = _PEB_W7._fields_
  1856. else:
  1857. _fields_ = _PEB_W7_64._fields_
  1858. PPEB = POINTER(PEB)
  1859. # PEB structure for WOW64 processes.
  1860. class PEB_32(Structure):
  1861. _pack_ = 8
  1862. if os == 'Windows NT':
  1863. _pack_ = _PEB_NT._pack_
  1864. _fields_ = _PEB_NT._fields_
  1865. elif os == 'Windows 2000':
  1866. _pack_ = _PEB_2000._pack_
  1867. _fields_ = _PEB_2000._fields_
  1868. elif os.startswith('Windows XP'):
  1869. _fields_ = _PEB_XP._fields_
  1870. elif os.startswith('Windows 2003 R2'):
  1871. _fields_ = _PEB_2003_R2._fields_
  1872. elif os.startswith('Windows 2003'):
  1873. _fields_ = _PEB_2003._fields_
  1874. elif os.startswith('Windows 2008 R2'):
  1875. _fields_ = _PEB_2008_R2._fields_
  1876. elif os.startswith('Windows 2008'):
  1877. _fields_ = _PEB_2008._fields_
  1878. elif os.startswith('Windows Vista'):
  1879. _fields_ = _PEB_Vista._fields_
  1880. else: #if os.startswith('Windows 7'):
  1881. _fields_ = _PEB_W7._fields_
  1882. # from https://vmexplorer.svn.codeplex.com/svn/VMExplorer/src/Win32/Threads.cs
  1883. #
  1884. # [StructLayout (LayoutKind.Sequential, Size = 0x0C)]
  1885. # public struct Wx86ThreadState
  1886. # {
  1887. # public IntPtr CallBx86Eip; // Ptr32 to Uint4B
  1888. # public IntPtr DeallocationCpu; // Ptr32 to Void
  1889. # public Byte UseKnownWx86Dll; // UChar
  1890. # public Byte OleStubInvoked; // Char
  1891. # };
  1892. class Wx86ThreadState(Structure):
  1893. _fields_ = [
  1894. ("CallBx86Eip", PVOID),
  1895. ("DeallocationCpu", PVOID),
  1896. ("UseKnownWx86Dll", UCHAR),
  1897. ("OleStubInvoked", CHAR),
  1898. ]
  1899. # ntdll!_RTL_ACTIVATION_CONTEXT_STACK_FRAME
  1900. # +0x000 Previous : Ptr64 _RTL_ACTIVATION_CONTEXT_STACK_FRAME
  1901. # +0x008 ActivationContext : Ptr64 _ACTIVATION_CONTEXT
  1902. # +0x010 Flags : Uint4B
  1903. class RTL_ACTIVATION_CONTEXT_STACK_FRAME(Structure):
  1904. _fields_ = [
  1905. ("Previous", PVOID),
  1906. ("ActivationContext", PVOID),
  1907. ("Flags", DWORD),
  1908. ]
  1909. # ntdll!_ACTIVATION_CONTEXT_STACK
  1910. # +0x000 ActiveFrame : Ptr64 _RTL_ACTIVATION_CONTEXT_STACK_FRAME
  1911. # +0x008 FrameListCache : _LIST_ENTRY
  1912. # +0x018 Flags : Uint4B
  1913. # +0x01c NextCookieSequenceNumber : Uint4B
  1914. # +0x020 StackId : Uint4B
  1915. class ACTIVATION_CONTEXT_STACK(Structure):
  1916. _fields_ = [
  1917. ("ActiveFrame", PVOID),
  1918. ("FrameListCache", LIST_ENTRY),
  1919. ("Flags", DWORD),
  1920. ("NextCookieSequenceNumber", DWORD),
  1921. ("StackId", DWORD),
  1922. ]
  1923. # typedef struct _PROCESSOR_NUMBER {
  1924. # WORD Group;
  1925. # BYTE Number;
  1926. # BYTE Reserved;
  1927. # }PROCESSOR_NUMBER, *PPROCESSOR_NUMBER;
  1928. class PROCESSOR_NUMBER(Structure):
  1929. _fields_ = [
  1930. ("Group", WORD),
  1931. ("Number", BYTE),
  1932. ("Reserved", BYTE),
  1933. ]
  1934. # from http://www.nirsoft.net/kernel_struct/vista/NT_TIB.html
  1935. #
  1936. # typedef struct _NT_TIB
  1937. # {
  1938. # PEXCEPTION_REGISTRATION_RECORD ExceptionList;
  1939. # PVOID StackBase;
  1940. # PVOID StackLimit;
  1941. # PVOID SubSystemTib;
  1942. # union
  1943. # {
  1944. # PVOID FiberData;
  1945. # ULONG Version;
  1946. # };
  1947. # PVOID ArbitraryUserPointer;
  1948. # PNT_TIB Self;
  1949. # } NT_TIB, *PNT_TIB;
  1950. class _NT_TIB_UNION(Union):
  1951. _fields_ = [
  1952. ("FiberData", PVOID),
  1953. ("Version", ULONG),
  1954. ]
  1955. class NT_TIB(Structure):
  1956. _fields_ = [
  1957. ("ExceptionList", PVOID), # PEXCEPTION_REGISTRATION_RECORD
  1958. ("StackBase", PVOID),
  1959. ("StackLimit", PVOID),
  1960. ("SubSystemTib", PVOID),
  1961. ("u", _NT_TIB_UNION),
  1962. ("ArbitraryUserPointer", PVOID),
  1963. ("Self", PVOID), # PNTTIB
  1964. ]
  1965. def __get_FiberData(self):
  1966. return self.u.FiberData
  1967. def __set_FiberData(self, value):
  1968. self.u.FiberData = value
  1969. FiberData = property(__get_FiberData, __set_FiberData)
  1970. def __get_Version(self):
  1971. return self.u.Version
  1972. def __set_Version(self, value):
  1973. self.u.Version = value
  1974. Version = property(__get_Version, __set_Version)
  1975. PNTTIB = POINTER(NT_TIB)
  1976. # From http://www.nirsoft.net/kernel_struct/vista/EXCEPTION_REGISTRATION_RECORD.html
  1977. #
  1978. # typedef struct _EXCEPTION_REGISTRATION_RECORD
  1979. # {
  1980. # PEXCEPTION_REGISTRATION_RECORD Next;
  1981. # PEXCEPTION_DISPOSITION Handler;
  1982. # } EXCEPTION_REGISTRATION_RECORD, *PEXCEPTION_REGISTRATION_RECORD;
  1983. class EXCEPTION_REGISTRATION_RECORD(Structure):
  1984. pass
  1985. EXCEPTION_DISPOSITION = DWORD
  1986. ##PEXCEPTION_DISPOSITION = POINTER(EXCEPTION_DISPOSITION)
  1987. ##PEXCEPTION_REGISTRATION_RECORD = POINTER(EXCEPTION_REGISTRATION_RECORD)
  1988. PEXCEPTION_DISPOSITION = PVOID
  1989. PEXCEPTION_REGISTRATION_RECORD = PVOID
  1990. EXCEPTION_REGISTRATION_RECORD._fields_ = [
  1991. ("Next", PEXCEPTION_REGISTRATION_RECORD),
  1992. ("Handler", PEXCEPTION_DISPOSITION),
  1993. ]
  1994. ##PPEB = POINTER(PEB)
  1995. PPEB = PVOID
  1996. # From http://www.nirsoft.net/kernel_struct/vista/GDI_TEB_BATCH.html
  1997. #
  1998. # typedef struct _GDI_TEB_BATCH
  1999. # {
  2000. # ULONG Offset;
  2001. # ULONG HDC;
  2002. # ULONG Buffer[310];
  2003. # } GDI_TEB_BATCH, *PGDI_TEB_BATCH;
  2004. class GDI_TEB_BATCH(Structure):
  2005. _fields_ = [
  2006. ("Offset", ULONG),
  2007. ("HDC", ULONG),
  2008. ("Buffer", ULONG * 310),
  2009. ]
  2010. # ntdll!_TEB_ACTIVE_FRAME_CONTEXT
  2011. # +0x000 Flags : Uint4B
  2012. # +0x008 FrameName : Ptr64 Char
  2013. class TEB_ACTIVE_FRAME_CONTEXT(Structure):
  2014. _fields_ = [
  2015. ("Flags", DWORD),
  2016. ("FrameName", LPVOID), # LPCHAR
  2017. ]
  2018. PTEB_ACTIVE_FRAME_CONTEXT = POINTER(TEB_ACTIVE_FRAME_CONTEXT)
  2019. # ntdll!_TEB_ACTIVE_FRAME
  2020. # +0x000 Flags : Uint4B
  2021. # +0x008 Previous : Ptr64 _TEB_ACTIVE_FRAME
  2022. # +0x010 Context : Ptr64 _TEB_ACTIVE_FRAME_CONTEXT
  2023. class TEB_ACTIVE_FRAME(Structure):
  2024. _fields_ = [
  2025. ("Flags", DWORD),
  2026. ("Previous", LPVOID), # PTEB_ACTIVE_FRAME
  2027. ("Context", LPVOID), # PTEB_ACTIVE_FRAME_CONTEXT
  2028. ]
  2029. PTEB_ACTIVE_FRAME = POINTER(TEB_ACTIVE_FRAME)
  2030. # SameTebFlags
  2031. DbgSafeThunkCall = 1 << 0
  2032. DbgInDebugPrint = 1 << 1
  2033. DbgHasFiberData = 1 << 2
  2034. DbgSkipThreadAttach = 1 << 3
  2035. DbgWerInShipAssertCode = 1 << 4
  2036. DbgRanProcessInit = 1 << 5
  2037. DbgClonedThread = 1 << 6
  2038. DbgSuppressDebugMsg = 1 << 7
  2039. RtlDisableUserStackWalk = 1 << 8
  2040. RtlExceptionAttached = 1 << 9
  2041. RtlInitialThread = 1 << 10
  2042. # XXX This is quite wrong :P
  2043. class _TEB_NT(Structure):
  2044. _pack_ = 4
  2045. _fields_ = [
  2046. ("NtTib", NT_TIB),
  2047. ("EnvironmentPointer", PVOID),
  2048. ("ClientId", CLIENT_ID),
  2049. ("ActiveRpcHandle", HANDLE),
  2050. ("ThreadLocalStoragePointer", PVOID),
  2051. ("ProcessEnvironmentBlock", PPEB),
  2052. ("LastErrorValue", ULONG),
  2053. ("CountOfOwnedCriticalSections", ULONG),
  2054. ("CsrClientThread", PVOID),
  2055. ("Win32ThreadInfo", PVOID),
  2056. ("User32Reserved", ULONG * 26),
  2057. ("UserReserved", ULONG * 5),
  2058. ("WOW32Reserved", PVOID), # ptr to wow64cpu!X86SwitchTo64BitMode
  2059. ("CurrentLocale", ULONG),
  2060. ("FpSoftwareStatusRegister", ULONG),
  2061. ("SystemReserved1", PVOID * 54),
  2062. ("Spare1", PVOID),
  2063. ("ExceptionCode", ULONG),
  2064. ("ActivationContextStackPointer", PVOID), # PACTIVATION_CONTEXT_STACK
  2065. ("SpareBytes1", ULONG * 36),
  2066. ("TxFsContext", ULONG),
  2067. ("GdiTebBatch", GDI_TEB_BATCH),
  2068. ("RealClientId", CLIENT_ID),
  2069. ("GdiCachedProcessHandle", PVOID),
  2070. ("GdiClientPID", ULONG),
  2071. ("GdiClientTID", ULONG),
  2072. ("GdiThreadLocalInfo", PVOID),
  2073. ("Win32ClientInfo", PVOID * 62),
  2074. ("glDispatchTable", PVOID * 233),
  2075. ("glReserved1", ULONG * 29),
  2076. ("glReserved2", PVOID),
  2077. ("glSectionInfo", PVOID),
  2078. ("glSection", PVOID),
  2079. ("glTable", PVOID),
  2080. ("glCurrentRC", PVOID),
  2081. ("glContext", PVOID),
  2082. ("LastStatusValue", NTSTATUS),
  2083. ("StaticUnicodeString", UNICODE_STRING),
  2084. ("StaticUnicodeBuffer", WCHAR * 261),
  2085. ("DeallocationStack", PVOID),
  2086. ("TlsSlots", PVOID * 64),
  2087. ("TlsLinks", LIST_ENTRY),
  2088. ("Vdm", PVOID),
  2089. ("ReservedForNtRpc", PVOID),
  2090. ("DbgSsReserved", PVOID * 2),
  2091. ("HardErrorDisabled", ULONG),
  2092. ("Instrumentation", PVOID * 9),
  2093. ("ActivityId", GUID),
  2094. ("SubProcessTag", PVOID),
  2095. ("EtwLocalData", PVOID),
  2096. ("EtwTraceData", PVOID),
  2097. ("WinSockData", PVOID),
  2098. ("GdiBatchCount", ULONG),
  2099. ("SpareBool0", BOOLEAN),
  2100. ("SpareBool1", BOOLEAN),
  2101. ("SpareBool2", BOOLEAN),
  2102. ("IdealProcessor", UCHAR),
  2103. ("GuaranteedStackBytes", ULONG),
  2104. ("ReservedForPerf", PVOID),
  2105. ("ReservedForOle", PVOID),
  2106. ("WaitingOnLoaderLock", ULONG),
  2107. ("StackCommit", PVOID),
  2108. ("StackCommitMax", PVOID),
  2109. ("StackReserved", PVOID),
  2110. ]
  2111. # not really, but "dt _TEB" in w2k isn't working for me :(
  2112. _TEB_2000 = _TEB_NT
  2113. # +0x000 NtTib : _NT_TIB
  2114. # +0x01c EnvironmentPointer : Ptr32 Void
  2115. # +0x020 ClientId : _CLIENT_ID
  2116. # +0x028 ActiveRpcHandle : Ptr32 Void
  2117. # +0x02c ThreadLocalStoragePointer : Ptr32 Void
  2118. # +0x030 ProcessEnvironmentBlock : Ptr32 _PEB
  2119. # +0x034 LastErrorValue : Uint4B
  2120. # +0x038 CountOfOwnedCriticalSections : Uint4B
  2121. # +0x03c CsrClientThread : Ptr32 Void
  2122. # +0x040 Win32ThreadInfo : Ptr32 Void
  2123. # +0x044 User32Reserved : [26] Uint4B
  2124. # +0x0ac UserReserved : [5] Uint4B
  2125. # +0x0c0 WOW32Reserved : Ptr32 Void
  2126. # +0x0c4 CurrentLocale : Uint4B
  2127. # +0x0c8 FpSoftwareStatusRegister : Uint4B
  2128. # +0x0cc SystemReserved1 : [54] Ptr32 Void
  2129. # +0x1a4 ExceptionCode : Int4B
  2130. # +0x1a8 ActivationContextStack : _ACTIVATION_CONTEXT_STACK
  2131. # +0x1bc SpareBytes1 : [24] UChar
  2132. # +0x1d4 GdiTebBatch : _GDI_TEB_BATCH
  2133. # +0x6b4 RealClientId : _CLIENT_ID
  2134. # +0x6bc GdiCachedProcessHandle : Ptr32 Void
  2135. # +0x6c0 GdiClientPID : Uint4B
  2136. # +0x6c4 GdiClientTID : Uint4B
  2137. # +0x6c8 GdiThreadLocalInfo : Ptr32 Void
  2138. # +0x6cc Win32ClientInfo : [62] Uint4B
  2139. # +0x7c4 glDispatchTable : [233] Ptr32 Void
  2140. # +0xb68 glReserved1 : [29] Uint4B
  2141. # +0xbdc glReserved2 : Ptr32 Void
  2142. # +0xbe0 glSectionInfo : Ptr32 Void
  2143. # +0xbe4 glSection : Ptr32 Void
  2144. # +0xbe8 glTable : Ptr32 Void
  2145. # +0xbec glCurrentRC : Ptr32 Void
  2146. # +0xbf0 glContext : Ptr32 Void
  2147. # +0xbf4 LastStatusValue : Uint4B
  2148. # +0xbf8 StaticUnicodeString : _UNICODE_STRING
  2149. # +0xc00 StaticUnicodeBuffer : [261] Uint2B
  2150. # +0xe0c DeallocationStack : Ptr32 Void
  2151. # +0xe10 TlsSlots : [64] Ptr32 Void
  2152. # +0xf10 TlsLinks : _LIST_ENTRY
  2153. # +0xf18 Vdm : Ptr32 Void
  2154. # +0xf1c ReservedForNtRpc : Ptr32 Void
  2155. # +0xf20 DbgSsReserved : [2] Ptr32 Void
  2156. # +0xf28 HardErrorsAreDisabled : Uint4B
  2157. # +0xf2c Instrumentation : [16] Ptr32 Void
  2158. # +0xf6c WinSockData : Ptr32 Void
  2159. # +0xf70 GdiBatchCount : Uint4B
  2160. # +0xf74 InDbgPrint : UChar
  2161. # +0xf75 FreeStackOnTermination : UChar
  2162. # +0xf76 HasFiberData : UChar
  2163. # +0xf77 IdealProcessor : UChar
  2164. # +0xf78 Spare3 : Uint4B
  2165. # +0xf7c ReservedForPerf : Ptr32 Void
  2166. # +0xf80 ReservedForOle : Ptr32 Void
  2167. # +0xf84 WaitingOnLoaderLock : Uint4B
  2168. # +0xf88 Wx86Thread : _Wx86ThreadState
  2169. # +0xf94 TlsExpansionSlots : Ptr32 Ptr32 Void
  2170. # +0xf98 ImpersonationLocale : Uint4B
  2171. # +0xf9c IsImpersonating : Uint4B
  2172. # +0xfa0 NlsCache : Ptr32 Void
  2173. # +0xfa4 pShimData : Ptr32 Void
  2174. # +0xfa8 HeapVirtualAffinity : Uint4B
  2175. # +0xfac CurrentTransactionHandle : Ptr32 Void
  2176. # +0xfb0 ActiveFrame : Ptr32 _TEB_ACTIVE_FRAME
  2177. # +0xfb4 SafeThunkCall : UChar
  2178. # +0xfb5 BooleanSpare : [3] UChar
  2179. class _TEB_XP(Structure):
  2180. _pack_ = 8
  2181. _fields_ = [
  2182. ("NtTib", NT_TIB),
  2183. ("EnvironmentPointer", PVOID),
  2184. ("ClientId", CLIENT_ID),
  2185. ("ActiveRpcHandle", HANDLE),
  2186. ("ThreadLocalStoragePointer", PVOID),
  2187. ("ProcessEnvironmentBlock", PVOID), # PPEB
  2188. ("LastErrorValue", DWORD),
  2189. ("CountOfOwnedCriticalSections", DWORD),
  2190. ("CsrClientThread", PVOID),
  2191. ("Win32ThreadInfo", PVOID),
  2192. ("User32Reserved", DWORD * 26),
  2193. ("UserReserved", DWORD * 5),
  2194. ("WOW32Reserved", PVOID), # ptr to wow64cpu!X86SwitchTo64BitMode
  2195. ("CurrentLocale", DWORD),
  2196. ("FpSoftwareStatusRegister", DWORD),
  2197. ("SystemReserved1", PVOID * 54),
  2198. ("ExceptionCode", SDWORD),
  2199. ("ActivationContextStackPointer", PVOID), # PACTIVATION_CONTEXT_STACK
  2200. ("SpareBytes1", UCHAR * 24),
  2201. ("TxFsContext", DWORD),
  2202. ("GdiTebBatch", GDI_TEB_BATCH),
  2203. ("RealClientId", CLIENT_ID),
  2204. ("GdiCachedProcessHandle", HANDLE),
  2205. ("GdiClientPID", DWORD),
  2206. ("GdiClientTID", DWORD),
  2207. ("GdiThreadLocalInfo", PVOID),
  2208. ("Win32ClientInfo", DWORD * 62),
  2209. ("glDispatchTable", PVOID * 233),
  2210. ("glReserved1", DWORD * 29),
  2211. ("glReserved2", PVOID),
  2212. ("glSectionInfo", PVOID),
  2213. ("glSection", PVOID),
  2214. ("glTable", PVOID),
  2215. ("glCurrentRC", PVOID),
  2216. ("glContext", PVOID),
  2217. ("LastStatusValue", NTSTATUS),
  2218. ("StaticUnicodeString", UNICODE_STRING),
  2219. ("StaticUnicodeBuffer", WCHAR * 261),
  2220. ("DeallocationStack", PVOID),
  2221. ("TlsSlots", PVOID * 64),
  2222. ("TlsLinks", LIST_ENTRY),
  2223. ("Vdm", PVOID),
  2224. ("ReservedForNtRpc", PVOID),
  2225. ("DbgSsReserved", PVOID * 2),
  2226. ("HardErrorsAreDisabled", DWORD),
  2227. ("Instrumentation", PVOID * 16),
  2228. ("WinSockData", PVOID),
  2229. ("GdiBatchCount", DWORD),
  2230. ("InDbgPrint", BOOLEAN),
  2231. ("FreeStackOnTermination", BOOLEAN),
  2232. ("HasFiberData", BOOLEAN),
  2233. ("IdealProcessor", UCHAR),
  2234. ("Spare3", DWORD),
  2235. ("ReservedForPerf", PVOID),
  2236. ("ReservedForOle", PVOID),
  2237. ("WaitingOnLoaderLock", DWORD),
  2238. ("Wx86Thread", Wx86ThreadState),
  2239. ("TlsExpansionSlots", PVOID), # Ptr32 Ptr32 Void
  2240. ("ImpersonationLocale", DWORD),
  2241. ("IsImpersonating", BOOL),
  2242. ("NlsCache", PVOID),
  2243. ("pShimData", PVOID),
  2244. ("HeapVirtualAffinity", DWORD),
  2245. ("CurrentTransactionHandle", HANDLE),
  2246. ("ActiveFrame", PVOID), # PTEB_ACTIVE_FRAME
  2247. ("SafeThunkCall", BOOLEAN),
  2248. ("BooleanSpare", BOOLEAN * 3),
  2249. ]
  2250. # +0x000 NtTib : _NT_TIB
  2251. # +0x038 EnvironmentPointer : Ptr64 Void
  2252. # +0x040 ClientId : _CLIENT_ID
  2253. # +0x050 ActiveRpcHandle : Ptr64 Void
  2254. # +0x058 ThreadLocalStoragePointer : Ptr64 Void
  2255. # +0x060 ProcessEnvironmentBlock : Ptr64 _PEB
  2256. # +0x068 LastErrorValue : Uint4B
  2257. # +0x06c CountOfOwnedCriticalSections : Uint4B
  2258. # +0x070 CsrClientThread : Ptr64 Void
  2259. # +0x078 Win32ThreadInfo : Ptr64 Void
  2260. # +0x080 User32Reserved : [26] Uint4B
  2261. # +0x0e8 UserReserved : [5] Uint4B
  2262. # +0x100 WOW32Reserved : Ptr64 Void
  2263. # +0x108 CurrentLocale : Uint4B
  2264. # +0x10c FpSoftwareStatusRegister : Uint4B
  2265. # +0x110 SystemReserved1 : [54] Ptr64 Void
  2266. # +0x2c0 ExceptionCode : Int4B
  2267. # +0x2c8 ActivationContextStackPointer : Ptr64 _ACTIVATION_CONTEXT_STACK
  2268. # +0x2d0 SpareBytes1 : [28] UChar
  2269. # +0x2f0 GdiTebBatch : _GDI_TEB_BATCH
  2270. # +0x7d8 RealClientId : _CLIENT_ID
  2271. # +0x7e8 GdiCachedProcessHandle : Ptr64 Void
  2272. # +0x7f0 GdiClientPID : Uint4B
  2273. # +0x7f4 GdiClientTID : Uint4B
  2274. # +0x7f8 GdiThreadLocalInfo : Ptr64 Void
  2275. # +0x800 Win32ClientInfo : [62] Uint8B
  2276. # +0x9f0 glDispatchTable : [233] Ptr64 Void
  2277. # +0x1138 glReserved1 : [29] Uint8B
  2278. # +0x1220 glReserved2 : Ptr64 Void
  2279. # +0x1228 glSectionInfo : Ptr64 Void
  2280. # +0x1230 glSection : Ptr64 Void
  2281. # +0x1238 glTable : Ptr64 Void
  2282. # +0x1240 glCurrentRC : Ptr64 Void
  2283. # +0x1248 glContext : Ptr64 Void
  2284. # +0x1250 LastStatusValue : Uint4B
  2285. # +0x1258 StaticUnicodeString : _UNICODE_STRING
  2286. # +0x1268 StaticUnicodeBuffer : [261] Uint2B
  2287. # +0x1478 DeallocationStack : Ptr64 Void
  2288. # +0x1480 TlsSlots : [64] Ptr64 Void
  2289. # +0x1680 TlsLinks : _LIST_ENTRY
  2290. # +0x1690 Vdm : Ptr64 Void
  2291. # +0x1698 ReservedForNtRpc : Ptr64 Void
  2292. # +0x16a0 DbgSsReserved : [2] Ptr64 Void
  2293. # +0x16b0 HardErrorMode : Uint4B
  2294. # +0x16b8 Instrumentation : [14] Ptr64 Void
  2295. # +0x1728 SubProcessTag : Ptr64 Void
  2296. # +0x1730 EtwTraceData : Ptr64 Void
  2297. # +0x1738 WinSockData : Ptr64 Void
  2298. # +0x1740 GdiBatchCount : Uint4B
  2299. # +0x1744 InDbgPrint : UChar
  2300. # +0x1745 FreeStackOnTermination : UChar
  2301. # +0x1746 HasFiberData : UChar
  2302. # +0x1747 IdealProcessor : UChar
  2303. # +0x1748 GuaranteedStackBytes : Uint4B
  2304. # +0x1750 ReservedForPerf : Ptr64 Void
  2305. # +0x1758 ReservedForOle : Ptr64 Void
  2306. # +0x1760 WaitingOnLoaderLock : Uint4B
  2307. # +0x1768 SparePointer1 : Uint8B
  2308. # +0x1770 SoftPatchPtr1 : Uint8B
  2309. # +0x1778 SoftPatchPtr2 : Uint8B
  2310. # +0x1780 TlsExpansionSlots : Ptr64 Ptr64 Void
  2311. # +0x1788 DeallocationBStore : Ptr64 Void
  2312. # +0x1790 BStoreLimit : Ptr64 Void
  2313. # +0x1798 ImpersonationLocale : Uint4B
  2314. # +0x179c IsImpersonating : Uint4B
  2315. # +0x17a0 NlsCache : Ptr64 Void
  2316. # +0x17a8 pShimData : Ptr64 Void
  2317. # +0x17b0 HeapVirtualAffinity : Uint4B
  2318. # +0x17b8 CurrentTransactionHandle : Ptr64 Void
  2319. # +0x17c0 ActiveFrame : Ptr64 _TEB_ACTIVE_FRAME
  2320. # +0x17c8 FlsData : Ptr64 Void
  2321. # +0x17d0 SafeThunkCall : UChar
  2322. # +0x17d1 BooleanSpare : [3] UChar
  2323. class _TEB_XP_64(Structure):
  2324. _pack_ = 8
  2325. _fields_ = [
  2326. ("NtTib", NT_TIB),
  2327. ("EnvironmentPointer", PVOID),
  2328. ("ClientId", CLIENT_ID),
  2329. ("ActiveRpcHandle", PVOID),
  2330. ("ThreadLocalStoragePointer", PVOID),
  2331. ("ProcessEnvironmentBlock", PVOID), # PPEB
  2332. ("LastErrorValue", DWORD),
  2333. ("CountOfOwnedCriticalSections", DWORD),
  2334. ("CsrClientThread", PVOID),
  2335. ("Win32ThreadInfo", PVOID),
  2336. ("User32Reserved", DWORD * 26),
  2337. ("UserReserved", DWORD * 5),
  2338. ("WOW32Reserved", PVOID), # ptr to wow64cpu!X86SwitchTo64BitMode
  2339. ("CurrentLocale", DWORD),
  2340. ("FpSoftwareStatusRegister", DWORD),
  2341. ("SystemReserved1", PVOID * 54),
  2342. ("ExceptionCode", SDWORD),
  2343. ("ActivationContextStackPointer", PVOID), # PACTIVATION_CONTEXT_STACK
  2344. ("SpareBytes1", UCHAR * 28),
  2345. ("GdiTebBatch", GDI_TEB_BATCH),
  2346. ("RealClientId", CLIENT_ID),
  2347. ("GdiCachedProcessHandle", HANDLE),
  2348. ("GdiClientPID", DWORD),
  2349. ("GdiClientTID", DWORD),
  2350. ("GdiThreadLocalInfo", PVOID),
  2351. ("Win32ClientInfo", QWORD * 62),
  2352. ("glDispatchTable", PVOID * 233),
  2353. ("glReserved1", QWORD * 29),
  2354. ("glReserved2", PVOID),
  2355. ("glSectionInfo", PVOID),
  2356. ("glSection", PVOID),
  2357. ("glTable", PVOID),
  2358. ("glCurrentRC", PVOID),
  2359. ("glContext", PVOID),
  2360. ("LastStatusValue", NTSTATUS),
  2361. ("StaticUnicodeString", UNICODE_STRING),
  2362. ("StaticUnicodeBuffer", WCHAR * 261),
  2363. ("DeallocationStack", PVOID),
  2364. ("TlsSlots", PVOID * 64),
  2365. ("TlsLinks", LIST_ENTRY),
  2366. ("Vdm", PVOID),
  2367. ("ReservedForNtRpc", PVOID),
  2368. ("DbgSsReserved", PVOID * 2),
  2369. ("HardErrorMode", DWORD),
  2370. ("Instrumentation", PVOID * 14),
  2371. ("SubProcessTag", PVOID),
  2372. ("EtwTraceData", PVOID),
  2373. ("WinSockData", PVOID),
  2374. ("GdiBatchCount", DWORD),
  2375. ("InDbgPrint", BOOLEAN),
  2376. ("FreeStackOnTermination", BOOLEAN),
  2377. ("HasFiberData", BOOLEAN),
  2378. ("IdealProcessor", UCHAR),
  2379. ("GuaranteedStackBytes", DWORD),
  2380. ("ReservedForPerf", PVOID),
  2381. ("ReservedForOle", PVOID),
  2382. ("WaitingOnLoaderLock", DWORD),
  2383. ("SparePointer1", PVOID),
  2384. ("SoftPatchPtr1", PVOID),
  2385. ("SoftPatchPtr2", PVOID),
  2386. ("TlsExpansionSlots", PVOID), # Ptr64 Ptr64 Void
  2387. ("DeallocationBStore", PVOID),
  2388. ("BStoreLimit", PVOID),
  2389. ("ImpersonationLocale", DWORD),
  2390. ("IsImpersonating", BOOL),
  2391. ("NlsCache", PVOID),
  2392. ("pShimData", PVOID),
  2393. ("HeapVirtualAffinity", DWORD),
  2394. ("CurrentTransactionHandle", HANDLE),
  2395. ("ActiveFrame", PVOID), # PTEB_ACTIVE_FRAME
  2396. ("FlsData", PVOID),
  2397. ("SafeThunkCall", BOOLEAN),
  2398. ("BooleanSpare", BOOLEAN * 3),
  2399. ]
  2400. # +0x000 NtTib : _NT_TIB
  2401. # +0x01c EnvironmentPointer : Ptr32 Void
  2402. # +0x020 ClientId : _CLIENT_ID
  2403. # +0x028 ActiveRpcHandle : Ptr32 Void
  2404. # +0x02c ThreadLocalStoragePointer : Ptr32 Void
  2405. # +0x030 ProcessEnvironmentBlock : Ptr32 _PEB
  2406. # +0x034 LastErrorValue : Uint4B
  2407. # +0x038 CountOfOwnedCriticalSections : Uint4B
  2408. # +0x03c CsrClientThread : Ptr32 Void
  2409. # +0x040 Win32ThreadInfo : Ptr32 Void
  2410. # +0x044 User32Reserved : [26] Uint4B
  2411. # +0x0ac UserReserved : [5] Uint4B
  2412. # +0x0c0 WOW32Reserved : Ptr32 Void
  2413. # +0x0c4 CurrentLocale : Uint4B
  2414. # +0x0c8 FpSoftwareStatusRegister : Uint4B
  2415. # +0x0cc SystemReserved1 : [54] Ptr32 Void
  2416. # +0x1a4 ExceptionCode : Int4B
  2417. # +0x1a8 ActivationContextStackPointer : Ptr32 _ACTIVATION_CONTEXT_STACK
  2418. # +0x1ac SpareBytes1 : [40] UChar
  2419. # +0x1d4 GdiTebBatch : _GDI_TEB_BATCH
  2420. # +0x6b4 RealClientId : _CLIENT_ID
  2421. # +0x6bc GdiCachedProcessHandle : Ptr32 Void
  2422. # +0x6c0 GdiClientPID : Uint4B
  2423. # +0x6c4 GdiClientTID : Uint4B
  2424. # +0x6c8 GdiThreadLocalInfo : Ptr32 Void
  2425. # +0x6cc Win32ClientInfo : [62] Uint4B
  2426. # +0x7c4 glDispatchTable : [233] Ptr32 Void
  2427. # +0xb68 glReserved1 : [29] Uint4B
  2428. # +0xbdc glReserved2 : Ptr32 Void
  2429. # +0xbe0 glSectionInfo : Ptr32 Void
  2430. # +0xbe4 glSection : Ptr32 Void
  2431. # +0xbe8 glTable : Ptr32 Void
  2432. # +0xbec glCurrentRC : Ptr32 Void
  2433. # +0xbf0 glContext : Ptr32 Void
  2434. # +0xbf4 LastStatusValue : Uint4B
  2435. # +0xbf8 StaticUnicodeString : _UNICODE_STRING
  2436. # +0xc00 StaticUnicodeBuffer : [261] Uint2B
  2437. # +0xe0c DeallocationStack : Ptr32 Void
  2438. # +0xe10 TlsSlots : [64] Ptr32 Void
  2439. # +0xf10 TlsLinks : _LIST_ENTRY
  2440. # +0xf18 Vdm : Ptr32 Void
  2441. # +0xf1c ReservedForNtRpc : Ptr32 Void
  2442. # +0xf20 DbgSsReserved : [2] Ptr32 Void
  2443. # +0xf28 HardErrorMode : Uint4B
  2444. # +0xf2c Instrumentation : [14] Ptr32 Void
  2445. # +0xf64 SubProcessTag : Ptr32 Void
  2446. # +0xf68 EtwTraceData : Ptr32 Void
  2447. # +0xf6c WinSockData : Ptr32 Void
  2448. # +0xf70 GdiBatchCount : Uint4B
  2449. # +0xf74 InDbgPrint : UChar
  2450. # +0xf75 FreeStackOnTermination : UChar
  2451. # +0xf76 HasFiberData : UChar
  2452. # +0xf77 IdealProcessor : UChar
  2453. # +0xf78 GuaranteedStackBytes : Uint4B
  2454. # +0xf7c ReservedForPerf : Ptr32 Void
  2455. # +0xf80 ReservedForOle : Ptr32 Void
  2456. # +0xf84 WaitingOnLoaderLock : Uint4B
  2457. # +0xf88 SparePointer1 : Uint4B
  2458. # +0xf8c SoftPatchPtr1 : Uint4B
  2459. # +0xf90 SoftPatchPtr2 : Uint4B
  2460. # +0xf94 TlsExpansionSlots : Ptr32 Ptr32 Void
  2461. # +0xf98 ImpersonationLocale : Uint4B
  2462. # +0xf9c IsImpersonating : Uint4B
  2463. # +0xfa0 NlsCache : Ptr32 Void
  2464. # +0xfa4 pShimData : Ptr32 Void
  2465. # +0xfa8 HeapVirtualAffinity : Uint4B
  2466. # +0xfac CurrentTransactionHandle : Ptr32 Void
  2467. # +0xfb0 ActiveFrame : Ptr32 _TEB_ACTIVE_FRAME
  2468. # +0xfb4 FlsData : Ptr32 Void
  2469. # +0xfb8 SafeThunkCall : UChar
  2470. # +0xfb9 BooleanSpare : [3] UChar
  2471. class _TEB_2003(Structure):
  2472. _pack_ = 8
  2473. _fields_ = [
  2474. ("NtTib", NT_TIB),
  2475. ("EnvironmentPointer", PVOID),
  2476. ("ClientId", CLIENT_ID),
  2477. ("ActiveRpcHandle", HANDLE),
  2478. ("ThreadLocalStoragePointer", PVOID),
  2479. ("ProcessEnvironmentBlock", PVOID), # PPEB
  2480. ("LastErrorValue", DWORD),
  2481. ("CountOfOwnedCriticalSections", DWORD),
  2482. ("CsrClientThread", PVOID),
  2483. ("Win32ThreadInfo", PVOID),
  2484. ("User32Reserved", DWORD * 26),
  2485. ("UserReserved", DWORD * 5),
  2486. ("WOW32Reserved", PVOID), # ptr to wow64cpu!X86SwitchTo64BitMode
  2487. ("CurrentLocale", DWORD),
  2488. ("FpSoftwareStatusRegister", DWORD),
  2489. ("SystemReserved1", PVOID * 54),
  2490. ("ExceptionCode", SDWORD),
  2491. ("ActivationContextStackPointer", PVOID), # PACTIVATION_CONTEXT_STACK
  2492. ("SpareBytes1", UCHAR * 40),
  2493. ("GdiTebBatch", GDI_TEB_BATCH),
  2494. ("RealClientId", CLIENT_ID),
  2495. ("GdiCachedProcessHandle", HANDLE),
  2496. ("GdiClientPID", DWORD),
  2497. ("GdiClientTID", DWORD),
  2498. ("GdiThreadLocalInfo", PVOID),
  2499. ("Win32ClientInfo", DWORD * 62),
  2500. ("glDispatchTable", PVOID * 233),
  2501. ("glReserved1", DWORD * 29),
  2502. ("glReserved2", PVOID),
  2503. ("glSectionInfo", PVOID),
  2504. ("glSection", PVOID),
  2505. ("glTable", PVOID),
  2506. ("glCurrentRC", PVOID),
  2507. ("glContext", PVOID),
  2508. ("LastStatusValue", NTSTATUS),
  2509. ("StaticUnicodeString", UNICODE_STRING),
  2510. ("StaticUnicodeBuffer", WCHAR * 261),
  2511. ("DeallocationStack", PVOID),
  2512. ("TlsSlots", PVOID * 64),
  2513. ("TlsLinks", LIST_ENTRY),
  2514. ("Vdm", PVOID),
  2515. ("ReservedForNtRpc", PVOID),
  2516. ("DbgSsReserved", PVOID * 2),
  2517. ("HardErrorMode", DWORD),
  2518. ("Instrumentation", PVOID * 14),
  2519. ("SubProcessTag", PVOID),
  2520. ("EtwTraceData", PVOID),
  2521. ("WinSockData", PVOID),
  2522. ("GdiBatchCount", DWORD),
  2523. ("InDbgPrint", BOOLEAN),
  2524. ("FreeStackOnTermination", BOOLEAN),
  2525. ("HasFiberData", BOOLEAN),
  2526. ("IdealProcessor", UCHAR),
  2527. ("GuaranteedStackBytes", DWORD),
  2528. ("ReservedForPerf", PVOID),
  2529. ("ReservedForOle", PVOID),
  2530. ("WaitingOnLoaderLock", DWORD),
  2531. ("SparePointer1", PVOID),
  2532. ("SoftPatchPtr1", PVOID),
  2533. ("SoftPatchPtr2", PVOID),
  2534. ("TlsExpansionSlots", PVOID), # Ptr32 Ptr32 Void
  2535. ("ImpersonationLocale", DWORD),
  2536. ("IsImpersonating", BOOL),
  2537. ("NlsCache", PVOID),
  2538. ("pShimData", PVOID),
  2539. ("HeapVirtualAffinity", DWORD),
  2540. ("CurrentTransactionHandle", HANDLE),
  2541. ("ActiveFrame", PVOID), # PTEB_ACTIVE_FRAME
  2542. ("FlsData", PVOID),
  2543. ("SafeThunkCall", BOOLEAN),
  2544. ("BooleanSpare", BOOLEAN * 3),
  2545. ]
  2546. _TEB_2003_64 = _TEB_XP_64
  2547. _TEB_2003_R2 = _TEB_2003
  2548. _TEB_2003_R2_64 = _TEB_2003_64
  2549. # +0x000 NtTib : _NT_TIB
  2550. # +0x01c EnvironmentPointer : Ptr32 Void
  2551. # +0x020 ClientId : _CLIENT_ID
  2552. # +0x028 ActiveRpcHandle : Ptr32 Void
  2553. # +0x02c ThreadLocalStoragePointer : Ptr32 Void
  2554. # +0x030 ProcessEnvironmentBlock : Ptr32 _PEB
  2555. # +0x034 LastErrorValue : Uint4B
  2556. # +0x038 CountOfOwnedCriticalSections : Uint4B
  2557. # +0x03c CsrClientThread : Ptr32 Void
  2558. # +0x040 Win32ThreadInfo : Ptr32 Void
  2559. # +0x044 User32Reserved : [26] Uint4B
  2560. # +0x0ac UserReserved : [5] Uint4B
  2561. # +0x0c0 WOW32Reserved : Ptr32 Void
  2562. # +0x0c4 CurrentLocale : Uint4B
  2563. # +0x0c8 FpSoftwareStatusRegister : Uint4B
  2564. # +0x0cc SystemReserved1 : [54] Ptr32 Void
  2565. # +0x1a4 ExceptionCode : Int4B
  2566. # +0x1a8 ActivationContextStackPointer : Ptr32 _ACTIVATION_CONTEXT_STACK
  2567. # +0x1ac SpareBytes1 : [36] UChar
  2568. # +0x1d0 TxFsContext : Uint4B
  2569. # +0x1d4 GdiTebBatch : _GDI_TEB_BATCH
  2570. # +0x6b4 RealClientId : _CLIENT_ID
  2571. # +0x6bc GdiCachedProcessHandle : Ptr32 Void
  2572. # +0x6c0 GdiClientPID : Uint4B
  2573. # +0x6c4 GdiClientTID : Uint4B
  2574. # +0x6c8 GdiThreadLocalInfo : Ptr32 Void
  2575. # +0x6cc Win32ClientInfo : [62] Uint4B
  2576. # +0x7c4 glDispatchTable : [233] Ptr32 Void
  2577. # +0xb68 glReserved1 : [29] Uint4B
  2578. # +0xbdc glReserved2 : Ptr32 Void
  2579. # +0xbe0 glSectionInfo : Ptr32 Void
  2580. # +0xbe4 glSection : Ptr32 Void
  2581. # +0xbe8 glTable : Ptr32 Void
  2582. # +0xbec glCurrentRC : Ptr32 Void
  2583. # +0xbf0 glContext : Ptr32 Void
  2584. # +0xbf4 LastStatusValue : Uint4B
  2585. # +0xbf8 StaticUnicodeString : _UNICODE_STRING
  2586. # +0xc00 StaticUnicodeBuffer : [261] Wchar
  2587. # +0xe0c DeallocationStack : Ptr32 Void
  2588. # +0xe10 TlsSlots : [64] Ptr32 Void
  2589. # +0xf10 TlsLinks : _LIST_ENTRY
  2590. # +0xf18 Vdm : Ptr32 Void
  2591. # +0xf1c ReservedForNtRpc : Ptr32 Void
  2592. # +0xf20 DbgSsReserved : [2] Ptr32 Void
  2593. # +0xf28 HardErrorMode : Uint4B
  2594. # +0xf2c Instrumentation : [9] Ptr32 Void
  2595. # +0xf50 ActivityId : _GUID
  2596. # +0xf60 SubProcessTag : Ptr32 Void
  2597. # +0xf64 EtwLocalData : Ptr32 Void
  2598. # +0xf68 EtwTraceData : Ptr32 Void
  2599. # +0xf6c WinSockData : Ptr32 Void
  2600. # +0xf70 GdiBatchCount : Uint4B
  2601. # +0xf74 SpareBool0 : UChar
  2602. # +0xf75 SpareBool1 : UChar
  2603. # +0xf76 SpareBool2 : UChar
  2604. # +0xf77 IdealProcessor : UChar
  2605. # +0xf78 GuaranteedStackBytes : Uint4B
  2606. # +0xf7c ReservedForPerf : Ptr32 Void
  2607. # +0xf80 ReservedForOle : Ptr32 Void
  2608. # +0xf84 WaitingOnLoaderLock : Uint4B
  2609. # +0xf88 SavedPriorityState : Ptr32 Void
  2610. # +0xf8c SoftPatchPtr1 : Uint4B
  2611. # +0xf90 ThreadPoolData : Ptr32 Void
  2612. # +0xf94 TlsExpansionSlots : Ptr32 Ptr32 Void
  2613. # +0xf98 ImpersonationLocale : Uint4B
  2614. # +0xf9c IsImpersonating : Uint4B
  2615. # +0xfa0 NlsCache : Ptr32 Void
  2616. # +0xfa4 pShimData : Ptr32 Void
  2617. # +0xfa8 HeapVirtualAffinity : Uint4B
  2618. # +0xfac CurrentTransactionHandle : Ptr32 Void
  2619. # +0xfb0 ActiveFrame : Ptr32 _TEB_ACTIVE_FRAME
  2620. # +0xfb4 FlsData : Ptr32 Void
  2621. # +0xfb8 PreferredLanguages : Ptr32 Void
  2622. # +0xfbc UserPrefLanguages : Ptr32 Void
  2623. # +0xfc0 MergedPrefLanguages : Ptr32 Void
  2624. # +0xfc4 MuiImpersonation : Uint4B
  2625. # +0xfc8 CrossTebFlags : Uint2B
  2626. # +0xfc8 SpareCrossTebBits : Pos 0, 16 Bits
  2627. # +0xfca SameTebFlags : Uint2B
  2628. # +0xfca DbgSafeThunkCall : Pos 0, 1 Bit
  2629. # +0xfca DbgInDebugPrint : Pos 1, 1 Bit
  2630. # +0xfca DbgHasFiberData : Pos 2, 1 Bit
  2631. # +0xfca DbgSkipThreadAttach : Pos 3, 1 Bit
  2632. # +0xfca DbgWerInShipAssertCode : Pos 4, 1 Bit
  2633. # +0xfca DbgRanProcessInit : Pos 5, 1 Bit
  2634. # +0xfca DbgClonedThread : Pos 6, 1 Bit
  2635. # +0xfca DbgSuppressDebugMsg : Pos 7, 1 Bit
  2636. # +0xfca RtlDisableUserStackWalk : Pos 8, 1 Bit
  2637. # +0xfca RtlExceptionAttached : Pos 9, 1 Bit
  2638. # +0xfca SpareSameTebBits : Pos 10, 6 Bits
  2639. # +0xfcc TxnScopeEnterCallback : Ptr32 Void
  2640. # +0xfd0 TxnScopeExitCallback : Ptr32 Void
  2641. # +0xfd4 TxnScopeContext : Ptr32 Void
  2642. # +0xfd8 LockCount : Uint4B
  2643. # +0xfdc ProcessRundown : Uint4B
  2644. # +0xfe0 LastSwitchTime : Uint8B
  2645. # +0xfe8 TotalSwitchOutTime : Uint8B
  2646. # +0xff0 WaitReasonBitMap : _LARGE_INTEGER
  2647. class _TEB_2008(Structure):
  2648. _pack_ = 8
  2649. _fields_ = [
  2650. ("NtTib", NT_TIB),
  2651. ("EnvironmentPointer", PVOID),
  2652. ("ClientId", CLIENT_ID),
  2653. ("ActiveRpcHandle", HANDLE),
  2654. ("ThreadLocalStoragePointer", PVOID),
  2655. ("ProcessEnvironmentBlock", PVOID), # PPEB
  2656. ("LastErrorValue", DWORD),
  2657. ("CountOfOwnedCriticalSections", DWORD),
  2658. ("CsrClientThread", PVOID),
  2659. ("Win32ThreadInfo", PVOID),
  2660. ("User32Reserved", DWORD * 26),
  2661. ("UserReserved", DWORD * 5),
  2662. ("WOW32Reserved", PVOID), # ptr to wow64cpu!X86SwitchTo64BitMode
  2663. ("CurrentLocale", DWORD),
  2664. ("FpSoftwareStatusRegister", DWORD),
  2665. ("SystemReserved1", PVOID * 54),
  2666. ("ExceptionCode", SDWORD),
  2667. ("ActivationContextStackPointer", PVOID), # PACTIVATION_CONTEXT_STACK
  2668. ("SpareBytes1", UCHAR * 36),
  2669. ("TxFsContext", DWORD),
  2670. ("GdiTebBatch", GDI_TEB_BATCH),
  2671. ("RealClientId", CLIENT_ID),
  2672. ("GdiCachedProcessHandle", HANDLE),
  2673. ("GdiClientPID", DWORD),
  2674. ("GdiClientTID", DWORD),
  2675. ("GdiThreadLocalInfo", PVOID),
  2676. ("Win32ClientInfo", DWORD * 62),
  2677. ("glDispatchTable", PVOID * 233),
  2678. ("glReserved1", DWORD * 29),
  2679. ("glReserved2", PVOID),
  2680. ("glSectionInfo", PVOID),
  2681. ("glSection", PVOID),
  2682. ("glTable", PVOID),
  2683. ("glCurrentRC", PVOID),
  2684. ("glContext", PVOID),
  2685. ("LastStatusValue", NTSTATUS),
  2686. ("StaticUnicodeString", UNICODE_STRING),
  2687. ("StaticUnicodeBuffer", WCHAR * 261),
  2688. ("DeallocationStack", PVOID),
  2689. ("TlsSlots", PVOID * 64),
  2690. ("TlsLinks", LIST_ENTRY),
  2691. ("Vdm", PVOID),
  2692. ("ReservedForNtRpc", PVOID),
  2693. ("DbgSsReserved", PVOID * 2),
  2694. ("HardErrorMode", DWORD),
  2695. ("Instrumentation", PVOID * 9),
  2696. ("ActivityId", GUID),
  2697. ("SubProcessTag", PVOID),
  2698. ("EtwLocalData", PVOID),
  2699. ("EtwTraceData", PVOID),
  2700. ("WinSockData", PVOID),
  2701. ("GdiBatchCount", DWORD),
  2702. ("SpareBool0", BOOLEAN),
  2703. ("SpareBool1", BOOLEAN),
  2704. ("SpareBool2", BOOLEAN),
  2705. ("IdealProcessor", UCHAR),
  2706. ("GuaranteedStackBytes", DWORD),
  2707. ("ReservedForPerf", PVOID),
  2708. ("ReservedForOle", PVOID),
  2709. ("WaitingOnLoaderLock", DWORD),
  2710. ("SavedPriorityState", PVOID),
  2711. ("SoftPatchPtr1", PVOID),
  2712. ("ThreadPoolData", PVOID),
  2713. ("TlsExpansionSlots", PVOID), # Ptr32 Ptr32 Void
  2714. ("ImpersonationLocale", DWORD),
  2715. ("IsImpersonating", BOOL),
  2716. ("NlsCache", PVOID),
  2717. ("pShimData", PVOID),
  2718. ("HeapVirtualAffinity", DWORD),
  2719. ("CurrentTransactionHandle", HANDLE),
  2720. ("ActiveFrame", PVOID), # PTEB_ACTIVE_FRAME
  2721. ("FlsData", PVOID),
  2722. ("PreferredLanguages", PVOID),
  2723. ("UserPrefLanguages", PVOID),
  2724. ("MergedPrefLanguages", PVOID),
  2725. ("MuiImpersonation", BOOL),
  2726. ("CrossTebFlags", WORD),
  2727. ("SameTebFlags", WORD),
  2728. ("TxnScopeEnterCallback", PVOID),
  2729. ("TxnScopeExitCallback", PVOID),
  2730. ("TxnScopeContext", PVOID),
  2731. ("LockCount", DWORD),
  2732. ("ProcessRundown", DWORD),
  2733. ("LastSwitchTime", QWORD),
  2734. ("TotalSwitchOutTime", QWORD),
  2735. ("WaitReasonBitMap", LONGLONG), # LARGE_INTEGER
  2736. ]
  2737. # +0x000 NtTib : _NT_TIB
  2738. # +0x038 EnvironmentPointer : Ptr64 Void
  2739. # +0x040 ClientId : _CLIENT_ID
  2740. # +0x050 ActiveRpcHandle : Ptr64 Void
  2741. # +0x058 ThreadLocalStoragePointer : Ptr64 Void
  2742. # +0x060 ProcessEnvironmentBlock : Ptr64 _PEB
  2743. # +0x068 LastErrorValue : Uint4B
  2744. # +0x06c CountOfOwnedCriticalSections : Uint4B
  2745. # +0x070 CsrClientThread : Ptr64 Void
  2746. # +0x078 Win32ThreadInfo : Ptr64 Void
  2747. # +0x080 User32Reserved : [26] Uint4B
  2748. # +0x0e8 UserReserved : [5] Uint4B
  2749. # +0x100 WOW32Reserved : Ptr64 Void
  2750. # +0x108 CurrentLocale : Uint4B
  2751. # +0x10c FpSoftwareStatusRegister : Uint4B
  2752. # +0x110 SystemReserved1 : [54] Ptr64 Void
  2753. # +0x2c0 ExceptionCode : Int4B
  2754. # +0x2c8 ActivationContextStackPointer : Ptr64 _ACTIVATION_CONTEXT_STACK
  2755. # +0x2d0 SpareBytes1 : [24] UChar
  2756. # +0x2e8 TxFsContext : Uint4B
  2757. # +0x2f0 GdiTebBatch : _GDI_TEB_BATCH
  2758. # +0x7d8 RealClientId : _CLIENT_ID
  2759. # +0x7e8 GdiCachedProcessHandle : Ptr64 Void
  2760. # +0x7f0 GdiClientPID : Uint4B
  2761. # +0x7f4 GdiClientTID : Uint4B
  2762. # +0x7f8 GdiThreadLocalInfo : Ptr64 Void
  2763. # +0x800 Win32ClientInfo : [62] Uint8B
  2764. # +0x9f0 glDispatchTable : [233] Ptr64 Void
  2765. # +0x1138 glReserved1 : [29] Uint8B
  2766. # +0x1220 glReserved2 : Ptr64 Void
  2767. # +0x1228 glSectionInfo : Ptr64 Void
  2768. # +0x1230 glSection : Ptr64 Void
  2769. # +0x1238 glTable : Ptr64 Void
  2770. # +0x1240 glCurrentRC : Ptr64 Void
  2771. # +0x1248 glContext : Ptr64 Void
  2772. # +0x1250 LastStatusValue : Uint4B
  2773. # +0x1258 StaticUnicodeString : _UNICODE_STRING
  2774. # +0x1268 StaticUnicodeBuffer : [261] Wchar
  2775. # +0x1478 DeallocationStack : Ptr64 Void
  2776. # +0x1480 TlsSlots : [64] Ptr64 Void
  2777. # +0x1680 TlsLinks : _LIST_ENTRY
  2778. # +0x1690 Vdm : Ptr64 Void
  2779. # +0x1698 ReservedForNtRpc : Ptr64 Void
  2780. # +0x16a0 DbgSsReserved : [2] Ptr64 Void
  2781. # +0x16b0 HardErrorMode : Uint4B
  2782. # +0x16b8 Instrumentation : [11] Ptr64 Void
  2783. # +0x1710 ActivityId : _GUID
  2784. # +0x1720 SubProcessTag : Ptr64 Void
  2785. # +0x1728 EtwLocalData : Ptr64 Void
  2786. # +0x1730 EtwTraceData : Ptr64 Void
  2787. # +0x1738 WinSockData : Ptr64 Void
  2788. # +0x1740 GdiBatchCount : Uint4B
  2789. # +0x1744 SpareBool0 : UChar
  2790. # +0x1745 SpareBool1 : UChar
  2791. # +0x1746 SpareBool2 : UChar
  2792. # +0x1747 IdealProcessor : UChar
  2793. # +0x1748 GuaranteedStackBytes : Uint4B
  2794. # +0x1750 ReservedForPerf : Ptr64 Void
  2795. # +0x1758 ReservedForOle : Ptr64 Void
  2796. # +0x1760 WaitingOnLoaderLock : Uint4B
  2797. # +0x1768 SavedPriorityState : Ptr64 Void
  2798. # +0x1770 SoftPatchPtr1 : Uint8B
  2799. # +0x1778 ThreadPoolData : Ptr64 Void
  2800. # +0x1780 TlsExpansionSlots : Ptr64 Ptr64 Void
  2801. # +0x1788 DeallocationBStore : Ptr64 Void
  2802. # +0x1790 BStoreLimit : Ptr64 Void
  2803. # +0x1798 ImpersonationLocale : Uint4B
  2804. # +0x179c IsImpersonating : Uint4B
  2805. # +0x17a0 NlsCache : Ptr64 Void
  2806. # +0x17a8 pShimData : Ptr64 Void
  2807. # +0x17b0 HeapVirtualAffinity : Uint4B
  2808. # +0x17b8 CurrentTransactionHandle : Ptr64 Void
  2809. # +0x17c0 ActiveFrame : Ptr64 _TEB_ACTIVE_FRAME
  2810. # +0x17c8 FlsData : Ptr64 Void
  2811. # +0x17d0 PreferredLanguages : Ptr64 Void
  2812. # +0x17d8 UserPrefLanguages : Ptr64 Void
  2813. # +0x17e0 MergedPrefLanguages : Ptr64 Void
  2814. # +0x17e8 MuiImpersonation : Uint4B
  2815. # +0x17ec CrossTebFlags : Uint2B
  2816. # +0x17ec SpareCrossTebBits : Pos 0, 16 Bits
  2817. # +0x17ee SameTebFlags : Uint2B
  2818. # +0x17ee DbgSafeThunkCall : Pos 0, 1 Bit
  2819. # +0x17ee DbgInDebugPrint : Pos 1, 1 Bit
  2820. # +0x17ee DbgHasFiberData : Pos 2, 1 Bit
  2821. # +0x17ee DbgSkipThreadAttach : Pos 3, 1 Bit
  2822. # +0x17ee DbgWerInShipAssertCode : Pos 4, 1 Bit
  2823. # +0x17ee DbgRanProcessInit : Pos 5, 1 Bit
  2824. # +0x17ee DbgClonedThread : Pos 6, 1 Bit
  2825. # +0x17ee DbgSuppressDebugMsg : Pos 7, 1 Bit
  2826. # +0x17ee RtlDisableUserStackWalk : Pos 8, 1 Bit
  2827. # +0x17ee RtlExceptionAttached : Pos 9, 1 Bit
  2828. # +0x17ee SpareSameTebBits : Pos 10, 6 Bits
  2829. # +0x17f0 TxnScopeEnterCallback : Ptr64 Void
  2830. # +0x17f8 TxnScopeExitCallback : Ptr64 Void
  2831. # +0x1800 TxnScopeContext : Ptr64 Void
  2832. # +0x1808 LockCount : Uint4B
  2833. # +0x180c ProcessRundown : Uint4B
  2834. # +0x1810 LastSwitchTime : Uint8B
  2835. # +0x1818 TotalSwitchOutTime : Uint8B
  2836. # +0x1820 WaitReasonBitMap : _LARGE_INTEGER
  2837. class _TEB_2008_64(Structure):
  2838. _pack_ = 8
  2839. _fields_ = [
  2840. ("NtTib", NT_TIB),
  2841. ("EnvironmentPointer", PVOID),
  2842. ("ClientId", CLIENT_ID),
  2843. ("ActiveRpcHandle", HANDLE),
  2844. ("ThreadLocalStoragePointer", PVOID),
  2845. ("ProcessEnvironmentBlock", PVOID), # PPEB
  2846. ("LastErrorValue", DWORD),
  2847. ("CountOfOwnedCriticalSections", DWORD),
  2848. ("CsrClientThread", PVOID),
  2849. ("Win32ThreadInfo", PVOID),
  2850. ("User32Reserved", DWORD * 26),
  2851. ("UserReserved", DWORD * 5),
  2852. ("WOW32Reserved", PVOID), # ptr to wow64cpu!X86SwitchTo64BitMode
  2853. ("CurrentLocale", DWORD),
  2854. ("FpSoftwareStatusRegister", DWORD),
  2855. ("SystemReserved1", PVOID * 54),
  2856. ("ExceptionCode", SDWORD),
  2857. ("ActivationContextStackPointer", PVOID), # PACTIVATION_CONTEXT_STACK
  2858. ("SpareBytes1", UCHAR * 24),
  2859. ("TxFsContext", DWORD),
  2860. ("GdiTebBatch", GDI_TEB_BATCH),
  2861. ("RealClientId", CLIENT_ID),
  2862. ("GdiCachedProcessHandle", HANDLE),
  2863. ("GdiClientPID", DWORD),
  2864. ("GdiClientTID", DWORD),
  2865. ("GdiThreadLocalInfo", PVOID),
  2866. ("Win32ClientInfo", QWORD * 62),
  2867. ("glDispatchTable", PVOID * 233),
  2868. ("glReserved1", QWORD * 29),
  2869. ("glReserved2", PVOID),
  2870. ("glSectionInfo", PVOID),
  2871. ("glSection", PVOID),
  2872. ("glTable", PVOID),
  2873. ("glCurrentRC", PVOID),
  2874. ("glContext", PVOID),
  2875. ("LastStatusValue", NTSTATUS),
  2876. ("StaticUnicodeString", UNICODE_STRING),
  2877. ("StaticUnicodeBuffer", WCHAR * 261),
  2878. ("DeallocationStack", PVOID),
  2879. ("TlsSlots", PVOID * 64),
  2880. ("TlsLinks", LIST_ENTRY),
  2881. ("Vdm", PVOID),
  2882. ("ReservedForNtRpc", PVOID),
  2883. ("DbgSsReserved", PVOID * 2),
  2884. ("HardErrorMode", DWORD),
  2885. ("Instrumentation", PVOID * 11),
  2886. ("ActivityId", GUID),
  2887. ("SubProcessTag", PVOID),
  2888. ("EtwLocalData", PVOID),
  2889. ("EtwTraceData", PVOID),
  2890. ("WinSockData", PVOID),
  2891. ("GdiBatchCount", DWORD),
  2892. ("SpareBool0", BOOLEAN),
  2893. ("SpareBool1", BOOLEAN),
  2894. ("SpareBool2", BOOLEAN),
  2895. ("IdealProcessor", UCHAR),
  2896. ("GuaranteedStackBytes", DWORD),
  2897. ("ReservedForPerf", PVOID),
  2898. ("ReservedForOle", PVOID),
  2899. ("WaitingOnLoaderLock", DWORD),
  2900. ("SavedPriorityState", PVOID),
  2901. ("SoftPatchPtr1", PVOID),
  2902. ("ThreadPoolData", PVOID),
  2903. ("TlsExpansionSlots", PVOID), # Ptr64 Ptr64 Void
  2904. ("DeallocationBStore", PVOID),
  2905. ("BStoreLimit", PVOID),
  2906. ("ImpersonationLocale", DWORD),
  2907. ("IsImpersonating", BOOL),
  2908. ("NlsCache", PVOID),
  2909. ("pShimData", PVOID),
  2910. ("HeapVirtualAffinity", DWORD),
  2911. ("CurrentTransactionHandle", HANDLE),
  2912. ("ActiveFrame", PVOID), # PTEB_ACTIVE_FRAME
  2913. ("FlsData", PVOID),
  2914. ("PreferredLanguages", PVOID),
  2915. ("UserPrefLanguages", PVOID),
  2916. ("MergedPrefLanguages", PVOID),
  2917. ("MuiImpersonation", BOOL),
  2918. ("CrossTebFlags", WORD),
  2919. ("SameTebFlags", WORD),
  2920. ("TxnScopeEnterCallback", PVOID),
  2921. ("TxnScopeExitCallback", PVOID),
  2922. ("TxnScopeContext", PVOID),
  2923. ("LockCount", DWORD),
  2924. ("ProcessRundown", DWORD),
  2925. ("LastSwitchTime", QWORD),
  2926. ("TotalSwitchOutTime", QWORD),
  2927. ("WaitReasonBitMap", LONGLONG), # LARGE_INTEGER
  2928. ]
  2929. # +0x000 NtTib : _NT_TIB
  2930. # +0x01c EnvironmentPointer : Ptr32 Void
  2931. # +0x020 ClientId : _CLIENT_ID
  2932. # +0x028 ActiveRpcHandle : Ptr32 Void
  2933. # +0x02c ThreadLocalStoragePointer : Ptr32 Void
  2934. # +0x030 ProcessEnvironmentBlock : Ptr32 _PEB
  2935. # +0x034 LastErrorValue : Uint4B
  2936. # +0x038 CountOfOwnedCriticalSections : Uint4B
  2937. # +0x03c CsrClientThread : Ptr32 Void
  2938. # +0x040 Win32ThreadInfo : Ptr32 Void
  2939. # +0x044 User32Reserved : [26] Uint4B
  2940. # +0x0ac UserReserved : [5] Uint4B
  2941. # +0x0c0 WOW32Reserved : Ptr32 Void
  2942. # +0x0c4 CurrentLocale : Uint4B
  2943. # +0x0c8 FpSoftwareStatusRegister : Uint4B
  2944. # +0x0cc SystemReserved1 : [54] Ptr32 Void
  2945. # +0x1a4 ExceptionCode : Int4B
  2946. # +0x1a8 ActivationContextStackPointer : Ptr32 _ACTIVATION_CONTEXT_STACK
  2947. # +0x1ac SpareBytes : [36] UChar
  2948. # +0x1d0 TxFsContext : Uint4B
  2949. # +0x1d4 GdiTebBatch : _GDI_TEB_BATCH
  2950. # +0x6b4 RealClientId : _CLIENT_ID
  2951. # +0x6bc GdiCachedProcessHandle : Ptr32 Void
  2952. # +0x6c0 GdiClientPID : Uint4B
  2953. # +0x6c4 GdiClientTID : Uint4B
  2954. # +0x6c8 GdiThreadLocalInfo : Ptr32 Void
  2955. # +0x6cc Win32ClientInfo : [62] Uint4B
  2956. # +0x7c4 glDispatchTable : [233] Ptr32 Void
  2957. # +0xb68 glReserved1 : [29] Uint4B
  2958. # +0xbdc glReserved2 : Ptr32 Void
  2959. # +0xbe0 glSectionInfo : Ptr32 Void
  2960. # +0xbe4 glSection : Ptr32 Void
  2961. # +0xbe8 glTable : Ptr32 Void
  2962. # +0xbec glCurrentRC : Ptr32 Void
  2963. # +0xbf0 glContext : Ptr32 Void
  2964. # +0xbf4 LastStatusValue : Uint4B
  2965. # +0xbf8 StaticUnicodeString : _UNICODE_STRING
  2966. # +0xc00 StaticUnicodeBuffer : [261] Wchar
  2967. # +0xe0c DeallocationStack : Ptr32 Void
  2968. # +0xe10 TlsSlots : [64] Ptr32 Void
  2969. # +0xf10 TlsLinks : _LIST_ENTRY
  2970. # +0xf18 Vdm : Ptr32 Void
  2971. # +0xf1c ReservedForNtRpc : Ptr32 Void
  2972. # +0xf20 DbgSsReserved : [2] Ptr32 Void
  2973. # +0xf28 HardErrorMode : Uint4B
  2974. # +0xf2c Instrumentation : [9] Ptr32 Void
  2975. # +0xf50 ActivityId : _GUID
  2976. # +0xf60 SubProcessTag : Ptr32 Void
  2977. # +0xf64 EtwLocalData : Ptr32 Void
  2978. # +0xf68 EtwTraceData : Ptr32 Void
  2979. # +0xf6c WinSockData : Ptr32 Void
  2980. # +0xf70 GdiBatchCount : Uint4B
  2981. # +0xf74 CurrentIdealProcessor : _PROCESSOR_NUMBER
  2982. # +0xf74 IdealProcessorValue : Uint4B
  2983. # +0xf74 ReservedPad0 : UChar
  2984. # +0xf75 ReservedPad1 : UChar
  2985. # +0xf76 ReservedPad2 : UChar
  2986. # +0xf77 IdealProcessor : UChar
  2987. # +0xf78 GuaranteedStackBytes : Uint4B
  2988. # +0xf7c ReservedForPerf : Ptr32 Void
  2989. # +0xf80 ReservedForOle : Ptr32 Void
  2990. # +0xf84 WaitingOnLoaderLock : Uint4B
  2991. # +0xf88 SavedPriorityState : Ptr32 Void
  2992. # +0xf8c SoftPatchPtr1 : Uint4B
  2993. # +0xf90 ThreadPoolData : Ptr32 Void
  2994. # +0xf94 TlsExpansionSlots : Ptr32 Ptr32 Void
  2995. # +0xf98 MuiGeneration : Uint4B
  2996. # +0xf9c IsImpersonating : Uint4B
  2997. # +0xfa0 NlsCache : Ptr32 Void
  2998. # +0xfa4 pShimData : Ptr32 Void
  2999. # +0xfa8 HeapVirtualAffinity : Uint4B
  3000. # +0xfac CurrentTransactionHandle : Ptr32 Void
  3001. # +0xfb0 ActiveFrame : Ptr32 _TEB_ACTIVE_FRAME
  3002. # +0xfb4 FlsData : Ptr32 Void
  3003. # +0xfb8 PreferredLanguages : Ptr32 Void
  3004. # +0xfbc UserPrefLanguages : Ptr32 Void
  3005. # +0xfc0 MergedPrefLanguages : Ptr32 Void
  3006. # +0xfc4 MuiImpersonation : Uint4B
  3007. # +0xfc8 CrossTebFlags : Uint2B
  3008. # +0xfc8 SpareCrossTebBits : Pos 0, 16 Bits
  3009. # +0xfca SameTebFlags : Uint2B
  3010. # +0xfca SafeThunkCall : Pos 0, 1 Bit
  3011. # +0xfca InDebugPrint : Pos 1, 1 Bit
  3012. # +0xfca HasFiberData : Pos 2, 1 Bit
  3013. # +0xfca SkipThreadAttach : Pos 3, 1 Bit
  3014. # +0xfca WerInShipAssertCode : Pos 4, 1 Bit
  3015. # +0xfca RanProcessInit : Pos 5, 1 Bit
  3016. # +0xfca ClonedThread : Pos 6, 1 Bit
  3017. # +0xfca SuppressDebugMsg : Pos 7, 1 Bit
  3018. # +0xfca DisableUserStackWalk : Pos 8, 1 Bit
  3019. # +0xfca RtlExceptionAttached : Pos 9, 1 Bit
  3020. # +0xfca InitialThread : Pos 10, 1 Bit
  3021. # +0xfca SpareSameTebBits : Pos 11, 5 Bits
  3022. # +0xfcc TxnScopeEnterCallback : Ptr32 Void
  3023. # +0xfd0 TxnScopeExitCallback : Ptr32 Void
  3024. # +0xfd4 TxnScopeContext : Ptr32 Void
  3025. # +0xfd8 LockCount : Uint4B
  3026. # +0xfdc SpareUlong0 : Uint4B
  3027. # +0xfe0 ResourceRetValue : Ptr32 Void
  3028. class _TEB_2008_R2(Structure):
  3029. _pack_ = 8
  3030. _fields_ = [
  3031. ("NtTib", NT_TIB),
  3032. ("EnvironmentPointer", PVOID),
  3033. ("ClientId", CLIENT_ID),
  3034. ("ActiveRpcHandle", HANDLE),
  3035. ("ThreadLocalStoragePointer", PVOID),
  3036. ("ProcessEnvironmentBlock", PVOID), # PPEB
  3037. ("LastErrorValue", DWORD),
  3038. ("CountOfOwnedCriticalSections", DWORD),
  3039. ("CsrClientThread", PVOID),
  3040. ("Win32ThreadInfo", PVOID),
  3041. ("User32Reserved", DWORD * 26),
  3042. ("UserReserved", DWORD * 5),
  3043. ("WOW32Reserved", PVOID), # ptr to wow64cpu!X86SwitchTo64BitMode
  3044. ("CurrentLocale", DWORD),
  3045. ("FpSoftwareStatusRegister", DWORD),
  3046. ("SystemReserved1", PVOID * 54),
  3047. ("ExceptionCode", SDWORD),
  3048. ("ActivationContextStackPointer", PVOID), # PACTIVATION_CONTEXT_STACK
  3049. ("SpareBytes", UCHAR * 36),
  3050. ("TxFsContext", DWORD),
  3051. ("GdiTebBatch", GDI_TEB_BATCH),
  3052. ("RealClientId", CLIENT_ID),
  3053. ("GdiCachedProcessHandle", HANDLE),
  3054. ("GdiClientPID", DWORD),
  3055. ("GdiClientTID", DWORD),
  3056. ("GdiThreadLocalInfo", PVOID),
  3057. ("Win32ClientInfo", DWORD * 62),
  3058. ("glDispatchTable", PVOID * 233),
  3059. ("glReserved1", DWORD * 29),
  3060. ("glReserved2", PVOID),
  3061. ("glSectionInfo", PVOID),
  3062. ("glSection", PVOID),
  3063. ("glTable", PVOID),
  3064. ("glCurrentRC", PVOID),
  3065. ("glContext", PVOID),
  3066. ("LastStatusValue", NTSTATUS),
  3067. ("StaticUnicodeString", UNICODE_STRING),
  3068. ("StaticUnicodeBuffer", WCHAR * 261),
  3069. ("DeallocationStack", PVOID),
  3070. ("TlsSlots", PVOID * 64),
  3071. ("TlsLinks", LIST_ENTRY),
  3072. ("Vdm", PVOID),
  3073. ("ReservedForNtRpc", PVOID),
  3074. ("DbgSsReserved", PVOID * 2),
  3075. ("HardErrorMode", DWORD),
  3076. ("Instrumentation", PVOID * 9),
  3077. ("ActivityId", GUID),
  3078. ("SubProcessTag", PVOID),
  3079. ("EtwLocalData", PVOID),
  3080. ("EtwTraceData", PVOID),
  3081. ("WinSockData", PVOID),
  3082. ("GdiBatchCount", DWORD),
  3083. ("CurrentIdealProcessor", PROCESSOR_NUMBER),
  3084. ("IdealProcessorValue", DWORD),
  3085. ("ReservedPad0", UCHAR),
  3086. ("ReservedPad1", UCHAR),
  3087. ("ReservedPad2", UCHAR),
  3088. ("IdealProcessor", UCHAR),
  3089. ("GuaranteedStackBytes", DWORD),
  3090. ("ReservedForPerf", PVOID),
  3091. ("ReservedForOle", PVOID),
  3092. ("WaitingOnLoaderLock", DWORD),
  3093. ("SavedPriorityState", PVOID),
  3094. ("SoftPatchPtr1", PVOID),
  3095. ("ThreadPoolData", PVOID),
  3096. ("TlsExpansionSlots", PVOID), # Ptr32 Ptr32 Void
  3097. ("MuiGeneration", DWORD),
  3098. ("IsImpersonating", BOOL),
  3099. ("NlsCache", PVOID),
  3100. ("pShimData", PVOID),
  3101. ("HeapVirtualAffinity", DWORD),
  3102. ("CurrentTransactionHandle", HANDLE),
  3103. ("ActiveFrame", PVOID), # PTEB_ACTIVE_FRAME
  3104. ("FlsData", PVOID),
  3105. ("PreferredLanguages", PVOID),
  3106. ("UserPrefLanguages", PVOID),
  3107. ("MergedPrefLanguages", PVOID),
  3108. ("MuiImpersonation", BOOL),
  3109. ("CrossTebFlags", WORD),
  3110. ("SameTebFlags", WORD),
  3111. ("TxnScopeEnterCallback", PVOID),
  3112. ("TxnScopeExitCallback", PVOID),
  3113. ("TxnScopeContext", PVOID),
  3114. ("LockCount", DWORD),
  3115. ("SpareUlong0", ULONG),
  3116. ("ResourceRetValue", PVOID),
  3117. ]
  3118. # +0x000 NtTib : _NT_TIB
  3119. # +0x038 EnvironmentPointer : Ptr64 Void
  3120. # +0x040 ClientId : _CLIENT_ID
  3121. # +0x050 ActiveRpcHandle : Ptr64 Void
  3122. # +0x058 ThreadLocalStoragePointer : Ptr64 Void
  3123. # +0x060 ProcessEnvironmentBlock : Ptr64 _PEB
  3124. # +0x068 LastErrorValue : Uint4B
  3125. # +0x06c CountOfOwnedCriticalSections : Uint4B
  3126. # +0x070 CsrClientThread : Ptr64 Void
  3127. # +0x078 Win32ThreadInfo : Ptr64 Void
  3128. # +0x080 User32Reserved : [26] Uint4B
  3129. # +0x0e8 UserReserved : [5] Uint4B
  3130. # +0x100 WOW32Reserved : Ptr64 Void
  3131. # +0x108 CurrentLocale : Uint4B
  3132. # +0x10c FpSoftwareStatusRegister : Uint4B
  3133. # +0x110 SystemReserved1 : [54] Ptr64 Void
  3134. # +0x2c0 ExceptionCode : Int4B
  3135. # +0x2c8 ActivationContextStackPointer : Ptr64 _ACTIVATION_CONTEXT_STACK
  3136. # +0x2d0 SpareBytes : [24] UChar
  3137. # +0x2e8 TxFsContext : Uint4B
  3138. # +0x2f0 GdiTebBatch : _GDI_TEB_BATCH
  3139. # +0x7d8 RealClientId : _CLIENT_ID
  3140. # +0x7e8 GdiCachedProcessHandle : Ptr64 Void
  3141. # +0x7f0 GdiClientPID : Uint4B
  3142. # +0x7f4 GdiClientTID : Uint4B
  3143. # +0x7f8 GdiThreadLocalInfo : Ptr64 Void
  3144. # +0x800 Win32ClientInfo : [62] Uint8B
  3145. # +0x9f0 glDispatchTable : [233] Ptr64 Void
  3146. # +0x1138 glReserved1 : [29] Uint8B
  3147. # +0x1220 glReserved2 : Ptr64 Void
  3148. # +0x1228 glSectionInfo : Ptr64 Void
  3149. # +0x1230 glSection : Ptr64 Void
  3150. # +0x1238 glTable : Ptr64 Void
  3151. # +0x1240 glCurrentRC : Ptr64 Void
  3152. # +0x1248 glContext : Ptr64 Void
  3153. # +0x1250 LastStatusValue : Uint4B
  3154. # +0x1258 StaticUnicodeString : _UNICODE_STRING
  3155. # +0x1268 StaticUnicodeBuffer : [261] Wchar
  3156. # +0x1478 DeallocationStack : Ptr64 Void
  3157. # +0x1480 TlsSlots : [64] Ptr64 Void
  3158. # +0x1680 TlsLinks : _LIST_ENTRY
  3159. # +0x1690 Vdm : Ptr64 Void
  3160. # +0x1698 ReservedForNtRpc : Ptr64 Void
  3161. # +0x16a0 DbgSsReserved : [2] Ptr64 Void
  3162. # +0x16b0 HardErrorMode : Uint4B
  3163. # +0x16b8 Instrumentation : [11] Ptr64 Void
  3164. # +0x1710 ActivityId : _GUID
  3165. # +0x1720 SubProcessTag : Ptr64 Void
  3166. # +0x1728 EtwLocalData : Ptr64 Void
  3167. # +0x1730 EtwTraceData : Ptr64 Void
  3168. # +0x1738 WinSockData : Ptr64 Void
  3169. # +0x1740 GdiBatchCount : Uint4B
  3170. # +0x1744 CurrentIdealProcessor : _PROCESSOR_NUMBER
  3171. # +0x1744 IdealProcessorValue : Uint4B
  3172. # +0x1744 ReservedPad0 : UChar
  3173. # +0x1745 ReservedPad1 : UChar
  3174. # +0x1746 ReservedPad2 : UChar
  3175. # +0x1747 IdealProcessor : UChar
  3176. # +0x1748 GuaranteedStackBytes : Uint4B
  3177. # +0x1750 ReservedForPerf : Ptr64 Void
  3178. # +0x1758 ReservedForOle : Ptr64 Void
  3179. # +0x1760 WaitingOnLoaderLock : Uint4B
  3180. # +0x1768 SavedPriorityState : Ptr64 Void
  3181. # +0x1770 SoftPatchPtr1 : Uint8B
  3182. # +0x1778 ThreadPoolData : Ptr64 Void
  3183. # +0x1780 TlsExpansionSlots : Ptr64 Ptr64 Void
  3184. # +0x1788 DeallocationBStore : Ptr64 Void
  3185. # +0x1790 BStoreLimit : Ptr64 Void
  3186. # +0x1798 MuiGeneration : Uint4B
  3187. # +0x179c IsImpersonating : Uint4B
  3188. # +0x17a0 NlsCache : Ptr64 Void
  3189. # +0x17a8 pShimData : Ptr64 Void
  3190. # +0x17b0 HeapVirtualAffinity : Uint4B
  3191. # +0x17b8 CurrentTransactionHandle : Ptr64 Void
  3192. # +0x17c0 ActiveFrame : Ptr64 _TEB_ACTIVE_FRAME
  3193. # +0x17c8 FlsData : Ptr64 Void
  3194. # +0x17d0 PreferredLanguages : Ptr64 Void
  3195. # +0x17d8 UserPrefLanguages : Ptr64 Void
  3196. # +0x17e0 MergedPrefLanguages : Ptr64 Void
  3197. # +0x17e8 MuiImpersonation : Uint4B
  3198. # +0x17ec CrossTebFlags : Uint2B
  3199. # +0x17ec SpareCrossTebBits : Pos 0, 16 Bits
  3200. # +0x17ee SameTebFlags : Uint2B
  3201. # +0x17ee SafeThunkCall : Pos 0, 1 Bit
  3202. # +0x17ee InDebugPrint : Pos 1, 1 Bit
  3203. # +0x17ee HasFiberData : Pos 2, 1 Bit
  3204. # +0x17ee SkipThreadAttach : Pos 3, 1 Bit
  3205. # +0x17ee WerInShipAssertCode : Pos 4, 1 Bit
  3206. # +0x17ee RanProcessInit : Pos 5, 1 Bit
  3207. # +0x17ee ClonedThread : Pos 6, 1 Bit
  3208. # +0x17ee SuppressDebugMsg : Pos 7, 1 Bit
  3209. # +0x17ee DisableUserStackWalk : Pos 8, 1 Bit
  3210. # +0x17ee RtlExceptionAttached : Pos 9, 1 Bit
  3211. # +0x17ee InitialThread : Pos 10, 1 Bit
  3212. # +0x17ee SpareSameTebBits : Pos 11, 5 Bits
  3213. # +0x17f0 TxnScopeEnterCallback : Ptr64 Void
  3214. # +0x17f8 TxnScopeExitCallback : Ptr64 Void
  3215. # +0x1800 TxnScopeContext : Ptr64 Void
  3216. # +0x1808 LockCount : Uint4B
  3217. # +0x180c SpareUlong0 : Uint4B
  3218. # +0x1810 ResourceRetValue : Ptr64 Void
  3219. class _TEB_2008_R2_64(Structure):
  3220. _pack_ = 8
  3221. _fields_ = [
  3222. ("NtTib", NT_TIB),
  3223. ("EnvironmentPointer", PVOID),
  3224. ("ClientId", CLIENT_ID),
  3225. ("ActiveRpcHandle", HANDLE),
  3226. ("ThreadLocalStoragePointer", PVOID),
  3227. ("ProcessEnvironmentBlock", PVOID), # PPEB
  3228. ("LastErrorValue", DWORD),
  3229. ("CountOfOwnedCriticalSections", DWORD),
  3230. ("CsrClientThread", PVOID),
  3231. ("Win32ThreadInfo", PVOID),
  3232. ("User32Reserved", DWORD * 26),
  3233. ("UserReserved", DWORD * 5),
  3234. ("WOW32Reserved", PVOID), # ptr to wow64cpu!X86SwitchTo64BitMode
  3235. ("CurrentLocale", DWORD),
  3236. ("FpSoftwareStatusRegister", DWORD),
  3237. ("SystemReserved1", PVOID * 54),
  3238. ("ExceptionCode", SDWORD),
  3239. ("ActivationContextStackPointer", PVOID), # PACTIVATION_CONTEXT_STACK
  3240. ("SpareBytes", UCHAR * 24),
  3241. ("TxFsContext", DWORD),
  3242. ("GdiTebBatch", GDI_TEB_BATCH),
  3243. ("RealClientId", CLIENT_ID),
  3244. ("GdiCachedProcessHandle", HANDLE),
  3245. ("GdiClientPID", DWORD),
  3246. ("GdiClientTID", DWORD),
  3247. ("GdiThreadLocalInfo", PVOID),
  3248. ("Win32ClientInfo", DWORD * 62),
  3249. ("glDispatchTable", PVOID * 233),
  3250. ("glReserved1", QWORD * 29),
  3251. ("glReserved2", PVOID),
  3252. ("glSectionInfo", PVOID),
  3253. ("glSection", PVOID),
  3254. ("glTable", PVOID),
  3255. ("glCurrentRC", PVOID),
  3256. ("glContext", PVOID),
  3257. ("LastStatusValue", NTSTATUS),
  3258. ("StaticUnicodeString", UNICODE_STRING),
  3259. ("StaticUnicodeBuffer", WCHAR * 261),
  3260. ("DeallocationStack", PVOID),
  3261. ("TlsSlots", PVOID * 64),
  3262. ("TlsLinks", LIST_ENTRY),
  3263. ("Vdm", PVOID),
  3264. ("ReservedForNtRpc", PVOID),
  3265. ("DbgSsReserved", PVOID * 2),
  3266. ("HardErrorMode", DWORD),
  3267. ("Instrumentation", PVOID * 11),
  3268. ("ActivityId", GUID),
  3269. ("SubProcessTag", PVOID),
  3270. ("EtwLocalData", PVOID),
  3271. ("EtwTraceData", PVOID),
  3272. ("WinSockData", PVOID),
  3273. ("GdiBatchCount", DWORD),
  3274. ("CurrentIdealProcessor", PROCESSOR_NUMBER),
  3275. ("IdealProcessorValue", DWORD),
  3276. ("ReservedPad0", UCHAR),
  3277. ("ReservedPad1", UCHAR),
  3278. ("ReservedPad2", UCHAR),
  3279. ("IdealProcessor", UCHAR),
  3280. ("GuaranteedStackBytes", DWORD),
  3281. ("ReservedForPerf", PVOID),
  3282. ("ReservedForOle", PVOID),
  3283. ("WaitingOnLoaderLock", DWORD),
  3284. ("SavedPriorityState", PVOID),
  3285. ("SoftPatchPtr1", PVOID),
  3286. ("ThreadPoolData", PVOID),
  3287. ("TlsExpansionSlots", PVOID), # Ptr64 Ptr64 Void
  3288. ("DeallocationBStore", PVOID),
  3289. ("BStoreLimit", PVOID),
  3290. ("MuiGeneration", DWORD),
  3291. ("IsImpersonating", BOOL),
  3292. ("NlsCache", PVOID),
  3293. ("pShimData", PVOID),
  3294. ("HeapVirtualAffinity", DWORD),
  3295. ("CurrentTransactionHandle", HANDLE),
  3296. ("ActiveFrame", PVOID), # PTEB_ACTIVE_FRAME
  3297. ("FlsData", PVOID),
  3298. ("PreferredLanguages", PVOID),
  3299. ("UserPrefLanguages", PVOID),
  3300. ("MergedPrefLanguages", PVOID),
  3301. ("MuiImpersonation", BOOL),
  3302. ("CrossTebFlags", WORD),
  3303. ("SameTebFlags", WORD),
  3304. ("TxnScopeEnterCallback", PVOID),
  3305. ("TxnScopeExitCallback", PVOID),
  3306. ("TxnScopeContext", PVOID),
  3307. ("LockCount", DWORD),
  3308. ("SpareUlong0", ULONG),
  3309. ("ResourceRetValue", PVOID),
  3310. ]
  3311. _TEB_Vista = _TEB_2008
  3312. _TEB_Vista_64 = _TEB_2008_64
  3313. _TEB_W7 = _TEB_2008_R2
  3314. _TEB_W7_64 = _TEB_2008_R2_64
  3315. # Use the correct TEB structure definition.
  3316. # Defaults to the latest Windows version.
  3317. class TEB(Structure):
  3318. _pack_ = 8
  3319. if os == 'Windows NT':
  3320. _pack_ = _TEB_NT._pack_
  3321. _fields_ = _TEB_NT._fields_
  3322. elif os == 'Windows 2000':
  3323. _pack_ = _TEB_2000._pack_
  3324. _fields_ = _TEB_2000._fields_
  3325. elif os == 'Windows XP':
  3326. _fields_ = _TEB_XP._fields_
  3327. elif os == 'Windows XP (64 bits)':
  3328. _fields_ = _TEB_XP_64._fields_
  3329. elif os == 'Windows 2003':
  3330. _fields_ = _TEB_2003._fields_
  3331. elif os == 'Windows 2003 (64 bits)':
  3332. _fields_ = _TEB_2003_64._fields_
  3333. elif os == 'Windows 2008':
  3334. _fields_ = _TEB_2008._fields_
  3335. elif os == 'Windows 2008 (64 bits)':
  3336. _fields_ = _TEB_2008_64._fields_
  3337. elif os == 'Windows 2003 R2':
  3338. _fields_ = _TEB_2003_R2._fields_
  3339. elif os == 'Windows 2003 R2 (64 bits)':
  3340. _fields_ = _TEB_2003_R2_64._fields_
  3341. elif os == 'Windows 2008 R2':
  3342. _fields_ = _TEB_2008_R2._fields_
  3343. elif os == 'Windows 2008 R2 (64 bits)':
  3344. _fields_ = _TEB_2008_R2_64._fields_
  3345. elif os == 'Windows Vista':
  3346. _fields_ = _TEB_Vista._fields_
  3347. elif os == 'Windows Vista (64 bits)':
  3348. _fields_ = _TEB_Vista_64._fields_
  3349. elif os == 'Windows 7':
  3350. _fields_ = _TEB_W7._fields_
  3351. elif os == 'Windows 7 (64 bits)':
  3352. _fields_ = _TEB_W7_64._fields_
  3353. elif sizeof(SIZE_T) == sizeof(DWORD):
  3354. _fields_ = _TEB_W7._fields_
  3355. else:
  3356. _fields_ = _TEB_W7_64._fields_
  3357. PTEB = POINTER(TEB)
  3358. #==============================================================================
  3359. # This calculates the list of exported symbols.
  3360. _all = set(vars().keys()).difference(_all)
  3361. __all__ = [_x for _x in _all if not _x.startswith('_')]
  3362. __all__.sort()
  3363. #==============================================================================