Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

9800 lines
316 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Debugger engine interfaces.
  4. //
  5. // Copyright (c) Microsoft Corporation. All rights reserved.
  6. //
  7. //----------------------------------------------------------------------------
  8. #ifndef __DBGENG_H__
  9. #define __DBGENG_H__
  10. #include <stdarg.h>
  11. #include <objbase.h>
  12. #ifndef _WDBGEXTS_
  13. typedef struct _WINDBG_EXTENSION_APIS32* PWINDBG_EXTENSION_APIS32;
  14. typedef struct _WINDBG_EXTENSION_APIS64* PWINDBG_EXTENSION_APIS64;
  15. #endif
  16. #ifndef _CRASHLIB_
  17. typedef struct _MEMORY_BASIC_INFORMATION64* PMEMORY_BASIC_INFORMATION64;
  18. #endif
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. //----------------------------------------------------------------------------
  23. //
  24. // GUIDs and interface forward declarations.
  25. //
  26. //----------------------------------------------------------------------------
  27. /* f2df5f53-071f-47bd-9de6-5734c3fed689 */
  28. DEFINE_GUID(IID_IDebugAdvanced, 0xf2df5f53, 0x071f, 0x47bd,
  29. 0x9d, 0xe6, 0x57, 0x34, 0xc3, 0xfe, 0xd6, 0x89);
  30. /* 5bd9d474-5975-423a-b88b-65a8e7110e65 */
  31. DEFINE_GUID(IID_IDebugBreakpoint, 0x5bd9d474, 0x5975, 0x423a,
  32. 0xb8, 0x8b, 0x65, 0xa8, 0xe7, 0x11, 0x0e, 0x65);
  33. /* 27fe5639-8407-4f47-8364-ee118fb08ac8 */
  34. DEFINE_GUID(IID_IDebugClient, 0x27fe5639, 0x8407, 0x4f47,
  35. 0x83, 0x64, 0xee, 0x11, 0x8f, 0xb0, 0x8a, 0xc8);
  36. /* edbed635-372e-4dab-bbfe-ed0d2f63be81 */
  37. DEFINE_GUID(IID_IDebugClient2, 0xedbed635, 0x372e, 0x4dab,
  38. 0xbb, 0xfe, 0xed, 0x0d, 0x2f, 0x63, 0xbe, 0x81);
  39. /* dd492d7f-71b8-4ad6-a8dc-1c887479ff91 */
  40. DEFINE_GUID(IID_IDebugClient3, 0xdd492d7f, 0x71b8, 0x4ad6,
  41. 0xa8, 0xdc, 0x1c, 0x88, 0x74, 0x79, 0xff, 0x91);
  42. /* ca83c3de-5089-4cf8-93c8-d892387f2a5e */
  43. DEFINE_GUID(IID_IDebugClient4, 0xca83c3de, 0x5089, 0x4cf8,
  44. 0x93, 0xc8, 0xd8, 0x92, 0x38, 0x7f, 0x2a, 0x5e);
  45. /* 5182e668-105e-416e-ad92-24ef800424ba */
  46. DEFINE_GUID(IID_IDebugControl, 0x5182e668, 0x105e, 0x416e,
  47. 0xad, 0x92, 0x24, 0xef, 0x80, 0x04, 0x24, 0xba);
  48. /* d4366723-44df-4bed-8c7e-4c05424f4588 */
  49. DEFINE_GUID(IID_IDebugControl2, 0xd4366723, 0x44df, 0x4bed,
  50. 0x8c, 0x7e, 0x4c, 0x05, 0x42, 0x4f, 0x45, 0x88);
  51. /* 7df74a86-b03f-407f-90ab-a20dadcead08 */
  52. DEFINE_GUID(IID_IDebugControl3, 0x7df74a86, 0xb03f, 0x407f,
  53. 0x90, 0xab, 0xa2, 0x0d, 0xad, 0xce, 0xad, 0x08);
  54. /* 88f7dfab-3ea7-4c3a-aefb-c4e8106173aa */
  55. DEFINE_GUID(IID_IDebugDataSpaces, 0x88f7dfab, 0x3ea7, 0x4c3a,
  56. 0xae, 0xfb, 0xc4, 0xe8, 0x10, 0x61, 0x73, 0xaa);
  57. /* 7a5e852f-96e9-468f-ac1b-0b3addc4a049 */
  58. DEFINE_GUID(IID_IDebugDataSpaces2, 0x7a5e852f, 0x96e9, 0x468f,
  59. 0xac, 0x1b, 0x0b, 0x3a, 0xdd, 0xc4, 0xa0, 0x49);
  60. /* 23f79d6c-8aaf-4f7c-a607-9995f5407e63 */
  61. DEFINE_GUID(IID_IDebugDataSpaces3, 0x23f79d6c, 0x8aaf, 0x4f7c,
  62. 0xa6, 0x07, 0x99, 0x95, 0xf5, 0x40, 0x7e, 0x63);
  63. /* 337be28b-5036-4d72-b6bf-c45fbb9f2eaa */
  64. DEFINE_GUID(IID_IDebugEventCallbacks, 0x337be28b, 0x5036, 0x4d72,
  65. 0xb6, 0xbf, 0xc4, 0x5f, 0xbb, 0x9f, 0x2e, 0xaa);
  66. /* 9f50e42c-f136-499e-9a97-73036c94ed2d */
  67. DEFINE_GUID(IID_IDebugInputCallbacks, 0x9f50e42c, 0xf136, 0x499e,
  68. 0x9a, 0x97, 0x73, 0x03, 0x6c, 0x94, 0xed, 0x2d);
  69. /* 4bf58045-d654-4c40-b0af-683090f356dc */
  70. DEFINE_GUID(IID_IDebugOutputCallbacks, 0x4bf58045, 0xd654, 0x4c40,
  71. 0xb0, 0xaf, 0x68, 0x30, 0x90, 0xf3, 0x56, 0xdc);
  72. /* ce289126-9e84-45a7-937e-67bb18691493 */
  73. DEFINE_GUID(IID_IDebugRegisters, 0xce289126, 0x9e84, 0x45a7,
  74. 0x93, 0x7e, 0x67, 0xbb, 0x18, 0x69, 0x14, 0x93);
  75. /* f2528316-0f1a-4431-aeed-11d096e1e2ab */
  76. DEFINE_GUID(IID_IDebugSymbolGroup, 0xf2528316, 0x0f1a, 0x4431,
  77. 0xae, 0xed, 0x11, 0xd0, 0x96, 0xe1, 0xe2, 0xab);
  78. /* 8c31e98c-983a-48a5-9016-6fe5d667a950 */
  79. DEFINE_GUID(IID_IDebugSymbols, 0x8c31e98c, 0x983a, 0x48a5,
  80. 0x90, 0x16, 0x6f, 0xe5, 0xd6, 0x67, 0xa9, 0x50);
  81. /* 3a707211-afdd-4495-ad4f-56fecdf8163f */
  82. DEFINE_GUID(IID_IDebugSymbols2, 0x3a707211, 0xafdd, 0x4495,
  83. 0xad, 0x4f, 0x56, 0xfe, 0xcd, 0xf8, 0x16, 0x3f);
  84. /* 6b86fe2c-2c4f-4f0c-9da2-174311acc327 */
  85. DEFINE_GUID(IID_IDebugSystemObjects, 0x6b86fe2c, 0x2c4f, 0x4f0c,
  86. 0x9d, 0xa2, 0x17, 0x43, 0x11, 0xac, 0xc3, 0x27);
  87. /* 0ae9f5ff-1852-4679-b055-494bee6407ee */
  88. DEFINE_GUID(IID_IDebugSystemObjects2, 0x0ae9f5ff, 0x1852, 0x4679,
  89. 0xb0, 0x55, 0x49, 0x4b, 0xee, 0x64, 0x07, 0xee);
  90. /* e9676e2f-e286-4ea3-b0f9-dfe5d9fc330e */
  91. DEFINE_GUID(IID_IDebugSystemObjects3, 0xe9676e2f, 0xe286, 0x4ea3,
  92. 0xb0, 0xf9, 0xdf, 0xe5, 0xd9, 0xfc, 0x33, 0x0e);
  93. typedef interface DECLSPEC_UUID("f2df5f53-071f-47bd-9de6-5734c3fed689")
  94. IDebugAdvanced* PDEBUG_ADVANCED;
  95. typedef interface DECLSPEC_UUID("5bd9d474-5975-423a-b88b-65a8e7110e65")
  96. IDebugBreakpoint* PDEBUG_BREAKPOINT;
  97. typedef interface DECLSPEC_UUID("27fe5639-8407-4f47-8364-ee118fb08ac8")
  98. IDebugClient* PDEBUG_CLIENT;
  99. typedef interface DECLSPEC_UUID("edbed635-372e-4dab-bbfe-ed0d2f63be81")
  100. IDebugClient2* PDEBUG_CLIENT2;
  101. typedef interface DECLSPEC_UUID("dd492d7f-71b8-4ad6-a8dc-1c887479ff91")
  102. IDebugClient3* PDEBUG_CLIENT3;
  103. typedef interface DECLSPEC_UUID("ca83c3de-5089-4cf8-93c8-d892387f2a5e")
  104. IDebugClient4* PDEBUG_CLIENT4;
  105. typedef interface DECLSPEC_UUID("5182e668-105e-416e-ad92-24ef800424ba")
  106. IDebugControl* PDEBUG_CONTROL;
  107. typedef interface DECLSPEC_UUID("d4366723-44df-4bed-8c7e-4c05424f4588")
  108. IDebugControl2* PDEBUG_CONTROL2;
  109. typedef interface DECLSPEC_UUID("7df74a86-b03f-407f-90ab-a20dadcead08")
  110. IDebugControl3* PDEBUG_CONTROL3;
  111. typedef interface DECLSPEC_UUID("88f7dfab-3ea7-4c3a-aefb-c4e8106173aa")
  112. IDebugDataSpaces* PDEBUG_DATA_SPACES;
  113. typedef interface DECLSPEC_UUID("7a5e852f-96e9-468f-ac1b-0b3addc4a049")
  114. IDebugDataSpaces2* PDEBUG_DATA_SPACES2;
  115. typedef interface DECLSPEC_UUID("23f79d6c-8aaf-4f7c-a607-9995f5407e63")
  116. IDebugDataSpaces3* PDEBUG_DATA_SPACES3;
  117. typedef interface DECLSPEC_UUID("337be28b-5036-4d72-b6bf-c45fbb9f2eaa")
  118. IDebugEventCallbacks* PDEBUG_EVENT_CALLBACKS;
  119. typedef interface DECLSPEC_UUID("9f50e42c-f136-499e-9a97-73036c94ed2d")
  120. IDebugInputCallbacks* PDEBUG_INPUT_CALLBACKS;
  121. typedef interface DECLSPEC_UUID("4bf58045-d654-4c40-b0af-683090f356dc")
  122. IDebugOutputCallbacks* PDEBUG_OUTPUT_CALLBACKS;
  123. typedef interface DECLSPEC_UUID("ce289126-9e84-45a7-937e-67bb18691493")
  124. IDebugRegisters* PDEBUG_REGISTERS;
  125. typedef interface DECLSPEC_UUID("f2528316-0f1a-4431-aeed-11d096e1e2ab")
  126. IDebugSymbolGroup* PDEBUG_SYMBOL_GROUP;
  127. typedef interface DECLSPEC_UUID("8c31e98c-983a-48a5-9016-6fe5d667a950")
  128. IDebugSymbols* PDEBUG_SYMBOLS;
  129. typedef interface DECLSPEC_UUID("3a707211-afdd-4495-ad4f-56fecdf8163f")
  130. IDebugSymbols2* PDEBUG_SYMBOLS2;
  131. typedef interface DECLSPEC_UUID("6b86fe2c-2c4f-4f0c-9da2-174311acc327")
  132. IDebugSystemObjects* PDEBUG_SYSTEM_OBJECTS;
  133. typedef interface DECLSPEC_UUID("0ae9f5ff-1852-4679-b055-494bee6407ee")
  134. IDebugSystemObjects2* PDEBUG_SYSTEM_OBJECTS2;
  135. typedef interface DECLSPEC_UUID("e9676e2f-e286-4ea3-b0f9-dfe5d9fc330e")
  136. IDebugSystemObjects3* PDEBUG_SYSTEM_OBJECTS3;
  137. //----------------------------------------------------------------------------
  138. //
  139. // Macros.
  140. //
  141. //----------------------------------------------------------------------------
  142. // Extends a 32-bit address into a 64-bit address.
  143. #define DEBUG_EXTEND64(Addr) ((ULONG64)(LONG64)(LONG)(Addr))
  144. //----------------------------------------------------------------------------
  145. //
  146. // Client creation functions.
  147. //
  148. //----------------------------------------------------------------------------
  149. // RemoteOptions specifies connection types and
  150. // their parameters. Supported strings are:
  151. // npipe:Server=<Machine>,Pipe=<Pipe name>
  152. // tcp:Server=<Machine>,Port=<IP port>
  153. STDAPI
  154. DebugConnect(
  155. IN PCSTR RemoteOptions,
  156. IN REFIID InterfaceId,
  157. OUT PVOID* Interface
  158. );
  159. STDAPI
  160. DebugCreate(
  161. IN REFIID InterfaceId,
  162. OUT PVOID* Interface
  163. );
  164. //----------------------------------------------------------------------------
  165. //
  166. // IDebugAdvanced.
  167. //
  168. //----------------------------------------------------------------------------
  169. #undef INTERFACE
  170. #define INTERFACE IDebugAdvanced
  171. DECLARE_INTERFACE_(IDebugAdvanced, IUnknown)
  172. {
  173. // IUnknown.
  174. STDMETHOD(QueryInterface)(
  175. THIS_
  176. IN REFIID InterfaceId,
  177. OUT PVOID* Interface
  178. ) PURE;
  179. STDMETHOD_(ULONG, AddRef)(
  180. THIS
  181. ) PURE;
  182. STDMETHOD_(ULONG, Release)(
  183. THIS
  184. ) PURE;
  185. // IDebugAdvanced.
  186. // Get/SetThreadContext offer control over
  187. // the full processor context for a thread.
  188. // Higher-level functions, such as the
  189. // IDebugRegisters interface, allow similar
  190. // access in simpler and more generic ways.
  191. // Get/SetThreadContext are useful when
  192. // large amounts of thread context must
  193. // be changed and processor-specific code
  194. // is not a problem.
  195. STDMETHOD(GetThreadContext)(
  196. THIS_
  197. OUT /* align_is(16) */ PVOID Context,
  198. IN ULONG ContextSize
  199. ) PURE;
  200. STDMETHOD(SetThreadContext)(
  201. THIS_
  202. IN /* align_is(16) */ PVOID Context,
  203. IN ULONG ContextSize
  204. ) PURE;
  205. };
  206. //----------------------------------------------------------------------------
  207. //
  208. // IDebugBreakpoint.
  209. //
  210. //----------------------------------------------------------------------------
  211. // Types of breakpoints.
  212. #define DEBUG_BREAKPOINT_CODE 0
  213. #define DEBUG_BREAKPOINT_DATA 1
  214. // Breakpoint flags.
  215. // Go-only breakpoints are only active when
  216. // the engine is in unrestricted execution
  217. // mode. They do not fire when the engine
  218. // is stepping.
  219. #define DEBUG_BREAKPOINT_GO_ONLY 0x00000001
  220. // A breakpoint is flagged as deferred as long as
  221. // its offset expression cannot be evaluated.
  222. // A deferred breakpoint is not active.
  223. #define DEBUG_BREAKPOINT_DEFERRED 0x00000002
  224. #define DEBUG_BREAKPOINT_ENABLED 0x00000004
  225. // The adder-only flag does not affect breakpoint
  226. // operation. It is just a marker to restrict
  227. // output and notifications for the breakpoint to
  228. // the client that added the breakpoint. Breakpoint
  229. // callbacks for adder-only breaks will only be delivered
  230. // to the adding client. The breakpoint can not
  231. // be enumerated and accessed by other clients.
  232. #define DEBUG_BREAKPOINT_ADDER_ONLY 0x00000008
  233. // One-shot breakpoints automatically clear themselves
  234. // the first time they are hit.
  235. #define DEBUG_BREAKPOINT_ONE_SHOT 0x00000010
  236. // Data breakpoint access types.
  237. // Different architectures support different
  238. // sets of these bits.
  239. #define DEBUG_BREAK_READ 0x00000001
  240. #define DEBUG_BREAK_WRITE 0x00000002
  241. #define DEBUG_BREAK_EXECUTE 0x00000004
  242. #define DEBUG_BREAK_IO 0x00000008
  243. // Structure for querying breakpoint information
  244. // all at once.
  245. typedef struct _DEBUG_BREAKPOINT_PARAMETERS
  246. {
  247. ULONG64 Offset;
  248. ULONG Id;
  249. ULONG BreakType;
  250. ULONG ProcType;
  251. ULONG Flags;
  252. ULONG DataSize;
  253. ULONG DataAccessType;
  254. ULONG PassCount;
  255. ULONG CurrentPassCount;
  256. ULONG MatchThread;
  257. ULONG CommandSize;
  258. ULONG OffsetExpressionSize;
  259. } DEBUG_BREAKPOINT_PARAMETERS, *PDEBUG_BREAKPOINT_PARAMETERS;
  260. #undef INTERFACE
  261. #define INTERFACE IDebugBreakpoint
  262. DECLARE_INTERFACE_(IDebugBreakpoint, IUnknown)
  263. {
  264. // IUnknown.
  265. STDMETHOD(QueryInterface)(
  266. THIS_
  267. IN REFIID InterfaceId,
  268. OUT PVOID* Interface
  269. ) PURE;
  270. STDMETHOD_(ULONG, AddRef)(
  271. THIS
  272. ) PURE;
  273. STDMETHOD_(ULONG, Release)(
  274. THIS
  275. ) PURE;
  276. // IDebugBreakpoint.
  277. // Retrieves debugger engine unique ID
  278. // for the breakpoint. This ID is
  279. // fixed as long as the breakpoint exists
  280. // but after that may be reused.
  281. STDMETHOD(GetId)(
  282. THIS_
  283. OUT PULONG Id
  284. ) PURE;
  285. // Retrieves the type of break and
  286. // processor type for the breakpoint.
  287. STDMETHOD(GetType)(
  288. THIS_
  289. OUT PULONG BreakType,
  290. OUT PULONG ProcType
  291. ) PURE;
  292. // Returns the client that called AddBreakpoint.
  293. STDMETHOD(GetAdder)(
  294. THIS_
  295. OUT PDEBUG_CLIENT* Adder
  296. ) PURE;
  297. STDMETHOD(GetFlags)(
  298. THIS_
  299. OUT PULONG Flags
  300. ) PURE;
  301. // Only certain flags can be changed. Flags
  302. // are: GO_ONLY, ENABLE.
  303. // Sets the given flags.
  304. STDMETHOD(AddFlags)(
  305. THIS_
  306. IN ULONG Flags
  307. ) PURE;
  308. // Clears the given flags.
  309. STDMETHOD(RemoveFlags)(
  310. THIS_
  311. IN ULONG Flags
  312. ) PURE;
  313. // Sets the flags.
  314. STDMETHOD(SetFlags)(
  315. THIS_
  316. IN ULONG Flags
  317. ) PURE;
  318. // Controls the offset of the breakpoint. The
  319. // interpretation of the offset value depends on
  320. // the type of breakpoint and its settings. It
  321. // may be a code address, a data address, an
  322. // I/O port, etc.
  323. STDMETHOD(GetOffset)(
  324. THIS_
  325. OUT PULONG64 Offset
  326. ) PURE;
  327. STDMETHOD(SetOffset)(
  328. THIS_
  329. IN ULONG64 Offset
  330. ) PURE;
  331. // Data breakpoint methods will fail is the
  332. // target platform does not support the
  333. // parameters used.
  334. // These methods only function for breakpoints
  335. // created as data breakpoints.
  336. STDMETHOD(GetDataParameters)(
  337. THIS_
  338. OUT PULONG Size,
  339. OUT PULONG AccessType
  340. ) PURE;
  341. STDMETHOD(SetDataParameters)(
  342. THIS_
  343. IN ULONG Size,
  344. IN ULONG AccessType
  345. ) PURE;
  346. // Pass count defaults to one.
  347. STDMETHOD(GetPassCount)(
  348. THIS_
  349. OUT PULONG Count
  350. ) PURE;
  351. STDMETHOD(SetPassCount)(
  352. THIS_
  353. IN ULONG Count
  354. ) PURE;
  355. // Gets the current number of times
  356. // the breakpoint has been hit since
  357. // it was last triggered.
  358. STDMETHOD(GetCurrentPassCount)(
  359. THIS_
  360. OUT PULONG Count
  361. ) PURE;
  362. // If a match thread is set this breakpoint will
  363. // only trigger if it occurs on the match thread.
  364. // Otherwise it triggers for all threads.
  365. // Thread restrictions are not currently supported
  366. // in kernel mode.
  367. STDMETHOD(GetMatchThreadId)(
  368. THIS_
  369. OUT PULONG Id
  370. ) PURE;
  371. STDMETHOD(SetMatchThreadId)(
  372. THIS_
  373. IN ULONG Thread
  374. ) PURE;
  375. // The command for a breakpoint is automatically
  376. // executed by the engine before the event
  377. // is propagated. If the breakpoint continues
  378. // execution the event will begin with a continue
  379. // status. If the breakpoint does not continue
  380. // the event will begin with a break status.
  381. // This allows breakpoint commands to participate
  382. // in the normal event status voting.
  383. // Breakpoint commands are only executed until
  384. // the first command that alters the execution
  385. // status, such as g, p and t.
  386. // Breakpoint commands are removed when the
  387. // current syntax changes.
  388. STDMETHOD(GetCommand)(
  389. THIS_
  390. OUT OPTIONAL PSTR Buffer,
  391. IN ULONG BufferSize,
  392. OUT OPTIONAL PULONG CommandSize
  393. ) PURE;
  394. STDMETHOD(SetCommand)(
  395. THIS_
  396. IN PCSTR Command
  397. ) PURE;
  398. // Offset expressions are evaluated immediately
  399. // and at module load and unload events. If the
  400. // evaluation is successful the breakpoints
  401. // offset is updated and the breakpoint is
  402. // handled normally. If the expression cannot
  403. // be evaluated the breakpoint is deferred.
  404. // Currently the only offset expression
  405. // supported is a module-relative symbol
  406. // of the form <Module>!<Symbol>.
  407. STDMETHOD(GetOffsetExpression)(
  408. THIS_
  409. OUT OPTIONAL PSTR Buffer,
  410. IN ULONG BufferSize,
  411. OUT OPTIONAL PULONG ExpressionSize
  412. ) PURE;
  413. STDMETHOD(SetOffsetExpression)(
  414. THIS_
  415. IN PCSTR Expression
  416. ) PURE;
  417. STDMETHOD(GetParameters)(
  418. THIS_
  419. OUT PDEBUG_BREAKPOINT_PARAMETERS Params
  420. ) PURE;
  421. };
  422. //----------------------------------------------------------------------------
  423. //
  424. // IDebugClient.
  425. //
  426. //----------------------------------------------------------------------------
  427. // Kernel attach flags.
  428. #define DEBUG_ATTACH_KERNEL_CONNECTION 0x00000000
  429. // Attach to the local machine. If this flag is not set
  430. // a connection is made to a separate target machine using
  431. // the given connection options.
  432. #define DEBUG_ATTACH_LOCAL_KERNEL 0x00000001
  433. // Attach to an eXDI driver.
  434. #define DEBUG_ATTACH_EXDI_DRIVER 0x00000002
  435. // GetRunningProcessSystemIdByExecutableName flags.
  436. // By default the match allows a tail match on
  437. // just the filename. The match returns the first hit
  438. // even if multiple matches exist.
  439. #define DEBUG_GET_PROC_DEFAULT 0x00000000
  440. // The name must match fully.
  441. #define DEBUG_GET_PROC_FULL_MATCH 0x00000001
  442. // The match must be the only match.
  443. #define DEBUG_GET_PROC_ONLY_MATCH 0x00000002
  444. // GetRunningProcessDescription flags.
  445. #define DEBUG_PROC_DESC_DEFAULT 0x00000000
  446. // Return only filenames, not full paths.
  447. #define DEBUG_PROC_DESC_NO_PATHS 0x00000001
  448. // Dont look up service names.
  449. #define DEBUG_PROC_DESC_NO_SERVICES 0x00000002
  450. // Dont look up MTS package names.
  451. #define DEBUG_PROC_DESC_NO_MTS_PACKAGES 0x00000004
  452. // Dont retrieve the command line.
  453. #define DEBUG_PROC_DESC_NO_COMMAND_LINE 0x00000008
  454. //
  455. // Attach flags.
  456. //
  457. // Call DebugActiveProcess when attaching.
  458. #define DEBUG_ATTACH_DEFAULT 0x00000000
  459. // When attaching to a process just examine
  460. // the process state and suspend the threads.
  461. // DebugActiveProcess is not called so the process
  462. // is not actually being debugged. This is useful
  463. // for debugging processes holding locks which
  464. // interfere with the operation of DebugActiveProcess
  465. // or in situations where it is not desirable to
  466. // actually set up as a debugger.
  467. #define DEBUG_ATTACH_NONINVASIVE 0x00000001
  468. // Attempt to attach to a process that was abandoned
  469. // when being debugged. This is only supported in
  470. // some system versions.
  471. // This flag also allows multiple debuggers to
  472. // attach to the same process, which can result
  473. // in numerous problems unless very carefully
  474. // managed.
  475. #define DEBUG_ATTACH_EXISTING 0x00000002
  476. // When attaching non-invasively, do not suspend
  477. // threads. It is the callers responsibility
  478. // to either suspend the threads itself or be
  479. // aware that the attach state may not reflect
  480. // the current state of the process if threads
  481. // are still running.
  482. #define DEBUG_ATTACH_NONINVASIVE_NO_SUSPEND 0x00000004
  483. // When doing an invasive attach do not inject
  484. // a break-in thread to generate the initial break-in
  485. // event. This can be useful to save resources when
  486. // an initial break is not necessary or when injecting
  487. // a thread might affect the debuggee's state. This
  488. // option is only supported on Windows XP and above.
  489. #define DEBUG_ATTACH_INVASIVE_NO_INITIAL_BREAK 0x00000008
  490. // When doing an invasive attach resume all threads at the
  491. // time of attach. This makes it possible to attach
  492. // to a process created suspended and cause it to start running.
  493. #define DEBUG_ATTACH_INVASIVE_RESUME_PROCESS 0x00000010
  494. //
  495. // Process creation flags.
  496. //
  497. // On Windows XP this flag prevents the debug
  498. // heap from being used in the new process.
  499. #define DEBUG_CREATE_PROCESS_NO_DEBUG_HEAP CREATE_UNICODE_ENVIRONMENT
  500. // Indicates that the native NT RTL process creation
  501. // routines should be used instead of Win32. This
  502. // is only meaningful for special processes that run
  503. // as NT native processes.
  504. #define DEBUG_CREATE_PROCESS_THROUGH_RTL STACK_SIZE_PARAM_IS_A_RESERVATION
  505. //
  506. // Process options.
  507. //
  508. // Indicates that the debuggee process should be
  509. // automatically detached when the debugger exits.
  510. // A debugger can explicitly detach on exit or this
  511. // flag can be set so that detach occurs regardless
  512. // of how the debugger exits.
  513. // This is only supported on some system versions.
  514. #define DEBUG_PROCESS_DETACH_ON_EXIT 0x00000001
  515. // Indicates that processes created by the current
  516. // process should not be debugged.
  517. // Modifying this flag is only supported on some
  518. // system versions.
  519. #define DEBUG_PROCESS_ONLY_THIS_PROCESS 0x00000002
  520. // ConnectSession flags.
  521. // Default connect.
  522. #define DEBUG_CONNECT_SESSION_DEFAULT 0x00000000
  523. // Do not output the debugger version.
  524. #define DEBUG_CONNECT_SESSION_NO_VERSION 0x00000001
  525. // Do not announce the connection.
  526. #define DEBUG_CONNECT_SESSION_NO_ANNOUNCE 0x00000002
  527. // OutputServers flags.
  528. // Debugger servers from StartSever.
  529. #define DEBUG_SERVERS_DEBUGGER 0x00000001
  530. // Process servers from StartProcessServer.
  531. #define DEBUG_SERVERS_PROCESS 0x00000002
  532. #define DEBUG_SERVERS_ALL 0x00000003
  533. // EndSession flags.
  534. // Perform cleanup for the session.
  535. #define DEBUG_END_PASSIVE 0x00000000
  536. // Actively terminate the session and then perform cleanup.
  537. #define DEBUG_END_ACTIVE_TERMINATE 0x00000001
  538. // If possible, detach from all processes and then perform cleanup.
  539. #define DEBUG_END_ACTIVE_DETACH 0x00000002
  540. // Perform whatever cleanup is possible that doesn't require
  541. // acquiring any locks. This is useful for situations where
  542. // a thread is currently using the engine but the application
  543. // needs to exit and still wants to give the engine
  544. // the opportunity to clean up as much as possible.
  545. // This may leave the engine in an indeterminate state so
  546. // further engine calls should not be made.
  547. // When making a reentrant EndSession call from a remote
  548. // client it is the callers responsibility to ensure
  549. // that the server can process the request. It is best
  550. // to avoid making such calls.
  551. #define DEBUG_END_REENTRANT 0x00000003
  552. // Notify a server that a remote client is disconnecting.
  553. // This isnt required but if it isnt called then
  554. // no disconnect messages will be generated by the server.
  555. #define DEBUG_END_DISCONNECT 0x00000004
  556. // Output mask bits.
  557. // Normal output.
  558. #define DEBUG_OUTPUT_NORMAL 0x00000001
  559. // Error output.
  560. #define DEBUG_OUTPUT_ERROR 0x00000002
  561. // Warnings.
  562. #define DEBUG_OUTPUT_WARNING 0x00000004
  563. // Additional output.
  564. #define DEBUG_OUTPUT_VERBOSE 0x00000008
  565. // Prompt output.
  566. #define DEBUG_OUTPUT_PROMPT 0x00000010
  567. // Register dump before prompt.
  568. #define DEBUG_OUTPUT_PROMPT_REGISTERS 0x00000020
  569. // Warnings specific to extension operation.
  570. #define DEBUG_OUTPUT_EXTENSION_WARNING 0x00000040
  571. // Debuggee debug output, such as from OutputDebugString.
  572. #define DEBUG_OUTPUT_DEBUGGEE 0x00000080
  573. // Debuggee-generated prompt, such as from DbgPrompt.
  574. #define DEBUG_OUTPUT_DEBUGGEE_PROMPT 0x00000100
  575. // Symbol messages, such as for !sym noisy.
  576. #define DEBUG_OUTPUT_SYMBOLS 0x00000200
  577. // Internal debugger output, used mainly
  578. // for debugging the debugger. Output
  579. // may only occur in debug builds.
  580. // KD protocol output.
  581. #define DEBUG_IOUTPUT_KD_PROTOCOL 0x80000000
  582. // Remoting output.
  583. #define DEBUG_IOUTPUT_REMOTING 0x40000000
  584. // Breakpoint output.
  585. #define DEBUG_IOUTPUT_BREAKPOINT 0x20000000
  586. // Event output.
  587. #define DEBUG_IOUTPUT_EVENT 0x10000000
  588. // OutputIdentity flags.
  589. #define DEBUG_OUTPUT_IDENTITY_DEFAULT 0x00000000
  590. #undef INTERFACE
  591. #define INTERFACE IDebugClient
  592. DECLARE_INTERFACE_(IDebugClient, IUnknown)
  593. {
  594. // IUnknown.
  595. STDMETHOD(QueryInterface)(
  596. THIS_
  597. IN REFIID InterfaceId,
  598. OUT PVOID* Interface
  599. ) PURE;
  600. STDMETHOD_(ULONG, AddRef)(
  601. THIS
  602. ) PURE;
  603. STDMETHOD_(ULONG, Release)(
  604. THIS
  605. ) PURE;
  606. // IDebugClient.
  607. // The following set of methods start
  608. // the different kinds of debuggees.
  609. // Begins a debug session using the kernel
  610. // debugging protocol. This method selects
  611. // the protocol as the debuggee communication
  612. // mechanism but does not initiate the communication
  613. // itself.
  614. STDMETHOD(AttachKernel)(
  615. THIS_
  616. IN ULONG Flags,
  617. IN OPTIONAL PCSTR ConnectOptions
  618. ) PURE;
  619. STDMETHOD(GetKernelConnectionOptions)(
  620. THIS_
  621. OUT OPTIONAL PSTR Buffer,
  622. IN ULONG BufferSize,
  623. OUT OPTIONAL PULONG OptionsSize
  624. ) PURE;
  625. // Updates the connection options for a live
  626. // kernel connection. This can only be used
  627. // to modify parameters for the connection, not
  628. // to switch to a completely different kind of
  629. // connection.
  630. // This method is reentrant.
  631. STDMETHOD(SetKernelConnectionOptions)(
  632. THIS_
  633. IN PCSTR Options
  634. ) PURE;
  635. // Starts a process server for remote
  636. // user-mode process control.
  637. // The local process server is server zero.
  638. STDMETHOD(StartProcessServer)(
  639. THIS_
  640. IN ULONG Flags,
  641. IN PCSTR Options,
  642. IN PVOID Reserved
  643. ) PURE;
  644. STDMETHOD(ConnectProcessServer)(
  645. THIS_
  646. IN PCSTR RemoteOptions,
  647. OUT PULONG64 Server
  648. ) PURE;
  649. STDMETHOD(DisconnectProcessServer)(
  650. THIS_
  651. IN ULONG64 Server
  652. ) PURE;
  653. // Enumerates and describes processes
  654. // accessible through the given process server.
  655. STDMETHOD(GetRunningProcessSystemIds)(
  656. THIS_
  657. IN ULONG64 Server,
  658. OUT OPTIONAL /* size_is(Count) */ PULONG Ids,
  659. IN ULONG Count,
  660. OUT OPTIONAL PULONG ActualCount
  661. ) PURE;
  662. STDMETHOD(GetRunningProcessSystemIdByExecutableName)(
  663. THIS_
  664. IN ULONG64 Server,
  665. IN PCSTR ExeName,
  666. IN ULONG Flags,
  667. OUT PULONG Id
  668. ) PURE;
  669. STDMETHOD(GetRunningProcessDescription)(
  670. THIS_
  671. IN ULONG64 Server,
  672. IN ULONG SystemId,
  673. IN ULONG Flags,
  674. OUT OPTIONAL PSTR ExeName,
  675. IN ULONG ExeNameSize,
  676. OUT OPTIONAL PULONG ActualExeNameSize,
  677. OUT OPTIONAL PSTR Description,
  678. IN ULONG DescriptionSize,
  679. OUT OPTIONAL PULONG ActualDescriptionSize
  680. ) PURE;
  681. // Attaches to a running user-mode process.
  682. STDMETHOD(AttachProcess)(
  683. THIS_
  684. IN ULONG64 Server,
  685. IN ULONG ProcessId,
  686. IN ULONG AttachFlags
  687. ) PURE;
  688. // Creates a new user-mode process for debugging.
  689. // CreateFlags are as given to Win32s CreateProcess.
  690. // One of DEBUG_PROCESS or DEBUG_ONLY_THIS_PROCESS
  691. // must be specified.
  692. STDMETHOD(CreateProcess)(
  693. THIS_
  694. IN ULONG64 Server,
  695. IN PSTR CommandLine,
  696. IN ULONG CreateFlags
  697. ) PURE;
  698. // Creates or attaches to a user-mode process, or both.
  699. // If CommandLine is NULL this method operates as
  700. // AttachProcess does. If ProcessId is zero it
  701. // operates as CreateProcess does. If CommandLine is
  702. // non-NULL and ProcessId is non-zero the method first
  703. // starts a process with the given information but
  704. // in a suspended state. The engine then attaches to
  705. // the indicated process. Once the attach is successful
  706. // the suspended process is resumed. This provides
  707. // synchronization between the new process and the
  708. // attachment.
  709. STDMETHOD(CreateProcessAndAttach)(
  710. THIS_
  711. IN ULONG64 Server,
  712. IN OPTIONAL PSTR CommandLine,
  713. IN ULONG CreateFlags,
  714. IN ULONG ProcessId,
  715. IN ULONG AttachFlags
  716. ) PURE;
  717. // Gets and sets process control flags.
  718. STDMETHOD(GetProcessOptions)(
  719. THIS_
  720. OUT PULONG Options
  721. ) PURE;
  722. STDMETHOD(AddProcessOptions)(
  723. THIS_
  724. IN ULONG Options
  725. ) PURE;
  726. STDMETHOD(RemoveProcessOptions)(
  727. THIS_
  728. IN ULONG Options
  729. ) PURE;
  730. STDMETHOD(SetProcessOptions)(
  731. THIS_
  732. IN ULONG Options
  733. ) PURE;
  734. // Opens any kind of user- or kernel-mode dump file
  735. // and begins a debug session with the information
  736. // contained within it.
  737. STDMETHOD(OpenDumpFile)(
  738. THIS_
  739. IN PCSTR DumpFile
  740. ) PURE;
  741. // Writes a dump file from the current session information.
  742. // The kind of dump file written is determined by the
  743. // kind of session and the type qualifier given.
  744. // For example, if the current session is a kernel
  745. // debug session (DEBUG_CLASS_KERNEL) and the qualifier
  746. // is DEBUG_DUMP_SMALL a small kernel dump will be written.
  747. STDMETHOD(WriteDumpFile)(
  748. THIS_
  749. IN PCSTR DumpFile,
  750. IN ULONG Qualifier
  751. ) PURE;
  752. // Indicates that a remote client is ready to
  753. // begin participating in the current session.
  754. // HistoryLimit gives a character limit on
  755. // the amount of output history to be sent.
  756. STDMETHOD(ConnectSession)(
  757. THIS_
  758. IN ULONG Flags,
  759. IN ULONG HistoryLimit
  760. ) PURE;
  761. // Indicates that the engine should start accepting
  762. // remote connections. Options specifies connection types
  763. // and their parameters. Supported strings are:
  764. // npipe:Pipe=<Pipe name>
  765. // tcp:Port=<IP port>
  766. STDMETHOD(StartServer)(
  767. THIS_
  768. IN PCSTR Options
  769. ) PURE;
  770. // List the servers running on the given machine.
  771. // Uses the line prefix.
  772. STDMETHOD(OutputServers)(
  773. THIS_
  774. IN ULONG OutputControl,
  775. IN PCSTR Machine,
  776. IN ULONG Flags
  777. ) PURE;
  778. // Attempts to terminate all processes in the debuggers list.
  779. STDMETHOD(TerminateProcesses)(
  780. THIS
  781. ) PURE;
  782. // Attempts to detach from all processes in the debuggers list.
  783. // This requires OS support for debugger detach.
  784. STDMETHOD(DetachProcesses)(
  785. THIS
  786. ) PURE;
  787. // Stops the current debug session. If a process
  788. // was created or attached an active EndSession can
  789. // terminate or detach from it.
  790. // If a kernel connection was opened it will be closed but the
  791. // target machine is otherwise unaffected.
  792. STDMETHOD(EndSession)(
  793. THIS_
  794. IN ULONG Flags
  795. ) PURE;
  796. // If a process was started and ran to completion
  797. // this method can be used to retrieve its exit code.
  798. STDMETHOD(GetExitCode)(
  799. THIS_
  800. OUT PULONG Code
  801. ) PURE;
  802. // Client event callbacks are called on the thread
  803. // of the client. In order to give thread
  804. // execution to the engine for callbacks all
  805. // client threads should call DispatchCallbacks
  806. // when they are idle. Callbacks are only
  807. // received when a thread calls DispatchCallbacks
  808. // or WaitForEvent. WaitForEvent can only be
  809. // called by the thread that started the debug
  810. // session so all other client threads should
  811. // call DispatchCallbacks when possible.
  812. // DispatchCallbacks returns when ExitDispatch is used
  813. // to interrupt dispatch or when the timeout expires.
  814. // DispatchCallbacks dispatches callbacks for all
  815. // clients associated with the thread calling
  816. // DispatchCallbacks.
  817. // DispatchCallbacks returns S_FALSE when the
  818. // timeout expires.
  819. STDMETHOD(DispatchCallbacks)(
  820. THIS_
  821. IN ULONG Timeout
  822. ) PURE;
  823. // ExitDispatch can be used to interrupt callback
  824. // dispatch when a client thread is needed by the
  825. // client. This method is reentrant and can
  826. // be called from any thread.
  827. STDMETHOD(ExitDispatch)(
  828. THIS_
  829. IN PDEBUG_CLIENT Client
  830. ) PURE;
  831. // Clients are specific to the thread that
  832. // created them. Calls from other threads
  833. // fail immediately. The CreateClient method
  834. // is a notable exception; it allows creation
  835. // of a new client for a new thread.
  836. STDMETHOD(CreateClient)(
  837. THIS_
  838. OUT PDEBUG_CLIENT* Client
  839. ) PURE;
  840. STDMETHOD(GetInputCallbacks)(
  841. THIS_
  842. OUT PDEBUG_INPUT_CALLBACKS* Callbacks
  843. ) PURE;
  844. STDMETHOD(SetInputCallbacks)(
  845. THIS_
  846. IN PDEBUG_INPUT_CALLBACKS Callbacks
  847. ) PURE;
  848. // Output callback interfaces are described separately.
  849. STDMETHOD(GetOutputCallbacks)(
  850. THIS_
  851. OUT PDEBUG_OUTPUT_CALLBACKS* Callbacks
  852. ) PURE;
  853. STDMETHOD(SetOutputCallbacks)(
  854. THIS_
  855. IN PDEBUG_OUTPUT_CALLBACKS Callbacks
  856. ) PURE;
  857. // Output flags provide control over
  858. // the distribution of output among clients.
  859. // Output masks select which output streams
  860. // should be sent to the output callbacks.
  861. // Only Output calls with a mask that
  862. // contains one of the output mask bits
  863. // will be sent to the output callbacks.
  864. // These methods are reentrant.
  865. // If such access is not synchronized
  866. // disruptions in output may occur.
  867. STDMETHOD(GetOutputMask)(
  868. THIS_
  869. OUT PULONG Mask
  870. ) PURE;
  871. STDMETHOD(SetOutputMask)(
  872. THIS_
  873. IN ULONG Mask
  874. ) PURE;
  875. // These methods allow access to another clients
  876. // output mask. They are necessary for changing
  877. // a clients output mask when it is
  878. // waiting for events. These methods are reentrant
  879. // and can be called from any thread.
  880. STDMETHOD(GetOtherOutputMask)(
  881. THIS_
  882. IN PDEBUG_CLIENT Client,
  883. OUT PULONG Mask
  884. ) PURE;
  885. STDMETHOD(SetOtherOutputMask)(
  886. THIS_
  887. IN PDEBUG_CLIENT Client,
  888. IN ULONG Mask
  889. ) PURE;
  890. // Control the width of an output line for
  891. // commands which produce formatted output.
  892. // This setting is just a suggestion.
  893. STDMETHOD(GetOutputWidth)(
  894. THIS_
  895. OUT PULONG Columns
  896. ) PURE;
  897. STDMETHOD(SetOutputWidth)(
  898. THIS_
  899. IN ULONG Columns
  900. ) PURE;
  901. // Some of the engines output commands produce
  902. // multiple lines of output. A prefix can be
  903. // set that the engine will automatically output
  904. // for each line in that case, allowing a caller
  905. // to control indentation or identifying marks.
  906. // This is not a general setting for any output
  907. // with a newline in it. Methods which use
  908. // the line prefix are marked in their documentation.
  909. STDMETHOD(GetOutputLinePrefix)(
  910. THIS_
  911. OUT OPTIONAL PSTR Buffer,
  912. IN ULONG BufferSize,
  913. OUT OPTIONAL PULONG PrefixSize
  914. ) PURE;
  915. STDMETHOD(SetOutputLinePrefix)(
  916. THIS_
  917. IN OPTIONAL PCSTR Prefix
  918. ) PURE;
  919. // Returns a string describing the machine
  920. // and user this client represents. The
  921. // specific content of the string varies
  922. // with operating system. If the client is
  923. // remotely connected some network information
  924. // may also be present.
  925. STDMETHOD(GetIdentity)(
  926. THIS_
  927. OUT OPTIONAL PSTR Buffer,
  928. IN ULONG BufferSize,
  929. OUT OPTIONAL PULONG IdentitySize
  930. ) PURE;
  931. // Format is a printf-like format string
  932. // with one %s where the identity string should go.
  933. STDMETHOD(OutputIdentity)(
  934. THIS_
  935. IN ULONG OutputControl,
  936. IN ULONG Flags,
  937. IN PCSTR Format
  938. ) PURE;
  939. // Event callbacks allow a client to
  940. // receive notification about changes
  941. // during the debug session.
  942. STDMETHOD(GetEventCallbacks)(
  943. THIS_
  944. OUT PDEBUG_EVENT_CALLBACKS* Callbacks
  945. ) PURE;
  946. STDMETHOD(SetEventCallbacks)(
  947. THIS_
  948. IN PDEBUG_EVENT_CALLBACKS Callbacks
  949. ) PURE;
  950. // The engine sometimes merges compatible callback
  951. // requests to reduce callback overhead. This is
  952. // most noticeable with output as small pieces of
  953. // output are collected into larger groups to
  954. // reduce the overall number of output callback calls.
  955. // A client can use this method to force all pending
  956. // callbacks to be delivered. This is rarely necessary.
  957. STDMETHOD(FlushCallbacks)(
  958. THIS
  959. ) PURE;
  960. };
  961. // Per-dump-format control flags.
  962. #define DEBUG_FORMAT_DEFAULT 0x00000000
  963. // Write dump to a temporary file, then package it
  964. // into a CAB file and delete the temporary file.
  965. #define DEBUG_FORMAT_WRITE_CAB 0x20000000
  966. // When creating a CAB add secondary files such as
  967. // current symbols and mapped images.
  968. #define DEBUG_FORMAT_CAB_SECONDARY_FILES 0x40000000
  969. // Don't overwrite existing files.
  970. #define DEBUG_FORMAT_NO_OVERWRITE 0x80000000
  971. #define DEBUG_FORMAT_USER_SMALL_FULL_MEMORY 0x00000001
  972. #define DEBUG_FORMAT_USER_SMALL_HANDLE_DATA 0x00000002
  973. #define DEBUG_FORMAT_USER_SMALL_UNLOADED_MODULES 0x00000004
  974. #define DEBUG_FORMAT_USER_SMALL_INDIRECT_MEMORY 0x00000008
  975. #define DEBUG_FORMAT_USER_SMALL_DATA_SEGMENTS 0x00000010
  976. #define DEBUG_FORMAT_USER_SMALL_FILTER_MEMORY 0x00000020
  977. #define DEBUG_FORMAT_USER_SMALL_FILTER_PATHS 0x00000040
  978. #define DEBUG_FORMAT_USER_SMALL_PROCESS_THREAD_DATA 0x00000080
  979. #define DEBUG_FORMAT_USER_SMALL_PRIVATE_READ_WRITE_MEMORY 0x00000100
  980. //
  981. // Dump information file types.
  982. //
  983. // Base dump file, returned when querying for dump files.
  984. #define DEBUG_DUMP_FILE_BASE 0xffffffff
  985. // Single file containing packed page file information.
  986. #define DEBUG_DUMP_FILE_PAGE_FILE_DUMP 0x00000000
  987. //
  988. // GetDumpFile
  989. //
  990. // Special index that returns the name of the last .dmp file that failed
  991. // to laod (whether directly or from inside a .cab file
  992. #define DEBUG_DUMP_FILE_LOAD_FAILED_INDEX 0xffffffff
  993. #undef INTERFACE
  994. #define INTERFACE IDebugClient2
  995. DECLARE_INTERFACE_(IDebugClient2, IUnknown)
  996. {
  997. // IUnknown.
  998. STDMETHOD(QueryInterface)(
  999. THIS_
  1000. IN REFIID InterfaceId,
  1001. OUT PVOID* Interface
  1002. ) PURE;
  1003. STDMETHOD_(ULONG, AddRef)(
  1004. THIS
  1005. ) PURE;
  1006. STDMETHOD_(ULONG, Release)(
  1007. THIS
  1008. ) PURE;
  1009. // IDebugClient.
  1010. // The following set of methods start
  1011. // the different kinds of debuggees.
  1012. // Begins a debug session using the kernel
  1013. // debugging protocol. This method selects
  1014. // the protocol as the debuggee communication
  1015. // mechanism but does not initiate the communication
  1016. // itself.
  1017. STDMETHOD(AttachKernel)(
  1018. THIS_
  1019. IN ULONG Flags,
  1020. IN OPTIONAL PCSTR ConnectOptions
  1021. ) PURE;
  1022. STDMETHOD(GetKernelConnectionOptions)(
  1023. THIS_
  1024. OUT OPTIONAL PSTR Buffer,
  1025. IN ULONG BufferSize,
  1026. OUT OPTIONAL PULONG OptionsSize
  1027. ) PURE;
  1028. // Updates the connection options for a live
  1029. // kernel connection. This can only be used
  1030. // to modify parameters for the connection, not
  1031. // to switch to a completely different kind of
  1032. // connection.
  1033. // This method is reentrant.
  1034. STDMETHOD(SetKernelConnectionOptions)(
  1035. THIS_
  1036. IN PCSTR Options
  1037. ) PURE;
  1038. // Starts a process server for remote
  1039. // user-mode process control.
  1040. // The local process server is server zero.
  1041. STDMETHOD(StartProcessServer)(
  1042. THIS_
  1043. IN ULONG Flags,
  1044. IN PCSTR Options,
  1045. IN PVOID Reserved
  1046. ) PURE;
  1047. STDMETHOD(ConnectProcessServer)(
  1048. THIS_
  1049. IN PCSTR RemoteOptions,
  1050. OUT PULONG64 Server
  1051. ) PURE;
  1052. STDMETHOD(DisconnectProcessServer)(
  1053. THIS_
  1054. IN ULONG64 Server
  1055. ) PURE;
  1056. // Enumerates and describes processes
  1057. // accessible through the given process server.
  1058. STDMETHOD(GetRunningProcessSystemIds)(
  1059. THIS_
  1060. IN ULONG64 Server,
  1061. OUT OPTIONAL /* size_is(Count) */ PULONG Ids,
  1062. IN ULONG Count,
  1063. OUT OPTIONAL PULONG ActualCount
  1064. ) PURE;
  1065. STDMETHOD(GetRunningProcessSystemIdByExecutableName)(
  1066. THIS_
  1067. IN ULONG64 Server,
  1068. IN PCSTR ExeName,
  1069. IN ULONG Flags,
  1070. OUT PULONG Id
  1071. ) PURE;
  1072. STDMETHOD(GetRunningProcessDescription)(
  1073. THIS_
  1074. IN ULONG64 Server,
  1075. IN ULONG SystemId,
  1076. IN ULONG Flags,
  1077. OUT OPTIONAL PSTR ExeName,
  1078. IN ULONG ExeNameSize,
  1079. OUT OPTIONAL PULONG ActualExeNameSize,
  1080. OUT OPTIONAL PSTR Description,
  1081. IN ULONG DescriptionSize,
  1082. OUT OPTIONAL PULONG ActualDescriptionSize
  1083. ) PURE;
  1084. // Attaches to a running user-mode process.
  1085. STDMETHOD(AttachProcess)(
  1086. THIS_
  1087. IN ULONG64 Server,
  1088. IN ULONG ProcessId,
  1089. IN ULONG AttachFlags
  1090. ) PURE;
  1091. // Creates a new user-mode process for debugging.
  1092. // CreateFlags are as given to Win32s CreateProcess.
  1093. // One of DEBUG_PROCESS or DEBUG_ONLY_THIS_PROCESS
  1094. // must be specified.
  1095. STDMETHOD(CreateProcess)(
  1096. THIS_
  1097. IN ULONG64 Server,
  1098. IN PSTR CommandLine,
  1099. IN ULONG CreateFlags
  1100. ) PURE;
  1101. // Creates or attaches to a user-mode process, or both.
  1102. // If CommandLine is NULL this method operates as
  1103. // AttachProcess does. If ProcessId is zero it
  1104. // operates as CreateProcess does. If CommandLine is
  1105. // non-NULL and ProcessId is non-zero the method first
  1106. // starts a process with the given information but
  1107. // in a suspended state. The engine then attaches to
  1108. // the indicated process. Once the attach is successful
  1109. // the suspended process is resumed. This provides
  1110. // synchronization between the new process and the
  1111. // attachment.
  1112. STDMETHOD(CreateProcessAndAttach)(
  1113. THIS_
  1114. IN ULONG64 Server,
  1115. IN OPTIONAL PSTR CommandLine,
  1116. IN ULONG CreateFlags,
  1117. IN ULONG ProcessId,
  1118. IN ULONG AttachFlags
  1119. ) PURE;
  1120. // Gets and sets process control flags.
  1121. STDMETHOD(GetProcessOptions)(
  1122. THIS_
  1123. OUT PULONG Options
  1124. ) PURE;
  1125. STDMETHOD(AddProcessOptions)(
  1126. THIS_
  1127. IN ULONG Options
  1128. ) PURE;
  1129. STDMETHOD(RemoveProcessOptions)(
  1130. THIS_
  1131. IN ULONG Options
  1132. ) PURE;
  1133. STDMETHOD(SetProcessOptions)(
  1134. THIS_
  1135. IN ULONG Options
  1136. ) PURE;
  1137. // Opens any kind of user- or kernel-mode dump file
  1138. // and begins a debug session with the information
  1139. // contained within it.
  1140. STDMETHOD(OpenDumpFile)(
  1141. THIS_
  1142. IN PCSTR DumpFile
  1143. ) PURE;
  1144. // Writes a dump file from the current session information.
  1145. // The kind of dump file written is determined by the
  1146. // kind of session and the type qualifier given.
  1147. // For example, if the current session is a kernel
  1148. // debug session (DEBUG_CLASS_KERNEL) and the qualifier
  1149. // is DEBUG_DUMP_SMALL a small kernel dump will be written.
  1150. STDMETHOD(WriteDumpFile)(
  1151. THIS_
  1152. IN PCSTR DumpFile,
  1153. IN ULONG Qualifier
  1154. ) PURE;
  1155. // Indicates that a remote client is ready to
  1156. // begin participating in the current session.
  1157. // HistoryLimit gives a character limit on
  1158. // the amount of output history to be sent.
  1159. STDMETHOD(ConnectSession)(
  1160. THIS_
  1161. IN ULONG Flags,
  1162. IN ULONG HistoryLimit
  1163. ) PURE;
  1164. // Indicates that the engine should start accepting
  1165. // remote connections. Options specifies connection types
  1166. // and their parameters. Supported strings are:
  1167. // npipe:Pipe=<Pipe name>
  1168. // tcp:Port=<IP port>
  1169. STDMETHOD(StartServer)(
  1170. THIS_
  1171. IN PCSTR Options
  1172. ) PURE;
  1173. // List the servers running on the given machine.
  1174. // Uses the line prefix.
  1175. STDMETHOD(OutputServers)(
  1176. THIS_
  1177. IN ULONG OutputControl,
  1178. IN PCSTR Machine,
  1179. IN ULONG Flags
  1180. ) PURE;
  1181. // Attempts to terminate all processes in the debuggers list.
  1182. STDMETHOD(TerminateProcesses)(
  1183. THIS
  1184. ) PURE;
  1185. // Attempts to detach from all processes in the debuggers list.
  1186. // This requires OS support for debugger detach.
  1187. STDMETHOD(DetachProcesses)(
  1188. THIS
  1189. ) PURE;
  1190. // Stops the current debug session. If a process
  1191. // was created or attached an active EndSession can
  1192. // terminate or detach from it.
  1193. // If a kernel connection was opened it will be closed but the
  1194. // target machine is otherwise unaffected.
  1195. STDMETHOD(EndSession)(
  1196. THIS_
  1197. IN ULONG Flags
  1198. ) PURE;
  1199. // If a process was started and ran to completion
  1200. // this method can be used to retrieve its exit code.
  1201. STDMETHOD(GetExitCode)(
  1202. THIS_
  1203. OUT PULONG Code
  1204. ) PURE;
  1205. // Client event callbacks are called on the thread
  1206. // of the client. In order to give thread
  1207. // execution to the engine for callbacks all
  1208. // client threads should call DispatchCallbacks
  1209. // when they are idle. Callbacks are only
  1210. // received when a thread calls DispatchCallbacks
  1211. // or WaitForEvent. WaitForEvent can only be
  1212. // called by the thread that started the debug
  1213. // session so all other client threads should
  1214. // call DispatchCallbacks when possible.
  1215. // DispatchCallbacks returns when ExitDispatch is used
  1216. // to interrupt dispatch or when the timeout expires.
  1217. // DispatchCallbacks dispatches callbacks for all
  1218. // clients associated with the thread calling
  1219. // DispatchCallbacks.
  1220. // DispatchCallbacks returns S_FALSE when the
  1221. // timeout expires.
  1222. STDMETHOD(DispatchCallbacks)(
  1223. THIS_
  1224. IN ULONG Timeout
  1225. ) PURE;
  1226. // ExitDispatch can be used to interrupt callback
  1227. // dispatch when a client thread is needed by the
  1228. // client. This method is reentrant and can
  1229. // be called from any thread.
  1230. STDMETHOD(ExitDispatch)(
  1231. THIS_
  1232. IN PDEBUG_CLIENT Client
  1233. ) PURE;
  1234. // Clients are specific to the thread that
  1235. // created them. Calls from other threads
  1236. // fail immediately. The CreateClient method
  1237. // is a notable exception; it allows creation
  1238. // of a new client for a new thread.
  1239. STDMETHOD(CreateClient)(
  1240. THIS_
  1241. OUT PDEBUG_CLIENT* Client
  1242. ) PURE;
  1243. STDMETHOD(GetInputCallbacks)(
  1244. THIS_
  1245. OUT PDEBUG_INPUT_CALLBACKS* Callbacks
  1246. ) PURE;
  1247. STDMETHOD(SetInputCallbacks)(
  1248. THIS_
  1249. IN PDEBUG_INPUT_CALLBACKS Callbacks
  1250. ) PURE;
  1251. // Output callback interfaces are described separately.
  1252. STDMETHOD(GetOutputCallbacks)(
  1253. THIS_
  1254. OUT PDEBUG_OUTPUT_CALLBACKS* Callbacks
  1255. ) PURE;
  1256. STDMETHOD(SetOutputCallbacks)(
  1257. THIS_
  1258. IN PDEBUG_OUTPUT_CALLBACKS Callbacks
  1259. ) PURE;
  1260. // Output flags provide control over
  1261. // the distribution of output among clients.
  1262. // Output masks select which output streams
  1263. // should be sent to the output callbacks.
  1264. // Only Output calls with a mask that
  1265. // contains one of the output mask bits
  1266. // will be sent to the output callbacks.
  1267. // These methods are reentrant.
  1268. // If such access is not synchronized
  1269. // disruptions in output may occur.
  1270. STDMETHOD(GetOutputMask)(
  1271. THIS_
  1272. OUT PULONG Mask
  1273. ) PURE;
  1274. STDMETHOD(SetOutputMask)(
  1275. THIS_
  1276. IN ULONG Mask
  1277. ) PURE;
  1278. // These methods allow access to another clients
  1279. // output mask. They are necessary for changing
  1280. // a clients output mask when it is
  1281. // waiting for events. These methods are reentrant
  1282. // and can be called from any thread.
  1283. STDMETHOD(GetOtherOutputMask)(
  1284. THIS_
  1285. IN PDEBUG_CLIENT Client,
  1286. OUT PULONG Mask
  1287. ) PURE;
  1288. STDMETHOD(SetOtherOutputMask)(
  1289. THIS_
  1290. IN PDEBUG_CLIENT Client,
  1291. IN ULONG Mask
  1292. ) PURE;
  1293. // Control the width of an output line for
  1294. // commands which produce formatted output.
  1295. // This setting is just a suggestion.
  1296. STDMETHOD(GetOutputWidth)(
  1297. THIS_
  1298. OUT PULONG Columns
  1299. ) PURE;
  1300. STDMETHOD(SetOutputWidth)(
  1301. THIS_
  1302. IN ULONG Columns
  1303. ) PURE;
  1304. // Some of the engines output commands produce
  1305. // multiple lines of output. A prefix can be
  1306. // set that the engine will automatically output
  1307. // for each line in that case, allowing a caller
  1308. // to control indentation or identifying marks.
  1309. // This is not a general setting for any output
  1310. // with a newline in it. Methods which use
  1311. // the line prefix are marked in their documentation.
  1312. STDMETHOD(GetOutputLinePrefix)(
  1313. THIS_
  1314. OUT OPTIONAL PSTR Buffer,
  1315. IN ULONG BufferSize,
  1316. OUT OPTIONAL PULONG PrefixSize
  1317. ) PURE;
  1318. STDMETHOD(SetOutputLinePrefix)(
  1319. THIS_
  1320. IN OPTIONAL PCSTR Prefix
  1321. ) PURE;
  1322. // Returns a string describing the machine
  1323. // and user this client represents. The
  1324. // specific content of the string varies
  1325. // with operating system. If the client is
  1326. // remotely connected some network information
  1327. // may also be present.
  1328. STDMETHOD(GetIdentity)(
  1329. THIS_
  1330. OUT OPTIONAL PSTR Buffer,
  1331. IN ULONG BufferSize,
  1332. OUT OPTIONAL PULONG IdentitySize
  1333. ) PURE;
  1334. // Format is a printf-like format string
  1335. // with one %s where the identity string should go.
  1336. STDMETHOD(OutputIdentity)(
  1337. THIS_
  1338. IN ULONG OutputControl,
  1339. IN ULONG Flags,
  1340. IN PCSTR Format
  1341. ) PURE;
  1342. // Event callbacks allow a client to
  1343. // receive notification about changes
  1344. // during the debug session.
  1345. STDMETHOD(GetEventCallbacks)(
  1346. THIS_
  1347. OUT PDEBUG_EVENT_CALLBACKS* Callbacks
  1348. ) PURE;
  1349. STDMETHOD(SetEventCallbacks)(
  1350. THIS_
  1351. IN PDEBUG_EVENT_CALLBACKS Callbacks
  1352. ) PURE;
  1353. // The engine sometimes merges compatible callback
  1354. // requests to reduce callback overhead. This is
  1355. // most noticeable with output as small pieces of
  1356. // output are collected into larger groups to
  1357. // reduce the overall number of output callback calls.
  1358. // A client can use this method to force all pending
  1359. // callbacks to be delivered. This is rarely necessary.
  1360. STDMETHOD(FlushCallbacks)(
  1361. THIS
  1362. ) PURE;
  1363. // IDebugClient2.
  1364. // Functions similarly to WriteDumpFile with
  1365. // the addition of the ability to specify
  1366. // per-dump-format write control flags.
  1367. // Comment is not supported in all formats.
  1368. STDMETHOD(WriteDumpFile2)(
  1369. THIS_
  1370. IN PCSTR DumpFile,
  1371. IN ULONG Qualifier,
  1372. IN ULONG FormatFlags,
  1373. IN OPTIONAL PCSTR Comment
  1374. ) PURE;
  1375. // Registers additional files of supporting information
  1376. // for a dump file open. This method must be called
  1377. // before OpenDumpFile is called.
  1378. // The files registered may be opened at the time
  1379. // this method is called but generally will not
  1380. // be used until OpenDumpFile is called.
  1381. STDMETHOD(AddDumpInformationFile)(
  1382. THIS_
  1383. IN PCSTR InfoFile,
  1384. IN ULONG Type
  1385. ) PURE;
  1386. // Requests that the remote process server shut down.
  1387. STDMETHOD(EndProcessServer)(
  1388. THIS_
  1389. IN ULONG64 Server
  1390. ) PURE;
  1391. // Waits for a started process server to
  1392. // exit. Allows an application running a
  1393. // process server to monitor the process
  1394. // server so that it can tell when a remote
  1395. // client has asked for it to exit.
  1396. // Returns S_OK if the process server has
  1397. // shut down and S_FALSE for a timeout.
  1398. STDMETHOD(WaitForProcessServerEnd)(
  1399. THIS_
  1400. IN ULONG Timeout
  1401. ) PURE;
  1402. // Returns S_OK if the system is configured
  1403. // to allow kernel debugging.
  1404. STDMETHOD(IsKernelDebuggerEnabled)(
  1405. THIS
  1406. ) PURE;
  1407. // Attempts to terminate the current process.
  1408. // Exit process events for the process may be generated.
  1409. STDMETHOD(TerminateCurrentProcess)(
  1410. THIS
  1411. ) PURE;
  1412. // Attempts to detach from the current process.
  1413. // This requires OS support for debugger detach.
  1414. STDMETHOD(DetachCurrentProcess)(
  1415. THIS
  1416. ) PURE;
  1417. // Removes the process from the debuggers process
  1418. // list without making any other changes. The process
  1419. // will still be marked as being debugged and will
  1420. // not run. This allows a debugger to be shut down
  1421. // and a new debugger attached without taking the
  1422. // process out of the debugged state.
  1423. // This is only supported on some system versions.
  1424. STDMETHOD(AbandonCurrentProcess)(
  1425. THIS
  1426. ) PURE;
  1427. };
  1428. #undef INTERFACE
  1429. #define INTERFACE IDebugClient3
  1430. DECLARE_INTERFACE_(IDebugClient3, IUnknown)
  1431. {
  1432. // IUnknown.
  1433. STDMETHOD(QueryInterface)(
  1434. THIS_
  1435. IN REFIID InterfaceId,
  1436. OUT PVOID* Interface
  1437. ) PURE;
  1438. STDMETHOD_(ULONG, AddRef)(
  1439. THIS
  1440. ) PURE;
  1441. STDMETHOD_(ULONG, Release)(
  1442. THIS
  1443. ) PURE;
  1444. // IDebugClient.
  1445. // The following set of methods start
  1446. // the different kinds of debuggees.
  1447. // Begins a debug session using the kernel
  1448. // debugging protocol. This method selects
  1449. // the protocol as the debuggee communication
  1450. // mechanism but does not initiate the communication
  1451. // itself.
  1452. STDMETHOD(AttachKernel)(
  1453. THIS_
  1454. IN ULONG Flags,
  1455. IN OPTIONAL PCSTR ConnectOptions
  1456. ) PURE;
  1457. STDMETHOD(GetKernelConnectionOptions)(
  1458. THIS_
  1459. OUT OPTIONAL PSTR Buffer,
  1460. IN ULONG BufferSize,
  1461. OUT OPTIONAL PULONG OptionsSize
  1462. ) PURE;
  1463. // Updates the connection options for a live
  1464. // kernel connection. This can only be used
  1465. // to modify parameters for the connection, not
  1466. // to switch to a completely different kind of
  1467. // connection.
  1468. // This method is reentrant.
  1469. STDMETHOD(SetKernelConnectionOptions)(
  1470. THIS_
  1471. IN PCSTR Options
  1472. ) PURE;
  1473. // Starts a process server for remote
  1474. // user-mode process control.
  1475. // The local process server is server zero.
  1476. STDMETHOD(StartProcessServer)(
  1477. THIS_
  1478. IN ULONG Flags,
  1479. IN PCSTR Options,
  1480. IN PVOID Reserved
  1481. ) PURE;
  1482. STDMETHOD(ConnectProcessServer)(
  1483. THIS_
  1484. IN PCSTR RemoteOptions,
  1485. OUT PULONG64 Server
  1486. ) PURE;
  1487. STDMETHOD(DisconnectProcessServer)(
  1488. THIS_
  1489. IN ULONG64 Server
  1490. ) PURE;
  1491. // Enumerates and describes processes
  1492. // accessible through the given process server.
  1493. STDMETHOD(GetRunningProcessSystemIds)(
  1494. THIS_
  1495. IN ULONG64 Server,
  1496. OUT OPTIONAL /* size_is(Count) */ PULONG Ids,
  1497. IN ULONG Count,
  1498. OUT OPTIONAL PULONG ActualCount
  1499. ) PURE;
  1500. STDMETHOD(GetRunningProcessSystemIdByExecutableName)(
  1501. THIS_
  1502. IN ULONG64 Server,
  1503. IN PCSTR ExeName,
  1504. IN ULONG Flags,
  1505. OUT PULONG Id
  1506. ) PURE;
  1507. STDMETHOD(GetRunningProcessDescription)(
  1508. THIS_
  1509. IN ULONG64 Server,
  1510. IN ULONG SystemId,
  1511. IN ULONG Flags,
  1512. OUT OPTIONAL PSTR ExeName,
  1513. IN ULONG ExeNameSize,
  1514. OUT OPTIONAL PULONG ActualExeNameSize,
  1515. OUT OPTIONAL PSTR Description,
  1516. IN ULONG DescriptionSize,
  1517. OUT OPTIONAL PULONG ActualDescriptionSize
  1518. ) PURE;
  1519. // Attaches to a running user-mode process.
  1520. STDMETHOD(AttachProcess)(
  1521. THIS_
  1522. IN ULONG64 Server,
  1523. IN ULONG ProcessId,
  1524. IN ULONG AttachFlags
  1525. ) PURE;
  1526. // Creates a new user-mode process for debugging.
  1527. // CreateFlags are as given to Win32s CreateProcess.
  1528. // One of DEBUG_PROCESS or DEBUG_ONLY_THIS_PROCESS
  1529. // must be specified.
  1530. STDMETHOD(CreateProcess)(
  1531. THIS_
  1532. IN ULONG64 Server,
  1533. IN PSTR CommandLine,
  1534. IN ULONG CreateFlags
  1535. ) PURE;
  1536. // Creates or attaches to a user-mode process, or both.
  1537. // If CommandLine is NULL this method operates as
  1538. // AttachProcess does. If ProcessId is zero it
  1539. // operates as CreateProcess does. If CommandLine is
  1540. // non-NULL and ProcessId is non-zero the method first
  1541. // starts a process with the given information but
  1542. // in a suspended state. The engine then attaches to
  1543. // the indicated process. Once the attach is successful
  1544. // the suspended process is resumed. This provides
  1545. // synchronization between the new process and the
  1546. // attachment.
  1547. STDMETHOD(CreateProcessAndAttach)(
  1548. THIS_
  1549. IN ULONG64 Server,
  1550. IN OPTIONAL PSTR CommandLine,
  1551. IN ULONG CreateFlags,
  1552. IN ULONG ProcessId,
  1553. IN ULONG AttachFlags
  1554. ) PURE;
  1555. // Gets and sets process control flags.
  1556. STDMETHOD(GetProcessOptions)(
  1557. THIS_
  1558. OUT PULONG Options
  1559. ) PURE;
  1560. STDMETHOD(AddProcessOptions)(
  1561. THIS_
  1562. IN ULONG Options
  1563. ) PURE;
  1564. STDMETHOD(RemoveProcessOptions)(
  1565. THIS_
  1566. IN ULONG Options
  1567. ) PURE;
  1568. STDMETHOD(SetProcessOptions)(
  1569. THIS_
  1570. IN ULONG Options
  1571. ) PURE;
  1572. // Opens any kind of user- or kernel-mode dump file
  1573. // and begins a debug session with the information
  1574. // contained within it.
  1575. STDMETHOD(OpenDumpFile)(
  1576. THIS_
  1577. IN PCSTR DumpFile
  1578. ) PURE;
  1579. // Writes a dump file from the current session information.
  1580. // The kind of dump file written is determined by the
  1581. // kind of session and the type qualifier given.
  1582. // For example, if the current session is a kernel
  1583. // debug session (DEBUG_CLASS_KERNEL) and the qualifier
  1584. // is DEBUG_DUMP_SMALL a small kernel dump will be written.
  1585. STDMETHOD(WriteDumpFile)(
  1586. THIS_
  1587. IN PCSTR DumpFile,
  1588. IN ULONG Qualifier
  1589. ) PURE;
  1590. // Indicates that a remote client is ready to
  1591. // begin participating in the current session.
  1592. // HistoryLimit gives a character limit on
  1593. // the amount of output history to be sent.
  1594. STDMETHOD(ConnectSession)(
  1595. THIS_
  1596. IN ULONG Flags,
  1597. IN ULONG HistoryLimit
  1598. ) PURE;
  1599. // Indicates that the engine should start accepting
  1600. // remote connections. Options specifies connection types
  1601. // and their parameters. Supported strings are:
  1602. // npipe:Pipe=<Pipe name>
  1603. // tcp:Port=<IP port>
  1604. STDMETHOD(StartServer)(
  1605. THIS_
  1606. IN PCSTR Options
  1607. ) PURE;
  1608. // List the servers running on the given machine.
  1609. // Uses the line prefix.
  1610. STDMETHOD(OutputServers)(
  1611. THIS_
  1612. IN ULONG OutputControl,
  1613. IN PCSTR Machine,
  1614. IN ULONG Flags
  1615. ) PURE;
  1616. // Attempts to terminate all processes in the debuggers list.
  1617. STDMETHOD(TerminateProcesses)(
  1618. THIS
  1619. ) PURE;
  1620. // Attempts to detach from all processes in the debuggers list.
  1621. // This requires OS support for debugger detach.
  1622. STDMETHOD(DetachProcesses)(
  1623. THIS
  1624. ) PURE;
  1625. // Stops the current debug session. If a process
  1626. // was created or attached an active EndSession can
  1627. // terminate or detach from it.
  1628. // If a kernel connection was opened it will be closed but the
  1629. // target machine is otherwise unaffected.
  1630. STDMETHOD(EndSession)(
  1631. THIS_
  1632. IN ULONG Flags
  1633. ) PURE;
  1634. // If a process was started and ran to completion
  1635. // this method can be used to retrieve its exit code.
  1636. STDMETHOD(GetExitCode)(
  1637. THIS_
  1638. OUT PULONG Code
  1639. ) PURE;
  1640. // Client event callbacks are called on the thread
  1641. // of the client. In order to give thread
  1642. // execution to the engine for callbacks all
  1643. // client threads should call DispatchCallbacks
  1644. // when they are idle. Callbacks are only
  1645. // received when a thread calls DispatchCallbacks
  1646. // or WaitForEvent. WaitForEvent can only be
  1647. // called by the thread that started the debug
  1648. // session so all other client threads should
  1649. // call DispatchCallbacks when possible.
  1650. // DispatchCallbacks returns when ExitDispatch is used
  1651. // to interrupt dispatch or when the timeout expires.
  1652. // DispatchCallbacks dispatches callbacks for all
  1653. // clients associated with the thread calling
  1654. // DispatchCallbacks.
  1655. // DispatchCallbacks returns S_FALSE when the
  1656. // timeout expires.
  1657. STDMETHOD(DispatchCallbacks)(
  1658. THIS_
  1659. IN ULONG Timeout
  1660. ) PURE;
  1661. // ExitDispatch can be used to interrupt callback
  1662. // dispatch when a client thread is needed by the
  1663. // client. This method is reentrant and can
  1664. // be called from any thread.
  1665. STDMETHOD(ExitDispatch)(
  1666. THIS_
  1667. IN PDEBUG_CLIENT Client
  1668. ) PURE;
  1669. // Clients are specific to the thread that
  1670. // created them. Calls from other threads
  1671. // fail immediately. The CreateClient method
  1672. // is a notable exception; it allows creation
  1673. // of a new client for a new thread.
  1674. STDMETHOD(CreateClient)(
  1675. THIS_
  1676. OUT PDEBUG_CLIENT* Client
  1677. ) PURE;
  1678. STDMETHOD(GetInputCallbacks)(
  1679. THIS_
  1680. OUT PDEBUG_INPUT_CALLBACKS* Callbacks
  1681. ) PURE;
  1682. STDMETHOD(SetInputCallbacks)(
  1683. THIS_
  1684. IN PDEBUG_INPUT_CALLBACKS Callbacks
  1685. ) PURE;
  1686. // Output callback interfaces are described separately.
  1687. STDMETHOD(GetOutputCallbacks)(
  1688. THIS_
  1689. OUT PDEBUG_OUTPUT_CALLBACKS* Callbacks
  1690. ) PURE;
  1691. STDMETHOD(SetOutputCallbacks)(
  1692. THIS_
  1693. IN PDEBUG_OUTPUT_CALLBACKS Callbacks
  1694. ) PURE;
  1695. // Output flags provide control over
  1696. // the distribution of output among clients.
  1697. // Output masks select which output streams
  1698. // should be sent to the output callbacks.
  1699. // Only Output calls with a mask that
  1700. // contains one of the output mask bits
  1701. // will be sent to the output callbacks.
  1702. // These methods are reentrant.
  1703. // If such access is not synchronized
  1704. // disruptions in output may occur.
  1705. STDMETHOD(GetOutputMask)(
  1706. THIS_
  1707. OUT PULONG Mask
  1708. ) PURE;
  1709. STDMETHOD(SetOutputMask)(
  1710. THIS_
  1711. IN ULONG Mask
  1712. ) PURE;
  1713. // These methods allow access to another clients
  1714. // output mask. They are necessary for changing
  1715. // a clients output mask when it is
  1716. // waiting for events. These methods are reentrant
  1717. // and can be called from any thread.
  1718. STDMETHOD(GetOtherOutputMask)(
  1719. THIS_
  1720. IN PDEBUG_CLIENT Client,
  1721. OUT PULONG Mask
  1722. ) PURE;
  1723. STDMETHOD(SetOtherOutputMask)(
  1724. THIS_
  1725. IN PDEBUG_CLIENT Client,
  1726. IN ULONG Mask
  1727. ) PURE;
  1728. // Control the width of an output line for
  1729. // commands which produce formatted output.
  1730. // This setting is just a suggestion.
  1731. STDMETHOD(GetOutputWidth)(
  1732. THIS_
  1733. OUT PULONG Columns
  1734. ) PURE;
  1735. STDMETHOD(SetOutputWidth)(
  1736. THIS_
  1737. IN ULONG Columns
  1738. ) PURE;
  1739. // Some of the engines output commands produce
  1740. // multiple lines of output. A prefix can be
  1741. // set that the engine will automatically output
  1742. // for each line in that case, allowing a caller
  1743. // to control indentation or identifying marks.
  1744. // This is not a general setting for any output
  1745. // with a newline in it. Methods which use
  1746. // the line prefix are marked in their documentation.
  1747. STDMETHOD(GetOutputLinePrefix)(
  1748. THIS_
  1749. OUT OPTIONAL PSTR Buffer,
  1750. IN ULONG BufferSize,
  1751. OUT OPTIONAL PULONG PrefixSize
  1752. ) PURE;
  1753. STDMETHOD(SetOutputLinePrefix)(
  1754. THIS_
  1755. IN OPTIONAL PCSTR Prefix
  1756. ) PURE;
  1757. // Returns a string describing the machine
  1758. // and user this client represents. The
  1759. // specific content of the string varies
  1760. // with operating system. If the client is
  1761. // remotely connected some network information
  1762. // may also be present.
  1763. STDMETHOD(GetIdentity)(
  1764. THIS_
  1765. OUT OPTIONAL PSTR Buffer,
  1766. IN ULONG BufferSize,
  1767. OUT OPTIONAL PULONG IdentitySize
  1768. ) PURE;
  1769. // Format is a printf-like format string
  1770. // with one %s where the identity string should go.
  1771. STDMETHOD(OutputIdentity)(
  1772. THIS_
  1773. IN ULONG OutputControl,
  1774. IN ULONG Flags,
  1775. IN PCSTR Format
  1776. ) PURE;
  1777. // Event callbacks allow a client to
  1778. // receive notification about changes
  1779. // during the debug session.
  1780. STDMETHOD(GetEventCallbacks)(
  1781. THIS_
  1782. OUT PDEBUG_EVENT_CALLBACKS* Callbacks
  1783. ) PURE;
  1784. STDMETHOD(SetEventCallbacks)(
  1785. THIS_
  1786. IN PDEBUG_EVENT_CALLBACKS Callbacks
  1787. ) PURE;
  1788. // The engine sometimes merges compatible callback
  1789. // requests to reduce callback overhead. This is
  1790. // most noticeable with output as small pieces of
  1791. // output are collected into larger groups to
  1792. // reduce the overall number of output callback calls.
  1793. // A client can use this method to force all pending
  1794. // callbacks to be delivered. This is rarely necessary.
  1795. STDMETHOD(FlushCallbacks)(
  1796. THIS
  1797. ) PURE;
  1798. // IDebugClient2.
  1799. // Functions similarly to WriteDumpFile with
  1800. // the addition of the ability to specify
  1801. // per-dump-format write control flags.
  1802. // Comment is not supported in all formats.
  1803. STDMETHOD(WriteDumpFile2)(
  1804. THIS_
  1805. IN PCSTR DumpFile,
  1806. IN ULONG Qualifier,
  1807. IN ULONG FormatFlags,
  1808. IN OPTIONAL PCSTR Comment
  1809. ) PURE;
  1810. // Registers additional files of supporting information
  1811. // for a dump file open. This method must be called
  1812. // before OpenDumpFile is called.
  1813. // The files registered may be opened at the time
  1814. // this method is called but generally will not
  1815. // be used until OpenDumpFile is called.
  1816. STDMETHOD(AddDumpInformationFile)(
  1817. THIS_
  1818. IN PCSTR InfoFile,
  1819. IN ULONG Type
  1820. ) PURE;
  1821. // Requests that the remote process server shut down.
  1822. STDMETHOD(EndProcessServer)(
  1823. THIS_
  1824. IN ULONG64 Server
  1825. ) PURE;
  1826. // Waits for a started process server to
  1827. // exit. Allows an application running a
  1828. // process server to monitor the process
  1829. // server so that it can tell when a remote
  1830. // client has asked for it to exit.
  1831. // Returns S_OK if the process server has
  1832. // shut down and S_FALSE for a timeout.
  1833. STDMETHOD(WaitForProcessServerEnd)(
  1834. THIS_
  1835. IN ULONG Timeout
  1836. ) PURE;
  1837. // Returns S_OK if the system is configured
  1838. // to allow kernel debugging.
  1839. STDMETHOD(IsKernelDebuggerEnabled)(
  1840. THIS
  1841. ) PURE;
  1842. // Attempts to terminate the current process.
  1843. // Exit process events for the process may be generated.
  1844. STDMETHOD(TerminateCurrentProcess)(
  1845. THIS
  1846. ) PURE;
  1847. // Attempts to detach from the current process.
  1848. // This requires OS support for debugger detach.
  1849. STDMETHOD(DetachCurrentProcess)(
  1850. THIS
  1851. ) PURE;
  1852. // Removes the process from the debuggers process
  1853. // list without making any other changes. The process
  1854. // will still be marked as being debugged and will
  1855. // not run. This allows a debugger to be shut down
  1856. // and a new debugger attached without taking the
  1857. // process out of the debugged state.
  1858. // This is only supported on some system versions.
  1859. STDMETHOD(AbandonCurrentProcess)(
  1860. THIS
  1861. ) PURE;
  1862. // IDebugClient3.
  1863. STDMETHOD(GetRunningProcessSystemIdByExecutableNameWide)(
  1864. THIS_
  1865. IN ULONG64 Server,
  1866. IN PCWSTR ExeName,
  1867. IN ULONG Flags,
  1868. OUT PULONG Id
  1869. ) PURE;
  1870. STDMETHOD(GetRunningProcessDescriptionWide)(
  1871. THIS_
  1872. IN ULONG64 Server,
  1873. IN ULONG SystemId,
  1874. IN ULONG Flags,
  1875. OUT OPTIONAL PWSTR ExeName,
  1876. IN ULONG ExeNameSize,
  1877. OUT OPTIONAL PULONG ActualExeNameSize,
  1878. OUT OPTIONAL PWSTR Description,
  1879. IN ULONG DescriptionSize,
  1880. OUT OPTIONAL PULONG ActualDescriptionSize
  1881. ) PURE;
  1882. STDMETHOD(CreateProcessWide)(
  1883. THIS_
  1884. IN ULONG64 Server,
  1885. IN PWSTR CommandLine,
  1886. IN ULONG CreateFlags
  1887. ) PURE;
  1888. STDMETHOD(CreateProcessAndAttachWide)(
  1889. THIS_
  1890. IN ULONG64 Server,
  1891. IN OPTIONAL PWSTR CommandLine,
  1892. IN ULONG CreateFlags,
  1893. IN ULONG ProcessId,
  1894. IN ULONG AttachFlags
  1895. ) PURE;
  1896. };
  1897. #undef INTERFACE
  1898. #define INTERFACE IDebugClient4
  1899. DECLARE_INTERFACE_(IDebugClient4, IUnknown)
  1900. {
  1901. // IUnknown.
  1902. STDMETHOD(QueryInterface)(
  1903. THIS_
  1904. IN REFIID InterfaceId,
  1905. OUT PVOID* Interface
  1906. ) PURE;
  1907. STDMETHOD_(ULONG, AddRef)(
  1908. THIS
  1909. ) PURE;
  1910. STDMETHOD_(ULONG, Release)(
  1911. THIS
  1912. ) PURE;
  1913. // IDebugClient.
  1914. // The following set of methods start
  1915. // the different kinds of debuggees.
  1916. // Begins a debug session using the kernel
  1917. // debugging protocol. This method selects
  1918. // the protocol as the debuggee communication
  1919. // mechanism but does not initiate the communication
  1920. // itself.
  1921. STDMETHOD(AttachKernel)(
  1922. THIS_
  1923. IN ULONG Flags,
  1924. IN OPTIONAL PCSTR ConnectOptions
  1925. ) PURE;
  1926. STDMETHOD(GetKernelConnectionOptions)(
  1927. THIS_
  1928. OUT OPTIONAL PSTR Buffer,
  1929. IN ULONG BufferSize,
  1930. OUT OPTIONAL PULONG OptionsSize
  1931. ) PURE;
  1932. // Updates the connection options for a live
  1933. // kernel connection. This can only be used
  1934. // to modify parameters for the connection, not
  1935. // to switch to a completely different kind of
  1936. // connection.
  1937. // This method is reentrant.
  1938. STDMETHOD(SetKernelConnectionOptions)(
  1939. THIS_
  1940. IN PCSTR Options
  1941. ) PURE;
  1942. // Starts a process server for remote
  1943. // user-mode process control.
  1944. // The local process server is server zero.
  1945. STDMETHOD(StartProcessServer)(
  1946. THIS_
  1947. IN ULONG Flags,
  1948. IN PCSTR Options,
  1949. IN PVOID Reserved
  1950. ) PURE;
  1951. STDMETHOD(ConnectProcessServer)(
  1952. THIS_
  1953. IN PCSTR RemoteOptions,
  1954. OUT PULONG64 Server
  1955. ) PURE;
  1956. STDMETHOD(DisconnectProcessServer)(
  1957. THIS_
  1958. IN ULONG64 Server
  1959. ) PURE;
  1960. // Enumerates and describes processes
  1961. // accessible through the given process server.
  1962. STDMETHOD(GetRunningProcessSystemIds)(
  1963. THIS_
  1964. IN ULONG64 Server,
  1965. OUT OPTIONAL /* size_is(Count) */ PULONG Ids,
  1966. IN ULONG Count,
  1967. OUT OPTIONAL PULONG ActualCount
  1968. ) PURE;
  1969. STDMETHOD(GetRunningProcessSystemIdByExecutableName)(
  1970. THIS_
  1971. IN ULONG64 Server,
  1972. IN PCSTR ExeName,
  1973. IN ULONG Flags,
  1974. OUT PULONG Id
  1975. ) PURE;
  1976. STDMETHOD(GetRunningProcessDescription)(
  1977. THIS_
  1978. IN ULONG64 Server,
  1979. IN ULONG SystemId,
  1980. IN ULONG Flags,
  1981. OUT OPTIONAL PSTR ExeName,
  1982. IN ULONG ExeNameSize,
  1983. OUT OPTIONAL PULONG ActualExeNameSize,
  1984. OUT OPTIONAL PSTR Description,
  1985. IN ULONG DescriptionSize,
  1986. OUT OPTIONAL PULONG ActualDescriptionSize
  1987. ) PURE;
  1988. // Attaches to a running user-mode process.
  1989. STDMETHOD(AttachProcess)(
  1990. THIS_
  1991. IN ULONG64 Server,
  1992. IN ULONG ProcessId,
  1993. IN ULONG AttachFlags
  1994. ) PURE;
  1995. // Creates a new user-mode process for debugging.
  1996. // CreateFlags are as given to Win32s CreateProcess.
  1997. // One of DEBUG_PROCESS or DEBUG_ONLY_THIS_PROCESS
  1998. // must be specified.
  1999. STDMETHOD(CreateProcess)(
  2000. THIS_
  2001. IN ULONG64 Server,
  2002. IN PSTR CommandLine,
  2003. IN ULONG CreateFlags
  2004. ) PURE;
  2005. // Creates or attaches to a user-mode process, or both.
  2006. // If CommandLine is NULL this method operates as
  2007. // AttachProcess does. If ProcessId is zero it
  2008. // operates as CreateProcess does. If CommandLine is
  2009. // non-NULL and ProcessId is non-zero the method first
  2010. // starts a process with the given information but
  2011. // in a suspended state. The engine then attaches to
  2012. // the indicated process. Once the attach is successful
  2013. // the suspended process is resumed. This provides
  2014. // synchronization between the new process and the
  2015. // attachment.
  2016. STDMETHOD(CreateProcessAndAttach)(
  2017. THIS_
  2018. IN ULONG64 Server,
  2019. IN OPTIONAL PSTR CommandLine,
  2020. IN ULONG CreateFlags,
  2021. IN ULONG ProcessId,
  2022. IN ULONG AttachFlags
  2023. ) PURE;
  2024. // Gets and sets process control flags.
  2025. STDMETHOD(GetProcessOptions)(
  2026. THIS_
  2027. OUT PULONG Options
  2028. ) PURE;
  2029. STDMETHOD(AddProcessOptions)(
  2030. THIS_
  2031. IN ULONG Options
  2032. ) PURE;
  2033. STDMETHOD(RemoveProcessOptions)(
  2034. THIS_
  2035. IN ULONG Options
  2036. ) PURE;
  2037. STDMETHOD(SetProcessOptions)(
  2038. THIS_
  2039. IN ULONG Options
  2040. ) PURE;
  2041. // Opens any kind of user- or kernel-mode dump file
  2042. // and begins a debug session with the information
  2043. // contained within it.
  2044. STDMETHOD(OpenDumpFile)(
  2045. THIS_
  2046. IN PCSTR DumpFile
  2047. ) PURE;
  2048. // Writes a dump file from the current session information.
  2049. // The kind of dump file written is determined by the
  2050. // kind of session and the type qualifier given.
  2051. // For example, if the current session is a kernel
  2052. // debug session (DEBUG_CLASS_KERNEL) and the qualifier
  2053. // is DEBUG_DUMP_SMALL a small kernel dump will be written.
  2054. STDMETHOD(WriteDumpFile)(
  2055. THIS_
  2056. IN PCSTR DumpFile,
  2057. IN ULONG Qualifier
  2058. ) PURE;
  2059. // Indicates that a remote client is ready to
  2060. // begin participating in the current session.
  2061. // HistoryLimit gives a character limit on
  2062. // the amount of output history to be sent.
  2063. STDMETHOD(ConnectSession)(
  2064. THIS_
  2065. IN ULONG Flags,
  2066. IN ULONG HistoryLimit
  2067. ) PURE;
  2068. // Indicates that the engine should start accepting
  2069. // remote connections. Options specifies connection types
  2070. // and their parameters. Supported strings are:
  2071. // npipe:Pipe=<Pipe name>
  2072. // tcp:Port=<IP port>
  2073. STDMETHOD(StartServer)(
  2074. THIS_
  2075. IN PCSTR Options
  2076. ) PURE;
  2077. // List the servers running on the given machine.
  2078. // Uses the line prefix.
  2079. STDMETHOD(OutputServers)(
  2080. THIS_
  2081. IN ULONG OutputControl,
  2082. IN PCSTR Machine,
  2083. IN ULONG Flags
  2084. ) PURE;
  2085. // Attempts to terminate all processes in the debuggers list.
  2086. STDMETHOD(TerminateProcesses)(
  2087. THIS
  2088. ) PURE;
  2089. // Attempts to detach from all processes in the debuggers list.
  2090. // This requires OS support for debugger detach.
  2091. STDMETHOD(DetachProcesses)(
  2092. THIS
  2093. ) PURE;
  2094. // Stops the current debug session. If a process
  2095. // was created or attached an active EndSession can
  2096. // terminate or detach from it.
  2097. // If a kernel connection was opened it will be closed but the
  2098. // target machine is otherwise unaffected.
  2099. STDMETHOD(EndSession)(
  2100. THIS_
  2101. IN ULONG Flags
  2102. ) PURE;
  2103. // If a process was started and ran to completion
  2104. // this method can be used to retrieve its exit code.
  2105. STDMETHOD(GetExitCode)(
  2106. THIS_
  2107. OUT PULONG Code
  2108. ) PURE;
  2109. // Client event callbacks are called on the thread
  2110. // of the client. In order to give thread
  2111. // execution to the engine for callbacks all
  2112. // client threads should call DispatchCallbacks
  2113. // when they are idle. Callbacks are only
  2114. // received when a thread calls DispatchCallbacks
  2115. // or WaitForEvent. WaitForEvent can only be
  2116. // called by the thread that started the debug
  2117. // session so all other client threads should
  2118. // call DispatchCallbacks when possible.
  2119. // DispatchCallbacks returns when ExitDispatch is used
  2120. // to interrupt dispatch or when the timeout expires.
  2121. // DispatchCallbacks dispatches callbacks for all
  2122. // clients associated with the thread calling
  2123. // DispatchCallbacks.
  2124. // DispatchCallbacks returns S_FALSE when the
  2125. // timeout expires.
  2126. STDMETHOD(DispatchCallbacks)(
  2127. THIS_
  2128. IN ULONG Timeout
  2129. ) PURE;
  2130. // ExitDispatch can be used to interrupt callback
  2131. // dispatch when a client thread is needed by the
  2132. // client. This method is reentrant and can
  2133. // be called from any thread.
  2134. STDMETHOD(ExitDispatch)(
  2135. THIS_
  2136. IN PDEBUG_CLIENT Client
  2137. ) PURE;
  2138. // Clients are specific to the thread that
  2139. // created them. Calls from other threads
  2140. // fail immediately. The CreateClient method
  2141. // is a notable exception; it allows creation
  2142. // of a new client for a new thread.
  2143. STDMETHOD(CreateClient)(
  2144. THIS_
  2145. OUT PDEBUG_CLIENT* Client
  2146. ) PURE;
  2147. STDMETHOD(GetInputCallbacks)(
  2148. THIS_
  2149. OUT PDEBUG_INPUT_CALLBACKS* Callbacks
  2150. ) PURE;
  2151. STDMETHOD(SetInputCallbacks)(
  2152. THIS_
  2153. IN PDEBUG_INPUT_CALLBACKS Callbacks
  2154. ) PURE;
  2155. // Output callback interfaces are described separately.
  2156. STDMETHOD(GetOutputCallbacks)(
  2157. THIS_
  2158. OUT PDEBUG_OUTPUT_CALLBACKS* Callbacks
  2159. ) PURE;
  2160. STDMETHOD(SetOutputCallbacks)(
  2161. THIS_
  2162. IN PDEBUG_OUTPUT_CALLBACKS Callbacks
  2163. ) PURE;
  2164. // Output flags provide control over
  2165. // the distribution of output among clients.
  2166. // Output masks select which output streams
  2167. // should be sent to the output callbacks.
  2168. // Only Output calls with a mask that
  2169. // contains one of the output mask bits
  2170. // will be sent to the output callbacks.
  2171. // These methods are reentrant.
  2172. // If such access is not synchronized
  2173. // disruptions in output may occur.
  2174. STDMETHOD(GetOutputMask)(
  2175. THIS_
  2176. OUT PULONG Mask
  2177. ) PURE;
  2178. STDMETHOD(SetOutputMask)(
  2179. THIS_
  2180. IN ULONG Mask
  2181. ) PURE;
  2182. // These methods allow access to another clients
  2183. // output mask. They are necessary for changing
  2184. // a clients output mask when it is
  2185. // waiting for events. These methods are reentrant
  2186. // and can be called from any thread.
  2187. STDMETHOD(GetOtherOutputMask)(
  2188. THIS_
  2189. IN PDEBUG_CLIENT Client,
  2190. OUT PULONG Mask
  2191. ) PURE;
  2192. STDMETHOD(SetOtherOutputMask)(
  2193. THIS_
  2194. IN PDEBUG_CLIENT Client,
  2195. IN ULONG Mask
  2196. ) PURE;
  2197. // Control the width of an output line for
  2198. // commands which produce formatted output.
  2199. // This setting is just a suggestion.
  2200. STDMETHOD(GetOutputWidth)(
  2201. THIS_
  2202. OUT PULONG Columns
  2203. ) PURE;
  2204. STDMETHOD(SetOutputWidth)(
  2205. THIS_
  2206. IN ULONG Columns
  2207. ) PURE;
  2208. // Some of the engines output commands produce
  2209. // multiple lines of output. A prefix can be
  2210. // set that the engine will automatically output
  2211. // for each line in that case, allowing a caller
  2212. // to control indentation or identifying marks.
  2213. // This is not a general setting for any output
  2214. // with a newline in it. Methods which use
  2215. // the line prefix are marked in their documentation.
  2216. STDMETHOD(GetOutputLinePrefix)(
  2217. THIS_
  2218. OUT OPTIONAL PSTR Buffer,
  2219. IN ULONG BufferSize,
  2220. OUT OPTIONAL PULONG PrefixSize
  2221. ) PURE;
  2222. STDMETHOD(SetOutputLinePrefix)(
  2223. THIS_
  2224. IN OPTIONAL PCSTR Prefix
  2225. ) PURE;
  2226. // Returns a string describing the machine
  2227. // and user this client represents. The
  2228. // specific content of the string varies
  2229. // with operating system. If the client is
  2230. // remotely connected some network information
  2231. // may also be present.
  2232. STDMETHOD(GetIdentity)(
  2233. THIS_
  2234. OUT OPTIONAL PSTR Buffer,
  2235. IN ULONG BufferSize,
  2236. OUT OPTIONAL PULONG IdentitySize
  2237. ) PURE;
  2238. // Format is a printf-like format string
  2239. // with one %s where the identity string should go.
  2240. STDMETHOD(OutputIdentity)(
  2241. THIS_
  2242. IN ULONG OutputControl,
  2243. IN ULONG Flags,
  2244. IN PCSTR Format
  2245. ) PURE;
  2246. // Event callbacks allow a client to
  2247. // receive notification about changes
  2248. // during the debug session.
  2249. STDMETHOD(GetEventCallbacks)(
  2250. THIS_
  2251. OUT PDEBUG_EVENT_CALLBACKS* Callbacks
  2252. ) PURE;
  2253. STDMETHOD(SetEventCallbacks)(
  2254. THIS_
  2255. IN PDEBUG_EVENT_CALLBACKS Callbacks
  2256. ) PURE;
  2257. // The engine sometimes merges compatible callback
  2258. // requests to reduce callback overhead. This is
  2259. // most noticeable with output as small pieces of
  2260. // output are collected into larger groups to
  2261. // reduce the overall number of output callback calls.
  2262. // A client can use this method to force all pending
  2263. // callbacks to be delivered. This is rarely necessary.
  2264. STDMETHOD(FlushCallbacks)(
  2265. THIS
  2266. ) PURE;
  2267. // IDebugClient2.
  2268. // Functions similarly to WriteDumpFile with
  2269. // the addition of the ability to specify
  2270. // per-dump-format write control flags.
  2271. // Comment is not supported in all formats.
  2272. STDMETHOD(WriteDumpFile2)(
  2273. THIS_
  2274. IN PCSTR DumpFile,
  2275. IN ULONG Qualifier,
  2276. IN ULONG FormatFlags,
  2277. IN OPTIONAL PCSTR Comment
  2278. ) PURE;
  2279. // Registers additional files of supporting information
  2280. // for a dump file open. This method must be called
  2281. // before OpenDumpFile is called.
  2282. // The files registered may be opened at the time
  2283. // this method is called but generally will not
  2284. // be used until OpenDumpFile is called.
  2285. STDMETHOD(AddDumpInformationFile)(
  2286. THIS_
  2287. IN PCSTR InfoFile,
  2288. IN ULONG Type
  2289. ) PURE;
  2290. // Requests that the remote process server shut down.
  2291. STDMETHOD(EndProcessServer)(
  2292. THIS_
  2293. IN ULONG64 Server
  2294. ) PURE;
  2295. // Waits for a started process server to
  2296. // exit. Allows an application running a
  2297. // process server to monitor the process
  2298. // server so that it can tell when a remote
  2299. // client has asked for it to exit.
  2300. // Returns S_OK if the process server has
  2301. // shut down and S_FALSE for a timeout.
  2302. STDMETHOD(WaitForProcessServerEnd)(
  2303. THIS_
  2304. IN ULONG Timeout
  2305. ) PURE;
  2306. // Returns S_OK if the system is configured
  2307. // to allow kernel debugging.
  2308. STDMETHOD(IsKernelDebuggerEnabled)(
  2309. THIS
  2310. ) PURE;
  2311. // Attempts to terminate the current process.
  2312. // Exit process events for the process may be generated.
  2313. STDMETHOD(TerminateCurrentProcess)(
  2314. THIS
  2315. ) PURE;
  2316. // Attempts to detach from the current process.
  2317. // This requires OS support for debugger detach.
  2318. STDMETHOD(DetachCurrentProcess)(
  2319. THIS
  2320. ) PURE;
  2321. // Removes the process from the debuggers process
  2322. // list without making any other changes. The process
  2323. // will still be marked as being debugged and will
  2324. // not run. This allows a debugger to be shut down
  2325. // and a new debugger attached without taking the
  2326. // process out of the debugged state.
  2327. // This is only supported on some system versions.
  2328. STDMETHOD(AbandonCurrentProcess)(
  2329. THIS
  2330. ) PURE;
  2331. // IDebugClient3.
  2332. STDMETHOD(GetRunningProcessSystemIdByExecutableNameWide)(
  2333. THIS_
  2334. IN ULONG64 Server,
  2335. IN PCWSTR ExeName,
  2336. IN ULONG Flags,
  2337. OUT PULONG Id
  2338. ) PURE;
  2339. STDMETHOD(GetRunningProcessDescriptionWide)(
  2340. THIS_
  2341. IN ULONG64 Server,
  2342. IN ULONG SystemId,
  2343. IN ULONG Flags,
  2344. OUT OPTIONAL PWSTR ExeName,
  2345. IN ULONG ExeNameSize,
  2346. OUT OPTIONAL PULONG ActualExeNameSize,
  2347. OUT OPTIONAL PWSTR Description,
  2348. IN ULONG DescriptionSize,
  2349. OUT OPTIONAL PULONG ActualDescriptionSize
  2350. ) PURE;
  2351. STDMETHOD(CreateProcessWide)(
  2352. THIS_
  2353. IN ULONG64 Server,
  2354. IN PWSTR CommandLine,
  2355. IN ULONG CreateFlags
  2356. ) PURE;
  2357. STDMETHOD(CreateProcessAndAttachWide)(
  2358. THIS_
  2359. IN ULONG64 Server,
  2360. IN OPTIONAL PWSTR CommandLine,
  2361. IN ULONG CreateFlags,
  2362. IN ULONG ProcessId,
  2363. IN ULONG AttachFlags
  2364. ) PURE;
  2365. // IDebugClient4.
  2366. // In the following methods both a filename and a file
  2367. // handle can be passed in. If a file handle is given
  2368. // the filename may be omitted, although providing it
  2369. // allows the debugger to properly report the name when
  2370. // queried.
  2371. // File handles cannot be used in remote calls.
  2372. STDMETHOD(OpenDumpFileWide)(
  2373. THIS_
  2374. IN OPTIONAL PCWSTR FileName,
  2375. IN ULONG64 FileHandle
  2376. ) PURE;
  2377. STDMETHOD(WriteDumpFileWide)(
  2378. THIS_
  2379. IN OPTIONAL PCWSTR FileName,
  2380. IN ULONG64 FileHandle,
  2381. IN ULONG Qualifier,
  2382. IN ULONG FormatFlags,
  2383. IN OPTIONAL PCWSTR Comment
  2384. ) PURE;
  2385. STDMETHOD(AddDumpInformationFileWide)(
  2386. THIS_
  2387. IN OPTIONAL PCWSTR FileName,
  2388. IN ULONG64 FileHandle,
  2389. IN ULONG Type
  2390. ) PURE;
  2391. STDMETHOD(GetNumberDumpFiles)(
  2392. THIS_
  2393. OUT PULONG Number
  2394. ) PURE;
  2395. STDMETHOD(GetDumpFile)(
  2396. THIS_
  2397. IN ULONG Index,
  2398. OUT OPTIONAL PSTR Buffer,
  2399. IN ULONG BufferSize,
  2400. OUT OPTIONAL PULONG NameSize,
  2401. OUT OPTIONAL PULONG64 Handle,
  2402. OUT PULONG Type
  2403. ) PURE;
  2404. STDMETHOD(GetDumpFileWide)(
  2405. THIS_
  2406. IN ULONG Index,
  2407. OUT OPTIONAL PWSTR Buffer,
  2408. IN ULONG BufferSize,
  2409. OUT OPTIONAL PULONG NameSize,
  2410. OUT OPTIONAL PULONG64 Handle,
  2411. OUT PULONG Type
  2412. ) PURE;
  2413. };
  2414. //----------------------------------------------------------------------------
  2415. //
  2416. // IDebugControl.
  2417. //
  2418. //----------------------------------------------------------------------------
  2419. // Execution status codes used for waiting,
  2420. // for returning current status and for
  2421. // event method return values.
  2422. #define DEBUG_STATUS_NO_CHANGE 0
  2423. #define DEBUG_STATUS_GO 1
  2424. #define DEBUG_STATUS_GO_HANDLED 2
  2425. #define DEBUG_STATUS_GO_NOT_HANDLED 3
  2426. #define DEBUG_STATUS_STEP_OVER 4
  2427. #define DEBUG_STATUS_STEP_INTO 5
  2428. #define DEBUG_STATUS_BREAK 6
  2429. #define DEBUG_STATUS_NO_DEBUGGEE 7
  2430. #define DEBUG_STATUS_STEP_BRANCH 8
  2431. #define DEBUG_STATUS_IGNORE_EVENT 9
  2432. #define DEBUG_STATUS_MASK 0xf
  2433. // This bit is added in DEBUG_CES_EXECUTION_STATUS
  2434. // notifications when the engines execution status
  2435. // is changing due to operations performed during
  2436. // a wait, such as making synchronous callbacks. If
  2437. // the bit is not set the execution status is changing
  2438. // due to a wait being satisfied.
  2439. #define DEBUG_STATUS_INSIDE_WAIT 0x100000000
  2440. // Output control flags.
  2441. // Output generated by methods called by this
  2442. // client will be sent only to this clients
  2443. // output callbacks.
  2444. #define DEBUG_OUTCTL_THIS_CLIENT 0x00000000
  2445. // Output will be sent to all clients.
  2446. #define DEBUG_OUTCTL_ALL_CLIENTS 0x00000001
  2447. // Output will be sent to all clients except
  2448. // the client generating the output.
  2449. #define DEBUG_OUTCTL_ALL_OTHER_CLIENTS 0x00000002
  2450. // Output will be discarded immediately and will not
  2451. // be logged or sent to callbacks.
  2452. #define DEBUG_OUTCTL_IGNORE 0x00000003
  2453. // Output will be logged but not sent to callbacks.
  2454. #define DEBUG_OUTCTL_LOG_ONLY 0x00000004
  2455. // All send control bits.
  2456. #define DEBUG_OUTCTL_SEND_MASK 0x00000007
  2457. // Do not place output from this client in
  2458. // the global log file.
  2459. #define DEBUG_OUTCTL_NOT_LOGGED 0x00000008
  2460. // Send output to clients regardless of whether the
  2461. // mask allows it or not.
  2462. #define DEBUG_OUTCTL_OVERRIDE_MASK 0x00000010
  2463. // Special value which means leave the output settings
  2464. // unchanged.
  2465. #define DEBUG_OUTCTL_AMBIENT 0xffffffff
  2466. // Interrupt types.
  2467. // Force a break in if the debuggee is running.
  2468. #define DEBUG_INTERRUPT_ACTIVE 0
  2469. // Notify but do not force a break in.
  2470. #define DEBUG_INTERRUPT_PASSIVE 1
  2471. // Try and get the current engine operation to
  2472. // complete so that the engine will be available
  2473. // again. If no wait is active this is the same
  2474. // as a passive interrupt. If a wait is active
  2475. // this will try to cause the wait to fail without
  2476. // breaking in to the debuggee. There is
  2477. // no guarantee that issuing an exit interrupt
  2478. // will cause the engine to become available
  2479. // as not all operations are arbitrarily
  2480. // interruptible.
  2481. #define DEBUG_INTERRUPT_EXIT 2
  2482. // OutputCurrentState flags. These flags
  2483. // allow a particular type of information
  2484. // to be displayed but do not guarantee
  2485. // that it will be displayed. Other global
  2486. // settings may override these flags or
  2487. // the particular state may not be available.
  2488. // For example, source line information may
  2489. // not be present so source line information
  2490. // may not be displayed.
  2491. #define DEBUG_CURRENT_DEFAULT 0x0000000f
  2492. #define DEBUG_CURRENT_SYMBOL 0x00000001
  2493. #define DEBUG_CURRENT_DISASM 0x00000002
  2494. #define DEBUG_CURRENT_REGISTERS 0x00000004
  2495. #define DEBUG_CURRENT_SOURCE_LINE 0x00000008
  2496. // Disassemble flags.
  2497. // Compute the effective address from current register
  2498. // information and display it.
  2499. #define DEBUG_DISASM_EFFECTIVE_ADDRESS 0x00000001
  2500. // If the current disassembly offset has an exact
  2501. // symbol match output the symbol.
  2502. #define DEBUG_DISASM_MATCHING_SYMBOLS 0x00000002
  2503. // Code interpretation levels for stepping
  2504. // and other operations.
  2505. #define DEBUG_LEVEL_SOURCE 0
  2506. #define DEBUG_LEVEL_ASSEMBLY 1
  2507. // Engine control flags.
  2508. #define DEBUG_ENGOPT_IGNORE_DBGHELP_VERSION 0x00000001
  2509. #define DEBUG_ENGOPT_IGNORE_EXTENSION_VERSIONS 0x00000002
  2510. // If neither allow nor disallow is specified
  2511. // the engine will pick one based on what kind
  2512. // of debugging is going on.
  2513. #define DEBUG_ENGOPT_ALLOW_NETWORK_PATHS 0x00000004
  2514. #define DEBUG_ENGOPT_DISALLOW_NETWORK_PATHS 0x00000008
  2515. #define DEBUG_ENGOPT_NETWORK_PATHS (0x00000004 | 0x00000008)
  2516. // Ignore loader-generated first-chance exceptions.
  2517. #define DEBUG_ENGOPT_IGNORE_LOADER_EXCEPTIONS 0x00000010
  2518. // Break in on a debuggees initial event. In user-mode
  2519. // this will break at the initial system breakpoint
  2520. // for every created process. In kernel-mode it
  2521. // will attempt break in on the target at the first
  2522. // WaitForEvent.
  2523. #define DEBUG_ENGOPT_INITIAL_BREAK 0x00000020
  2524. // Break in on the first module load for a debuggee.
  2525. #define DEBUG_ENGOPT_INITIAL_MODULE_BREAK 0x00000040
  2526. // Break in on a debuggees final event. In user-mode
  2527. // this will break on process exit for every process.
  2528. // In kernel-mode it currently does nothing.
  2529. #define DEBUG_ENGOPT_FINAL_BREAK 0x00000080
  2530. // By default Execute will repeat the last command
  2531. // if it is given an empty string. The flags to
  2532. // Execute can override this behavior for a single
  2533. // command or this engine option can be used to
  2534. // change the default globally.
  2535. #define DEBUG_ENGOPT_NO_EXECUTE_REPEAT 0x00000100
  2536. // Disable places in the engine that have fallback
  2537. // code when presented with incomplete information.
  2538. // 1. Fails minidump module loads unless matching
  2539. // executables can be mapped.
  2540. #define DEBUG_ENGOPT_FAIL_INCOMPLETE_INFORMATION 0x00000200
  2541. // Allow the debugger to manipulate page protections
  2542. // in order to insert code breakpoints on pages that
  2543. // do not have write access. This option is not on
  2544. // by default as it allows breakpoints to be set
  2545. // in potentially hazardous memory areas.
  2546. #define DEBUG_ENGOPT_ALLOW_READ_ONLY_BREAKPOINTS 0x00000400
  2547. // When using a software (bp/bu) breakpoint in code
  2548. // that will be executed by multiple threads it is
  2549. // possible for breakpoint management to cause the
  2550. // breakpoint to be missed or for spurious single-step
  2551. // exceptions to be generated. This flag suspends
  2552. // all but the active thread when doing breakpoint
  2553. // management and thereby avoids multithreading
  2554. // problems. Care must be taken when using it, though,
  2555. // as the suspension of threads can cause deadlocks
  2556. // if the suspended threads are holding resources that
  2557. // the active thread needs. Additionally, there
  2558. // are still rare situations where problems may
  2559. // occur, but setting this flag corrects nearly
  2560. // all multithreading issues with software breakpoints.
  2561. // Thread-restricted stepping and execution supersedes
  2562. // this flags effect.
  2563. // This flag is ignored in kernel sessions as there
  2564. // is no way to restrict processor execution.
  2565. #define DEBUG_ENGOPT_SYNCHRONIZE_BREAKPOINTS 0x00000800
  2566. // Disallows executing shell commands through the
  2567. // engine with .shell (!!).
  2568. #define DEBUG_ENGOPT_DISALLOW_SHELL_COMMANDS 0x00001000
  2569. #define DEBUG_ENGOPT_ALL 0x00001FFF
  2570. // General unspecified ID constant.
  2571. #define DEBUG_ANY_ID 0xffffffff
  2572. typedef struct _DEBUG_STACK_FRAME
  2573. {
  2574. ULONG64 InstructionOffset;
  2575. ULONG64 ReturnOffset;
  2576. ULONG64 FrameOffset;
  2577. ULONG64 StackOffset;
  2578. ULONG64 FuncTableEntry;
  2579. ULONG64 Params[4];
  2580. ULONG64 Reserved[6];
  2581. BOOL Virtual;
  2582. ULONG FrameNumber;
  2583. } DEBUG_STACK_FRAME, *PDEBUG_STACK_FRAME;
  2584. // OutputStackTrace flags.
  2585. // Display a small number of arguments for each call.
  2586. // These may or may not be the actual arguments depending
  2587. // on the architecture, particular function and
  2588. // point during the execution of the function.
  2589. // If the current code level is assembly arguments
  2590. // are dumped as hex values. If the code level is
  2591. // source the engine attempts to provide symbolic
  2592. // argument information.
  2593. #define DEBUG_STACK_ARGUMENTS 0x00000001
  2594. // Displays information about the functions
  2595. // frame such as __stdcall arguments, FPO
  2596. // information and whatever else is available.
  2597. #define DEBUG_STACK_FUNCTION_INFO 0x00000002
  2598. // Displays source line information for each
  2599. // frame of the stack trace.
  2600. #define DEBUG_STACK_SOURCE_LINE 0x00000004
  2601. // Show return, previous frame and other relevant address
  2602. // values for each frame.
  2603. #define DEBUG_STACK_FRAME_ADDRESSES 0x00000008
  2604. // Show column names.
  2605. #define DEBUG_STACK_COLUMN_NAMES 0x00000010
  2606. // Show non-volatile register context for each
  2607. // frame. This is only meaningful for some platforms.
  2608. #define DEBUG_STACK_NONVOLATILE_REGISTERS 0x00000020
  2609. // Show frame numbers
  2610. #define DEBUG_STACK_FRAME_NUMBERS 0x00000040
  2611. // Show parameters with type name
  2612. #define DEBUG_STACK_PARAMETERS 0x00000080
  2613. // Show just return address in stack frame addresses
  2614. #define DEBUG_STACK_FRAME_ADDRESSES_RA_ONLY 0x00000100
  2615. // Show frame-to-frame memory usage.
  2616. #define DEBUG_STACK_FRAME_MEMORY_USAGE 0x00000200
  2617. // Classes of debuggee. Each class
  2618. // has different qualifiers for specific
  2619. // kinds of debuggees.
  2620. #define DEBUG_CLASS_UNINITIALIZED 0
  2621. #define DEBUG_CLASS_KERNEL 1
  2622. #define DEBUG_CLASS_USER_WINDOWS 2
  2623. // Generic dump types. These can be used
  2624. // with either user or kernel sessions.
  2625. // Session-type-specific aliases are also
  2626. // provided.
  2627. #define DEBUG_DUMP_SMALL 1024
  2628. #define DEBUG_DUMP_DEFAULT 1025
  2629. #define DEBUG_DUMP_FULL 1026
  2630. // Specific types of kernel debuggees.
  2631. #define DEBUG_KERNEL_CONNECTION 0
  2632. #define DEBUG_KERNEL_LOCAL 1
  2633. #define DEBUG_KERNEL_EXDI_DRIVER 2
  2634. #define DEBUG_KERNEL_SMALL_DUMP DEBUG_DUMP_SMALL
  2635. #define DEBUG_KERNEL_DUMP DEBUG_DUMP_DEFAULT
  2636. #define DEBUG_KERNEL_FULL_DUMP DEBUG_DUMP_FULL
  2637. // Specific types of Windows user debuggees.
  2638. #define DEBUG_USER_WINDOWS_PROCESS 0
  2639. #define DEBUG_USER_WINDOWS_PROCESS_SERVER 1
  2640. #define DEBUG_USER_WINDOWS_SMALL_DUMP DEBUG_DUMP_SMALL
  2641. #define DEBUG_USER_WINDOWS_DUMP DEBUG_DUMP_DEFAULT
  2642. // Extension flags.
  2643. #define DEBUG_EXTENSION_AT_ENGINE 0x00000000
  2644. // Execute and ExecuteCommandFile flags.
  2645. // These flags only apply to the command
  2646. // text itself; output from the executed
  2647. // command is controlled by the output
  2648. // control parameter.
  2649. // Default execution. Command is logged
  2650. // but not output.
  2651. #define DEBUG_EXECUTE_DEFAULT 0x00000000
  2652. // Echo commands during execution. In
  2653. // ExecuteCommandFile also echoes the prompt
  2654. // for each line of the file.
  2655. #define DEBUG_EXECUTE_ECHO 0x00000001
  2656. // Do not log or output commands during execution.
  2657. // Overridden by DEBUG_EXECUTE_ECHO.
  2658. #define DEBUG_EXECUTE_NOT_LOGGED 0x00000002
  2659. // If this flag is not set an empty string
  2660. // to Execute will repeat the last Execute
  2661. // string.
  2662. #define DEBUG_EXECUTE_NO_REPEAT 0x00000004
  2663. // Specific event filter types. Some event
  2664. // filters have optional arguments to further
  2665. // qualify their operation.
  2666. #define DEBUG_FILTER_CREATE_THREAD 0x00000000
  2667. #define DEBUG_FILTER_EXIT_THREAD 0x00000001
  2668. #define DEBUG_FILTER_CREATE_PROCESS 0x00000002
  2669. #define DEBUG_FILTER_EXIT_PROCESS 0x00000003
  2670. // Argument is the name of a module to break on.
  2671. #define DEBUG_FILTER_LOAD_MODULE 0x00000004
  2672. // Argument is the base address of a specific module to break on.
  2673. #define DEBUG_FILTER_UNLOAD_MODULE 0x00000005
  2674. #define DEBUG_FILTER_SYSTEM_ERROR 0x00000006
  2675. // Initial breakpoint and initial module load are one-shot
  2676. // events that are triggered at the appropriate points in
  2677. // the beginning of a session. Their commands are executed
  2678. // and then further processing is controlled by the normal
  2679. // exception and load module filters.
  2680. #define DEBUG_FILTER_INITIAL_BREAKPOINT 0x00000007
  2681. #define DEBUG_FILTER_INITIAL_MODULE_LOAD 0x00000008
  2682. // The debug output filter allows the debugger to stop
  2683. // when output is produced so that the code causing
  2684. // output can be tracked down or synchronized with.
  2685. // This filter is not supported for live dual-machine
  2686. // kernel debugging.
  2687. #define DEBUG_FILTER_DEBUGGEE_OUTPUT 0x00000009
  2688. // Event filter execution options.
  2689. // Break in always.
  2690. #define DEBUG_FILTER_BREAK 0x00000000
  2691. // Break in on second-chance exceptions. For events
  2692. // that are not exceptions this is the same as BREAK.
  2693. #define DEBUG_FILTER_SECOND_CHANCE_BREAK 0x00000001
  2694. // Output a message about the event but continue.
  2695. #define DEBUG_FILTER_OUTPUT 0x00000002
  2696. // Continue the event.
  2697. #define DEBUG_FILTER_IGNORE 0x00000003
  2698. // Used to remove general exception filters.
  2699. #define DEBUG_FILTER_REMOVE 0x00000004
  2700. // Event filter continuation options. These options are
  2701. // only used when DEBUG_STATUS_GO is used to continue
  2702. // execution. If a specific go status such as
  2703. // DEBUG_STATUS_GO_NOT_HANDLED is used it controls
  2704. // the continuation.
  2705. #define DEBUG_FILTER_GO_HANDLED 0x00000000
  2706. #define DEBUG_FILTER_GO_NOT_HANDLED 0x00000001
  2707. // Specific event filter settings.
  2708. typedef struct _DEBUG_SPECIFIC_FILTER_PARAMETERS
  2709. {
  2710. ULONG ExecutionOption;
  2711. ULONG ContinueOption;
  2712. ULONG TextSize;
  2713. ULONG CommandSize;
  2714. // If ArgumentSize is zero this filter does
  2715. // not have an argument. An empty argument for
  2716. // a filter which does have an argument will take
  2717. // one byte for the terminator.
  2718. ULONG ArgumentSize;
  2719. } DEBUG_SPECIFIC_FILTER_PARAMETERS, *PDEBUG_SPECIFIC_FILTER_PARAMETERS;
  2720. // Exception event filter settings.
  2721. typedef struct _DEBUG_EXCEPTION_FILTER_PARAMETERS
  2722. {
  2723. ULONG ExecutionOption;
  2724. ULONG ContinueOption;
  2725. ULONG TextSize;
  2726. ULONG CommandSize;
  2727. ULONG SecondCommandSize;
  2728. ULONG ExceptionCode;
  2729. } DEBUG_EXCEPTION_FILTER_PARAMETERS, *PDEBUG_EXCEPTION_FILTER_PARAMETERS;
  2730. // Wait flags.
  2731. #define DEBUG_WAIT_DEFAULT 0x00000000
  2732. // Last event information structures.
  2733. typedef struct _DEBUG_LAST_EVENT_INFO_BREAKPOINT
  2734. {
  2735. ULONG Id;
  2736. } DEBUG_LAST_EVENT_INFO_BREAKPOINT, *PDEBUG_LAST_EVENT_INFO_BREAKPOINT;
  2737. typedef struct _DEBUG_LAST_EVENT_INFO_EXCEPTION
  2738. {
  2739. EXCEPTION_RECORD64 ExceptionRecord;
  2740. ULONG FirstChance;
  2741. } DEBUG_LAST_EVENT_INFO_EXCEPTION, *PDEBUG_LAST_EVENT_INFO_EXCEPTION;
  2742. typedef struct _DEBUG_LAST_EVENT_INFO_EXIT_THREAD
  2743. {
  2744. ULONG ExitCode;
  2745. } DEBUG_LAST_EVENT_INFO_EXIT_THREAD, *PDEBUG_LAST_EVENT_INFO_EXIT_THREAD;
  2746. typedef struct _DEBUG_LAST_EVENT_INFO_EXIT_PROCESS
  2747. {
  2748. ULONG ExitCode;
  2749. } DEBUG_LAST_EVENT_INFO_EXIT_PROCESS, *PDEBUG_LAST_EVENT_INFO_EXIT_PROCESS;
  2750. typedef struct _DEBUG_LAST_EVENT_INFO_LOAD_MODULE
  2751. {
  2752. ULONG64 Base;
  2753. } DEBUG_LAST_EVENT_INFO_LOAD_MODULE, *PDEBUG_LAST_EVENT_INFO_LOAD_MODULE;
  2754. typedef struct _DEBUG_LAST_EVENT_INFO_UNLOAD_MODULE
  2755. {
  2756. ULONG64 Base;
  2757. } DEBUG_LAST_EVENT_INFO_UNLOAD_MODULE, *PDEBUG_LAST_EVENT_INFO_UNLOAD_MODULE;
  2758. typedef struct _DEBUG_LAST_EVENT_INFO_SYSTEM_ERROR
  2759. {
  2760. ULONG Error;
  2761. ULONG Level;
  2762. } DEBUG_LAST_EVENT_INFO_SYSTEM_ERROR, *PDEBUG_LAST_EVENT_INFO_SYSTEM_ERROR;
  2763. // DEBUG_VALUE types.
  2764. #define DEBUG_VALUE_INVALID 0
  2765. #define DEBUG_VALUE_INT8 1
  2766. #define DEBUG_VALUE_INT16 2
  2767. #define DEBUG_VALUE_INT32 3
  2768. #define DEBUG_VALUE_INT64 4
  2769. #define DEBUG_VALUE_FLOAT32 5
  2770. #define DEBUG_VALUE_FLOAT64 6
  2771. #define DEBUG_VALUE_FLOAT80 7
  2772. #define DEBUG_VALUE_FLOAT82 8
  2773. #define DEBUG_VALUE_FLOAT128 9
  2774. #define DEBUG_VALUE_VECTOR64 10
  2775. #define DEBUG_VALUE_VECTOR128 11
  2776. // Count of type indices.
  2777. #define DEBUG_VALUE_TYPES 12
  2778. #if defined(_MSC_VER)
  2779. #if _MSC_VER >= 800
  2780. #if _MSC_VER >= 1200
  2781. #pragma warning(push)
  2782. #endif
  2783. #pragma warning(disable:4201) /* Nameless struct/union */
  2784. #endif
  2785. #endif
  2786. // We want the DEBUG_VALUE structure to have 8-byte alignment
  2787. // and be 32 bytes total. This is tricky because the compiler
  2788. // wants to pad the union of values out to a even 8-byte multiple,
  2789. // pushing the type out too far. We can't use 4-packing because
  2790. // then the 8-byte alignment requirement is lost, so instead
  2791. // we shrink the union to 24 bytes and have a reserved field
  2792. // before the type field. The same amount of space is available
  2793. // and everybody's happy, but the structure is somewhat unusual.
  2794. typedef struct _DEBUG_VALUE
  2795. {
  2796. union
  2797. {
  2798. UCHAR I8;
  2799. USHORT I16;
  2800. ULONG I32;
  2801. struct
  2802. {
  2803. // Extra NAT indicator for IA64
  2804. // integer registers. NAT will
  2805. // always be false for other CPUs.
  2806. ULONG64 I64;
  2807. BOOL Nat;
  2808. };
  2809. float F32;
  2810. double F64;
  2811. UCHAR F80Bytes[10];
  2812. UCHAR F82Bytes[11];
  2813. UCHAR F128Bytes[16];
  2814. // Vector interpretations. The actual number
  2815. // of valid elements depends on the vector length.
  2816. UCHAR VI8[16];
  2817. USHORT VI16[8];
  2818. ULONG VI32[4];
  2819. ULONG64 VI64[2];
  2820. float VF32[4];
  2821. double VF64[2];
  2822. struct
  2823. {
  2824. ULONG LowPart;
  2825. ULONG HighPart;
  2826. } I64Parts32;
  2827. struct
  2828. {
  2829. ULONG64 LowPart;
  2830. LONG64 HighPart;
  2831. } F128Parts64;
  2832. // Allows raw byte access to content. Array
  2833. // can be indexed for as much data as Type
  2834. // describes. This array also serves to pad
  2835. // the structure out to 32 bytes and reserves
  2836. // space for future members.
  2837. UCHAR RawBytes[24];
  2838. };
  2839. ULONG TailOfRawBytes;
  2840. ULONG Type;
  2841. } DEBUG_VALUE, *PDEBUG_VALUE;
  2842. #if defined(_MSC_VER)
  2843. #if _MSC_VER >= 800
  2844. #if _MSC_VER >= 1200
  2845. #pragma warning(pop)
  2846. #else
  2847. #pragma warning(default:4201) /* Nameless struct/union */
  2848. #endif
  2849. #endif
  2850. #endif
  2851. #undef INTERFACE
  2852. #define INTERFACE IDebugControl
  2853. DECLARE_INTERFACE_(IDebugControl, IUnknown)
  2854. {
  2855. // IUnknown.
  2856. STDMETHOD(QueryInterface)(
  2857. THIS_
  2858. IN REFIID InterfaceId,
  2859. OUT PVOID* Interface
  2860. ) PURE;
  2861. STDMETHOD_(ULONG, AddRef)(
  2862. THIS
  2863. ) PURE;
  2864. STDMETHOD_(ULONG, Release)(
  2865. THIS
  2866. ) PURE;
  2867. // IDebugControl.
  2868. // Checks for a user interrupt, such a Ctrl-C
  2869. // or stop button.
  2870. // This method is reentrant.
  2871. STDMETHOD(GetInterrupt)(
  2872. THIS
  2873. ) PURE;
  2874. // Registers a user interrupt.
  2875. // This method is reentrant.
  2876. STDMETHOD(SetInterrupt)(
  2877. THIS_
  2878. IN ULONG Flags
  2879. ) PURE;
  2880. // Interrupting a user-mode process requires
  2881. // access to some system resources that the
  2882. // process may hold itself, preventing the
  2883. // interrupt from occurring. The engine
  2884. // will time-out pending interrupt requests
  2885. // and simulate an interrupt if necessary.
  2886. // These methods control the interrupt timeout.
  2887. STDMETHOD(GetInterruptTimeout)(
  2888. THIS_
  2889. OUT PULONG Seconds
  2890. ) PURE;
  2891. STDMETHOD(SetInterruptTimeout)(
  2892. THIS_
  2893. IN ULONG Seconds
  2894. ) PURE;
  2895. STDMETHOD(GetLogFile)(
  2896. THIS_
  2897. OUT OPTIONAL PSTR Buffer,
  2898. IN ULONG BufferSize,
  2899. OUT OPTIONAL PULONG FileSize,
  2900. OUT PBOOL Append
  2901. ) PURE;
  2902. // Opens a log file which collects all
  2903. // output. Output from every client except
  2904. // those that explicitly disable logging
  2905. // goes into the log.
  2906. // Opening a log file closes any log file
  2907. // already open.
  2908. STDMETHOD(OpenLogFile)(
  2909. THIS_
  2910. IN PCSTR File,
  2911. IN BOOL Append
  2912. ) PURE;
  2913. STDMETHOD(CloseLogFile)(
  2914. THIS
  2915. ) PURE;
  2916. // Controls what output is logged.
  2917. STDMETHOD(GetLogMask)(
  2918. THIS_
  2919. OUT PULONG Mask
  2920. ) PURE;
  2921. STDMETHOD(SetLogMask)(
  2922. THIS_
  2923. IN ULONG Mask
  2924. ) PURE;
  2925. // Input requests input from all clients.
  2926. // The first input that is returned is used
  2927. // to satisfy the call. Other returned
  2928. // input is discarded.
  2929. STDMETHOD(Input)(
  2930. THIS_
  2931. OUT PSTR Buffer,
  2932. IN ULONG BufferSize,
  2933. OUT OPTIONAL PULONG InputSize
  2934. ) PURE;
  2935. // This method is used by clients to return
  2936. // input when it is available. It will
  2937. // return S_OK if the input is used to
  2938. // satisfy an Input call and S_FALSE if
  2939. // the input is ignored.
  2940. // This method is reentrant.
  2941. STDMETHOD(ReturnInput)(
  2942. THIS_
  2943. IN PCSTR Buffer
  2944. ) PURE;
  2945. // Sends output through clients
  2946. // output callbacks if the mask is allowed
  2947. // by the current output control mask and
  2948. // according to the output distribution
  2949. // settings.
  2950. STDMETHODV(Output)(
  2951. THIS_
  2952. IN ULONG Mask,
  2953. IN PCSTR Format,
  2954. ...
  2955. ) PURE;
  2956. STDMETHOD(OutputVaList)(
  2957. THIS_
  2958. IN ULONG Mask,
  2959. IN PCSTR Format,
  2960. IN va_list Args
  2961. ) PURE;
  2962. // The following methods allow direct control
  2963. // over the distribution of the given output
  2964. // for situations where something other than
  2965. // the default is desired. These methods require
  2966. // extra work in the engine so they should
  2967. // only be used when necessary.
  2968. STDMETHODV(ControlledOutput)(
  2969. THIS_
  2970. IN ULONG OutputControl,
  2971. IN ULONG Mask,
  2972. IN PCSTR Format,
  2973. ...
  2974. ) PURE;
  2975. STDMETHOD(ControlledOutputVaList)(
  2976. THIS_
  2977. IN ULONG OutputControl,
  2978. IN ULONG Mask,
  2979. IN PCSTR Format,
  2980. IN va_list Args
  2981. ) PURE;
  2982. // Displays the standard command-line prompt
  2983. // followed by the given output. If Format
  2984. // is NULL no additional output is produced.
  2985. // Output is produced under the
  2986. // DEBUG_OUTPUT_PROMPT mask.
  2987. // This method only outputs the prompt; it
  2988. // does not get input.
  2989. STDMETHODV(OutputPrompt)(
  2990. THIS_
  2991. IN ULONG OutputControl,
  2992. IN OPTIONAL PCSTR Format,
  2993. ...
  2994. ) PURE;
  2995. STDMETHOD(OutputPromptVaList)(
  2996. THIS_
  2997. IN ULONG OutputControl,
  2998. IN OPTIONAL PCSTR Format,
  2999. IN va_list Args
  3000. ) PURE;
  3001. // Gets the text that would be displayed by OutputPrompt.
  3002. STDMETHOD(GetPromptText)(
  3003. THIS_
  3004. OUT OPTIONAL PSTR Buffer,
  3005. IN ULONG BufferSize,
  3006. OUT OPTIONAL PULONG TextSize
  3007. ) PURE;
  3008. // Outputs information about the current
  3009. // debuggee state such as a register
  3010. // summary, disassembly at the current PC,
  3011. // closest symbol and others.
  3012. // Uses the line prefix.
  3013. STDMETHOD(OutputCurrentState)(
  3014. THIS_
  3015. IN ULONG OutputControl,
  3016. IN ULONG Flags
  3017. ) PURE;
  3018. // Outputs the debugger and extension version
  3019. // information. This method is reentrant.
  3020. // Uses the line prefix.
  3021. STDMETHOD(OutputVersionInformation)(
  3022. THIS_
  3023. IN ULONG OutputControl
  3024. ) PURE;
  3025. // In user-mode debugging sessions the
  3026. // engine will set an event when
  3027. // exceptions are continued. This can
  3028. // be used to synchronize other processes
  3029. // with the debuggers handling of events.
  3030. // For example, this is used to support
  3031. // the e argument to ntsd.
  3032. STDMETHOD(GetNotifyEventHandle)(
  3033. THIS_
  3034. OUT PULONG64 Handle
  3035. ) PURE;
  3036. STDMETHOD(SetNotifyEventHandle)(
  3037. THIS_
  3038. IN ULONG64 Handle
  3039. ) PURE;
  3040. STDMETHOD(Assemble)(
  3041. THIS_
  3042. IN ULONG64 Offset,
  3043. IN PCSTR Instr,
  3044. OUT PULONG64 EndOffset
  3045. ) PURE;
  3046. STDMETHOD(Disassemble)(
  3047. THIS_
  3048. IN ULONG64 Offset,
  3049. IN ULONG Flags,
  3050. OUT OPTIONAL PSTR Buffer,
  3051. IN ULONG BufferSize,
  3052. OUT OPTIONAL PULONG DisassemblySize,
  3053. OUT PULONG64 EndOffset
  3054. ) PURE;
  3055. // Returns the value of the effective address
  3056. // computed for the last Disassemble, if there
  3057. // was one.
  3058. STDMETHOD(GetDisassembleEffectiveOffset)(
  3059. THIS_
  3060. OUT PULONG64 Offset
  3061. ) PURE;
  3062. // Uses the line prefix if necessary.
  3063. STDMETHOD(OutputDisassembly)(
  3064. THIS_
  3065. IN ULONG OutputControl,
  3066. IN ULONG64 Offset,
  3067. IN ULONG Flags,
  3068. OUT PULONG64 EndOffset
  3069. ) PURE;
  3070. // Produces multiple lines of disassembly output.
  3071. // There will be PreviousLines of disassembly before
  3072. // the given offset if a valid disassembly exists.
  3073. // In all, there will be TotalLines of output produced.
  3074. // The first and last line offsets are returned
  3075. // specially and all lines offsets can be retrieved
  3076. // through LineOffsets. LineOffsets will contain
  3077. // offsets for each line where disassembly started.
  3078. // When disassembly of a single instruction takes
  3079. // multiple lines the initial offset will be followed
  3080. // by DEBUG_INVALID_OFFSET.
  3081. // Uses the line prefix.
  3082. STDMETHOD(OutputDisassemblyLines)(
  3083. THIS_
  3084. IN ULONG OutputControl,
  3085. IN ULONG PreviousLines,
  3086. IN ULONG TotalLines,
  3087. IN ULONG64 Offset,
  3088. IN ULONG Flags,
  3089. OUT OPTIONAL PULONG OffsetLine,
  3090. OUT OPTIONAL PULONG64 StartOffset,
  3091. OUT OPTIONAL PULONG64 EndOffset,
  3092. OUT OPTIONAL /* size_is(TotalLines) */ PULONG64 LineOffsets
  3093. ) PURE;
  3094. // Returns the offset of the start of
  3095. // the instruction thats the given
  3096. // delta away from the instruction
  3097. // at the initial offset.
  3098. // This routine does not check for
  3099. // validity of the instruction or
  3100. // the memory containing it.
  3101. STDMETHOD(GetNearInstruction)(
  3102. THIS_
  3103. IN ULONG64 Offset,
  3104. IN LONG Delta,
  3105. OUT PULONG64 NearOffset
  3106. ) PURE;
  3107. // Offsets can be passed in as zero to use the current
  3108. // thread state.
  3109. STDMETHOD(GetStackTrace)(
  3110. THIS_
  3111. IN ULONG64 FrameOffset,
  3112. IN ULONG64 StackOffset,
  3113. IN ULONG64 InstructionOffset,
  3114. OUT /* size_is(FramesSize) */ PDEBUG_STACK_FRAME Frames,
  3115. IN ULONG FramesSize,
  3116. OUT OPTIONAL PULONG FramesFilled
  3117. ) PURE;
  3118. // Does a simple stack trace to determine
  3119. // what the current return address is.
  3120. STDMETHOD(GetReturnOffset)(
  3121. THIS_
  3122. OUT PULONG64 Offset
  3123. ) PURE;
  3124. // If Frames is NULL OutputStackTrace will
  3125. // use GetStackTrace to get FramesSize frames
  3126. // and then output them. The current register
  3127. // values for frame, stack and instruction offsets
  3128. // are used.
  3129. // Uses the line prefix.
  3130. STDMETHOD(OutputStackTrace)(
  3131. THIS_
  3132. IN ULONG OutputControl,
  3133. IN OPTIONAL /* size_is(FramesSize) */ PDEBUG_STACK_FRAME Frames,
  3134. IN ULONG FramesSize,
  3135. IN ULONG Flags
  3136. ) PURE;
  3137. // Returns information about the debuggee such
  3138. // as user vs. kernel, dump vs. live, etc.
  3139. STDMETHOD(GetDebuggeeType)(
  3140. THIS_
  3141. OUT PULONG Class,
  3142. OUT PULONG Qualifier
  3143. ) PURE;
  3144. // Returns the type of physical processors in
  3145. // the machine.
  3146. // Returns one of the IMAGE_FILE_MACHINE values.
  3147. STDMETHOD(GetActualProcessorType)(
  3148. THIS_
  3149. OUT PULONG Type
  3150. ) PURE;
  3151. // Returns the type of processor used in the
  3152. // current processor context.
  3153. STDMETHOD(GetExecutingProcessorType)(
  3154. THIS_
  3155. OUT PULONG Type
  3156. ) PURE;
  3157. // Query all the possible processor types that
  3158. // may be encountered during this debug session.
  3159. STDMETHOD(GetNumberPossibleExecutingProcessorTypes)(
  3160. THIS_
  3161. OUT PULONG Number
  3162. ) PURE;
  3163. STDMETHOD(GetPossibleExecutingProcessorTypes)(
  3164. THIS_
  3165. IN ULONG Start,
  3166. IN ULONG Count,
  3167. OUT /* size_is(Count) */ PULONG Types
  3168. ) PURE;
  3169. // Get the number of actual processors in
  3170. // the machine.
  3171. STDMETHOD(GetNumberProcessors)(
  3172. THIS_
  3173. OUT PULONG Number
  3174. ) PURE;
  3175. // PlatformId is one of the VER_PLATFORM values.
  3176. // Major and minor are as given in the NT
  3177. // kernel debugger protocol.
  3178. // ServicePackString and ServicePackNumber indicate the
  3179. // system service pack level. ServicePackNumber is not
  3180. // available in some sessions where the service pack level
  3181. // is only expressed as a string. The service pack information
  3182. // will be empty if the system does not have a service pack
  3183. // applied.
  3184. // The build string is string information identifying the
  3185. // particular build of the system. The build string is
  3186. // empty if the system has no particular identifying
  3187. // information.
  3188. STDMETHOD(GetSystemVersion)(
  3189. THIS_
  3190. OUT PULONG PlatformId,
  3191. OUT PULONG Major,
  3192. OUT PULONG Minor,
  3193. OUT OPTIONAL PSTR ServicePackString,
  3194. IN ULONG ServicePackStringSize,
  3195. OUT OPTIONAL PULONG ServicePackStringUsed,
  3196. OUT PULONG ServicePackNumber,
  3197. OUT OPTIONAL PSTR BuildString,
  3198. IN ULONG BuildStringSize,
  3199. OUT OPTIONAL PULONG BuildStringUsed
  3200. ) PURE;
  3201. // Returns the page size for the currently executing
  3202. // processor context. The page size may vary between
  3203. // processor types.
  3204. STDMETHOD(GetPageSize)(
  3205. THIS_
  3206. OUT PULONG Size
  3207. ) PURE;
  3208. // Returns S_OK if the current processor context uses
  3209. // 64-bit addresses, otherwise S_FALSE.
  3210. STDMETHOD(IsPointer64Bit)(
  3211. THIS
  3212. ) PURE;
  3213. // Reads the bugcheck data area and returns the
  3214. // current contents. This method only works
  3215. // in kernel debugging sessions.
  3216. STDMETHOD(ReadBugCheckData)(
  3217. THIS_
  3218. OUT PULONG Code,
  3219. OUT PULONG64 Arg1,
  3220. OUT PULONG64 Arg2,
  3221. OUT PULONG64 Arg3,
  3222. OUT PULONG64 Arg4
  3223. ) PURE;
  3224. // Query all the processor types supported by
  3225. // the engine. This is a complete list and is
  3226. // not related to the machine running the engine
  3227. // or the debuggee.
  3228. STDMETHOD(GetNumberSupportedProcessorTypes)(
  3229. THIS_
  3230. OUT PULONG Number
  3231. ) PURE;
  3232. STDMETHOD(GetSupportedProcessorTypes)(
  3233. THIS_
  3234. IN ULONG Start,
  3235. IN ULONG Count,
  3236. OUT /* size_is(Count) */ PULONG Types
  3237. ) PURE;
  3238. // Returns a full, descriptive name and an
  3239. // abbreviated name for a processor type.
  3240. STDMETHOD(GetProcessorTypeNames)(
  3241. THIS_
  3242. IN ULONG Type,
  3243. OUT OPTIONAL PSTR FullNameBuffer,
  3244. IN ULONG FullNameBufferSize,
  3245. OUT OPTIONAL PULONG FullNameSize,
  3246. OUT OPTIONAL PSTR AbbrevNameBuffer,
  3247. IN ULONG AbbrevNameBufferSize,
  3248. OUT OPTIONAL PULONG AbbrevNameSize
  3249. ) PURE;
  3250. // Gets and sets the type of processor to
  3251. // use when doing things like setting
  3252. // breakpoints, accessing registers,
  3253. // getting stack traces and so on.
  3254. STDMETHOD(GetEffectiveProcessorType)(
  3255. THIS_
  3256. OUT PULONG Type
  3257. ) PURE;
  3258. STDMETHOD(SetEffectiveProcessorType)(
  3259. THIS_
  3260. IN ULONG Type
  3261. ) PURE;
  3262. // Returns information about whether and how
  3263. // the debuggee is running. Status will
  3264. // be GO if the debuggee is running and
  3265. // BREAK if it isnt.
  3266. // If no debuggee exists the status is
  3267. // NO_DEBUGGEE.
  3268. // This method is reentrant.
  3269. STDMETHOD(GetExecutionStatus)(
  3270. THIS_
  3271. OUT PULONG Status
  3272. ) PURE;
  3273. // Changes the execution status of the
  3274. // engine from stopped to running.
  3275. // Status must be one of the go or step
  3276. // status values.
  3277. STDMETHOD(SetExecutionStatus)(
  3278. THIS_
  3279. IN ULONG Status
  3280. ) PURE;
  3281. // Controls what code interpretation level the debugger
  3282. // runs at. The debugger checks the code level when
  3283. // deciding whether to step by a source line or
  3284. // assembly instruction along with other related operations.
  3285. STDMETHOD(GetCodeLevel)(
  3286. THIS_
  3287. OUT PULONG Level
  3288. ) PURE;
  3289. STDMETHOD(SetCodeLevel)(
  3290. THIS_
  3291. IN ULONG Level
  3292. ) PURE;
  3293. // Gets and sets engine control flags.
  3294. // These methods are reentrant.
  3295. STDMETHOD(GetEngineOptions)(
  3296. THIS_
  3297. OUT PULONG Options
  3298. ) PURE;
  3299. STDMETHOD(AddEngineOptions)(
  3300. THIS_
  3301. IN ULONG Options
  3302. ) PURE;
  3303. STDMETHOD(RemoveEngineOptions)(
  3304. THIS_
  3305. IN ULONG Options
  3306. ) PURE;
  3307. STDMETHOD(SetEngineOptions)(
  3308. THIS_
  3309. IN ULONG Options
  3310. ) PURE;
  3311. // Gets and sets control values for
  3312. // handling system error events.
  3313. // If the system error level is less
  3314. // than or equal to the given levels
  3315. // the error may be displayed and
  3316. // the default break for the event
  3317. // may be set.
  3318. STDMETHOD(GetSystemErrorControl)(
  3319. THIS_
  3320. OUT PULONG OutputLevel,
  3321. OUT PULONG BreakLevel
  3322. ) PURE;
  3323. STDMETHOD(SetSystemErrorControl)(
  3324. THIS_
  3325. IN ULONG OutputLevel,
  3326. IN ULONG BreakLevel
  3327. ) PURE;
  3328. // The command processor supports simple
  3329. // string replacement macros in Evaluate and
  3330. // Execute. There are currently ten macro
  3331. // slots available. Slots 0-9 map to
  3332. // the command invocations $u0-$u9.
  3333. STDMETHOD(GetTextMacro)(
  3334. THIS_
  3335. IN ULONG Slot,
  3336. OUT OPTIONAL PSTR Buffer,
  3337. IN ULONG BufferSize,
  3338. OUT OPTIONAL PULONG MacroSize
  3339. ) PURE;
  3340. STDMETHOD(SetTextMacro)(
  3341. THIS_
  3342. IN ULONG Slot,
  3343. IN PCSTR Macro
  3344. ) PURE;
  3345. // Controls the default number radix used
  3346. // in expressions and commands.
  3347. STDMETHOD(GetRadix)(
  3348. THIS_
  3349. OUT PULONG Radix
  3350. ) PURE;
  3351. STDMETHOD(SetRadix)(
  3352. THIS_
  3353. IN ULONG Radix
  3354. ) PURE;
  3355. // Evaluates the given expression string and
  3356. // returns the resulting value.
  3357. // If DesiredType is DEBUG_VALUE_INVALID then
  3358. // the natural type is used.
  3359. // RemainderIndex, if provided, is set to the index
  3360. // of the first character in the input string that was
  3361. // not used when evaluating the expression.
  3362. STDMETHOD(Evaluate)(
  3363. THIS_
  3364. IN PCSTR Expression,
  3365. IN ULONG DesiredType,
  3366. OUT PDEBUG_VALUE Value,
  3367. OUT OPTIONAL PULONG RemainderIndex
  3368. ) PURE;
  3369. // Attempts to convert the input value to a value
  3370. // of the requested type in the output value.
  3371. // Conversions can fail if no conversion exists.
  3372. // Successful conversions may be lossy.
  3373. STDMETHOD(CoerceValue)(
  3374. THIS_
  3375. IN PDEBUG_VALUE In,
  3376. IN ULONG OutType,
  3377. OUT PDEBUG_VALUE Out
  3378. ) PURE;
  3379. STDMETHOD(CoerceValues)(
  3380. THIS_
  3381. IN ULONG Count,
  3382. IN /* size_is(Count) */ PDEBUG_VALUE In,
  3383. IN /* size_is(Count) */ PULONG OutTypes,
  3384. OUT /* size_is(Count) */ PDEBUG_VALUE Out
  3385. ) PURE;
  3386. // Executes the given command string.
  3387. // If the string has multiple commands
  3388. // Execute will not return until all
  3389. // of them have been executed. If this
  3390. // requires waiting for the debuggee to
  3391. // execute an internal wait will be done
  3392. // so Execute can take an arbitrary amount
  3393. // of time.
  3394. STDMETHOD(Execute)(
  3395. THIS_
  3396. IN ULONG OutputControl,
  3397. IN PCSTR Command,
  3398. IN ULONG Flags
  3399. ) PURE;
  3400. // Executes the given command file by
  3401. // reading a line at a time and processing
  3402. // it with Execute.
  3403. STDMETHOD(ExecuteCommandFile)(
  3404. THIS_
  3405. IN ULONG OutputControl,
  3406. IN PCSTR CommandFile,
  3407. IN ULONG Flags
  3408. ) PURE;
  3409. // Breakpoint interfaces are described
  3410. // elsewhere in this section.
  3411. STDMETHOD(GetNumberBreakpoints)(
  3412. THIS_
  3413. OUT PULONG Number
  3414. ) PURE;
  3415. // It is possible for this retrieval function to
  3416. // fail even with an index within the number of
  3417. // existing breakpoints if the breakpoint is
  3418. // a private breakpoint.
  3419. STDMETHOD(GetBreakpointByIndex)(
  3420. THIS_
  3421. IN ULONG Index,
  3422. OUT PDEBUG_BREAKPOINT* Bp
  3423. ) PURE;
  3424. STDMETHOD(GetBreakpointById)(
  3425. THIS_
  3426. IN ULONG Id,
  3427. OUT PDEBUG_BREAKPOINT* Bp
  3428. ) PURE;
  3429. // If Ids is non-NULL the Count breakpoints
  3430. // referred to in the Ids array are returned,
  3431. // otherwise breakpoints from index Start to
  3432. // Start + Count 1 are returned.
  3433. STDMETHOD(GetBreakpointParameters)(
  3434. THIS_
  3435. IN ULONG Count,
  3436. IN OPTIONAL /* size_is(Count) */ PULONG Ids,
  3437. IN ULONG Start,
  3438. OUT /* size_is(Count) */ PDEBUG_BREAKPOINT_PARAMETERS Params
  3439. ) PURE;
  3440. // Breakpoints are created empty and disabled.
  3441. // When their parameters have been set they
  3442. // should be enabled by setting the ENABLE flag.
  3443. // If DesiredId is DEBUG_ANY_ID then the
  3444. // engine picks an unused ID. If DesiredId
  3445. // is any other number the engine attempts
  3446. // to use the given ID for the breakpoint.
  3447. // If another breakpoint exists with that ID
  3448. // the call will fail.
  3449. STDMETHOD(AddBreakpoint)(
  3450. THIS_
  3451. IN ULONG Type,
  3452. IN ULONG DesiredId,
  3453. OUT PDEBUG_BREAKPOINT* Bp
  3454. ) PURE;
  3455. // Breakpoint interface is invalid after this call.
  3456. STDMETHOD(RemoveBreakpoint)(
  3457. THIS_
  3458. IN PDEBUG_BREAKPOINT Bp
  3459. ) PURE;
  3460. // Control and use extension DLLs.
  3461. STDMETHOD(AddExtension)(
  3462. THIS_
  3463. IN PCSTR Path,
  3464. IN ULONG Flags,
  3465. OUT PULONG64 Handle
  3466. ) PURE;
  3467. STDMETHOD(RemoveExtension)(
  3468. THIS_
  3469. IN ULONG64 Handle
  3470. ) PURE;
  3471. STDMETHOD(GetExtensionByPath)(
  3472. THIS_
  3473. IN PCSTR Path,
  3474. OUT PULONG64 Handle
  3475. ) PURE;
  3476. // If Handle is zero the extension
  3477. // chain is walked searching for the
  3478. // function.
  3479. STDMETHOD(CallExtension)(
  3480. THIS_
  3481. IN ULONG64 Handle,
  3482. IN PCSTR Function,
  3483. IN OPTIONAL PCSTR Arguments
  3484. ) PURE;
  3485. // GetExtensionFunction works like
  3486. // GetProcAddress on extension DLLs
  3487. // to allow raw function-call-level
  3488. // interaction with extension DLLs.
  3489. // Such functions do not need to
  3490. // follow the standard extension prototype
  3491. // if they are not going to be called
  3492. // through the text extension interface.
  3493. // _EFN_ is automatically prepended to
  3494. // the name string given.
  3495. // This function cannot be called remotely.
  3496. STDMETHOD(GetExtensionFunction)(
  3497. THIS_
  3498. IN ULONG64 Handle,
  3499. IN PCSTR FuncName,
  3500. OUT FARPROC* Function
  3501. ) PURE;
  3502. // These methods return alternate
  3503. // extension interfaces in order to allow
  3504. // interface-style extension DLLs to mix in
  3505. // older extension calls.
  3506. // Structure sizes must be initialized before
  3507. // the call.
  3508. // These methods cannot be called remotely.
  3509. STDMETHOD(GetWindbgExtensionApis32)(
  3510. THIS_
  3511. IN OUT PWINDBG_EXTENSION_APIS32 Api
  3512. ) PURE;
  3513. STDMETHOD(GetWindbgExtensionApis64)(
  3514. THIS_
  3515. IN OUT PWINDBG_EXTENSION_APIS64 Api
  3516. ) PURE;
  3517. // The engine provides a simple mechanism
  3518. // to filter common events. Arbitrarily complicated
  3519. // filtering can be done by registering event callbacks
  3520. // but simple event filtering only requires
  3521. // setting the options of one of the predefined
  3522. // event filters.
  3523. // Simple event filters are either for specific
  3524. // events and therefore have an enumerant or
  3525. // they are for an exception and are based on
  3526. // the exceptions code. Exception filters
  3527. // are further divided into exceptions specially
  3528. // handled by the engine, which is a fixed set,
  3529. // and arbitrary exceptions.
  3530. // All three groups of filters are indexed together
  3531. // with the specific filters first, then the specific
  3532. // exception filters and finally the arbitrary
  3533. // exception filters.
  3534. // The first specific exception is the default
  3535. // exception. If an exception event occurs for
  3536. // an exception without settings the default
  3537. // exception settings are used.
  3538. STDMETHOD(GetNumberEventFilters)(
  3539. THIS_
  3540. OUT PULONG SpecificEvents,
  3541. OUT PULONG SpecificExceptions,
  3542. OUT PULONG ArbitraryExceptions
  3543. ) PURE;
  3544. // Some filters have descriptive text associated with them.
  3545. STDMETHOD(GetEventFilterText)(
  3546. THIS_
  3547. IN ULONG Index,
  3548. OUT OPTIONAL PSTR Buffer,
  3549. IN ULONG BufferSize,
  3550. OUT OPTIONAL PULONG TextSize
  3551. ) PURE;
  3552. // All filters support executing a command when the
  3553. // event occurs.
  3554. STDMETHOD(GetEventFilterCommand)(
  3555. THIS_
  3556. IN ULONG Index,
  3557. OUT OPTIONAL PSTR Buffer,
  3558. IN ULONG BufferSize,
  3559. OUT OPTIONAL PULONG CommandSize
  3560. ) PURE;
  3561. STDMETHOD(SetEventFilterCommand)(
  3562. THIS_
  3563. IN ULONG Index,
  3564. IN PCSTR Command
  3565. ) PURE;
  3566. STDMETHOD(GetSpecificFilterParameters)(
  3567. THIS_
  3568. IN ULONG Start,
  3569. IN ULONG Count,
  3570. OUT /* size_is(Count) */ PDEBUG_SPECIFIC_FILTER_PARAMETERS Params
  3571. ) PURE;
  3572. STDMETHOD(SetSpecificFilterParameters)(
  3573. THIS_
  3574. IN ULONG Start,
  3575. IN ULONG Count,
  3576. IN /* size_is(Count) */ PDEBUG_SPECIFIC_FILTER_PARAMETERS Params
  3577. ) PURE;
  3578. // Some specific filters have arguments to further
  3579. // qualify their operation.
  3580. STDMETHOD(GetSpecificFilterArgument)(
  3581. THIS_
  3582. IN ULONG Index,
  3583. OUT OPTIONAL PSTR Buffer,
  3584. IN ULONG BufferSize,
  3585. OUT OPTIONAL PULONG ArgumentSize
  3586. ) PURE;
  3587. STDMETHOD(SetSpecificFilterArgument)(
  3588. THIS_
  3589. IN ULONG Index,
  3590. IN PCSTR Argument
  3591. ) PURE;
  3592. // If Codes is non-NULL Start is ignored.
  3593. STDMETHOD(GetExceptionFilterParameters)(
  3594. THIS_
  3595. IN ULONG Count,
  3596. IN OPTIONAL /* size_is(Count) */ PULONG Codes,
  3597. IN ULONG Start,
  3598. OUT /* size_is(Count) */ PDEBUG_EXCEPTION_FILTER_PARAMETERS Params
  3599. ) PURE;
  3600. // The codes in the parameter data control the application
  3601. // of the parameter data. If a code is not already in
  3602. // the set of filters it is added. If the ExecutionOption
  3603. // for a code is REMOVE then the filter is removed.
  3604. // Specific exception filters cannot be removed.
  3605. STDMETHOD(SetExceptionFilterParameters)(
  3606. THIS_
  3607. IN ULONG Count,
  3608. IN /* size_is(Count) */ PDEBUG_EXCEPTION_FILTER_PARAMETERS Params
  3609. ) PURE;
  3610. // Exception filters support an additional command for
  3611. // second-chance events.
  3612. STDMETHOD(GetExceptionFilterSecondCommand)(
  3613. THIS_
  3614. IN ULONG Index,
  3615. OUT OPTIONAL PSTR Buffer,
  3616. IN ULONG BufferSize,
  3617. OUT OPTIONAL PULONG CommandSize
  3618. ) PURE;
  3619. STDMETHOD(SetExceptionFilterSecondCommand)(
  3620. THIS_
  3621. IN ULONG Index,
  3622. IN PCSTR Command
  3623. ) PURE;
  3624. // Yields processing to the engine until
  3625. // an event occurs. This method may
  3626. // only be called by the thread that started
  3627. // the debug session.
  3628. // When an event occurs the engine carries
  3629. // out all event processing such as calling
  3630. // callbacks.
  3631. // If the callbacks indicate that execution should
  3632. // break the wait will return, otherwise it
  3633. // goes back to waiting for a new event.
  3634. // If the timeout expires, S_FALSE is returned.
  3635. // The timeout is not currently supported for
  3636. // kernel debugging.
  3637. STDMETHOD(WaitForEvent)(
  3638. THIS_
  3639. IN ULONG Flags,
  3640. IN ULONG Timeout
  3641. ) PURE;
  3642. // Retrieves information about the last event that occurred.
  3643. // EventType is one of the event callback mask bits.
  3644. // ExtraInformation contains additional event-specific
  3645. // information. Not all events have additional information.
  3646. STDMETHOD(GetLastEventInformation)(
  3647. THIS_
  3648. OUT PULONG Type,
  3649. OUT PULONG ProcessId,
  3650. OUT PULONG ThreadId,
  3651. OUT OPTIONAL PVOID ExtraInformation,
  3652. IN ULONG ExtraInformationSize,
  3653. OUT OPTIONAL PULONG ExtraInformationUsed,
  3654. OUT OPTIONAL PSTR Description,
  3655. IN ULONG DescriptionSize,
  3656. OUT OPTIONAL PULONG DescriptionUsed
  3657. ) PURE;
  3658. };
  3659. // OutputTextReplacements flags.
  3660. #define DEBUG_OUT_TEXT_REPL_DEFAULT 0x00000000
  3661. #undef INTERFACE
  3662. #define INTERFACE IDebugControl2
  3663. DECLARE_INTERFACE_(IDebugControl2, IUnknown)
  3664. {
  3665. // IUnknown.
  3666. STDMETHOD(QueryInterface)(
  3667. THIS_
  3668. IN REFIID InterfaceId,
  3669. OUT PVOID* Interface
  3670. ) PURE;
  3671. STDMETHOD_(ULONG, AddRef)(
  3672. THIS
  3673. ) PURE;
  3674. STDMETHOD_(ULONG, Release)(
  3675. THIS
  3676. ) PURE;
  3677. // IDebugControl.
  3678. // Checks for a user interrupt, such a Ctrl-C
  3679. // or stop button.
  3680. // This method is reentrant.
  3681. STDMETHOD(GetInterrupt)(
  3682. THIS
  3683. ) PURE;
  3684. // Registers a user interrupt.
  3685. // This method is reentrant.
  3686. STDMETHOD(SetInterrupt)(
  3687. THIS_
  3688. IN ULONG Flags
  3689. ) PURE;
  3690. // Interrupting a user-mode process requires
  3691. // access to some system resources that the
  3692. // process may hold itself, preventing the
  3693. // interrupt from occurring. The engine
  3694. // will time-out pending interrupt requests
  3695. // and simulate an interrupt if necessary.
  3696. // These methods control the interrupt timeout.
  3697. STDMETHOD(GetInterruptTimeout)(
  3698. THIS_
  3699. OUT PULONG Seconds
  3700. ) PURE;
  3701. STDMETHOD(SetInterruptTimeout)(
  3702. THIS_
  3703. IN ULONG Seconds
  3704. ) PURE;
  3705. STDMETHOD(GetLogFile)(
  3706. THIS_
  3707. OUT OPTIONAL PSTR Buffer,
  3708. IN ULONG BufferSize,
  3709. OUT OPTIONAL PULONG FileSize,
  3710. OUT PBOOL Append
  3711. ) PURE;
  3712. // Opens a log file which collects all
  3713. // output. Output from every client except
  3714. // those that explicitly disable logging
  3715. // goes into the log.
  3716. // Opening a log file closes any log file
  3717. // already open.
  3718. STDMETHOD(OpenLogFile)(
  3719. THIS_
  3720. IN PCSTR File,
  3721. IN BOOL Append
  3722. ) PURE;
  3723. STDMETHOD(CloseLogFile)(
  3724. THIS
  3725. ) PURE;
  3726. // Controls what output is logged.
  3727. STDMETHOD(GetLogMask)(
  3728. THIS_
  3729. OUT PULONG Mask
  3730. ) PURE;
  3731. STDMETHOD(SetLogMask)(
  3732. THIS_
  3733. IN ULONG Mask
  3734. ) PURE;
  3735. // Input requests input from all clients.
  3736. // The first input that is returned is used
  3737. // to satisfy the call. Other returned
  3738. // input is discarded.
  3739. STDMETHOD(Input)(
  3740. THIS_
  3741. OUT PSTR Buffer,
  3742. IN ULONG BufferSize,
  3743. OUT OPTIONAL PULONG InputSize
  3744. ) PURE;
  3745. // This method is used by clients to return
  3746. // input when it is available. It will
  3747. // return S_OK if the input is used to
  3748. // satisfy an Input call and S_FALSE if
  3749. // the input is ignored.
  3750. // This method is reentrant.
  3751. STDMETHOD(ReturnInput)(
  3752. THIS_
  3753. IN PCSTR Buffer
  3754. ) PURE;
  3755. // Sends output through clients
  3756. // output callbacks if the mask is allowed
  3757. // by the current output control mask and
  3758. // according to the output distribution
  3759. // settings.
  3760. STDMETHODV(Output)(
  3761. THIS_
  3762. IN ULONG Mask,
  3763. IN PCSTR Format,
  3764. ...
  3765. ) PURE;
  3766. STDMETHOD(OutputVaList)(
  3767. THIS_
  3768. IN ULONG Mask,
  3769. IN PCSTR Format,
  3770. IN va_list Args
  3771. ) PURE;
  3772. // The following methods allow direct control
  3773. // over the distribution of the given output
  3774. // for situations where something other than
  3775. // the default is desired. These methods require
  3776. // extra work in the engine so they should
  3777. // only be used when necessary.
  3778. STDMETHODV(ControlledOutput)(
  3779. THIS_
  3780. IN ULONG OutputControl,
  3781. IN ULONG Mask,
  3782. IN PCSTR Format,
  3783. ...
  3784. ) PURE;
  3785. STDMETHOD(ControlledOutputVaList)(
  3786. THIS_
  3787. IN ULONG OutputControl,
  3788. IN ULONG Mask,
  3789. IN PCSTR Format,
  3790. IN va_list Args
  3791. ) PURE;
  3792. // Displays the standard command-line prompt
  3793. // followed by the given output. If Format
  3794. // is NULL no additional output is produced.
  3795. // Output is produced under the
  3796. // DEBUG_OUTPUT_PROMPT mask.
  3797. // This method only outputs the prompt; it
  3798. // does not get input.
  3799. STDMETHODV(OutputPrompt)(
  3800. THIS_
  3801. IN ULONG OutputControl,
  3802. IN OPTIONAL PCSTR Format,
  3803. ...
  3804. ) PURE;
  3805. STDMETHOD(OutputPromptVaList)(
  3806. THIS_
  3807. IN ULONG OutputControl,
  3808. IN OPTIONAL PCSTR Format,
  3809. IN va_list Args
  3810. ) PURE;
  3811. // Gets the text that would be displayed by OutputPrompt.
  3812. STDMETHOD(GetPromptText)(
  3813. THIS_
  3814. OUT OPTIONAL PSTR Buffer,
  3815. IN ULONG BufferSize,
  3816. OUT OPTIONAL PULONG TextSize
  3817. ) PURE;
  3818. // Outputs information about the current
  3819. // debuggee state such as a register
  3820. // summary, disassembly at the current PC,
  3821. // closest symbol and others.
  3822. // Uses the line prefix.
  3823. STDMETHOD(OutputCurrentState)(
  3824. THIS_
  3825. IN ULONG OutputControl,
  3826. IN ULONG Flags
  3827. ) PURE;
  3828. // Outputs the debugger and extension version
  3829. // information. This method is reentrant.
  3830. // Uses the line prefix.
  3831. STDMETHOD(OutputVersionInformation)(
  3832. THIS_
  3833. IN ULONG OutputControl
  3834. ) PURE;
  3835. // In user-mode debugging sessions the
  3836. // engine will set an event when
  3837. // exceptions are continued. This can
  3838. // be used to synchronize other processes
  3839. // with the debuggers handling of events.
  3840. // For example, this is used to support
  3841. // the e argument to ntsd.
  3842. STDMETHOD(GetNotifyEventHandle)(
  3843. THIS_
  3844. OUT PULONG64 Handle
  3845. ) PURE;
  3846. STDMETHOD(SetNotifyEventHandle)(
  3847. THIS_
  3848. IN ULONG64 Handle
  3849. ) PURE;
  3850. STDMETHOD(Assemble)(
  3851. THIS_
  3852. IN ULONG64 Offset,
  3853. IN PCSTR Instr,
  3854. OUT PULONG64 EndOffset
  3855. ) PURE;
  3856. STDMETHOD(Disassemble)(
  3857. THIS_
  3858. IN ULONG64 Offset,
  3859. IN ULONG Flags,
  3860. OUT OPTIONAL PSTR Buffer,
  3861. IN ULONG BufferSize,
  3862. OUT OPTIONAL PULONG DisassemblySize,
  3863. OUT PULONG64 EndOffset
  3864. ) PURE;
  3865. // Returns the value of the effective address
  3866. // computed for the last Disassemble, if there
  3867. // was one.
  3868. STDMETHOD(GetDisassembleEffectiveOffset)(
  3869. THIS_
  3870. OUT PULONG64 Offset
  3871. ) PURE;
  3872. // Uses the line prefix if necessary.
  3873. STDMETHOD(OutputDisassembly)(
  3874. THIS_
  3875. IN ULONG OutputControl,
  3876. IN ULONG64 Offset,
  3877. IN ULONG Flags,
  3878. OUT PULONG64 EndOffset
  3879. ) PURE;
  3880. // Produces multiple lines of disassembly output.
  3881. // There will be PreviousLines of disassembly before
  3882. // the given offset if a valid disassembly exists.
  3883. // In all, there will be TotalLines of output produced.
  3884. // The first and last line offsets are returned
  3885. // specially and all lines offsets can be retrieved
  3886. // through LineOffsets. LineOffsets will contain
  3887. // offsets for each line where disassembly started.
  3888. // When disassembly of a single instruction takes
  3889. // multiple lines the initial offset will be followed
  3890. // by DEBUG_INVALID_OFFSET.
  3891. // Uses the line prefix.
  3892. STDMETHOD(OutputDisassemblyLines)(
  3893. THIS_
  3894. IN ULONG OutputControl,
  3895. IN ULONG PreviousLines,
  3896. IN ULONG TotalLines,
  3897. IN ULONG64 Offset,
  3898. IN ULONG Flags,
  3899. OUT OPTIONAL PULONG OffsetLine,
  3900. OUT OPTIONAL PULONG64 StartOffset,
  3901. OUT OPTIONAL PULONG64 EndOffset,
  3902. OUT OPTIONAL /* size_is(TotalLines) */ PULONG64 LineOffsets
  3903. ) PURE;
  3904. // Returns the offset of the start of
  3905. // the instruction thats the given
  3906. // delta away from the instruction
  3907. // at the initial offset.
  3908. // This routine does not check for
  3909. // validity of the instruction or
  3910. // the memory containing it.
  3911. STDMETHOD(GetNearInstruction)(
  3912. THIS_
  3913. IN ULONG64 Offset,
  3914. IN LONG Delta,
  3915. OUT PULONG64 NearOffset
  3916. ) PURE;
  3917. // Offsets can be passed in as zero to use the current
  3918. // thread state.
  3919. STDMETHOD(GetStackTrace)(
  3920. THIS_
  3921. IN ULONG64 FrameOffset,
  3922. IN ULONG64 StackOffset,
  3923. IN ULONG64 InstructionOffset,
  3924. OUT /* size_is(FramesSize) */ PDEBUG_STACK_FRAME Frames,
  3925. IN ULONG FramesSize,
  3926. OUT OPTIONAL PULONG FramesFilled
  3927. ) PURE;
  3928. // Does a simple stack trace to determine
  3929. // what the current return address is.
  3930. STDMETHOD(GetReturnOffset)(
  3931. THIS_
  3932. OUT PULONG64 Offset
  3933. ) PURE;
  3934. // If Frames is NULL OutputStackTrace will
  3935. // use GetStackTrace to get FramesSize frames
  3936. // and then output them. The current register
  3937. // values for frame, stack and instruction offsets
  3938. // are used.
  3939. // Uses the line prefix.
  3940. STDMETHOD(OutputStackTrace)(
  3941. THIS_
  3942. IN ULONG OutputControl,
  3943. IN OPTIONAL /* size_is(FramesSize) */ PDEBUG_STACK_FRAME Frames,
  3944. IN ULONG FramesSize,
  3945. IN ULONG Flags
  3946. ) PURE;
  3947. // Returns information about the debuggee such
  3948. // as user vs. kernel, dump vs. live, etc.
  3949. STDMETHOD(GetDebuggeeType)(
  3950. THIS_
  3951. OUT PULONG Class,
  3952. OUT PULONG Qualifier
  3953. ) PURE;
  3954. // Returns the type of physical processors in
  3955. // the machine.
  3956. // Returns one of the IMAGE_FILE_MACHINE values.
  3957. STDMETHOD(GetActualProcessorType)(
  3958. THIS_
  3959. OUT PULONG Type
  3960. ) PURE;
  3961. // Returns the type of processor used in the
  3962. // current processor context.
  3963. STDMETHOD(GetExecutingProcessorType)(
  3964. THIS_
  3965. OUT PULONG Type
  3966. ) PURE;
  3967. // Query all the possible processor types that
  3968. // may be encountered during this debug session.
  3969. STDMETHOD(GetNumberPossibleExecutingProcessorTypes)(
  3970. THIS_
  3971. OUT PULONG Number
  3972. ) PURE;
  3973. STDMETHOD(GetPossibleExecutingProcessorTypes)(
  3974. THIS_
  3975. IN ULONG Start,
  3976. IN ULONG Count,
  3977. OUT /* size_is(Count) */ PULONG Types
  3978. ) PURE;
  3979. // Get the number of actual processors in
  3980. // the machine.
  3981. STDMETHOD(GetNumberProcessors)(
  3982. THIS_
  3983. OUT PULONG Number
  3984. ) PURE;
  3985. // PlatformId is one of the VER_PLATFORM values.
  3986. // Major and minor are as given in the NT
  3987. // kernel debugger protocol.
  3988. // ServicePackString and ServicePackNumber indicate the
  3989. // system service pack level. ServicePackNumber is not
  3990. // available in some sessions where the service pack level
  3991. // is only expressed as a string. The service pack information
  3992. // will be empty if the system does not have a service pack
  3993. // applied.
  3994. // The build string is string information identifying the
  3995. // particular build of the system. The build string is
  3996. // empty if the system has no particular identifying
  3997. // information.
  3998. STDMETHOD(GetSystemVersion)(
  3999. THIS_
  4000. OUT PULONG PlatformId,
  4001. OUT PULONG Major,
  4002. OUT PULONG Minor,
  4003. OUT OPTIONAL PSTR ServicePackString,
  4004. IN ULONG ServicePackStringSize,
  4005. OUT OPTIONAL PULONG ServicePackStringUsed,
  4006. OUT PULONG ServicePackNumber,
  4007. OUT OPTIONAL PSTR BuildString,
  4008. IN ULONG BuildStringSize,
  4009. OUT OPTIONAL PULONG BuildStringUsed
  4010. ) PURE;
  4011. // Returns the page size for the currently executing
  4012. // processor context. The page size may vary between
  4013. // processor types.
  4014. STDMETHOD(GetPageSize)(
  4015. THIS_
  4016. OUT PULONG Size
  4017. ) PURE;
  4018. // Returns S_OK if the current processor context uses
  4019. // 64-bit addresses, otherwise S_FALSE.
  4020. STDMETHOD(IsPointer64Bit)(
  4021. THIS
  4022. ) PURE;
  4023. // Reads the bugcheck data area and returns the
  4024. // current contents. This method only works
  4025. // in kernel debugging sessions.
  4026. STDMETHOD(ReadBugCheckData)(
  4027. THIS_
  4028. OUT PULONG Code,
  4029. OUT PULONG64 Arg1,
  4030. OUT PULONG64 Arg2,
  4031. OUT PULONG64 Arg3,
  4032. OUT PULONG64 Arg4
  4033. ) PURE;
  4034. // Query all the processor types supported by
  4035. // the engine. This is a complete list and is
  4036. // not related to the machine running the engine
  4037. // or the debuggee.
  4038. STDMETHOD(GetNumberSupportedProcessorTypes)(
  4039. THIS_
  4040. OUT PULONG Number
  4041. ) PURE;
  4042. STDMETHOD(GetSupportedProcessorTypes)(
  4043. THIS_
  4044. IN ULONG Start,
  4045. IN ULONG Count,
  4046. OUT /* size_is(Count) */ PULONG Types
  4047. ) PURE;
  4048. // Returns a full, descriptive name and an
  4049. // abbreviated name for a processor type.
  4050. STDMETHOD(GetProcessorTypeNames)(
  4051. THIS_
  4052. IN ULONG Type,
  4053. OUT OPTIONAL PSTR FullNameBuffer,
  4054. IN ULONG FullNameBufferSize,
  4055. OUT OPTIONAL PULONG FullNameSize,
  4056. OUT OPTIONAL PSTR AbbrevNameBuffer,
  4057. IN ULONG AbbrevNameBufferSize,
  4058. OUT OPTIONAL PULONG AbbrevNameSize
  4059. ) PURE;
  4060. // Gets and sets the type of processor to
  4061. // use when doing things like setting
  4062. // breakpoints, accessing registers,
  4063. // getting stack traces and so on.
  4064. STDMETHOD(GetEffectiveProcessorType)(
  4065. THIS_
  4066. OUT PULONG Type
  4067. ) PURE;
  4068. STDMETHOD(SetEffectiveProcessorType)(
  4069. THIS_
  4070. IN ULONG Type
  4071. ) PURE;
  4072. // Returns information about whether and how
  4073. // the debuggee is running. Status will
  4074. // be GO if the debuggee is running and
  4075. // BREAK if it isnt.
  4076. // If no debuggee exists the status is
  4077. // NO_DEBUGGEE.
  4078. // This method is reentrant.
  4079. STDMETHOD(GetExecutionStatus)(
  4080. THIS_
  4081. OUT PULONG Status
  4082. ) PURE;
  4083. // Changes the execution status of the
  4084. // engine from stopped to running.
  4085. // Status must be one of the go or step
  4086. // status values.
  4087. STDMETHOD(SetExecutionStatus)(
  4088. THIS_
  4089. IN ULONG Status
  4090. ) PURE;
  4091. // Controls what code interpretation level the debugger
  4092. // runs at. The debugger checks the code level when
  4093. // deciding whether to step by a source line or
  4094. // assembly instruction along with other related operations.
  4095. STDMETHOD(GetCodeLevel)(
  4096. THIS_
  4097. OUT PULONG Level
  4098. ) PURE;
  4099. STDMETHOD(SetCodeLevel)(
  4100. THIS_
  4101. IN ULONG Level
  4102. ) PURE;
  4103. // Gets and sets engine control flags.
  4104. // These methods are reentrant.
  4105. STDMETHOD(GetEngineOptions)(
  4106. THIS_
  4107. OUT PULONG Options
  4108. ) PURE;
  4109. STDMETHOD(AddEngineOptions)(
  4110. THIS_
  4111. IN ULONG Options
  4112. ) PURE;
  4113. STDMETHOD(RemoveEngineOptions)(
  4114. THIS_
  4115. IN ULONG Options
  4116. ) PURE;
  4117. STDMETHOD(SetEngineOptions)(
  4118. THIS_
  4119. IN ULONG Options
  4120. ) PURE;
  4121. // Gets and sets control values for
  4122. // handling system error events.
  4123. // If the system error level is less
  4124. // than or equal to the given levels
  4125. // the error may be displayed and
  4126. // the default break for the event
  4127. // may be set.
  4128. STDMETHOD(GetSystemErrorControl)(
  4129. THIS_
  4130. OUT PULONG OutputLevel,
  4131. OUT PULONG BreakLevel
  4132. ) PURE;
  4133. STDMETHOD(SetSystemErrorControl)(
  4134. THIS_
  4135. IN ULONG OutputLevel,
  4136. IN ULONG BreakLevel
  4137. ) PURE;
  4138. // The command processor supports simple
  4139. // string replacement macros in Evaluate and
  4140. // Execute. There are currently ten macro
  4141. // slots available. Slots 0-9 map to
  4142. // the command invocations $u0-$u9.
  4143. STDMETHOD(GetTextMacro)(
  4144. THIS_
  4145. IN ULONG Slot,
  4146. OUT OPTIONAL PSTR Buffer,
  4147. IN ULONG BufferSize,
  4148. OUT OPTIONAL PULONG MacroSize
  4149. ) PURE;
  4150. STDMETHOD(SetTextMacro)(
  4151. THIS_
  4152. IN ULONG Slot,
  4153. IN PCSTR Macro
  4154. ) PURE;
  4155. // Controls the default number radix used
  4156. // in expressions and commands.
  4157. STDMETHOD(GetRadix)(
  4158. THIS_
  4159. OUT PULONG Radix
  4160. ) PURE;
  4161. STDMETHOD(SetRadix)(
  4162. THIS_
  4163. IN ULONG Radix
  4164. ) PURE;
  4165. // Evaluates the given expression string and
  4166. // returns the resulting value.
  4167. // If DesiredType is DEBUG_VALUE_INVALID then
  4168. // the natural type is used.
  4169. // RemainderIndex, if provided, is set to the index
  4170. // of the first character in the input string that was
  4171. // not used when evaluating the expression.
  4172. STDMETHOD(Evaluate)(
  4173. THIS_
  4174. IN PCSTR Expression,
  4175. IN ULONG DesiredType,
  4176. OUT PDEBUG_VALUE Value,
  4177. OUT OPTIONAL PULONG RemainderIndex
  4178. ) PURE;
  4179. // Attempts to convert the input value to a value
  4180. // of the requested type in the output value.
  4181. // Conversions can fail if no conversion exists.
  4182. // Successful conversions may be lossy.
  4183. STDMETHOD(CoerceValue)(
  4184. THIS_
  4185. IN PDEBUG_VALUE In,
  4186. IN ULONG OutType,
  4187. OUT PDEBUG_VALUE Out
  4188. ) PURE;
  4189. STDMETHOD(CoerceValues)(
  4190. THIS_
  4191. IN ULONG Count,
  4192. IN /* size_is(Count) */ PDEBUG_VALUE In,
  4193. IN /* size_is(Count) */ PULONG OutTypes,
  4194. OUT /* size_is(Count) */ PDEBUG_VALUE Out
  4195. ) PURE;
  4196. // Executes the given command string.
  4197. // If the string has multiple commands
  4198. // Execute will not return until all
  4199. // of them have been executed. If this
  4200. // requires waiting for the debuggee to
  4201. // execute an internal wait will be done
  4202. // so Execute can take an arbitrary amount
  4203. // of time.
  4204. STDMETHOD(Execute)(
  4205. THIS_
  4206. IN ULONG OutputControl,
  4207. IN PCSTR Command,
  4208. IN ULONG Flags
  4209. ) PURE;
  4210. // Executes the given command file by
  4211. // reading a line at a time and processing
  4212. // it with Execute.
  4213. STDMETHOD(ExecuteCommandFile)(
  4214. THIS_
  4215. IN ULONG OutputControl,
  4216. IN PCSTR CommandFile,
  4217. IN ULONG Flags
  4218. ) PURE;
  4219. // Breakpoint interfaces are described
  4220. // elsewhere in this section.
  4221. STDMETHOD(GetNumberBreakpoints)(
  4222. THIS_
  4223. OUT PULONG Number
  4224. ) PURE;
  4225. // It is possible for this retrieval function to
  4226. // fail even with an index within the number of
  4227. // existing breakpoints if the breakpoint is
  4228. // a private breakpoint.
  4229. STDMETHOD(GetBreakpointByIndex)(
  4230. THIS_
  4231. IN ULONG Index,
  4232. OUT PDEBUG_BREAKPOINT* Bp
  4233. ) PURE;
  4234. STDMETHOD(GetBreakpointById)(
  4235. THIS_
  4236. IN ULONG Id,
  4237. OUT PDEBUG_BREAKPOINT* Bp
  4238. ) PURE;
  4239. // If Ids is non-NULL the Count breakpoints
  4240. // referred to in the Ids array are returned,
  4241. // otherwise breakpoints from index Start to
  4242. // Start + Count 1 are returned.
  4243. STDMETHOD(GetBreakpointParameters)(
  4244. THIS_
  4245. IN ULONG Count,
  4246. IN OPTIONAL /* size_is(Count) */ PULONG Ids,
  4247. IN ULONG Start,
  4248. OUT /* size_is(Count) */ PDEBUG_BREAKPOINT_PARAMETERS Params
  4249. ) PURE;
  4250. // Breakpoints are created empty and disabled.
  4251. // When their parameters have been set they
  4252. // should be enabled by setting the ENABLE flag.
  4253. // If DesiredId is DEBUG_ANY_ID then the
  4254. // engine picks an unused ID. If DesiredId
  4255. // is any other number the engine attempts
  4256. // to use the given ID for the breakpoint.
  4257. // If another breakpoint exists with that ID
  4258. // the call will fail.
  4259. STDMETHOD(AddBreakpoint)(
  4260. THIS_
  4261. IN ULONG Type,
  4262. IN ULONG DesiredId,
  4263. OUT PDEBUG_BREAKPOINT* Bp
  4264. ) PURE;
  4265. // Breakpoint interface is invalid after this call.
  4266. STDMETHOD(RemoveBreakpoint)(
  4267. THIS_
  4268. IN PDEBUG_BREAKPOINT Bp
  4269. ) PURE;
  4270. // Control and use extension DLLs.
  4271. STDMETHOD(AddExtension)(
  4272. THIS_
  4273. IN PCSTR Path,
  4274. IN ULONG Flags,
  4275. OUT PULONG64 Handle
  4276. ) PURE;
  4277. STDMETHOD(RemoveExtension)(
  4278. THIS_
  4279. IN ULONG64 Handle
  4280. ) PURE;
  4281. STDMETHOD(GetExtensionByPath)(
  4282. THIS_
  4283. IN PCSTR Path,
  4284. OUT PULONG64 Handle
  4285. ) PURE;
  4286. // If Handle is zero the extension
  4287. // chain is walked searching for the
  4288. // function.
  4289. STDMETHOD(CallExtension)(
  4290. THIS_
  4291. IN ULONG64 Handle,
  4292. IN PCSTR Function,
  4293. IN OPTIONAL PCSTR Arguments
  4294. ) PURE;
  4295. // GetExtensionFunction works like
  4296. // GetProcAddress on extension DLLs
  4297. // to allow raw function-call-level
  4298. // interaction with extension DLLs.
  4299. // Such functions do not need to
  4300. // follow the standard extension prototype
  4301. // if they are not going to be called
  4302. // through the text extension interface.
  4303. // This function cannot be called remotely.
  4304. STDMETHOD(GetExtensionFunction)(
  4305. THIS_
  4306. IN ULONG64 Handle,
  4307. IN PCSTR FuncName,
  4308. OUT FARPROC* Function
  4309. ) PURE;
  4310. // These methods return alternate
  4311. // extension interfaces in order to allow
  4312. // interface-style extension DLLs to mix in
  4313. // older extension calls.
  4314. // Structure sizes must be initialized before
  4315. // the call.
  4316. // These methods cannot be called remotely.
  4317. STDMETHOD(GetWindbgExtensionApis32)(
  4318. THIS_
  4319. IN OUT PWINDBG_EXTENSION_APIS32 Api
  4320. ) PURE;
  4321. STDMETHOD(GetWindbgExtensionApis64)(
  4322. THIS_
  4323. IN OUT PWINDBG_EXTENSION_APIS64 Api
  4324. ) PURE;
  4325. // The engine provides a simple mechanism
  4326. // to filter common events. Arbitrarily complicated
  4327. // filtering can be done by registering event callbacks
  4328. // but simple event filtering only requires
  4329. // setting the options of one of the predefined
  4330. // event filters.
  4331. // Simple event filters are either for specific
  4332. // events and therefore have an enumerant or
  4333. // they are for an exception and are based on
  4334. // the exceptions code. Exception filters
  4335. // are further divided into exceptions specially
  4336. // handled by the engine, which is a fixed set,
  4337. // and arbitrary exceptions.
  4338. // All three groups of filters are indexed together
  4339. // with the specific filters first, then the specific
  4340. // exception filters and finally the arbitrary
  4341. // exception filters.
  4342. // The first specific exception is the default
  4343. // exception. If an exception event occurs for
  4344. // an exception without settings the default
  4345. // exception settings are used.
  4346. STDMETHOD(GetNumberEventFilters)(
  4347. THIS_
  4348. OUT PULONG SpecificEvents,
  4349. OUT PULONG SpecificExceptions,
  4350. OUT PULONG ArbitraryExceptions
  4351. ) PURE;
  4352. // Some filters have descriptive text associated with them.
  4353. STDMETHOD(GetEventFilterText)(
  4354. THIS_
  4355. IN ULONG Index,
  4356. OUT OPTIONAL PSTR Buffer,
  4357. IN ULONG BufferSize,
  4358. OUT OPTIONAL PULONG TextSize
  4359. ) PURE;
  4360. // All filters support executing a command when the
  4361. // event occurs.
  4362. STDMETHOD(GetEventFilterCommand)(
  4363. THIS_
  4364. IN ULONG Index,
  4365. OUT OPTIONAL PSTR Buffer,
  4366. IN ULONG BufferSize,
  4367. OUT OPTIONAL PULONG CommandSize
  4368. ) PURE;
  4369. STDMETHOD(SetEventFilterCommand)(
  4370. THIS_
  4371. IN ULONG Index,
  4372. IN PCSTR Command
  4373. ) PURE;
  4374. STDMETHOD(GetSpecificFilterParameters)(
  4375. THIS_
  4376. IN ULONG Start,
  4377. IN ULONG Count,
  4378. OUT /* size_is(Count) */ PDEBUG_SPECIFIC_FILTER_PARAMETERS Params
  4379. ) PURE;
  4380. STDMETHOD(SetSpecificFilterParameters)(
  4381. THIS_
  4382. IN ULONG Start,
  4383. IN ULONG Count,
  4384. IN /* size_is(Count) */ PDEBUG_SPECIFIC_FILTER_PARAMETERS Params
  4385. ) PURE;
  4386. // Some specific filters have arguments to further
  4387. // qualify their operation.
  4388. STDMETHOD(GetSpecificFilterArgument)(
  4389. THIS_
  4390. IN ULONG Index,
  4391. OUT OPTIONAL PSTR Buffer,
  4392. IN ULONG BufferSize,
  4393. OUT OPTIONAL PULONG ArgumentSize
  4394. ) PURE;
  4395. STDMETHOD(SetSpecificFilterArgument)(
  4396. THIS_
  4397. IN ULONG Index,
  4398. IN PCSTR Argument
  4399. ) PURE;
  4400. // If Codes is non-NULL Start is ignored.
  4401. STDMETHOD(GetExceptionFilterParameters)(
  4402. THIS_
  4403. IN ULONG Count,
  4404. IN OPTIONAL /* size_is(Count) */ PULONG Codes,
  4405. IN ULONG Start,
  4406. OUT /* size_is(Count) */ PDEBUG_EXCEPTION_FILTER_PARAMETERS Params
  4407. ) PURE;
  4408. // The codes in the parameter data control the application
  4409. // of the parameter data. If a code is not already in
  4410. // the set of filters it is added. If the ExecutionOption
  4411. // for a code is REMOVE then the filter is removed.
  4412. // Specific exception filters cannot be removed.
  4413. STDMETHOD(SetExceptionFilterParameters)(
  4414. THIS_
  4415. IN ULONG Count,
  4416. IN /* size_is(Count) */ PDEBUG_EXCEPTION_FILTER_PARAMETERS Params
  4417. ) PURE;
  4418. // Exception filters support an additional command for
  4419. // second-chance events.
  4420. STDMETHOD(GetExceptionFilterSecondCommand)(
  4421. THIS_
  4422. IN ULONG Index,
  4423. OUT OPTIONAL PSTR Buffer,
  4424. IN ULONG BufferSize,
  4425. OUT OPTIONAL PULONG CommandSize
  4426. ) PURE;
  4427. STDMETHOD(SetExceptionFilterSecondCommand)(
  4428. THIS_
  4429. IN ULONG Index,
  4430. IN PCSTR Command
  4431. ) PURE;
  4432. // Yields processing to the engine until
  4433. // an event occurs. This method may
  4434. // only be called by the thread that started
  4435. // the debug session.
  4436. // When an event occurs the engine carries
  4437. // out all event processing such as calling
  4438. // callbacks.
  4439. // If the callbacks indicate that execution should
  4440. // break the wait will return, otherwise it
  4441. // goes back to waiting for a new event.
  4442. // If the timeout expires, S_FALSE is returned.
  4443. // The timeout is not currently supported for
  4444. // kernel debugging.
  4445. STDMETHOD(WaitForEvent)(
  4446. THIS_
  4447. IN ULONG Flags,
  4448. IN ULONG Timeout
  4449. ) PURE;
  4450. // Retrieves information about the last event that occurred.
  4451. // EventType is one of the event callback mask bits.
  4452. // ExtraInformation contains additional event-specific
  4453. // information. Not all events have additional information.
  4454. STDMETHOD(GetLastEventInformation)(
  4455. THIS_
  4456. OUT PULONG Type,
  4457. OUT PULONG ProcessId,
  4458. OUT PULONG ThreadId,
  4459. OUT OPTIONAL PVOID ExtraInformation,
  4460. IN ULONG ExtraInformationSize,
  4461. OUT OPTIONAL PULONG ExtraInformationUsed,
  4462. OUT OPTIONAL PSTR Description,
  4463. IN ULONG DescriptionSize,
  4464. OUT OPTIONAL PULONG DescriptionUsed
  4465. ) PURE;
  4466. // IDebugControl2.
  4467. STDMETHOD(GetCurrentTimeDate)(
  4468. THIS_
  4469. OUT PULONG TimeDate
  4470. ) PURE;
  4471. // Retrieves the number of seconds since the
  4472. // machine started running.
  4473. STDMETHOD(GetCurrentSystemUpTime)(
  4474. THIS_
  4475. OUT PULONG UpTime
  4476. ) PURE;
  4477. // If the current session is a dump session,
  4478. // retrieves any extended format information.
  4479. STDMETHOD(GetDumpFormatFlags)(
  4480. THIS_
  4481. OUT PULONG FormatFlags
  4482. ) PURE;
  4483. // The debugger has been enhanced to allow
  4484. // arbitrary text replacements in addition
  4485. // to the simple $u0-$u9 text macros.
  4486. // Text replacement takes a given source
  4487. // text in commands and converts it to the
  4488. // given destination text. Replacements
  4489. // are named by their source text so that
  4490. // only one replacement for a source text
  4491. // string can exist.
  4492. STDMETHOD(GetNumberTextReplacements)(
  4493. THIS_
  4494. OUT PULONG NumRepl
  4495. ) PURE;
  4496. // If SrcText is non-NULL the replacement
  4497. // is looked up by source text, otherwise
  4498. // Index is used to get the Nth replacement.
  4499. STDMETHOD(GetTextReplacement)(
  4500. THIS_
  4501. IN OPTIONAL PCSTR SrcText,
  4502. IN ULONG Index,
  4503. OUT OPTIONAL PSTR SrcBuffer,
  4504. IN ULONG SrcBufferSize,
  4505. OUT OPTIONAL PULONG SrcSize,
  4506. OUT OPTIONAL PSTR DstBuffer,
  4507. IN ULONG DstBufferSize,
  4508. OUT OPTIONAL PULONG DstSize
  4509. ) PURE;
  4510. // Setting the destination text to
  4511. // NULL removes the alias.
  4512. STDMETHOD(SetTextReplacement)(
  4513. THIS_
  4514. IN PCSTR SrcText,
  4515. IN OPTIONAL PCSTR DstText
  4516. ) PURE;
  4517. STDMETHOD(RemoveTextReplacements)(
  4518. THIS
  4519. ) PURE;
  4520. // Outputs the complete list of current
  4521. // replacements.
  4522. STDMETHOD(OutputTextReplacements)(
  4523. THIS_
  4524. IN ULONG OutputControl,
  4525. IN ULONG Flags
  4526. ) PURE;
  4527. };
  4528. //
  4529. // Assembly/disassembly options.
  4530. //
  4531. // The specific effects of these flags varies depending
  4532. // on the particular instruction set.
  4533. //
  4534. #define DEBUG_ASMOPT_DEFAULT 0x00000000
  4535. // Display additional information in disassembly.
  4536. #define DEBUG_ASMOPT_VERBOSE 0x00000001
  4537. // Do not display raw code bytes in disassembly.
  4538. #define DEBUG_ASMOPT_NO_CODE_BYTES 0x00000002
  4539. // Do not take the output width into account when
  4540. // formatting disassembly.
  4541. #define DEBUG_ASMOPT_IGNORE_OUTPUT_WIDTH 0x00000004
  4542. //
  4543. // Expression syntax options.
  4544. //
  4545. // MASM-style expression evaluation.
  4546. #define DEBUG_EXPR_MASM 0x00000000
  4547. // C++-style expression evaluation.
  4548. #define DEBUG_EXPR_CPLUSPLUS 0x00000001
  4549. //
  4550. // Event index description information.
  4551. //
  4552. #define DEBUG_EINDEX_NAME 0x00000000
  4553. //
  4554. // SetNextEventIndex relation options.
  4555. //
  4556. // Value increases forward from the first index.
  4557. #define DEBUG_EINDEX_FROM_START 0x00000000
  4558. // Value increases backwards from the last index.
  4559. #define DEBUG_EINDEX_FROM_END 0x00000001
  4560. // Value is a signed delta from the current index.
  4561. #define DEBUG_EINDEX_FROM_CURRENT 0x00000002
  4562. #undef INTERFACE
  4563. #define INTERFACE IDebugControl3
  4564. DECLARE_INTERFACE_(IDebugControl3, IUnknown)
  4565. {
  4566. // IUnknown.
  4567. STDMETHOD(QueryInterface)(
  4568. THIS_
  4569. IN REFIID InterfaceId,
  4570. OUT PVOID* Interface
  4571. ) PURE;
  4572. STDMETHOD_(ULONG, AddRef)(
  4573. THIS
  4574. ) PURE;
  4575. STDMETHOD_(ULONG, Release)(
  4576. THIS
  4577. ) PURE;
  4578. // IDebugControl.
  4579. // Checks for a user interrupt, such a Ctrl-C
  4580. // or stop button.
  4581. // This method is reentrant.
  4582. STDMETHOD(GetInterrupt)(
  4583. THIS
  4584. ) PURE;
  4585. // Registers a user interrupt.
  4586. // This method is reentrant.
  4587. STDMETHOD(SetInterrupt)(
  4588. THIS_
  4589. IN ULONG Flags
  4590. ) PURE;
  4591. // Interrupting a user-mode process requires
  4592. // access to some system resources that the
  4593. // process may hold itself, preventing the
  4594. // interrupt from occurring. The engine
  4595. // will time-out pending interrupt requests
  4596. // and simulate an interrupt if necessary.
  4597. // These methods control the interrupt timeout.
  4598. STDMETHOD(GetInterruptTimeout)(
  4599. THIS_
  4600. OUT PULONG Seconds
  4601. ) PURE;
  4602. STDMETHOD(SetInterruptTimeout)(
  4603. THIS_
  4604. IN ULONG Seconds
  4605. ) PURE;
  4606. STDMETHOD(GetLogFile)(
  4607. THIS_
  4608. OUT OPTIONAL PSTR Buffer,
  4609. IN ULONG BufferSize,
  4610. OUT OPTIONAL PULONG FileSize,
  4611. OUT PBOOL Append
  4612. ) PURE;
  4613. // Opens a log file which collects all
  4614. // output. Output from every client except
  4615. // those that explicitly disable logging
  4616. // goes into the log.
  4617. // Opening a log file closes any log file
  4618. // already open.
  4619. STDMETHOD(OpenLogFile)(
  4620. THIS_
  4621. IN PCSTR File,
  4622. IN BOOL Append
  4623. ) PURE;
  4624. STDMETHOD(CloseLogFile)(
  4625. THIS
  4626. ) PURE;
  4627. // Controls what output is logged.
  4628. STDMETHOD(GetLogMask)(
  4629. THIS_
  4630. OUT PULONG Mask
  4631. ) PURE;
  4632. STDMETHOD(SetLogMask)(
  4633. THIS_
  4634. IN ULONG Mask
  4635. ) PURE;
  4636. // Input requests input from all clients.
  4637. // The first input that is returned is used
  4638. // to satisfy the call. Other returned
  4639. // input is discarded.
  4640. STDMETHOD(Input)(
  4641. THIS_
  4642. OUT PSTR Buffer,
  4643. IN ULONG BufferSize,
  4644. OUT OPTIONAL PULONG InputSize
  4645. ) PURE;
  4646. // This method is used by clients to return
  4647. // input when it is available. It will
  4648. // return S_OK if the input is used to
  4649. // satisfy an Input call and S_FALSE if
  4650. // the input is ignored.
  4651. // This method is reentrant.
  4652. STDMETHOD(ReturnInput)(
  4653. THIS_
  4654. IN PCSTR Buffer
  4655. ) PURE;
  4656. // Sends output through clients
  4657. // output callbacks if the mask is allowed
  4658. // by the current output control mask and
  4659. // according to the output distribution
  4660. // settings.
  4661. STDMETHODV(Output)(
  4662. THIS_
  4663. IN ULONG Mask,
  4664. IN PCSTR Format,
  4665. ...
  4666. ) PURE;
  4667. STDMETHOD(OutputVaList)(
  4668. THIS_
  4669. IN ULONG Mask,
  4670. IN PCSTR Format,
  4671. IN va_list Args
  4672. ) PURE;
  4673. // The following methods allow direct control
  4674. // over the distribution of the given output
  4675. // for situations where something other than
  4676. // the default is desired. These methods require
  4677. // extra work in the engine so they should
  4678. // only be used when necessary.
  4679. STDMETHODV(ControlledOutput)(
  4680. THIS_
  4681. IN ULONG OutputControl,
  4682. IN ULONG Mask,
  4683. IN PCSTR Format,
  4684. ...
  4685. ) PURE;
  4686. STDMETHOD(ControlledOutputVaList)(
  4687. THIS_
  4688. IN ULONG OutputControl,
  4689. IN ULONG Mask,
  4690. IN PCSTR Format,
  4691. IN va_list Args
  4692. ) PURE;
  4693. // Displays the standard command-line prompt
  4694. // followed by the given output. If Format
  4695. // is NULL no additional output is produced.
  4696. // Output is produced under the
  4697. // DEBUG_OUTPUT_PROMPT mask.
  4698. // This method only outputs the prompt; it
  4699. // does not get input.
  4700. STDMETHODV(OutputPrompt)(
  4701. THIS_
  4702. IN ULONG OutputControl,
  4703. IN OPTIONAL PCSTR Format,
  4704. ...
  4705. ) PURE;
  4706. STDMETHOD(OutputPromptVaList)(
  4707. THIS_
  4708. IN ULONG OutputControl,
  4709. IN OPTIONAL PCSTR Format,
  4710. IN va_list Args
  4711. ) PURE;
  4712. // Gets the text that would be displayed by OutputPrompt.
  4713. STDMETHOD(GetPromptText)(
  4714. THIS_
  4715. OUT OPTIONAL PSTR Buffer,
  4716. IN ULONG BufferSize,
  4717. OUT OPTIONAL PULONG TextSize
  4718. ) PURE;
  4719. // Outputs information about the current
  4720. // debuggee state such as a register
  4721. // summary, disassembly at the current PC,
  4722. // closest symbol and others.
  4723. // Uses the line prefix.
  4724. STDMETHOD(OutputCurrentState)(
  4725. THIS_
  4726. IN ULONG OutputControl,
  4727. IN ULONG Flags
  4728. ) PURE;
  4729. // Outputs the debugger and extension version
  4730. // information. This method is reentrant.
  4731. // Uses the line prefix.
  4732. STDMETHOD(OutputVersionInformation)(
  4733. THIS_
  4734. IN ULONG OutputControl
  4735. ) PURE;
  4736. // In user-mode debugging sessions the
  4737. // engine will set an event when
  4738. // exceptions are continued. This can
  4739. // be used to synchronize other processes
  4740. // with the debuggers handling of events.
  4741. // For example, this is used to support
  4742. // the e argument to ntsd.
  4743. STDMETHOD(GetNotifyEventHandle)(
  4744. THIS_
  4745. OUT PULONG64 Handle
  4746. ) PURE;
  4747. STDMETHOD(SetNotifyEventHandle)(
  4748. THIS_
  4749. IN ULONG64 Handle
  4750. ) PURE;
  4751. STDMETHOD(Assemble)(
  4752. THIS_
  4753. IN ULONG64 Offset,
  4754. IN PCSTR Instr,
  4755. OUT PULONG64 EndOffset
  4756. ) PURE;
  4757. STDMETHOD(Disassemble)(
  4758. THIS_
  4759. IN ULONG64 Offset,
  4760. IN ULONG Flags,
  4761. OUT OPTIONAL PSTR Buffer,
  4762. IN ULONG BufferSize,
  4763. OUT OPTIONAL PULONG DisassemblySize,
  4764. OUT PULONG64 EndOffset
  4765. ) PURE;
  4766. // Returns the value of the effective address
  4767. // computed for the last Disassemble, if there
  4768. // was one.
  4769. STDMETHOD(GetDisassembleEffectiveOffset)(
  4770. THIS_
  4771. OUT PULONG64 Offset
  4772. ) PURE;
  4773. // Uses the line prefix if necessary.
  4774. STDMETHOD(OutputDisassembly)(
  4775. THIS_
  4776. IN ULONG OutputControl,
  4777. IN ULONG64 Offset,
  4778. IN ULONG Flags,
  4779. OUT PULONG64 EndOffset
  4780. ) PURE;
  4781. // Produces multiple lines of disassembly output.
  4782. // There will be PreviousLines of disassembly before
  4783. // the given offset if a valid disassembly exists.
  4784. // In all, there will be TotalLines of output produced.
  4785. // The first and last line offsets are returned
  4786. // specially and all lines offsets can be retrieved
  4787. // through LineOffsets. LineOffsets will contain
  4788. // offsets for each line where disassembly started.
  4789. // When disassembly of a single instruction takes
  4790. // multiple lines the initial offset will be followed
  4791. // by DEBUG_INVALID_OFFSET.
  4792. // Uses the line prefix.
  4793. STDMETHOD(OutputDisassemblyLines)(
  4794. THIS_
  4795. IN ULONG OutputControl,
  4796. IN ULONG PreviousLines,
  4797. IN ULONG TotalLines,
  4798. IN ULONG64 Offset,
  4799. IN ULONG Flags,
  4800. OUT OPTIONAL PULONG OffsetLine,
  4801. OUT OPTIONAL PULONG64 StartOffset,
  4802. OUT OPTIONAL PULONG64 EndOffset,
  4803. OUT OPTIONAL /* size_is(TotalLines) */ PULONG64 LineOffsets
  4804. ) PURE;
  4805. // Returns the offset of the start of
  4806. // the instruction thats the given
  4807. // delta away from the instruction
  4808. // at the initial offset.
  4809. // This routine does not check for
  4810. // validity of the instruction or
  4811. // the memory containing it.
  4812. STDMETHOD(GetNearInstruction)(
  4813. THIS_
  4814. IN ULONG64 Offset,
  4815. IN LONG Delta,
  4816. OUT PULONG64 NearOffset
  4817. ) PURE;
  4818. // Offsets can be passed in as zero to use the current
  4819. // thread state.
  4820. STDMETHOD(GetStackTrace)(
  4821. THIS_
  4822. IN ULONG64 FrameOffset,
  4823. IN ULONG64 StackOffset,
  4824. IN ULONG64 InstructionOffset,
  4825. OUT /* size_is(FramesSize) */ PDEBUG_STACK_FRAME Frames,
  4826. IN ULONG FramesSize,
  4827. OUT OPTIONAL PULONG FramesFilled
  4828. ) PURE;
  4829. // Does a simple stack trace to determine
  4830. // what the current return address is.
  4831. STDMETHOD(GetReturnOffset)(
  4832. THIS_
  4833. OUT PULONG64 Offset
  4834. ) PURE;
  4835. // If Frames is NULL OutputStackTrace will
  4836. // use GetStackTrace to get FramesSize frames
  4837. // and then output them. The current register
  4838. // values for frame, stack and instruction offsets
  4839. // are used.
  4840. // Uses the line prefix.
  4841. STDMETHOD(OutputStackTrace)(
  4842. THIS_
  4843. IN ULONG OutputControl,
  4844. IN OPTIONAL /* size_is(FramesSize) */ PDEBUG_STACK_FRAME Frames,
  4845. IN ULONG FramesSize,
  4846. IN ULONG Flags
  4847. ) PURE;
  4848. // Returns information about the debuggee such
  4849. // as user vs. kernel, dump vs. live, etc.
  4850. STDMETHOD(GetDebuggeeType)(
  4851. THIS_
  4852. OUT PULONG Class,
  4853. OUT PULONG Qualifier
  4854. ) PURE;
  4855. // Returns the type of physical processors in
  4856. // the machine.
  4857. // Returns one of the IMAGE_FILE_MACHINE values.
  4858. STDMETHOD(GetActualProcessorType)(
  4859. THIS_
  4860. OUT PULONG Type
  4861. ) PURE;
  4862. // Returns the type of processor used in the
  4863. // current processor context.
  4864. STDMETHOD(GetExecutingProcessorType)(
  4865. THIS_
  4866. OUT PULONG Type
  4867. ) PURE;
  4868. // Query all the possible processor types that
  4869. // may be encountered during this debug session.
  4870. STDMETHOD(GetNumberPossibleExecutingProcessorTypes)(
  4871. THIS_
  4872. OUT PULONG Number
  4873. ) PURE;
  4874. STDMETHOD(GetPossibleExecutingProcessorTypes)(
  4875. THIS_
  4876. IN ULONG Start,
  4877. IN ULONG Count,
  4878. OUT /* size_is(Count) */ PULONG Types
  4879. ) PURE;
  4880. // Get the number of actual processors in
  4881. // the machine.
  4882. STDMETHOD(GetNumberProcessors)(
  4883. THIS_
  4884. OUT PULONG Number
  4885. ) PURE;
  4886. // PlatformId is one of the VER_PLATFORM values.
  4887. // Major and minor are as given in the NT
  4888. // kernel debugger protocol.
  4889. // ServicePackString and ServicePackNumber indicate the
  4890. // system service pack level. ServicePackNumber is not
  4891. // available in some sessions where the service pack level
  4892. // is only expressed as a string. The service pack information
  4893. // will be empty if the system does not have a service pack
  4894. // applied.
  4895. // The build string is string information identifying the
  4896. // particular build of the system. The build string is
  4897. // empty if the system has no particular identifying
  4898. // information.
  4899. STDMETHOD(GetSystemVersion)(
  4900. THIS_
  4901. OUT PULONG PlatformId,
  4902. OUT PULONG Major,
  4903. OUT PULONG Minor,
  4904. OUT OPTIONAL PSTR ServicePackString,
  4905. IN ULONG ServicePackStringSize,
  4906. OUT OPTIONAL PULONG ServicePackStringUsed,
  4907. OUT PULONG ServicePackNumber,
  4908. OUT OPTIONAL PSTR BuildString,
  4909. IN ULONG BuildStringSize,
  4910. OUT OPTIONAL PULONG BuildStringUsed
  4911. ) PURE;
  4912. // Returns the page size for the currently executing
  4913. // processor context. The page size may vary between
  4914. // processor types.
  4915. STDMETHOD(GetPageSize)(
  4916. THIS_
  4917. OUT PULONG Size
  4918. ) PURE;
  4919. // Returns S_OK if the current processor context uses
  4920. // 64-bit addresses, otherwise S_FALSE.
  4921. STDMETHOD(IsPointer64Bit)(
  4922. THIS
  4923. ) PURE;
  4924. // Reads the bugcheck data area and returns the
  4925. // current contents. This method only works
  4926. // in kernel debugging sessions.
  4927. STDMETHOD(ReadBugCheckData)(
  4928. THIS_
  4929. OUT PULONG Code,
  4930. OUT PULONG64 Arg1,
  4931. OUT PULONG64 Arg2,
  4932. OUT PULONG64 Arg3,
  4933. OUT PULONG64 Arg4
  4934. ) PURE;
  4935. // Query all the processor types supported by
  4936. // the engine. This is a complete list and is
  4937. // not related to the machine running the engine
  4938. // or the debuggee.
  4939. STDMETHOD(GetNumberSupportedProcessorTypes)(
  4940. THIS_
  4941. OUT PULONG Number
  4942. ) PURE;
  4943. STDMETHOD(GetSupportedProcessorTypes)(
  4944. THIS_
  4945. IN ULONG Start,
  4946. IN ULONG Count,
  4947. OUT /* size_is(Count) */ PULONG Types
  4948. ) PURE;
  4949. // Returns a full, descriptive name and an
  4950. // abbreviated name for a processor type.
  4951. STDMETHOD(GetProcessorTypeNames)(
  4952. THIS_
  4953. IN ULONG Type,
  4954. OUT OPTIONAL PSTR FullNameBuffer,
  4955. IN ULONG FullNameBufferSize,
  4956. OUT OPTIONAL PULONG FullNameSize,
  4957. OUT OPTIONAL PSTR AbbrevNameBuffer,
  4958. IN ULONG AbbrevNameBufferSize,
  4959. OUT OPTIONAL PULONG AbbrevNameSize
  4960. ) PURE;
  4961. // Gets and sets the type of processor to
  4962. // use when doing things like setting
  4963. // breakpoints, accessing registers,
  4964. // getting stack traces and so on.
  4965. STDMETHOD(GetEffectiveProcessorType)(
  4966. THIS_
  4967. OUT PULONG Type
  4968. ) PURE;
  4969. STDMETHOD(SetEffectiveProcessorType)(
  4970. THIS_
  4971. IN ULONG Type
  4972. ) PURE;
  4973. // Returns information about whether and how
  4974. // the debuggee is running. Status will
  4975. // be GO if the debuggee is running and
  4976. // BREAK if it isnt.
  4977. // If no debuggee exists the status is
  4978. // NO_DEBUGGEE.
  4979. // This method is reentrant.
  4980. STDMETHOD(GetExecutionStatus)(
  4981. THIS_
  4982. OUT PULONG Status
  4983. ) PURE;
  4984. // Changes the execution status of the
  4985. // engine from stopped to running.
  4986. // Status must be one of the go or step
  4987. // status values.
  4988. STDMETHOD(SetExecutionStatus)(
  4989. THIS_
  4990. IN ULONG Status
  4991. ) PURE;
  4992. // Controls what code interpretation level the debugger
  4993. // runs at. The debugger checks the code level when
  4994. // deciding whether to step by a source line or
  4995. // assembly instruction along with other related operations.
  4996. STDMETHOD(GetCodeLevel)(
  4997. THIS_
  4998. OUT PULONG Level
  4999. ) PURE;
  5000. STDMETHOD(SetCodeLevel)(
  5001. THIS_
  5002. IN ULONG Level
  5003. ) PURE;
  5004. // Gets and sets engine control flags.
  5005. // These methods are reentrant.
  5006. STDMETHOD(GetEngineOptions)(
  5007. THIS_
  5008. OUT PULONG Options
  5009. ) PURE;
  5010. STDMETHOD(AddEngineOptions)(
  5011. THIS_
  5012. IN ULONG Options
  5013. ) PURE;
  5014. STDMETHOD(RemoveEngineOptions)(
  5015. THIS_
  5016. IN ULONG Options
  5017. ) PURE;
  5018. STDMETHOD(SetEngineOptions)(
  5019. THIS_
  5020. IN ULONG Options
  5021. ) PURE;
  5022. // Gets and sets control values for
  5023. // handling system error events.
  5024. // If the system error level is less
  5025. // than or equal to the given levels
  5026. // the error may be displayed and
  5027. // the default break for the event
  5028. // may be set.
  5029. STDMETHOD(GetSystemErrorControl)(
  5030. THIS_
  5031. OUT PULONG OutputLevel,
  5032. OUT PULONG BreakLevel
  5033. ) PURE;
  5034. STDMETHOD(SetSystemErrorControl)(
  5035. THIS_
  5036. IN ULONG OutputLevel,
  5037. IN ULONG BreakLevel
  5038. ) PURE;
  5039. // The command processor supports simple
  5040. // string replacement macros in Evaluate and
  5041. // Execute. There are currently ten macro
  5042. // slots available. Slots 0-9 map to
  5043. // the command invocations $u0-$u9.
  5044. STDMETHOD(GetTextMacro)(
  5045. THIS_
  5046. IN ULONG Slot,
  5047. OUT OPTIONAL PSTR Buffer,
  5048. IN ULONG BufferSize,
  5049. OUT OPTIONAL PULONG MacroSize
  5050. ) PURE;
  5051. STDMETHOD(SetTextMacro)(
  5052. THIS_
  5053. IN ULONG Slot,
  5054. IN PCSTR Macro
  5055. ) PURE;
  5056. // Controls the default number radix used
  5057. // in expressions and commands.
  5058. STDMETHOD(GetRadix)(
  5059. THIS_
  5060. OUT PULONG Radix
  5061. ) PURE;
  5062. STDMETHOD(SetRadix)(
  5063. THIS_
  5064. IN ULONG Radix
  5065. ) PURE;
  5066. // Evaluates the given expression string and
  5067. // returns the resulting value.
  5068. // If DesiredType is DEBUG_VALUE_INVALID then
  5069. // the natural type is used.
  5070. // RemainderIndex, if provided, is set to the index
  5071. // of the first character in the input string that was
  5072. // not used when evaluating the expression.
  5073. STDMETHOD(Evaluate)(
  5074. THIS_
  5075. IN PCSTR Expression,
  5076. IN ULONG DesiredType,
  5077. OUT PDEBUG_VALUE Value,
  5078. OUT OPTIONAL PULONG RemainderIndex
  5079. ) PURE;
  5080. // Attempts to convert the input value to a value
  5081. // of the requested type in the output value.
  5082. // Conversions can fail if no conversion exists.
  5083. // Successful conversions may be lossy.
  5084. STDMETHOD(CoerceValue)(
  5085. THIS_
  5086. IN PDEBUG_VALUE In,
  5087. IN ULONG OutType,
  5088. OUT PDEBUG_VALUE Out
  5089. ) PURE;
  5090. STDMETHOD(CoerceValues)(
  5091. THIS_
  5092. IN ULONG Count,
  5093. IN /* size_is(Count) */ PDEBUG_VALUE In,
  5094. IN /* size_is(Count) */ PULONG OutTypes,
  5095. OUT /* size_is(Count) */ PDEBUG_VALUE Out
  5096. ) PURE;
  5097. // Executes the given command string.
  5098. // If the string has multiple commands
  5099. // Execute will not return until all
  5100. // of them have been executed. If this
  5101. // requires waiting for the debuggee to
  5102. // execute an internal wait will be done
  5103. // so Execute can take an arbitrary amount
  5104. // of time.
  5105. STDMETHOD(Execute)(
  5106. THIS_
  5107. IN ULONG OutputControl,
  5108. IN PCSTR Command,
  5109. IN ULONG Flags
  5110. ) PURE;
  5111. // Executes the given command file by
  5112. // reading a line at a time and processing
  5113. // it with Execute.
  5114. STDMETHOD(ExecuteCommandFile)(
  5115. THIS_
  5116. IN ULONG OutputControl,
  5117. IN PCSTR CommandFile,
  5118. IN ULONG Flags
  5119. ) PURE;
  5120. // Breakpoint interfaces are described
  5121. // elsewhere in this section.
  5122. STDMETHOD(GetNumberBreakpoints)(
  5123. THIS_
  5124. OUT PULONG Number
  5125. ) PURE;
  5126. // It is possible for this retrieval function to
  5127. // fail even with an index within the number of
  5128. // existing breakpoints if the breakpoint is
  5129. // a private breakpoint.
  5130. STDMETHOD(GetBreakpointByIndex)(
  5131. THIS_
  5132. IN ULONG Index,
  5133. OUT PDEBUG_BREAKPOINT* Bp
  5134. ) PURE;
  5135. STDMETHOD(GetBreakpointById)(
  5136. THIS_
  5137. IN ULONG Id,
  5138. OUT PDEBUG_BREAKPOINT* Bp
  5139. ) PURE;
  5140. // If Ids is non-NULL the Count breakpoints
  5141. // referred to in the Ids array are returned,
  5142. // otherwise breakpoints from index Start to
  5143. // Start + Count 1 are returned.
  5144. STDMETHOD(GetBreakpointParameters)(
  5145. THIS_
  5146. IN ULONG Count,
  5147. IN OPTIONAL /* size_is(Count) */ PULONG Ids,
  5148. IN ULONG Start,
  5149. OUT /* size_is(Count) */ PDEBUG_BREAKPOINT_PARAMETERS Params
  5150. ) PURE;
  5151. // Breakpoints are created empty and disabled.
  5152. // When their parameters have been set they
  5153. // should be enabled by setting the ENABLE flag.
  5154. // If DesiredId is DEBUG_ANY_ID then the
  5155. // engine picks an unused ID. If DesiredId
  5156. // is any other number the engine attempts
  5157. // to use the given ID for the breakpoint.
  5158. // If another breakpoint exists with that ID
  5159. // the call will fail.
  5160. STDMETHOD(AddBreakpoint)(
  5161. THIS_
  5162. IN ULONG Type,
  5163. IN ULONG DesiredId,
  5164. OUT PDEBUG_BREAKPOINT* Bp
  5165. ) PURE;
  5166. // Breakpoint interface is invalid after this call.
  5167. STDMETHOD(RemoveBreakpoint)(
  5168. THIS_
  5169. IN PDEBUG_BREAKPOINT Bp
  5170. ) PURE;
  5171. // Control and use extension DLLs.
  5172. STDMETHOD(AddExtension)(
  5173. THIS_
  5174. IN PCSTR Path,
  5175. IN ULONG Flags,
  5176. OUT PULONG64 Handle
  5177. ) PURE;
  5178. STDMETHOD(RemoveExtension)(
  5179. THIS_
  5180. IN ULONG64 Handle
  5181. ) PURE;
  5182. STDMETHOD(GetExtensionByPath)(
  5183. THIS_
  5184. IN PCSTR Path,
  5185. OUT PULONG64 Handle
  5186. ) PURE;
  5187. // If Handle is zero the extension
  5188. // chain is walked searching for the
  5189. // function.
  5190. STDMETHOD(CallExtension)(
  5191. THIS_
  5192. IN ULONG64 Handle,
  5193. IN PCSTR Function,
  5194. IN OPTIONAL PCSTR Arguments
  5195. ) PURE;
  5196. // GetExtensionFunction works like
  5197. // GetProcAddress on extension DLLs
  5198. // to allow raw function-call-level
  5199. // interaction with extension DLLs.
  5200. // Such functions do not need to
  5201. // follow the standard extension prototype
  5202. // if they are not going to be called
  5203. // through the text extension interface.
  5204. // This function cannot be called remotely.
  5205. STDMETHOD(GetExtensionFunction)(
  5206. THIS_
  5207. IN ULONG64 Handle,
  5208. IN PCSTR FuncName,
  5209. OUT FARPROC* Function
  5210. ) PURE;
  5211. // These methods return alternate
  5212. // extension interfaces in order to allow
  5213. // interface-style extension DLLs to mix in
  5214. // older extension calls.
  5215. // Structure sizes must be initialized before
  5216. // the call.
  5217. // These methods cannot be called remotely.
  5218. STDMETHOD(GetWindbgExtensionApis32)(
  5219. THIS_
  5220. IN OUT PWINDBG_EXTENSION_APIS32 Api
  5221. ) PURE;
  5222. STDMETHOD(GetWindbgExtensionApis64)(
  5223. THIS_
  5224. IN OUT PWINDBG_EXTENSION_APIS64 Api
  5225. ) PURE;
  5226. // The engine provides a simple mechanism
  5227. // to filter common events. Arbitrarily complicated
  5228. // filtering can be done by registering event callbacks
  5229. // but simple event filtering only requires
  5230. // setting the options of one of the predefined
  5231. // event filters.
  5232. // Simple event filters are either for specific
  5233. // events and therefore have an enumerant or
  5234. // they are for an exception and are based on
  5235. // the exceptions code. Exception filters
  5236. // are further divided into exceptions specially
  5237. // handled by the engine, which is a fixed set,
  5238. // and arbitrary exceptions.
  5239. // All three groups of filters are indexed together
  5240. // with the specific filters first, then the specific
  5241. // exception filters and finally the arbitrary
  5242. // exception filters.
  5243. // The first specific exception is the default
  5244. // exception. If an exception event occurs for
  5245. // an exception without settings the default
  5246. // exception settings are used.
  5247. STDMETHOD(GetNumberEventFilters)(
  5248. THIS_
  5249. OUT PULONG SpecificEvents,
  5250. OUT PULONG SpecificExceptions,
  5251. OUT PULONG ArbitraryExceptions
  5252. ) PURE;
  5253. // Some filters have descriptive text associated with them.
  5254. STDMETHOD(GetEventFilterText)(
  5255. THIS_
  5256. IN ULONG Index,
  5257. OUT OPTIONAL PSTR Buffer,
  5258. IN ULONG BufferSize,
  5259. OUT OPTIONAL PULONG TextSize
  5260. ) PURE;
  5261. // All filters support executing a command when the
  5262. // event occurs.
  5263. STDMETHOD(GetEventFilterCommand)(
  5264. THIS_
  5265. IN ULONG Index,
  5266. OUT OPTIONAL PSTR Buffer,
  5267. IN ULONG BufferSize,
  5268. OUT OPTIONAL PULONG CommandSize
  5269. ) PURE;
  5270. STDMETHOD(SetEventFilterCommand)(
  5271. THIS_
  5272. IN ULONG Index,
  5273. IN PCSTR Command
  5274. ) PURE;
  5275. STDMETHOD(GetSpecificFilterParameters)(
  5276. THIS_
  5277. IN ULONG Start,
  5278. IN ULONG Count,
  5279. OUT /* size_is(Count) */ PDEBUG_SPECIFIC_FILTER_PARAMETERS Params
  5280. ) PURE;
  5281. STDMETHOD(SetSpecificFilterParameters)(
  5282. THIS_
  5283. IN ULONG Start,
  5284. IN ULONG Count,
  5285. IN /* size_is(Count) */ PDEBUG_SPECIFIC_FILTER_PARAMETERS Params
  5286. ) PURE;
  5287. // Some specific filters have arguments to further
  5288. // qualify their operation.
  5289. STDMETHOD(GetSpecificFilterArgument)(
  5290. THIS_
  5291. IN ULONG Index,
  5292. OUT OPTIONAL PSTR Buffer,
  5293. IN ULONG BufferSize,
  5294. OUT OPTIONAL PULONG ArgumentSize
  5295. ) PURE;
  5296. STDMETHOD(SetSpecificFilterArgument)(
  5297. THIS_
  5298. IN ULONG Index,
  5299. IN PCSTR Argument
  5300. ) PURE;
  5301. // If Codes is non-NULL Start is ignored.
  5302. STDMETHOD(GetExceptionFilterParameters)(
  5303. THIS_
  5304. IN ULONG Count,
  5305. IN OPTIONAL /* size_is(Count) */ PULONG Codes,
  5306. IN ULONG Start,
  5307. OUT /* size_is(Count) */ PDEBUG_EXCEPTION_FILTER_PARAMETERS Params
  5308. ) PURE;
  5309. // The codes in the parameter data control the application
  5310. // of the parameter data. If a code is not already in
  5311. // the set of filters it is added. If the ExecutionOption
  5312. // for a code is REMOVE then the filter is removed.
  5313. // Specific exception filters cannot be removed.
  5314. STDMETHOD(SetExceptionFilterParameters)(
  5315. THIS_
  5316. IN ULONG Count,
  5317. IN /* size_is(Count) */ PDEBUG_EXCEPTION_FILTER_PARAMETERS Params
  5318. ) PURE;
  5319. // Exception filters support an additional command for
  5320. // second-chance events.
  5321. STDMETHOD(GetExceptionFilterSecondCommand)(
  5322. THIS_
  5323. IN ULONG Index,
  5324. OUT OPTIONAL PSTR Buffer,
  5325. IN ULONG BufferSize,
  5326. OUT OPTIONAL PULONG CommandSize
  5327. ) PURE;
  5328. STDMETHOD(SetExceptionFilterSecondCommand)(
  5329. THIS_
  5330. IN ULONG Index,
  5331. IN PCSTR Command
  5332. ) PURE;
  5333. // Yields processing to the engine until
  5334. // an event occurs. This method may
  5335. // only be called by the thread that started
  5336. // the debug session.
  5337. // When an event occurs the engine carries
  5338. // out all event processing such as calling
  5339. // callbacks.
  5340. // If the callbacks indicate that execution should
  5341. // break the wait will return, otherwise it
  5342. // goes back to waiting for a new event.
  5343. // If the timeout expires, S_FALSE is returned.
  5344. // The timeout is not currently supported for
  5345. // kernel debugging.
  5346. STDMETHOD(WaitForEvent)(
  5347. THIS_
  5348. IN ULONG Flags,
  5349. IN ULONG Timeout
  5350. ) PURE;
  5351. // Retrieves information about the last event that occurred.
  5352. // EventType is one of the event callback mask bits.
  5353. // ExtraInformation contains additional event-specific
  5354. // information. Not all events have additional information.
  5355. STDMETHOD(GetLastEventInformation)(
  5356. THIS_
  5357. OUT PULONG Type,
  5358. OUT PULONG ProcessId,
  5359. OUT PULONG ThreadId,
  5360. OUT OPTIONAL PVOID ExtraInformation,
  5361. IN ULONG ExtraInformationSize,
  5362. OUT OPTIONAL PULONG ExtraInformationUsed,
  5363. OUT OPTIONAL PSTR Description,
  5364. IN ULONG DescriptionSize,
  5365. OUT OPTIONAL PULONG DescriptionUsed
  5366. ) PURE;
  5367. // IDebugControl2.
  5368. STDMETHOD(GetCurrentTimeDate)(
  5369. THIS_
  5370. OUT PULONG TimeDate
  5371. ) PURE;
  5372. // Retrieves the number of seconds since the
  5373. // machine started running.
  5374. STDMETHOD(GetCurrentSystemUpTime)(
  5375. THIS_
  5376. OUT PULONG UpTime
  5377. ) PURE;
  5378. // If the current session is a dump session,
  5379. // retrieves any extended format information.
  5380. STDMETHOD(GetDumpFormatFlags)(
  5381. THIS_
  5382. OUT PULONG FormatFlags
  5383. ) PURE;
  5384. // The debugger has been enhanced to allow
  5385. // arbitrary text replacements in addition
  5386. // to the simple $u0-$u9 text macros.
  5387. // Text replacement takes a given source
  5388. // text in commands and converts it to the
  5389. // given destination text. Replacements
  5390. // are named by their source text so that
  5391. // only one replacement for a source text
  5392. // string can exist.
  5393. STDMETHOD(GetNumberTextReplacements)(
  5394. THIS_
  5395. OUT PULONG NumRepl
  5396. ) PURE;
  5397. // If SrcText is non-NULL the replacement
  5398. // is looked up by source text, otherwise
  5399. // Index is used to get the Nth replacement.
  5400. STDMETHOD(GetTextReplacement)(
  5401. THIS_
  5402. IN OPTIONAL PCSTR SrcText,
  5403. IN ULONG Index,
  5404. OUT OPTIONAL PSTR SrcBuffer,
  5405. IN ULONG SrcBufferSize,
  5406. OUT OPTIONAL PULONG SrcSize,
  5407. OUT OPTIONAL PSTR DstBuffer,
  5408. IN ULONG DstBufferSize,
  5409. OUT OPTIONAL PULONG DstSize
  5410. ) PURE;
  5411. // Setting the destination text to
  5412. // NULL removes the alias.
  5413. STDMETHOD(SetTextReplacement)(
  5414. THIS_
  5415. IN PCSTR SrcText,
  5416. IN OPTIONAL PCSTR DstText
  5417. ) PURE;
  5418. STDMETHOD(RemoveTextReplacements)(
  5419. THIS
  5420. ) PURE;
  5421. // Outputs the complete list of current
  5422. // replacements.
  5423. STDMETHOD(OutputTextReplacements)(
  5424. THIS_
  5425. IN ULONG OutputControl,
  5426. IN ULONG Flags
  5427. ) PURE;
  5428. // IDebugControl3.
  5429. // Control options for assembly and disassembly.
  5430. STDMETHOD(GetAssemblyOptions)(
  5431. THIS_
  5432. OUT PULONG Options
  5433. ) PURE;
  5434. STDMETHOD(AddAssemblyOptions)(
  5435. THIS_
  5436. IN ULONG Options
  5437. ) PURE;
  5438. STDMETHOD(RemoveAssemblyOptions)(
  5439. THIS_
  5440. IN ULONG Options
  5441. ) PURE;
  5442. STDMETHOD(SetAssemblyOptions)(
  5443. THIS_
  5444. IN ULONG Options
  5445. ) PURE;
  5446. // Control the expression syntax.
  5447. STDMETHOD(GetExpressionSyntax)(
  5448. THIS_
  5449. OUT PULONG Flags
  5450. ) PURE;
  5451. STDMETHOD(SetExpressionSyntax)(
  5452. THIS_
  5453. IN ULONG Flags
  5454. ) PURE;
  5455. // Look up a syntax by its abbreviated
  5456. // name and set it.
  5457. STDMETHOD(SetExpressionSyntaxByName)(
  5458. THIS_
  5459. IN PCSTR AbbrevName
  5460. ) PURE;
  5461. STDMETHOD(GetNumberExpressionSyntaxes)(
  5462. THIS_
  5463. OUT PULONG Number
  5464. ) PURE;
  5465. STDMETHOD(GetExpressionSyntaxNames)(
  5466. THIS_
  5467. IN ULONG Index,
  5468. OUT OPTIONAL PSTR FullNameBuffer,
  5469. IN ULONG FullNameBufferSize,
  5470. OUT OPTIONAL PULONG FullNameSize,
  5471. OUT OPTIONAL PSTR AbbrevNameBuffer,
  5472. IN ULONG AbbrevNameBufferSize,
  5473. OUT OPTIONAL PULONG AbbrevNameSize
  5474. ) PURE;
  5475. //
  5476. // Some debug sessions have only a single
  5477. // possible event, such as a snapshot dump
  5478. // file; some have dynamic events, such as
  5479. // a live debug session; and others may have
  5480. // multiple events, such as a dump file that
  5481. // contains snapshots from different points
  5482. // in time. The following methods allow
  5483. // discovery and selection of the available
  5484. // events for a session.
  5485. // Sessions with one or more static events
  5486. // will be able to report all of the events
  5487. // when queried. Sessions with dynamic events
  5488. // will only report a single event representing
  5489. // the current event.
  5490. // Switching events constitutes execution and
  5491. // changing the current event will alter the
  5492. // execution status to a running state, after
  5493. // which WaitForEvent must be used to process
  5494. // the selected event.
  5495. //
  5496. // GetNumberEvents returns S_OK if this is the
  5497. // complete set of events possible, such as for
  5498. // a static session; or S_FALSE if other events
  5499. // may be possible, such as for a dynamic session.
  5500. STDMETHOD(GetNumberEvents)(
  5501. THIS_
  5502. OUT PULONG Events
  5503. ) PURE;
  5504. // Sessions may have descriptive information for
  5505. // the various events available. The amount of
  5506. // information varies according to the specific
  5507. // session and data.
  5508. STDMETHOD(GetEventIndexDescription)(
  5509. THIS_
  5510. IN ULONG Index,
  5511. IN ULONG Which,
  5512. IN OPTIONAL PSTR Buffer,
  5513. IN ULONG BufferSize,
  5514. OUT OPTIONAL PULONG DescSize
  5515. ) PURE;
  5516. STDMETHOD(GetCurrentEventIndex)(
  5517. THIS_
  5518. OUT PULONG Index
  5519. ) PURE;
  5520. // SetNextEventIndex works like seek in that
  5521. // it can set an absolute or relative index.
  5522. // SetNextEventIndex works similarly to SetExecutionStatus
  5523. // by putting the session into a running state, after
  5524. // which the caller must call WaitForEvent. The
  5525. // current event index only changes when WaitForEvent
  5526. // is called.
  5527. STDMETHOD(SetNextEventIndex)(
  5528. THIS_
  5529. IN ULONG Relation,
  5530. IN ULONG Value,
  5531. OUT PULONG NextIndex
  5532. ) PURE;
  5533. };
  5534. //----------------------------------------------------------------------------
  5535. //
  5536. // IDebugDataSpaces.
  5537. //
  5538. //----------------------------------------------------------------------------
  5539. // Data space indices for callbacks and other methods.
  5540. #define DEBUG_DATA_SPACE_VIRTUAL 0
  5541. #define DEBUG_DATA_SPACE_PHYSICAL 1
  5542. #define DEBUG_DATA_SPACE_CONTROL 2
  5543. #define DEBUG_DATA_SPACE_IO 3
  5544. #define DEBUG_DATA_SPACE_MSR 4
  5545. #define DEBUG_DATA_SPACE_BUS_DATA 5
  5546. #define DEBUG_DATA_SPACE_DEBUGGER_DATA 6
  5547. // Count of data spaces.
  5548. #define DEBUG_DATA_SPACE_COUNT 7
  5549. // Indices for ReadDebuggerData interface
  5550. #define DEBUG_DATA_KernBase 24
  5551. #define DEBUG_DATA_BreakpointWithStatusAddr 32
  5552. #define DEBUG_DATA_SavedContextAddr 40
  5553. #define DEBUG_DATA_KiCallUserModeAddr 56
  5554. #define DEBUG_DATA_KeUserCallbackDispatcherAddr 64
  5555. #define DEBUG_DATA_PsLoadedModuleListAddr 72
  5556. #define DEBUG_DATA_PsActiveProcessHeadAddr 80
  5557. #define DEBUG_DATA_PspCidTableAddr 88
  5558. #define DEBUG_DATA_ExpSystemResourcesListAddr 96
  5559. #define DEBUG_DATA_ExpPagedPoolDescriptorAddr 104
  5560. #define DEBUG_DATA_ExpNumberOfPagedPoolsAddr 112
  5561. #define DEBUG_DATA_KeTimeIncrementAddr 120
  5562. #define DEBUG_DATA_KeBugCheckCallbackListHeadAddr 128
  5563. #define DEBUG_DATA_KiBugcheckDataAddr 136
  5564. #define DEBUG_DATA_IopErrorLogListHeadAddr 144
  5565. #define DEBUG_DATA_ObpRootDirectoryObjectAddr 152
  5566. #define DEBUG_DATA_ObpTypeObjectTypeAddr 160
  5567. #define DEBUG_DATA_MmSystemCacheStartAddr 168
  5568. #define DEBUG_DATA_MmSystemCacheEndAddr 176
  5569. #define DEBUG_DATA_MmSystemCacheWsAddr 184
  5570. #define DEBUG_DATA_MmPfnDatabaseAddr 192
  5571. #define DEBUG_DATA_MmSystemPtesStartAddr 200
  5572. #define DEBUG_DATA_MmSystemPtesEndAddr 208
  5573. #define DEBUG_DATA_MmSubsectionBaseAddr 216
  5574. #define DEBUG_DATA_MmNumberOfPagingFilesAddr 224
  5575. #define DEBUG_DATA_MmLowestPhysicalPageAddr 232
  5576. #define DEBUG_DATA_MmHighestPhysicalPageAddr 240
  5577. #define DEBUG_DATA_MmNumberOfPhysicalPagesAddr 248
  5578. #define DEBUG_DATA_MmMaximumNonPagedPoolInBytesAddr 256
  5579. #define DEBUG_DATA_MmNonPagedSystemStartAddr 264
  5580. #define DEBUG_DATA_MmNonPagedPoolStartAddr 272
  5581. #define DEBUG_DATA_MmNonPagedPoolEndAddr 280
  5582. #define DEBUG_DATA_MmPagedPoolStartAddr 288
  5583. #define DEBUG_DATA_MmPagedPoolEndAddr 296
  5584. #define DEBUG_DATA_MmPagedPoolInformationAddr 304
  5585. #define DEBUG_DATA_MmPageSize 312
  5586. #define DEBUG_DATA_MmSizeOfPagedPoolInBytesAddr 320
  5587. #define DEBUG_DATA_MmTotalCommitLimitAddr 328
  5588. #define DEBUG_DATA_MmTotalCommittedPagesAddr 336
  5589. #define DEBUG_DATA_MmSharedCommitAddr 344
  5590. #define DEBUG_DATA_MmDriverCommitAddr 352
  5591. #define DEBUG_DATA_MmProcessCommitAddr 360
  5592. #define DEBUG_DATA_MmPagedPoolCommitAddr 368
  5593. #define DEBUG_DATA_MmExtendedCommitAddr 376
  5594. #define DEBUG_DATA_MmZeroedPageListHeadAddr 384
  5595. #define DEBUG_DATA_MmFreePageListHeadAddr 392
  5596. #define DEBUG_DATA_MmStandbyPageListHeadAddr 400
  5597. #define DEBUG_DATA_MmModifiedPageListHeadAddr 408
  5598. #define DEBUG_DATA_MmModifiedNoWritePageListHeadAddr 416
  5599. #define DEBUG_DATA_MmAvailablePagesAddr 424
  5600. #define DEBUG_DATA_MmResidentAvailablePagesAddr 432
  5601. #define DEBUG_DATA_PoolTrackTableAddr 440
  5602. #define DEBUG_DATA_NonPagedPoolDescriptorAddr 448
  5603. #define DEBUG_DATA_MmHighestUserAddressAddr 456
  5604. #define DEBUG_DATA_MmSystemRangeStartAddr 464
  5605. #define DEBUG_DATA_MmUserProbeAddressAddr 472
  5606. #define DEBUG_DATA_KdPrintCircularBufferAddr 480
  5607. #define DEBUG_DATA_KdPrintCircularBufferEndAddr 488
  5608. #define DEBUG_DATA_KdPrintWritePointerAddr 496
  5609. #define DEBUG_DATA_KdPrintRolloverCountAddr 504
  5610. #define DEBUG_DATA_MmLoadedUserImageListAddr 512
  5611. #define DEBUG_DATA_NtBuildLabAddr 520
  5612. #define DEBUG_DATA_KiNormalSystemCall 528
  5613. #define DEBUG_DATA_KiProcessorBlockAddr 536
  5614. #define DEBUG_DATA_MmUnloadedDriversAddr 544
  5615. #define DEBUG_DATA_MmLastUnloadedDriverAddr 552
  5616. #define DEBUG_DATA_MmTriageActionTakenAddr 560
  5617. #define DEBUG_DATA_MmSpecialPoolTagAddr 568
  5618. #define DEBUG_DATA_KernelVerifierAddr 576
  5619. #define DEBUG_DATA_MmVerifierDataAddr 584
  5620. #define DEBUG_DATA_MmAllocatedNonPagedPoolAddr 592
  5621. #define DEBUG_DATA_MmPeakCommitmentAddr 600
  5622. #define DEBUG_DATA_MmTotalCommitLimitMaximumAddr 608
  5623. #define DEBUG_DATA_CmNtCSDVersionAddr 616
  5624. #define DEBUG_DATA_MmPhysicalMemoryBlockAddr 624
  5625. #define DEBUG_DATA_MmSessionBase 632
  5626. #define DEBUG_DATA_MmSessionSize 640
  5627. #define DEBUG_DATA_MmSystemParentTablePage 648
  5628. #define DEBUG_DATA_MmVirtualTranslationBase 656
  5629. #define DEBUG_DATA_OffsetKThreadNextProcessor 664
  5630. #define DEBUG_DATA_OffsetKThreadTeb 666
  5631. #define DEBUG_DATA_OffsetKThreadKernelStack 668
  5632. #define DEBUG_DATA_OffsetKThreadInitialStack 670
  5633. #define DEBUG_DATA_OffsetKThreadApcProcess 672
  5634. #define DEBUG_DATA_OffsetKThreadState 674
  5635. #define DEBUG_DATA_OffsetKThreadBStore 676
  5636. #define DEBUG_DATA_OffsetKThreadBStoreLimit 678
  5637. #define DEBUG_DATA_SizeEProcess 680
  5638. #define DEBUG_DATA_OffsetEprocessPeb 682
  5639. #define DEBUG_DATA_OffsetEprocessParentCID 684
  5640. #define DEBUG_DATA_OffsetEprocessDirectoryTableBase 686
  5641. #define DEBUG_DATA_SizePrcb 688
  5642. #define DEBUG_DATA_OffsetPrcbDpcRoutine 690
  5643. #define DEBUG_DATA_OffsetPrcbCurrentThread 692
  5644. #define DEBUG_DATA_OffsetPrcbMhz 694
  5645. #define DEBUG_DATA_OffsetPrcbCpuType 696
  5646. #define DEBUG_DATA_OffsetPrcbVendorString 698
  5647. #define DEBUG_DATA_OffsetPrcbProcessorState 700
  5648. #define DEBUG_DATA_OffsetPrcbNumber 702
  5649. #define DEBUG_DATA_SizeEThread 704
  5650. #define DEBUG_DATA_KdPrintCircularBufferPtrAddr 712
  5651. #define DEBUG_DATA_KdPrintBufferSizeAddr 720
  5652. #define DEBUG_DATA_PaeEnabled 100000
  5653. #define DEBUG_DATA_SharedUserData 100008
  5654. #define DEBUG_DATA_ProductType 100016
  5655. #define DEBUG_DATA_SuiteMask 100024
  5656. //
  5657. // Processor information structures.
  5658. //
  5659. typedef struct _DEBUG_PROCESSOR_IDENTIFICATION_ALPHA
  5660. {
  5661. ULONG Type;
  5662. ULONG Revision;
  5663. } DEBUG_PROCESSOR_IDENTIFICATION_ALPHA, *PDEBUG_PROCESSOR_IDENTIFICATION_ALPHA;
  5664. typedef struct _DEBUG_PROCESSOR_IDENTIFICATION_AMD64
  5665. {
  5666. ULONG Family;
  5667. ULONG Model;
  5668. ULONG Stepping;
  5669. CHAR VendorString[16];
  5670. } DEBUG_PROCESSOR_IDENTIFICATION_AMD64, *PDEBUG_PROCESSOR_IDENTIFICATION_AMD64;
  5671. typedef struct _DEBUG_PROCESSOR_IDENTIFICATION_IA64
  5672. {
  5673. ULONG Model;
  5674. ULONG Revision;
  5675. ULONG Family;
  5676. ULONG ArchRev;
  5677. CHAR VendorString[16];
  5678. } DEBUG_PROCESSOR_IDENTIFICATION_IA64, *PDEBUG_PROCESSOR_IDENTIFICATION_IA64;
  5679. typedef struct _DEBUG_PROCESSOR_IDENTIFICATION_X86
  5680. {
  5681. ULONG Family;
  5682. ULONG Model;
  5683. ULONG Stepping;
  5684. CHAR VendorString[16];
  5685. } DEBUG_PROCESSOR_IDENTIFICATION_X86, *PDEBUG_PROCESSOR_IDENTIFICATION_X86;
  5686. typedef struct _DEBUG_PROCESSOR_IDENTIFICATION_ARM
  5687. {
  5688. ULONG Type;
  5689. ULONG Revision;
  5690. } DEBUG_PROCESSOR_IDENTIFICATION_ARM, *PDEBUG_PROCESSOR_IDENTIFICATION_ARM;
  5691. typedef union _DEBUG_PROCESSOR_IDENTIFICATION_ALL
  5692. {
  5693. DEBUG_PROCESSOR_IDENTIFICATION_ALPHA Alpha;
  5694. DEBUG_PROCESSOR_IDENTIFICATION_AMD64 Amd64;
  5695. DEBUG_PROCESSOR_IDENTIFICATION_IA64 Ia64;
  5696. DEBUG_PROCESSOR_IDENTIFICATION_X86 X86;
  5697. DEBUG_PROCESSOR_IDENTIFICATION_ARM Arm;
  5698. } DEBUG_PROCESSOR_IDENTIFICATION_ALL, *PDEBUG_PROCESSOR_IDENTIFICATION_ALL;
  5699. // Indices for ReadProcessorSystemData.
  5700. #define DEBUG_DATA_KPCR_OFFSET 0
  5701. #define DEBUG_DATA_KPRCB_OFFSET 1
  5702. #define DEBUG_DATA_KTHREAD_OFFSET 2
  5703. #define DEBUG_DATA_BASE_TRANSLATION_VIRTUAL_OFFSET 3
  5704. #define DEBUG_DATA_PROCESSOR_IDENTIFICATION 4
  5705. #define DEBUG_DATA_PROCESSOR_SPEED 5
  5706. #undef INTERFACE
  5707. #define INTERFACE IDebugDataSpaces
  5708. DECLARE_INTERFACE_(IDebugDataSpaces, IUnknown)
  5709. {
  5710. // IUnknown.
  5711. STDMETHOD(QueryInterface)(
  5712. THIS_
  5713. IN REFIID InterfaceId,
  5714. OUT PVOID* Interface
  5715. ) PURE;
  5716. STDMETHOD_(ULONG, AddRef)(
  5717. THIS
  5718. ) PURE;
  5719. STDMETHOD_(ULONG, Release)(
  5720. THIS
  5721. ) PURE;
  5722. // IDebugDataSpaces.
  5723. STDMETHOD(ReadVirtual)(
  5724. THIS_
  5725. IN ULONG64 Offset,
  5726. OUT PVOID Buffer,
  5727. IN ULONG BufferSize,
  5728. OUT OPTIONAL PULONG BytesRead
  5729. ) PURE;
  5730. STDMETHOD(WriteVirtual)(
  5731. THIS_
  5732. IN ULONG64 Offset,
  5733. IN PVOID Buffer,
  5734. IN ULONG BufferSize,
  5735. OUT OPTIONAL PULONG BytesWritten
  5736. ) PURE;
  5737. // SearchVirtual searches the given virtual
  5738. // address range for the given pattern. PatternSize
  5739. // gives the byte length of the pattern and PatternGranularity
  5740. // controls the granularity of comparisons during
  5741. // the search.
  5742. // For example, a DWORD-granular search would
  5743. // use a pattern granularity of four to search by DWORD
  5744. // increments.
  5745. STDMETHOD(SearchVirtual)(
  5746. THIS_
  5747. IN ULONG64 Offset,
  5748. IN ULONG64 Length,
  5749. IN PVOID Pattern,
  5750. IN ULONG PatternSize,
  5751. IN ULONG PatternGranularity,
  5752. OUT PULONG64 MatchOffset
  5753. ) PURE;
  5754. // These methods are identical to Read/WriteVirtual
  5755. // except that they avoid the kernel virtual memory
  5756. // cache entirely and are therefore useful for reading
  5757. // virtual memory which is inherently volatile, such
  5758. // as memory-mapped device areas, without contaminating
  5759. // or invalidating the cache.
  5760. // In user-mode they are the same as Read/WriteVirtual.
  5761. STDMETHOD(ReadVirtualUncached)(
  5762. THIS_
  5763. IN ULONG64 Offset,
  5764. OUT PVOID Buffer,
  5765. IN ULONG BufferSize,
  5766. OUT OPTIONAL PULONG BytesRead
  5767. ) PURE;
  5768. STDMETHOD(WriteVirtualUncached)(
  5769. THIS_
  5770. IN ULONG64 Offset,
  5771. IN PVOID Buffer,
  5772. IN ULONG BufferSize,
  5773. OUT OPTIONAL PULONG BytesWritten
  5774. ) PURE;
  5775. // The following two methods are convenience
  5776. // methods for accessing pointer values.
  5777. // They automatically convert between native pointers
  5778. // and canonical 64-bit values as necessary.
  5779. // These routines stop at the first failure.
  5780. STDMETHOD(ReadPointersVirtual)(
  5781. THIS_
  5782. IN ULONG Count,
  5783. IN ULONG64 Offset,
  5784. OUT /* size_is(Count) */ PULONG64 Ptrs
  5785. ) PURE;
  5786. STDMETHOD(WritePointersVirtual)(
  5787. THIS_
  5788. IN ULONG Count,
  5789. IN ULONG64 Offset,
  5790. IN /* size_is(Count) */ PULONG64 Ptrs
  5791. ) PURE;
  5792. // All non-virtual data spaces are only
  5793. // available when kernel debugging.
  5794. STDMETHOD(ReadPhysical)(
  5795. THIS_
  5796. IN ULONG64 Offset,
  5797. OUT PVOID Buffer,
  5798. IN ULONG BufferSize,
  5799. OUT OPTIONAL PULONG BytesRead
  5800. ) PURE;
  5801. STDMETHOD(WritePhysical)(
  5802. THIS_
  5803. IN ULONG64 Offset,
  5804. IN PVOID Buffer,
  5805. IN ULONG BufferSize,
  5806. OUT OPTIONAL PULONG BytesWritten
  5807. ) PURE;
  5808. STDMETHOD(ReadControl)(
  5809. THIS_
  5810. IN ULONG Processor,
  5811. IN ULONG64 Offset,
  5812. OUT PVOID Buffer,
  5813. IN ULONG BufferSize,
  5814. OUT OPTIONAL PULONG BytesRead
  5815. ) PURE;
  5816. STDMETHOD(WriteControl)(
  5817. THIS_
  5818. IN ULONG Processor,
  5819. IN ULONG64 Offset,
  5820. IN PVOID Buffer,
  5821. IN ULONG BufferSize,
  5822. OUT OPTIONAL PULONG BytesWritten
  5823. ) PURE;
  5824. STDMETHOD(ReadIo)(
  5825. THIS_
  5826. IN ULONG InterfaceType,
  5827. IN ULONG BusNumber,
  5828. IN ULONG AddressSpace,
  5829. IN ULONG64 Offset,
  5830. OUT PVOID Buffer,
  5831. IN ULONG BufferSize,
  5832. OUT OPTIONAL PULONG BytesRead
  5833. ) PURE;
  5834. STDMETHOD(WriteIo)(
  5835. THIS_
  5836. IN ULONG InterfaceType,
  5837. IN ULONG BusNumber,
  5838. IN ULONG AddressSpace,
  5839. IN ULONG64 Offset,
  5840. IN PVOID Buffer,
  5841. IN ULONG BufferSize,
  5842. OUT OPTIONAL PULONG BytesWritten
  5843. ) PURE;
  5844. STDMETHOD(ReadMsr)(
  5845. THIS_
  5846. IN ULONG Msr,
  5847. OUT PULONG64 Value
  5848. ) PURE;
  5849. STDMETHOD(WriteMsr)(
  5850. THIS_
  5851. IN ULONG Msr,
  5852. IN ULONG64 Value
  5853. ) PURE;
  5854. STDMETHOD(ReadBusData)(
  5855. THIS_
  5856. IN ULONG BusDataType,
  5857. IN ULONG BusNumber,
  5858. IN ULONG SlotNumber,
  5859. IN ULONG Offset,
  5860. OUT PVOID Buffer,
  5861. IN ULONG BufferSize,
  5862. OUT OPTIONAL PULONG BytesRead
  5863. ) PURE;
  5864. STDMETHOD(WriteBusData)(
  5865. THIS_
  5866. IN ULONG BusDataType,
  5867. IN ULONG BusNumber,
  5868. IN ULONG SlotNumber,
  5869. IN ULONG Offset,
  5870. IN PVOID Buffer,
  5871. IN ULONG BufferSize,
  5872. OUT OPTIONAL PULONG BytesWritten
  5873. ) PURE;
  5874. STDMETHOD(CheckLowMemory)(
  5875. THIS
  5876. ) PURE;
  5877. STDMETHOD(ReadDebuggerData)(
  5878. THIS_
  5879. IN ULONG Index,
  5880. OUT PVOID Buffer,
  5881. IN ULONG BufferSize,
  5882. OUT OPTIONAL PULONG DataSize
  5883. ) PURE;
  5884. STDMETHOD(ReadProcessorSystemData)(
  5885. THIS_
  5886. IN ULONG Processor,
  5887. IN ULONG Index,
  5888. OUT PVOID Buffer,
  5889. IN ULONG BufferSize,
  5890. OUT OPTIONAL PULONG DataSize
  5891. ) PURE;
  5892. };
  5893. //
  5894. // Handle data types and structures.
  5895. //
  5896. #define DEBUG_HANDLE_DATA_TYPE_BASIC 0
  5897. #define DEBUG_HANDLE_DATA_TYPE_TYPE_NAME 1
  5898. #define DEBUG_HANDLE_DATA_TYPE_OBJECT_NAME 2
  5899. #define DEBUG_HANDLE_DATA_TYPE_HANDLE_COUNT 3
  5900. #define DEBUG_HANDLE_DATA_TYPE_TYPE_NAME_WIDE 4
  5901. #define DEBUG_HANDLE_DATA_TYPE_OBJECT_NAME_WIDE 5
  5902. typedef struct _DEBUG_HANDLE_DATA_BASIC
  5903. {
  5904. ULONG TypeNameSize;
  5905. ULONG ObjectNameSize;
  5906. ULONG Attributes;
  5907. ULONG GrantedAccess;
  5908. ULONG HandleCount;
  5909. ULONG PointerCount;
  5910. } DEBUG_HANDLE_DATA_BASIC, *PDEBUG_HANDLE_DATA_BASIC;
  5911. #undef INTERFACE
  5912. #define INTERFACE IDebugDataSpaces2
  5913. DECLARE_INTERFACE_(IDebugDataSpaces2, IUnknown)
  5914. {
  5915. // IUnknown.
  5916. STDMETHOD(QueryInterface)(
  5917. THIS_
  5918. IN REFIID InterfaceId,
  5919. OUT PVOID* Interface
  5920. ) PURE;
  5921. STDMETHOD_(ULONG, AddRef)(
  5922. THIS
  5923. ) PURE;
  5924. STDMETHOD_(ULONG, Release)(
  5925. THIS
  5926. ) PURE;
  5927. // IDebugDataSpaces.
  5928. STDMETHOD(ReadVirtual)(
  5929. THIS_
  5930. IN ULONG64 Offset,
  5931. OUT PVOID Buffer,
  5932. IN ULONG BufferSize,
  5933. OUT OPTIONAL PULONG BytesRead
  5934. ) PURE;
  5935. STDMETHOD(WriteVirtual)(
  5936. THIS_
  5937. IN ULONG64 Offset,
  5938. IN PVOID Buffer,
  5939. IN ULONG BufferSize,
  5940. OUT OPTIONAL PULONG BytesWritten
  5941. ) PURE;
  5942. // SearchVirtual searches the given virtual
  5943. // address range for the given pattern. PatternSize
  5944. // gives the byte length of the pattern and PatternGranularity
  5945. // controls the granularity of comparisons during
  5946. // the search.
  5947. // For example, a DWORD-granular search would
  5948. // use a pattern granularity of four to search by DWORD
  5949. // increments.
  5950. STDMETHOD(SearchVirtual)(
  5951. THIS_
  5952. IN ULONG64 Offset,
  5953. IN ULONG64 Length,
  5954. IN PVOID Pattern,
  5955. IN ULONG PatternSize,
  5956. IN ULONG PatternGranularity,
  5957. OUT PULONG64 MatchOffset
  5958. ) PURE;
  5959. // These methods are identical to Read/WriteVirtual
  5960. // except that they avoid the kernel virtual memory
  5961. // cache entirely and are therefore useful for reading
  5962. // virtual memory which is inherently volatile, such
  5963. // as memory-mapped device areas, without contaminating
  5964. // or invalidating the cache.
  5965. // In user-mode they are the same as Read/WriteVirtual.
  5966. STDMETHOD(ReadVirtualUncached)(
  5967. THIS_
  5968. IN ULONG64 Offset,
  5969. OUT PVOID Buffer,
  5970. IN ULONG BufferSize,
  5971. OUT OPTIONAL PULONG BytesRead
  5972. ) PURE;
  5973. STDMETHOD(WriteVirtualUncached)(
  5974. THIS_
  5975. IN ULONG64 Offset,
  5976. IN PVOID Buffer,
  5977. IN ULONG BufferSize,
  5978. OUT OPTIONAL PULONG BytesWritten
  5979. ) PURE;
  5980. // The following two methods are convenience
  5981. // methods for accessing pointer values.
  5982. // They automatically convert between native pointers
  5983. // and canonical 64-bit values as necessary.
  5984. // These routines stop at the first failure.
  5985. STDMETHOD(ReadPointersVirtual)(
  5986. THIS_
  5987. IN ULONG Count,
  5988. IN ULONG64 Offset,
  5989. OUT /* size_is(Count) */ PULONG64 Ptrs
  5990. ) PURE;
  5991. STDMETHOD(WritePointersVirtual)(
  5992. THIS_
  5993. IN ULONG Count,
  5994. IN ULONG64 Offset,
  5995. IN /* size_is(Count) */ PULONG64 Ptrs
  5996. ) PURE;
  5997. // All non-virtual data spaces are only
  5998. // available when kernel debugging.
  5999. STDMETHOD(ReadPhysical)(
  6000. THIS_
  6001. IN ULONG64 Offset,
  6002. OUT PVOID Buffer,
  6003. IN ULONG BufferSize,
  6004. OUT OPTIONAL PULONG BytesRead
  6005. ) PURE;
  6006. STDMETHOD(WritePhysical)(
  6007. THIS_
  6008. IN ULONG64 Offset,
  6009. IN PVOID Buffer,
  6010. IN ULONG BufferSize,
  6011. OUT OPTIONAL PULONG BytesWritten
  6012. ) PURE;
  6013. STDMETHOD(ReadControl)(
  6014. THIS_
  6015. IN ULONG Processor,
  6016. IN ULONG64 Offset,
  6017. OUT PVOID Buffer,
  6018. IN ULONG BufferSize,
  6019. OUT OPTIONAL PULONG BytesRead
  6020. ) PURE;
  6021. STDMETHOD(WriteControl)(
  6022. THIS_
  6023. IN ULONG Processor,
  6024. IN ULONG64 Offset,
  6025. IN PVOID Buffer,
  6026. IN ULONG BufferSize,
  6027. OUT OPTIONAL PULONG BytesWritten
  6028. ) PURE;
  6029. STDMETHOD(ReadIo)(
  6030. THIS_
  6031. IN ULONG InterfaceType,
  6032. IN ULONG BusNumber,
  6033. IN ULONG AddressSpace,
  6034. IN ULONG64 Offset,
  6035. OUT PVOID Buffer,
  6036. IN ULONG BufferSize,
  6037. OUT OPTIONAL PULONG BytesRead
  6038. ) PURE;
  6039. STDMETHOD(WriteIo)(
  6040. THIS_
  6041. IN ULONG InterfaceType,
  6042. IN ULONG BusNumber,
  6043. IN ULONG AddressSpace,
  6044. IN ULONG64 Offset,
  6045. IN PVOID Buffer,
  6046. IN ULONG BufferSize,
  6047. OUT OPTIONAL PULONG BytesWritten
  6048. ) PURE;
  6049. STDMETHOD(ReadMsr)(
  6050. THIS_
  6051. IN ULONG Msr,
  6052. OUT PULONG64 Value
  6053. ) PURE;
  6054. STDMETHOD(WriteMsr)(
  6055. THIS_
  6056. IN ULONG Msr,
  6057. IN ULONG64 Value
  6058. ) PURE;
  6059. STDMETHOD(ReadBusData)(
  6060. THIS_
  6061. IN ULONG BusDataType,
  6062. IN ULONG BusNumber,
  6063. IN ULONG SlotNumber,
  6064. IN ULONG Offset,
  6065. OUT PVOID Buffer,
  6066. IN ULONG BufferSize,
  6067. OUT OPTIONAL PULONG BytesRead
  6068. ) PURE;
  6069. STDMETHOD(WriteBusData)(
  6070. THIS_
  6071. IN ULONG BusDataType,
  6072. IN ULONG BusNumber,
  6073. IN ULONG SlotNumber,
  6074. IN ULONG Offset,
  6075. IN PVOID Buffer,
  6076. IN ULONG BufferSize,
  6077. OUT OPTIONAL PULONG BytesWritten
  6078. ) PURE;
  6079. STDMETHOD(CheckLowMemory)(
  6080. THIS
  6081. ) PURE;
  6082. STDMETHOD(ReadDebuggerData)(
  6083. THIS_
  6084. IN ULONG Index,
  6085. OUT PVOID Buffer,
  6086. IN ULONG BufferSize,
  6087. OUT OPTIONAL PULONG DataSize
  6088. ) PURE;
  6089. STDMETHOD(ReadProcessorSystemData)(
  6090. THIS_
  6091. IN ULONG Processor,
  6092. IN ULONG Index,
  6093. OUT PVOID Buffer,
  6094. IN ULONG BufferSize,
  6095. OUT OPTIONAL PULONG DataSize
  6096. ) PURE;
  6097. // IDebugDataSpaces2.
  6098. STDMETHOD(VirtualToPhysical)(
  6099. THIS_
  6100. IN ULONG64 Virtual,
  6101. OUT PULONG64 Physical
  6102. ) PURE;
  6103. // Returns the physical addresses for the
  6104. // N levels of the systems paging structures.
  6105. // Level zero is the starting base physical
  6106. // address for virtual translations.
  6107. // Levels one-(N-1) will point to the appropriate
  6108. // paging descriptor for the virtual address at
  6109. // the given level of the paging hierarchy. The
  6110. // exact number of levels depends on many factors.
  6111. // The last level will be the fully translated
  6112. // physical address, matching what VirtualToPhysical
  6113. // returns. If the address can only be partially
  6114. // translated S_FALSE is returned.
  6115. STDMETHOD(GetVirtualTranslationPhysicalOffsets)(
  6116. THIS_
  6117. IN ULONG64 Virtual,
  6118. OUT OPTIONAL /* size_is(OffsetsSize) */ PULONG64 Offsets,
  6119. IN ULONG OffsetsSize,
  6120. OUT OPTIONAL PULONG Levels
  6121. ) PURE;
  6122. // System handle data is accessible in certain
  6123. // debug sessions. The particular data available
  6124. // varies from session to session and platform
  6125. // to platform.
  6126. STDMETHOD(ReadHandleData)(
  6127. THIS_
  6128. IN ULONG64 Handle,
  6129. IN ULONG DataType,
  6130. OUT OPTIONAL PVOID Buffer,
  6131. IN ULONG BufferSize,
  6132. OUT OPTIONAL PULONG DataSize
  6133. ) PURE;
  6134. // Fills memory with the given pattern.
  6135. // The fill stops at the first non-writable byte.
  6136. STDMETHOD(FillVirtual)(
  6137. THIS_
  6138. IN ULONG64 Start,
  6139. IN ULONG Size,
  6140. IN PVOID Pattern,
  6141. IN ULONG PatternSize,
  6142. OUT OPTIONAL PULONG Filled
  6143. ) PURE;
  6144. STDMETHOD(FillPhysical)(
  6145. THIS_
  6146. IN ULONG64 Start,
  6147. IN ULONG Size,
  6148. IN PVOID Pattern,
  6149. IN ULONG PatternSize,
  6150. OUT OPTIONAL PULONG Filled
  6151. ) PURE;
  6152. // Queries virtual memory mapping information given
  6153. // an address similarly to the Win32 API VirtualQuery.
  6154. // MEMORY_BASIC_INFORMATION64 is defined in crash.h.
  6155. // This method currently only works for user-mode sessions.
  6156. STDMETHOD(QueryVirtual)(
  6157. THIS_
  6158. IN ULONG64 Offset,
  6159. OUT PMEMORY_BASIC_INFORMATION64 Info
  6160. ) PURE;
  6161. };
  6162. #undef INTERFACE
  6163. #define INTERFACE IDebugDataSpaces3
  6164. DECLARE_INTERFACE_(IDebugDataSpaces3, IUnknown)
  6165. {
  6166. // IUnknown.
  6167. STDMETHOD(QueryInterface)(
  6168. THIS_
  6169. IN REFIID InterfaceId,
  6170. OUT PVOID* Interface
  6171. ) PURE;
  6172. STDMETHOD_(ULONG, AddRef)(
  6173. THIS
  6174. ) PURE;
  6175. STDMETHOD_(ULONG, Release)(
  6176. THIS
  6177. ) PURE;
  6178. // IDebugDataSpaces.
  6179. STDMETHOD(ReadVirtual)(
  6180. THIS_
  6181. IN ULONG64 Offset,
  6182. OUT PVOID Buffer,
  6183. IN ULONG BufferSize,
  6184. OUT OPTIONAL PULONG BytesRead
  6185. ) PURE;
  6186. STDMETHOD(WriteVirtual)(
  6187. THIS_
  6188. IN ULONG64 Offset,
  6189. IN PVOID Buffer,
  6190. IN ULONG BufferSize,
  6191. OUT OPTIONAL PULONG BytesWritten
  6192. ) PURE;
  6193. // SearchVirtual searches the given virtual
  6194. // address range for the given pattern. PatternSize
  6195. // gives the byte length of the pattern and PatternGranularity
  6196. // controls the granularity of comparisons during
  6197. // the search.
  6198. // For example, a DWORD-granular search would
  6199. // use a pattern granularity of four to search by DWORD
  6200. // increments.
  6201. STDMETHOD(SearchVirtual)(
  6202. THIS_
  6203. IN ULONG64 Offset,
  6204. IN ULONG64 Length,
  6205. IN PVOID Pattern,
  6206. IN ULONG PatternSize,
  6207. IN ULONG PatternGranularity,
  6208. OUT PULONG64 MatchOffset
  6209. ) PURE;
  6210. // These methods are identical to Read/WriteVirtual
  6211. // except that they avoid the kernel virtual memory
  6212. // cache entirely and are therefore useful for reading
  6213. // virtual memory which is inherently volatile, such
  6214. // as memory-mapped device areas, without contaminating
  6215. // or invalidating the cache.
  6216. // In user-mode they are the same as Read/WriteVirtual.
  6217. STDMETHOD(ReadVirtualUncached)(
  6218. THIS_
  6219. IN ULONG64 Offset,
  6220. OUT PVOID Buffer,
  6221. IN ULONG BufferSize,
  6222. OUT OPTIONAL PULONG BytesRead
  6223. ) PURE;
  6224. STDMETHOD(WriteVirtualUncached)(
  6225. THIS_
  6226. IN ULONG64 Offset,
  6227. IN PVOID Buffer,
  6228. IN ULONG BufferSize,
  6229. OUT OPTIONAL PULONG BytesWritten
  6230. ) PURE;
  6231. // The following two methods are convenience
  6232. // methods for accessing pointer values.
  6233. // They automatically convert between native pointers
  6234. // and canonical 64-bit values as necessary.
  6235. // These routines stop at the first failure.
  6236. STDMETHOD(ReadPointersVirtual)(
  6237. THIS_
  6238. IN ULONG Count,
  6239. IN ULONG64 Offset,
  6240. OUT /* size_is(Count) */ PULONG64 Ptrs
  6241. ) PURE;
  6242. STDMETHOD(WritePointersVirtual)(
  6243. THIS_
  6244. IN ULONG Count,
  6245. IN ULONG64 Offset,
  6246. IN /* size_is(Count) */ PULONG64 Ptrs
  6247. ) PURE;
  6248. // All non-virtual data spaces are only
  6249. // available when kernel debugging.
  6250. STDMETHOD(ReadPhysical)(
  6251. THIS_
  6252. IN ULONG64 Offset,
  6253. OUT PVOID Buffer,
  6254. IN ULONG BufferSize,
  6255. OUT OPTIONAL PULONG BytesRead
  6256. ) PURE;
  6257. STDMETHOD(WritePhysical)(
  6258. THIS_
  6259. IN ULONG64 Offset,
  6260. IN PVOID Buffer,
  6261. IN ULONG BufferSize,
  6262. OUT OPTIONAL PULONG BytesWritten
  6263. ) PURE;
  6264. STDMETHOD(ReadControl)(
  6265. THIS_
  6266. IN ULONG Processor,
  6267. IN ULONG64 Offset,
  6268. OUT PVOID Buffer,
  6269. IN ULONG BufferSize,
  6270. OUT OPTIONAL PULONG BytesRead
  6271. ) PURE;
  6272. STDMETHOD(WriteControl)(
  6273. THIS_
  6274. IN ULONG Processor,
  6275. IN ULONG64 Offset,
  6276. IN PVOID Buffer,
  6277. IN ULONG BufferSize,
  6278. OUT OPTIONAL PULONG BytesWritten
  6279. ) PURE;
  6280. STDMETHOD(ReadIo)(
  6281. THIS_
  6282. IN ULONG InterfaceType,
  6283. IN ULONG BusNumber,
  6284. IN ULONG AddressSpace,
  6285. IN ULONG64 Offset,
  6286. OUT PVOID Buffer,
  6287. IN ULONG BufferSize,
  6288. OUT OPTIONAL PULONG BytesRead
  6289. ) PURE;
  6290. STDMETHOD(WriteIo)(
  6291. THIS_
  6292. IN ULONG InterfaceType,
  6293. IN ULONG BusNumber,
  6294. IN ULONG AddressSpace,
  6295. IN ULONG64 Offset,
  6296. IN PVOID Buffer,
  6297. IN ULONG BufferSize,
  6298. OUT OPTIONAL PULONG BytesWritten
  6299. ) PURE;
  6300. STDMETHOD(ReadMsr)(
  6301. THIS_
  6302. IN ULONG Msr,
  6303. OUT PULONG64 Value
  6304. ) PURE;
  6305. STDMETHOD(WriteMsr)(
  6306. THIS_
  6307. IN ULONG Msr,
  6308. IN ULONG64 Value
  6309. ) PURE;
  6310. STDMETHOD(ReadBusData)(
  6311. THIS_
  6312. IN ULONG BusDataType,
  6313. IN ULONG BusNumber,
  6314. IN ULONG SlotNumber,
  6315. IN ULONG Offset,
  6316. OUT PVOID Buffer,
  6317. IN ULONG BufferSize,
  6318. OUT OPTIONAL PULONG BytesRead
  6319. ) PURE;
  6320. STDMETHOD(WriteBusData)(
  6321. THIS_
  6322. IN ULONG BusDataType,
  6323. IN ULONG BusNumber,
  6324. IN ULONG SlotNumber,
  6325. IN ULONG Offset,
  6326. IN PVOID Buffer,
  6327. IN ULONG BufferSize,
  6328. OUT OPTIONAL PULONG BytesWritten
  6329. ) PURE;
  6330. STDMETHOD(CheckLowMemory)(
  6331. THIS
  6332. ) PURE;
  6333. STDMETHOD(ReadDebuggerData)(
  6334. THIS_
  6335. IN ULONG Index,
  6336. OUT PVOID Buffer,
  6337. IN ULONG BufferSize,
  6338. OUT OPTIONAL PULONG DataSize
  6339. ) PURE;
  6340. STDMETHOD(ReadProcessorSystemData)(
  6341. THIS_
  6342. IN ULONG Processor,
  6343. IN ULONG Index,
  6344. OUT PVOID Buffer,
  6345. IN ULONG BufferSize,
  6346. OUT OPTIONAL PULONG DataSize
  6347. ) PURE;
  6348. // IDebugDataSpaces2.
  6349. STDMETHOD(VirtualToPhysical)(
  6350. THIS_
  6351. IN ULONG64 Virtual,
  6352. OUT PULONG64 Physical
  6353. ) PURE;
  6354. // Returns the physical addresses for the
  6355. // N levels of the systems paging structures.
  6356. // Level zero is the starting base physical
  6357. // address for virtual translations.
  6358. // Levels one-(N-1) will point to the appropriate
  6359. // paging descriptor for the virtual address at
  6360. // the given level of the paging hierarchy. The
  6361. // exact number of levels depends on many factors.
  6362. // The last level will be the fully translated
  6363. // physical address, matching what VirtualToPhysical
  6364. // returns. If the address can only be partially
  6365. // translated S_FALSE is returned.
  6366. STDMETHOD(GetVirtualTranslationPhysicalOffsets)(
  6367. THIS_
  6368. IN ULONG64 Virtual,
  6369. OUT OPTIONAL /* size_is(OffsetsSize) */ PULONG64 Offsets,
  6370. IN ULONG OffsetsSize,
  6371. OUT OPTIONAL PULONG Levels
  6372. ) PURE;
  6373. // System handle data is accessible in certain
  6374. // debug sessions. The particular data available
  6375. // varies from session to session and platform
  6376. // to platform.
  6377. STDMETHOD(ReadHandleData)(
  6378. THIS_
  6379. IN ULONG64 Handle,
  6380. IN ULONG DataType,
  6381. OUT OPTIONAL PVOID Buffer,
  6382. IN ULONG BufferSize,
  6383. OUT OPTIONAL PULONG DataSize
  6384. ) PURE;
  6385. // Fills memory with the given pattern.
  6386. // The fill stops at the first non-writable byte.
  6387. STDMETHOD(FillVirtual)(
  6388. THIS_
  6389. IN ULONG64 Start,
  6390. IN ULONG Size,
  6391. IN PVOID Pattern,
  6392. IN ULONG PatternSize,
  6393. OUT OPTIONAL PULONG Filled
  6394. ) PURE;
  6395. STDMETHOD(FillPhysical)(
  6396. THIS_
  6397. IN ULONG64 Start,
  6398. IN ULONG Size,
  6399. IN PVOID Pattern,
  6400. IN ULONG PatternSize,
  6401. OUT OPTIONAL PULONG Filled
  6402. ) PURE;
  6403. // Queries virtual memory mapping information given
  6404. // an address similarly to the Win32 API VirtualQuery.
  6405. // MEMORY_BASIC_INFORMATION64 is defined in crash.h.
  6406. // This method currently only works for user-mode sessions.
  6407. STDMETHOD(QueryVirtual)(
  6408. THIS_
  6409. IN ULONG64 Offset,
  6410. OUT PMEMORY_BASIC_INFORMATION64 Info
  6411. ) PURE;
  6412. // IDebugDataSpaces3.
  6413. // Convenience method for reading an image
  6414. // header from virtual memory. Given the
  6415. // image base, this method determines where
  6416. // the NT headers are, validates the necessary
  6417. // markers and converts the headers into
  6418. // 64-bit form for consistency.
  6419. // A caller can check whether the headers were
  6420. // originally 32-bit by checking the optional
  6421. // header magic value.
  6422. // This method will not read ROM headers.
  6423. STDMETHOD(ReadImageNtHeaders)(
  6424. THIS_
  6425. IN ULONG64 ImageBase,
  6426. OUT PIMAGE_NT_HEADERS64 Headers
  6427. ) PURE;
  6428. // Some debug sessions have arbitrary additional
  6429. // data available. For example, additional dump
  6430. // information files may contain extra information
  6431. // gathered at the same time as the primary dump.
  6432. // Such information is tagged with a unique identifier
  6433. // and can only be retrieved via the tag.
  6434. // Tagged data cannot be partially available; the
  6435. // tagged block is either fully present or completely
  6436. // absent.
  6437. STDMETHOD(ReadTagged)(
  6438. THIS_
  6439. IN LPGUID Tag,
  6440. IN ULONG Offset,
  6441. OUT OPTIONAL PVOID Buffer,
  6442. IN ULONG BufferSize,
  6443. OUT OPTIONAL PULONG TotalSize
  6444. ) PURE;
  6445. STDMETHOD(StartEnumTagged)(
  6446. THIS_
  6447. OUT PULONG64 Handle
  6448. ) PURE;
  6449. STDMETHOD(GetNextTagged)(
  6450. THIS_
  6451. IN ULONG64 Handle,
  6452. OUT LPGUID Tag,
  6453. OUT PULONG Size
  6454. ) PURE;
  6455. STDMETHOD(EndEnumTagged)(
  6456. THIS_
  6457. IN ULONG64 Handle
  6458. ) PURE;
  6459. };
  6460. //----------------------------------------------------------------------------
  6461. //
  6462. // IDebugEventCallbacks.
  6463. //
  6464. //----------------------------------------------------------------------------
  6465. // Interest mask bits.
  6466. #define DEBUG_EVENT_BREAKPOINT 0x00000001
  6467. #define DEBUG_EVENT_EXCEPTION 0x00000002
  6468. #define DEBUG_EVENT_CREATE_THREAD 0x00000004
  6469. #define DEBUG_EVENT_EXIT_THREAD 0x00000008
  6470. #define DEBUG_EVENT_CREATE_PROCESS 0x00000010
  6471. #define DEBUG_EVENT_EXIT_PROCESS 0x00000020
  6472. #define DEBUG_EVENT_LOAD_MODULE 0x00000040
  6473. #define DEBUG_EVENT_UNLOAD_MODULE 0x00000080
  6474. #define DEBUG_EVENT_SYSTEM_ERROR 0x00000100
  6475. #define DEBUG_EVENT_SESSION_STATUS 0x00000200
  6476. #define DEBUG_EVENT_CHANGE_DEBUGGEE_STATE 0x00000400
  6477. #define DEBUG_EVENT_CHANGE_ENGINE_STATE 0x00000800
  6478. #define DEBUG_EVENT_CHANGE_SYMBOL_STATE 0x00001000
  6479. // SessionStatus flags.
  6480. // A debuggee has been discovered for the session.
  6481. #define DEBUG_SESSION_ACTIVE 0x00000000
  6482. // The session has been ended by EndSession.
  6483. #define DEBUG_SESSION_END_SESSION_ACTIVE_TERMINATE 0x00000001
  6484. #define DEBUG_SESSION_END_SESSION_ACTIVE_DETACH 0x00000002
  6485. #define DEBUG_SESSION_END_SESSION_PASSIVE 0x00000003
  6486. // The debuggee has run to completion. User-mode only.
  6487. #define DEBUG_SESSION_END 0x00000004
  6488. // The target machine has rebooted. Kernel-mode only.
  6489. #define DEBUG_SESSION_REBOOT 0x00000005
  6490. // The target machine has hibernated. Kernel-mode only.
  6491. #define DEBUG_SESSION_HIBERNATE 0x00000006
  6492. // The engine was unable to continue the session.
  6493. #define DEBUG_SESSION_FAILURE 0x00000007
  6494. // ChangeDebuggeeState flags.
  6495. // The debuggees state has changed generally, such
  6496. // as when the debuggee has been executing.
  6497. // Argument is zero.
  6498. #define DEBUG_CDS_ALL 0xffffffff
  6499. // Registers have changed. If only a single register
  6500. // changed, argument is the index of the register.
  6501. // Otherwise it is DEBUG_ANY_ID.
  6502. #define DEBUG_CDS_REGISTERS 0x00000001
  6503. // Data spaces have changed. If only a single
  6504. // space was affected, argument is the data
  6505. // space. Otherwise it is DEBUG_ANY_ID.
  6506. #define DEBUG_CDS_DATA 0x00000002
  6507. // ChangeEngineState flags.
  6508. // The engine state has changed generally.
  6509. // Argument is zero.
  6510. #define DEBUG_CES_ALL 0xffffffff
  6511. // Current thread changed. This may imply a change
  6512. // of system and process also. Argument is the ID of the new
  6513. // current thread or DEBUG_ANY_ID if no thread is current.
  6514. #define DEBUG_CES_CURRENT_THREAD 0x00000001
  6515. // Effective processor changed. Argument is the
  6516. // new processor type.
  6517. #define DEBUG_CES_EFFECTIVE_PROCESSOR 0x00000002
  6518. // Breakpoints changed. If only a single breakpoint
  6519. // changed, argument is the ID of the breakpoint.
  6520. // Otherwise it is DEBUG_ANY_ID.
  6521. #define DEBUG_CES_BREAKPOINTS 0x00000004
  6522. // Code interpretation level changed. Argument is
  6523. // the new level.
  6524. #define DEBUG_CES_CODE_LEVEL 0x00000008
  6525. // Execution status changed. Argument is the new
  6526. // execution status.
  6527. #define DEBUG_CES_EXECUTION_STATUS 0x00000010
  6528. // Engine options have changed. Argument is the new
  6529. // options value.
  6530. #define DEBUG_CES_ENGINE_OPTIONS 0x00000020
  6531. // Log file information has changed. Argument
  6532. // is TRUE if a log file was opened and FALSE if
  6533. // a log file was closed.
  6534. #define DEBUG_CES_LOG_FILE 0x00000040
  6535. // Default number radix has changed. Argument
  6536. // is the new radix.
  6537. #define DEBUG_CES_RADIX 0x00000080
  6538. // Event filters changed. If only a single filter
  6539. // changed the argument is the filter's index,
  6540. // otherwise it is DEBUG_ANY_ID.
  6541. #define DEBUG_CES_EVENT_FILTERS 0x00000100
  6542. // Process options have changed. Argument is the new
  6543. // options value.
  6544. #define DEBUG_CES_PROCESS_OPTIONS 0x00000200
  6545. // Extensions have been added or removed.
  6546. #define DEBUG_CES_EXTENSIONS 0x00000400
  6547. // Systems have been added or removed. The argument
  6548. // is the system ID. Systems, unlike processes and
  6549. // threads, may be created at any time and not
  6550. // just during WaitForEvent.
  6551. #define DEBUG_CES_SYSTEMS 0x00000800
  6552. // Assembly/disassembly options have changed. Argument
  6553. // is the new options value.
  6554. #define DEBUG_CES_ASSEMBLY_OPTIONS 0x00001000
  6555. // Expression syntax has changed. Argument
  6556. // is the new syntax value.
  6557. #define DEBUG_CES_EXPRESSION_SYNTAX 0x00002000
  6558. // Text replacements have changed.
  6559. #define DEBUG_CES_TEXT_REPLACEMENTS 0x00004000
  6560. // ChangeSymbolState flags.
  6561. // Symbol state has changed generally, such
  6562. // as after reload operations. Argument is zero.
  6563. #define DEBUG_CSS_ALL 0xffffffff
  6564. // Modules have been loaded. If only a
  6565. // single module changed, argument is the
  6566. // base address of the module. Otherwise
  6567. // it is zero.
  6568. #define DEBUG_CSS_LOADS 0x00000001
  6569. // Modules have been unloaded. If only a
  6570. // single module changed, argument is the
  6571. // base address of the module. Otherwise
  6572. // it is zero.
  6573. #define DEBUG_CSS_UNLOADS 0x00000002
  6574. // Current symbol scope changed.
  6575. #define DEBUG_CSS_SCOPE 0x00000004
  6576. // Paths have changed.
  6577. #define DEBUG_CSS_PATHS 0x00000008
  6578. // Symbol options have changed. Argument is the new
  6579. // options value.
  6580. #define DEBUG_CSS_SYMBOL_OPTIONS 0x00000010
  6581. // Type options have changed. Argument is the new
  6582. // options value.
  6583. #define DEBUG_CSS_TYPE_OPTIONS 0x00000020
  6584. #undef INTERFACE
  6585. #define INTERFACE IDebugEventCallbacks
  6586. DECLARE_INTERFACE_(IDebugEventCallbacks, IUnknown)
  6587. {
  6588. // IUnknown.
  6589. STDMETHOD(QueryInterface)(
  6590. THIS_
  6591. IN REFIID InterfaceId,
  6592. OUT PVOID* Interface
  6593. ) PURE;
  6594. STDMETHOD_(ULONG, AddRef)(
  6595. THIS
  6596. ) PURE;
  6597. STDMETHOD_(ULONG, Release)(
  6598. THIS
  6599. ) PURE;
  6600. // IDebugEventCallbacks.
  6601. // The engine calls GetInterestMask once when
  6602. // the event callbacks are set for a client.
  6603. STDMETHOD(GetInterestMask)(
  6604. THIS_
  6605. OUT PULONG Mask
  6606. ) PURE;
  6607. // A breakpoint event is generated when
  6608. // a breakpoint exception is received and
  6609. // it can be mapped to an existing breakpoint.
  6610. // The callback method is given a reference
  6611. // to the breakpoint and should release it when
  6612. // it is done with it.
  6613. STDMETHOD(Breakpoint)(
  6614. THIS_
  6615. IN PDEBUG_BREAKPOINT Bp
  6616. ) PURE;
  6617. // Exceptions include breaks which cannot
  6618. // be mapped to an existing breakpoint
  6619. // instance.
  6620. STDMETHOD(Exception)(
  6621. THIS_
  6622. IN PEXCEPTION_RECORD64 Exception,
  6623. IN ULONG FirstChance
  6624. ) PURE;
  6625. // Any of these values can be zero if they
  6626. // cannot be provided by the engine.
  6627. // Currently the kernel does not return thread
  6628. // or process change events.
  6629. STDMETHOD(CreateThread)(
  6630. THIS_
  6631. IN ULONG64 Handle,
  6632. IN ULONG64 DataOffset,
  6633. IN ULONG64 StartOffset
  6634. ) PURE;
  6635. STDMETHOD(ExitThread)(
  6636. THIS_
  6637. IN ULONG ExitCode
  6638. ) PURE;
  6639. // Any of these values can be zero if they
  6640. // cannot be provided by the engine.
  6641. STDMETHOD(CreateProcess)(
  6642. THIS_
  6643. IN ULONG64 ImageFileHandle,
  6644. IN ULONG64 Handle,
  6645. IN ULONG64 BaseOffset,
  6646. IN ULONG ModuleSize,
  6647. IN PCSTR ModuleName,
  6648. IN PCSTR ImageName,
  6649. IN ULONG CheckSum,
  6650. IN ULONG TimeDateStamp,
  6651. IN ULONG64 InitialThreadHandle,
  6652. IN ULONG64 ThreadDataOffset,
  6653. IN ULONG64 StartOffset
  6654. ) PURE;
  6655. STDMETHOD(ExitProcess)(
  6656. THIS_
  6657. IN ULONG ExitCode
  6658. ) PURE;
  6659. // Any of these values may be zero.
  6660. STDMETHOD(LoadModule)(
  6661. THIS_
  6662. IN ULONG64 ImageFileHandle,
  6663. IN ULONG64 BaseOffset,
  6664. IN ULONG ModuleSize,
  6665. IN PCSTR ModuleName,
  6666. IN PCSTR ImageName,
  6667. IN ULONG CheckSum,
  6668. IN ULONG TimeDateStamp
  6669. ) PURE;
  6670. STDMETHOD(UnloadModule)(
  6671. THIS_
  6672. IN PCSTR ImageBaseName,
  6673. IN ULONG64 BaseOffset
  6674. ) PURE;
  6675. STDMETHOD(SystemError)(
  6676. THIS_
  6677. IN ULONG Error,
  6678. IN ULONG Level
  6679. ) PURE;
  6680. // Session status is synchronous like the other
  6681. // wait callbacks but it is called as the state
  6682. // of the session is changing rather than at
  6683. // specific events so its return value does not
  6684. // influence waiting. Implementations should just
  6685. // return DEBUG_STATUS_NO_CHANGE.
  6686. // Also, because some of the status
  6687. // notifications are very early or very
  6688. // late in the session lifetime there may not be
  6689. // current processes or threads when the notification
  6690. // is generated.
  6691. STDMETHOD(SessionStatus)(
  6692. THIS_
  6693. IN ULONG Status
  6694. ) PURE;
  6695. // The following callbacks are informational
  6696. // callbacks notifying the provider about
  6697. // changes in debug state. The return value
  6698. // of these callbacks is ignored. Implementations
  6699. // can not call back into the engine.
  6700. // Debuggee state, such as registers or data spaces,
  6701. // has changed.
  6702. STDMETHOD(ChangeDebuggeeState)(
  6703. THIS_
  6704. IN ULONG Flags,
  6705. IN ULONG64 Argument
  6706. ) PURE;
  6707. // Engine state has changed.
  6708. STDMETHOD(ChangeEngineState)(
  6709. THIS_
  6710. IN ULONG Flags,
  6711. IN ULONG64 Argument
  6712. ) PURE;
  6713. // Symbol state has changed.
  6714. STDMETHOD(ChangeSymbolState)(
  6715. THIS_
  6716. IN ULONG Flags,
  6717. IN ULONG64 Argument
  6718. ) PURE;
  6719. };
  6720. //----------------------------------------------------------------------------
  6721. //
  6722. // IDebugInputCallbacks.
  6723. //
  6724. //----------------------------------------------------------------------------
  6725. #undef INTERFACE
  6726. #define INTERFACE IDebugInputCallbacks
  6727. DECLARE_INTERFACE_(IDebugInputCallbacks, IUnknown)
  6728. {
  6729. // IUnknown.
  6730. STDMETHOD(QueryInterface)(
  6731. THIS_
  6732. IN REFIID InterfaceId,
  6733. OUT PVOID* Interface
  6734. ) PURE;
  6735. STDMETHOD_(ULONG, AddRef)(
  6736. THIS
  6737. ) PURE;
  6738. STDMETHOD_(ULONG, Release)(
  6739. THIS
  6740. ) PURE;
  6741. // IDebugInputCallbacks.
  6742. // A call to the StartInput method is a request for
  6743. // a line of input from any client. The returned input
  6744. // should always be zero-terminated. The buffer size
  6745. // provided is only a guideline. A client can return
  6746. // more if necessary and the engine will truncate it
  6747. // before returning from IDebugControl::Input.
  6748. // The return value is ignored.
  6749. STDMETHOD(StartInput)(
  6750. THIS_
  6751. IN ULONG BufferSize
  6752. ) PURE;
  6753. // The return value is ignored.
  6754. STDMETHOD(EndInput)(
  6755. THIS
  6756. ) PURE;
  6757. };
  6758. //----------------------------------------------------------------------------
  6759. //
  6760. // IDebugOutputCallbacks.
  6761. //
  6762. //----------------------------------------------------------------------------
  6763. #undef INTERFACE
  6764. #define INTERFACE IDebugOutputCallbacks
  6765. DECLARE_INTERFACE_(IDebugOutputCallbacks, IUnknown)
  6766. {
  6767. // IUnknown.
  6768. STDMETHOD(QueryInterface)(
  6769. THIS_
  6770. IN REFIID InterfaceId,
  6771. OUT PVOID* Interface
  6772. ) PURE;
  6773. STDMETHOD_(ULONG, AddRef)(
  6774. THIS
  6775. ) PURE;
  6776. STDMETHOD_(ULONG, Release)(
  6777. THIS
  6778. ) PURE;
  6779. // IDebugOutputCallbacks.
  6780. // This method is only called if the supplied mask
  6781. // is allowed by the clients output control.
  6782. // The return value is ignored.
  6783. STDMETHOD(Output)(
  6784. THIS_
  6785. IN ULONG Mask,
  6786. IN PCSTR Text
  6787. ) PURE;
  6788. };
  6789. //----------------------------------------------------------------------------
  6790. //
  6791. // IDebugRegisters.
  6792. //
  6793. //----------------------------------------------------------------------------
  6794. #define DEBUG_REGISTER_SUB_REGISTER 0x00000001
  6795. #define DEBUG_REGISTERS_DEFAULT 0x00000000
  6796. #define DEBUG_REGISTERS_INT32 0x00000001
  6797. #define DEBUG_REGISTERS_INT64 0x00000002
  6798. #define DEBUG_REGISTERS_FLOAT 0x00000004
  6799. #define DEBUG_REGISTERS_ALL 0x00000007
  6800. typedef struct _DEBUG_REGISTER_DESCRIPTION
  6801. {
  6802. // DEBUG_VALUE type.
  6803. ULONG Type;
  6804. ULONG Flags;
  6805. // If this is a subregister the full
  6806. // registers description index is
  6807. // given in SubregMaster. The length, mask
  6808. // and shift describe how the subregisters
  6809. // bits fit into the full register.
  6810. ULONG SubregMaster;
  6811. ULONG SubregLength;
  6812. ULONG64 SubregMask;
  6813. ULONG SubregShift;
  6814. ULONG Reserved0;
  6815. } DEBUG_REGISTER_DESCRIPTION, *PDEBUG_REGISTER_DESCRIPTION;
  6816. #undef INTERFACE
  6817. #define INTERFACE IDebugRegisters
  6818. DECLARE_INTERFACE_(IDebugRegisters, IUnknown)
  6819. {
  6820. // IUnknown.
  6821. STDMETHOD(QueryInterface)(
  6822. THIS_
  6823. IN REFIID InterfaceId,
  6824. OUT PVOID* Interface
  6825. ) PURE;
  6826. STDMETHOD_(ULONG, AddRef)(
  6827. THIS
  6828. ) PURE;
  6829. STDMETHOD_(ULONG, Release)(
  6830. THIS
  6831. ) PURE;
  6832. // IDebugRegisters.
  6833. STDMETHOD(GetNumberRegisters)(
  6834. THIS_
  6835. OUT PULONG Number
  6836. ) PURE;
  6837. STDMETHOD(GetDescription)(
  6838. THIS_
  6839. IN ULONG Register,
  6840. OUT OPTIONAL PSTR NameBuffer,
  6841. IN ULONG NameBufferSize,
  6842. OUT OPTIONAL PULONG NameSize,
  6843. OUT OPTIONAL PDEBUG_REGISTER_DESCRIPTION Desc
  6844. ) PURE;
  6845. STDMETHOD(GetIndexByName)(
  6846. THIS_
  6847. IN PCSTR Name,
  6848. OUT PULONG Index
  6849. ) PURE;
  6850. STDMETHOD(GetValue)(
  6851. THIS_
  6852. IN ULONG Register,
  6853. OUT PDEBUG_VALUE Value
  6854. ) PURE;
  6855. // SetValue makes a best effort at coercing
  6856. // the given value into the given registers
  6857. // value type. If the given value is larger
  6858. // than the register can hold the least
  6859. // significant bits will be dropped. Float
  6860. // to int and int to float will be done
  6861. // if necessary. Subregister bits will be
  6862. // inserted into the master register.
  6863. STDMETHOD(SetValue)(
  6864. THIS_
  6865. IN ULONG Register,
  6866. IN PDEBUG_VALUE Value
  6867. ) PURE;
  6868. // Gets Count register values. If Indices is
  6869. // non-NULL it must contain Count register
  6870. // indices which control the registers affected.
  6871. // If Indices is NULL the registers from Start
  6872. // to Start + Count 1 are retrieved.
  6873. STDMETHOD(GetValues)(
  6874. THIS_
  6875. IN ULONG Count,
  6876. IN OPTIONAL /* size_is(Count) */ PULONG Indices,
  6877. IN ULONG Start,
  6878. OUT /* size_is(Count) */ PDEBUG_VALUE Values
  6879. ) PURE;
  6880. STDMETHOD(SetValues)(
  6881. THIS_
  6882. IN ULONG Count,
  6883. IN OPTIONAL /* size_is(Count) */ PULONG Indices,
  6884. IN ULONG Start,
  6885. IN /* size_is(Count) */ PDEBUG_VALUE Values
  6886. ) PURE;
  6887. // Outputs a group of registers in a well-formatted
  6888. // way thats specific to the platforms register set.
  6889. // Uses the line prefix.
  6890. STDMETHOD(OutputRegisters)(
  6891. THIS_
  6892. IN ULONG OutputControl,
  6893. IN ULONG Flags
  6894. ) PURE;
  6895. // Abstracted pieces of processor information.
  6896. // The mapping of these values to architectural
  6897. // registers is architecture-specific and their
  6898. // interpretation and existence may vary. They
  6899. // are intended to be directly compatible with
  6900. // calls which take this information, such as
  6901. // stack walking.
  6902. STDMETHOD(GetInstructionOffset)(
  6903. THIS_
  6904. OUT PULONG64 Offset
  6905. ) PURE;
  6906. STDMETHOD(GetStackOffset)(
  6907. THIS_
  6908. OUT PULONG64 Offset
  6909. ) PURE;
  6910. STDMETHOD(GetFrameOffset)(
  6911. THIS_
  6912. OUT PULONG64 Offset
  6913. ) PURE;
  6914. };
  6915. //----------------------------------------------------------------------------
  6916. //
  6917. // IDebugSymbolGroup
  6918. //
  6919. //----------------------------------------------------------------------------
  6920. // OutputSymbols flags.
  6921. // Default output contains <Name>**NAME**<Offset>**OFF**<Value>**VALUE**
  6922. // per symbol.
  6923. #define DEBUG_OUTPUT_SYMBOLS_DEFAULT 0x00000000
  6924. #define DEBUG_OUTPUT_SYMBOLS_NO_NAMES 0x00000001
  6925. #define DEBUG_OUTPUT_SYMBOLS_NO_OFFSETS 0x00000002
  6926. #define DEBUG_OUTPUT_SYMBOLS_NO_VALUES 0x00000004
  6927. #define DEBUG_OUTPUT_SYMBOLS_NO_TYPES 0x00000010
  6928. #define DEBUG_OUTPUT_NAME_END "**NAME**"
  6929. #define DEBUG_OUTPUT_OFFSET_END "**OFF**"
  6930. #define DEBUG_OUTPUT_VALUE_END "**VALUE**"
  6931. #define DEBUG_OUTPUT_TYPE_END "**TYPE**"
  6932. // DEBUG_SYMBOL_PARAMETERS flags.
  6933. // Cumulative expansion level, takes four bits.
  6934. #define DEBUG_SYMBOL_EXPANSION_LEVEL_MASK 0x0000000f
  6935. // Symbols subelements follow.
  6936. #define DEBUG_SYMBOL_EXPANDED 0x00000010
  6937. // Symbols value is read-only.
  6938. #define DEBUG_SYMBOL_READ_ONLY 0x00000020
  6939. // Symbol subelements are array elements.
  6940. #define DEBUG_SYMBOL_IS_ARRAY 0x00000040
  6941. // Symbol is a float value.
  6942. #define DEBUG_SYMBOL_IS_FLOAT 0x00000080
  6943. // Symbol is a scope argument.
  6944. #define DEBUG_SYMBOL_IS_ARGUMENT 0x00000100
  6945. // Symbol is a scope argument.
  6946. #define DEBUG_SYMBOL_IS_LOCAL 0x00000200
  6947. typedef struct _DEBUG_SYMBOL_PARAMETERS
  6948. {
  6949. ULONG64 Module;
  6950. ULONG TypeId;
  6951. // ParentSymbol may be DEBUG_ANY_ID when unknown.
  6952. ULONG ParentSymbol;
  6953. // A subelement of a symbol can be a field, such
  6954. // as in structs, unions or classes; or an array
  6955. // element count for arrays.
  6956. ULONG SubElements;
  6957. ULONG Flags;
  6958. ULONG64 Reserved;
  6959. } DEBUG_SYMBOL_PARAMETERS, *PDEBUG_SYMBOL_PARAMETERS;
  6960. #undef INTERFACE
  6961. #define INTERFACE IDebugSymbolGroup
  6962. DECLARE_INTERFACE_(IDebugSymbolGroup, IUnknown)
  6963. {
  6964. // IUnknown.
  6965. STDMETHOD(QueryInterface)(
  6966. THIS_
  6967. IN REFIID InterfaceId,
  6968. OUT PVOID* Interface
  6969. ) PURE;
  6970. STDMETHOD_(ULONG, AddRef)(
  6971. THIS
  6972. ) PURE;
  6973. STDMETHOD_(ULONG, Release)(
  6974. THIS
  6975. ) PURE;
  6976. // IDebugSymbolGroup.
  6977. STDMETHOD(GetNumberSymbols)(
  6978. THIS_
  6979. OUT PULONG Number
  6980. ) PURE;
  6981. // On input Index indicates the desired insertion
  6982. // index. On output Index contains the actual index.
  6983. // Use DEBUG_ANY_ID to append a symbol to the end.
  6984. STDMETHOD(AddSymbol)(
  6985. THIS_
  6986. IN PCSTR Name,
  6987. IN OUT PULONG Index
  6988. ) PURE;
  6989. STDMETHOD(RemoveSymbolByName)(
  6990. THIS_
  6991. IN PCSTR Name
  6992. ) PURE;
  6993. STDMETHOD(RemoveSymbolByIndex)(
  6994. THIS_
  6995. IN ULONG Index
  6996. ) PURE;
  6997. STDMETHOD(GetSymbolName)(
  6998. THIS_
  6999. IN ULONG Index,
  7000. OUT OPTIONAL PSTR Buffer,
  7001. IN ULONG BufferSize,
  7002. OUT OPTIONAL PULONG NameSize
  7003. ) PURE;
  7004. STDMETHOD(GetSymbolParameters)(
  7005. THIS_
  7006. IN ULONG Start,
  7007. IN ULONG Count,
  7008. OUT /* size_is(Count) */ PDEBUG_SYMBOL_PARAMETERS Params
  7009. ) PURE;
  7010. STDMETHOD(ExpandSymbol)(
  7011. THIS_
  7012. IN ULONG Index,
  7013. IN BOOL Expand
  7014. ) PURE;
  7015. // Uses the line prefix.
  7016. STDMETHOD(OutputSymbols)(
  7017. THIS_
  7018. IN ULONG OutputControl,
  7019. IN ULONG Flags,
  7020. IN ULONG Start,
  7021. IN ULONG Count
  7022. ) PURE;
  7023. STDMETHOD(WriteSymbol)(
  7024. THIS_
  7025. IN ULONG Index,
  7026. IN PCSTR Value
  7027. ) PURE;
  7028. STDMETHOD(OutputAsType)(
  7029. THIS_
  7030. IN ULONG Index,
  7031. IN PCSTR Type
  7032. ) PURE;
  7033. };
  7034. //----------------------------------------------------------------------------
  7035. //
  7036. // IDebugSymbols.
  7037. //
  7038. //----------------------------------------------------------------------------
  7039. //
  7040. // Information about a module.
  7041. //
  7042. // Flags.
  7043. #define DEBUG_MODULE_LOADED 0x00000000
  7044. #define DEBUG_MODULE_UNLOADED 0x00000001
  7045. #define DEBUG_MODULE_USER_MODE 0x00000002
  7046. #define DEBUG_MODULE_SYM_BAD_CHECKSUM 0x00010000
  7047. // Symbol types.
  7048. #define DEBUG_SYMTYPE_NONE 0
  7049. #define DEBUG_SYMTYPE_COFF 1
  7050. #define DEBUG_SYMTYPE_CODEVIEW 2
  7051. #define DEBUG_SYMTYPE_PDB 3
  7052. #define DEBUG_SYMTYPE_EXPORT 4
  7053. #define DEBUG_SYMTYPE_DEFERRED 5
  7054. #define DEBUG_SYMTYPE_SYM 6
  7055. #define DEBUG_SYMTYPE_DIA 7
  7056. typedef struct _DEBUG_MODULE_PARAMETERS
  7057. {
  7058. ULONG64 Base;
  7059. ULONG Size;
  7060. ULONG TimeDateStamp;
  7061. ULONG Checksum;
  7062. ULONG Flags;
  7063. ULONG SymbolType;
  7064. ULONG ImageNameSize;
  7065. ULONG ModuleNameSize;
  7066. ULONG LoadedImageNameSize;
  7067. ULONG SymbolFileNameSize;
  7068. ULONG MappedImageNameSize;
  7069. ULONG64 Reserved[2];
  7070. } DEBUG_MODULE_PARAMETERS, *PDEBUG_MODULE_PARAMETERS;
  7071. // Scope arguments are function arguments
  7072. // and thus only change when the scope
  7073. // crosses functions.
  7074. #define DEBUG_SCOPE_GROUP_ARGUMENTS 0x00000001
  7075. // Scope locals are locals declared in a particular
  7076. // scope and are only defined within that scope.
  7077. #define DEBUG_SCOPE_GROUP_LOCALS 0x00000002
  7078. // All symbols in the scope.
  7079. #define DEBUG_SCOPE_GROUP_ALL 0x00000003
  7080. // Typed data output control flags.
  7081. #define DEBUG_OUTTYPE_DEFAULT 0x00000000
  7082. #define DEBUG_OUTTYPE_NO_INDENT 0x00000001
  7083. #define DEBUG_OUTTYPE_NO_OFFSET 0x00000002
  7084. #define DEBUG_OUTTYPE_VERBOSE 0x00000004
  7085. #define DEBUG_OUTTYPE_COMPACT_OUTPUT 0x00000008
  7086. #define DEBUG_OUTTYPE_RECURSION_LEVEL(Max) (((Max) & 0xf) << 4)
  7087. #define DEBUG_OUTTYPE_ADDRESS_OF_FIELD 0x00010000
  7088. #define DEBUG_OUTTYPE_ADDRESS_AT_END 0x00020000
  7089. #define DEBUG_OUTTYPE_BLOCK_RECURSE 0x00200000
  7090. // FindSourceFile flags.
  7091. #define DEBUG_FIND_SOURCE_DEFAULT 0x00000000
  7092. // Returns fully-qualified paths only. If this
  7093. // is not set the path returned may be relative.
  7094. #define DEBUG_FIND_SOURCE_FULL_PATH 0x00000001
  7095. // Scans all the path elements for a match and
  7096. // returns the one that has the most similarity
  7097. // between the given file and the matching element.
  7098. #define DEBUG_FIND_SOURCE_BEST_MATCH 0x00000002
  7099. // A special value marking an offset that should not
  7100. // be treated as a valid offset. This is only used
  7101. // in special situations where it is unlikely that
  7102. // this value would be a valid offset.
  7103. #define DEBUG_INVALID_OFFSET ((ULONG64)-1)
  7104. #undef INTERFACE
  7105. #define INTERFACE IDebugSymbols
  7106. DECLARE_INTERFACE_(IDebugSymbols, IUnknown)
  7107. {
  7108. // IUnknown.
  7109. STDMETHOD(QueryInterface)(
  7110. THIS_
  7111. IN REFIID InterfaceId,
  7112. OUT PVOID* Interface
  7113. ) PURE;
  7114. STDMETHOD_(ULONG, AddRef)(
  7115. THIS
  7116. ) PURE;
  7117. STDMETHOD_(ULONG, Release)(
  7118. THIS
  7119. ) PURE;
  7120. // IDebugSymbols.
  7121. // Controls the symbol options used during
  7122. // symbol operations.
  7123. // Uses the same flags as dbghelps SymSetOptions.
  7124. STDMETHOD(GetSymbolOptions)(
  7125. THIS_
  7126. OUT PULONG Options
  7127. ) PURE;
  7128. STDMETHOD(AddSymbolOptions)(
  7129. THIS_
  7130. IN ULONG Options
  7131. ) PURE;
  7132. STDMETHOD(RemoveSymbolOptions)(
  7133. THIS_
  7134. IN ULONG Options
  7135. ) PURE;
  7136. STDMETHOD(SetSymbolOptions)(
  7137. THIS_
  7138. IN ULONG Options
  7139. ) PURE;
  7140. STDMETHOD(GetNameByOffset)(
  7141. THIS_
  7142. IN ULONG64 Offset,
  7143. OUT OPTIONAL PSTR NameBuffer,
  7144. IN ULONG NameBufferSize,
  7145. OUT OPTIONAL PULONG NameSize,
  7146. OUT OPTIONAL PULONG64 Displacement
  7147. ) PURE;
  7148. // A symbol name may not be unique, particularly
  7149. // when overloaded functions exist which all
  7150. // have the same name. If GetOffsetByName
  7151. // finds multiple matches for the name it
  7152. // can return any one of them. In that
  7153. // case it will return S_FALSE to indicate
  7154. // that ambiguity was arbitrarily resolved.
  7155. // A caller can then use SearchSymbols to
  7156. // find all of the matches if it wishes to
  7157. // perform different disambiguation.
  7158. STDMETHOD(GetOffsetByName)(
  7159. THIS_
  7160. IN PCSTR Symbol,
  7161. OUT PULONG64 Offset
  7162. ) PURE;
  7163. // GetNearNameByOffset returns symbols
  7164. // located near the symbol closest to
  7165. // to the offset, such as the previous
  7166. // or next symbol. If Delta is zero it
  7167. // operates identically to GetNameByOffset.
  7168. // If Delta is nonzero and such a symbol
  7169. // does not exist an error is returned.
  7170. // The next symbol, if one exists, will
  7171. // always have a higher offset than the
  7172. // input offset so the displacement is
  7173. // always negative. The situation is
  7174. // reversed for the previous symbol.
  7175. STDMETHOD(GetNearNameByOffset)(
  7176. THIS_
  7177. IN ULONG64 Offset,
  7178. IN LONG Delta,
  7179. OUT OPTIONAL PSTR NameBuffer,
  7180. IN ULONG NameBufferSize,
  7181. OUT OPTIONAL PULONG NameSize,
  7182. OUT OPTIONAL PULONG64 Displacement
  7183. ) PURE;
  7184. STDMETHOD(GetLineByOffset)(
  7185. THIS_
  7186. IN ULONG64 Offset,
  7187. OUT OPTIONAL PULONG Line,
  7188. OUT OPTIONAL PSTR FileBuffer,
  7189. IN ULONG FileBufferSize,
  7190. OUT OPTIONAL PULONG FileSize,
  7191. OUT OPTIONAL PULONG64 Displacement
  7192. ) PURE;
  7193. STDMETHOD(GetOffsetByLine)(
  7194. THIS_
  7195. IN ULONG Line,
  7196. IN PCSTR File,
  7197. OUT PULONG64 Offset
  7198. ) PURE;
  7199. // Enumerates the engines list of modules
  7200. // loaded for the current process. This may
  7201. // or may not match the system module list
  7202. // for the process. Reload can be used to
  7203. // synchronize the engines list with the system
  7204. // if necessary.
  7205. // Some sessions also track recently unloaded
  7206. // code modules for help in analyzing failures
  7207. // where an attempt is made to call unloaded code.
  7208. // These modules are indexed after the loaded
  7209. // modules.
  7210. STDMETHOD(GetNumberModules)(
  7211. THIS_
  7212. OUT PULONG Loaded,
  7213. OUT PULONG Unloaded
  7214. ) PURE;
  7215. STDMETHOD(GetModuleByIndex)(
  7216. THIS_
  7217. IN ULONG Index,
  7218. OUT PULONG64 Base
  7219. ) PURE;
  7220. // The module name may not be unique.
  7221. // This method returns the first match.
  7222. STDMETHOD(GetModuleByModuleName)(
  7223. THIS_
  7224. IN PCSTR Name,
  7225. IN ULONG StartIndex,
  7226. OUT OPTIONAL PULONG Index,
  7227. OUT OPTIONAL PULONG64 Base
  7228. ) PURE;
  7229. // Offset can be any offset within
  7230. // the module extent. Extents may
  7231. // not be unique when including unloaded
  7232. // drivers. This method returns the
  7233. // first match.
  7234. STDMETHOD(GetModuleByOffset)(
  7235. THIS_
  7236. IN ULONG64 Offset,
  7237. IN ULONG StartIndex,
  7238. OUT OPTIONAL PULONG Index,
  7239. OUT OPTIONAL PULONG64 Base
  7240. ) PURE;
  7241. // If Index is DEBUG_ANY_ID the base address
  7242. // is used to look up the module instead.
  7243. STDMETHOD(GetModuleNames)(
  7244. THIS_
  7245. IN ULONG Index,
  7246. IN ULONG64 Base,
  7247. OUT OPTIONAL PSTR ImageNameBuffer,
  7248. IN ULONG ImageNameBufferSize,
  7249. OUT OPTIONAL PULONG ImageNameSize,
  7250. OUT OPTIONAL PSTR ModuleNameBuffer,
  7251. IN ULONG ModuleNameBufferSize,
  7252. OUT OPTIONAL PULONG ModuleNameSize,
  7253. OUT OPTIONAL PSTR LoadedImageNameBuffer,
  7254. IN ULONG LoadedImageNameBufferSize,
  7255. OUT OPTIONAL PULONG LoadedImageNameSize
  7256. ) PURE;
  7257. STDMETHOD(GetModuleParameters)(
  7258. THIS_
  7259. IN ULONG Count,
  7260. IN OPTIONAL /* size_is(Count) */ PULONG64 Bases,
  7261. IN ULONG Start,
  7262. OUT /* size_is(Count) */ PDEBUG_MODULE_PARAMETERS Params
  7263. ) PURE;
  7264. // Looks up the module from a <Module>!<Symbol>
  7265. // string.
  7266. STDMETHOD(GetSymbolModule)(
  7267. THIS_
  7268. IN PCSTR Symbol,
  7269. OUT PULONG64 Base
  7270. ) PURE;
  7271. // Returns the string name of a type.
  7272. STDMETHOD(GetTypeName)(
  7273. THIS_
  7274. IN ULONG64 Module,
  7275. IN ULONG TypeId,
  7276. OUT OPTIONAL PSTR NameBuffer,
  7277. IN ULONG NameBufferSize,
  7278. OUT OPTIONAL PULONG NameSize
  7279. ) PURE;
  7280. // Returns the ID for a type name.
  7281. STDMETHOD(GetTypeId)(
  7282. THIS_
  7283. IN ULONG64 Module,
  7284. IN PCSTR Name,
  7285. OUT PULONG TypeId
  7286. ) PURE;
  7287. STDMETHOD(GetTypeSize)(
  7288. THIS_
  7289. IN ULONG64 Module,
  7290. IN ULONG TypeId,
  7291. OUT PULONG Size
  7292. ) PURE;
  7293. // Given a type which can contain members
  7294. // this method returns the offset of a
  7295. // particular member within the type.
  7296. // TypeId should give the container type ID
  7297. // and Field gives the dot-separated path
  7298. // to the field of interest.
  7299. STDMETHOD(GetFieldOffset)(
  7300. THIS_
  7301. IN ULONG64 Module,
  7302. IN ULONG TypeId,
  7303. IN PCSTR Field,
  7304. OUT PULONG Offset
  7305. ) PURE;
  7306. STDMETHOD(GetSymbolTypeId)(
  7307. THIS_
  7308. IN PCSTR Symbol,
  7309. OUT PULONG TypeId,
  7310. OUT OPTIONAL PULONG64 Module
  7311. ) PURE;
  7312. // As with GetOffsetByName a symbol's
  7313. // name may be ambiguous. GetOffsetTypeId
  7314. // returns the type for the symbol closest
  7315. // to the given offset and can be used
  7316. // to avoid ambiguity.
  7317. STDMETHOD(GetOffsetTypeId)(
  7318. THIS_
  7319. IN ULONG64 Offset,
  7320. OUT PULONG TypeId,
  7321. OUT OPTIONAL PULONG64 Module
  7322. ) PURE;
  7323. // Helpers for virtual and physical data
  7324. // which combine creation of a location with
  7325. // the actual operation.
  7326. STDMETHOD(ReadTypedDataVirtual)(
  7327. THIS_
  7328. IN ULONG64 Offset,
  7329. IN ULONG64 Module,
  7330. IN ULONG TypeId,
  7331. OUT PVOID Buffer,
  7332. IN ULONG BufferSize,
  7333. OUT OPTIONAL PULONG BytesRead
  7334. ) PURE;
  7335. STDMETHOD(WriteTypedDataVirtual)(
  7336. THIS_
  7337. IN ULONG64 Offset,
  7338. IN ULONG64 Module,
  7339. IN ULONG TypeId,
  7340. IN PVOID Buffer,
  7341. IN ULONG BufferSize,
  7342. OUT OPTIONAL PULONG BytesWritten
  7343. ) PURE;
  7344. STDMETHOD(OutputTypedDataVirtual)(
  7345. THIS_
  7346. IN ULONG OutputControl,
  7347. IN ULONG64 Offset,
  7348. IN ULONG64 Module,
  7349. IN ULONG TypeId,
  7350. IN ULONG Flags
  7351. ) PURE;
  7352. STDMETHOD(ReadTypedDataPhysical)(
  7353. THIS_
  7354. IN ULONG64 Offset,
  7355. IN ULONG64 Module,
  7356. IN ULONG TypeId,
  7357. OUT PVOID Buffer,
  7358. IN ULONG BufferSize,
  7359. OUT OPTIONAL PULONG BytesRead
  7360. ) PURE;
  7361. STDMETHOD(WriteTypedDataPhysical)(
  7362. THIS_
  7363. IN ULONG64 Offset,
  7364. IN ULONG64 Module,
  7365. IN ULONG TypeId,
  7366. IN PVOID Buffer,
  7367. IN ULONG BufferSize,
  7368. OUT OPTIONAL PULONG BytesWritten
  7369. ) PURE;
  7370. STDMETHOD(OutputTypedDataPhysical)(
  7371. THIS_
  7372. IN ULONG OutputControl,
  7373. IN ULONG64 Offset,
  7374. IN ULONG64 Module,
  7375. IN ULONG TypeId,
  7376. IN ULONG Flags
  7377. ) PURE;
  7378. // Function arguments and scope block symbols
  7379. // can be retrieved relative to currently
  7380. // executing code. A caller can provide just
  7381. // a code offset for scoping purposes and look
  7382. // up names or the caller can provide a full frame
  7383. // and look up actual values. The values for
  7384. // scoped symbols are best-guess and may or may not
  7385. // be accurate depending on program optimizations,
  7386. // the machine architecture, the current point
  7387. // in the programs execution and so on.
  7388. // A caller can also provide a complete register
  7389. // context for setting a scope to a previous
  7390. // machine state such as a context saved for
  7391. // an exception. Usually this isnt necessary
  7392. // and the current register context is used.
  7393. STDMETHOD(GetScope)(
  7394. THIS_
  7395. OUT OPTIONAL PULONG64 InstructionOffset,
  7396. OUT OPTIONAL PDEBUG_STACK_FRAME ScopeFrame,
  7397. OUT OPTIONAL PVOID ScopeContext,
  7398. IN ULONG ScopeContextSize
  7399. ) PURE;
  7400. // If ScopeFrame or ScopeContext is non-NULL then
  7401. // InstructionOffset is ignored.
  7402. // If ScopeContext is NULL the current
  7403. // register context is used.
  7404. // If the scope identified by the given
  7405. // information is the same as before
  7406. // SetScope returns S_OK. If the scope
  7407. // information changes, such as when the
  7408. // scope moves between functions or scope
  7409. // blocks, SetScope returns S_FALSE.
  7410. STDMETHOD(SetScope)(
  7411. THIS_
  7412. IN ULONG64 InstructionOffset,
  7413. IN OPTIONAL PDEBUG_STACK_FRAME ScopeFrame,
  7414. IN OPTIONAL PVOID ScopeContext,
  7415. IN ULONG ScopeContextSize
  7416. ) PURE;
  7417. // ResetScope clears the scope information
  7418. // for situations where scoped symbols
  7419. // mask global symbols or when resetting
  7420. // from explicit information to the current
  7421. // information.
  7422. STDMETHOD(ResetScope)(
  7423. THIS
  7424. ) PURE;
  7425. // A scope symbol is tied to its particular
  7426. // scope and only is meaningful within the scope.
  7427. // The returned group can be updated by passing it back
  7428. // into the method for lower-cost
  7429. // incremental updates when stepping.
  7430. STDMETHOD(GetScopeSymbolGroup)(
  7431. THIS_
  7432. IN ULONG Flags,
  7433. IN OPTIONAL PDEBUG_SYMBOL_GROUP Update,
  7434. OUT PDEBUG_SYMBOL_GROUP* Symbols
  7435. ) PURE;
  7436. // Create a new symbol group.
  7437. STDMETHOD(CreateSymbolGroup)(
  7438. THIS_
  7439. OUT PDEBUG_SYMBOL_GROUP* Group
  7440. ) PURE;
  7441. // StartSymbolMatch matches symbol names
  7442. // against the given pattern using simple
  7443. // regular expressions. The search results
  7444. // are iterated through using GetNextSymbolMatch.
  7445. // When the caller is done examining results
  7446. // the match should be freed via EndSymbolMatch.
  7447. // If the match pattern contains a module name
  7448. // the search is restricted to a single module.
  7449. // Pattern matching is only done on symbol names,
  7450. // not module names.
  7451. // All active symbol match handles are invalidated
  7452. // when the set of loaded symbols changes.
  7453. STDMETHOD(StartSymbolMatch)(
  7454. THIS_
  7455. IN PCSTR Pattern,
  7456. OUT PULONG64 Handle
  7457. ) PURE;
  7458. // If Buffer is NULL the match does not
  7459. // advance.
  7460. STDMETHOD(GetNextSymbolMatch)(
  7461. THIS_
  7462. IN ULONG64 Handle,
  7463. OUT OPTIONAL PSTR Buffer,
  7464. IN ULONG BufferSize,
  7465. OUT OPTIONAL PULONG MatchSize,
  7466. OUT OPTIONAL PULONG64 Offset
  7467. ) PURE;
  7468. STDMETHOD(EndSymbolMatch)(
  7469. THIS_
  7470. IN ULONG64 Handle
  7471. ) PURE;
  7472. STDMETHOD(Reload)(
  7473. THIS_
  7474. IN PCSTR Module
  7475. ) PURE;
  7476. STDMETHOD(GetSymbolPath)(
  7477. THIS_
  7478. OUT OPTIONAL PSTR Buffer,
  7479. IN ULONG BufferSize,
  7480. OUT OPTIONAL PULONG PathSize
  7481. ) PURE;
  7482. STDMETHOD(SetSymbolPath)(
  7483. THIS_
  7484. IN PCSTR Path
  7485. ) PURE;
  7486. STDMETHOD(AppendSymbolPath)(
  7487. THIS_
  7488. IN PCSTR Addition
  7489. ) PURE;
  7490. // Manipulate the path for executable images.
  7491. // Some dump files need to load executable images
  7492. // in order to resolve dump information. This
  7493. // path controls where the engine looks for
  7494. // images.
  7495. STDMETHOD(GetImagePath)(
  7496. THIS_
  7497. OUT OPTIONAL PSTR Buffer,
  7498. IN ULONG BufferSize,
  7499. OUT OPTIONAL PULONG PathSize
  7500. ) PURE;
  7501. STDMETHOD(SetImagePath)(
  7502. THIS_
  7503. IN PCSTR Path
  7504. ) PURE;
  7505. STDMETHOD(AppendImagePath)(
  7506. THIS_
  7507. IN PCSTR Addition
  7508. ) PURE;
  7509. // Path routines for source file location
  7510. // methods.
  7511. STDMETHOD(GetSourcePath)(
  7512. THIS_
  7513. OUT OPTIONAL PSTR Buffer,
  7514. IN ULONG BufferSize,
  7515. OUT OPTIONAL PULONG PathSize
  7516. ) PURE;
  7517. // Gets the nth part of the source path.
  7518. STDMETHOD(GetSourcePathElement)(
  7519. THIS_
  7520. IN ULONG Index,
  7521. OUT OPTIONAL PSTR Buffer,
  7522. IN ULONG BufferSize,
  7523. OUT OPTIONAL PULONG ElementSize
  7524. ) PURE;
  7525. STDMETHOD(SetSourcePath)(
  7526. THIS_
  7527. IN PCSTR Path
  7528. ) PURE;
  7529. STDMETHOD(AppendSourcePath)(
  7530. THIS_
  7531. IN PCSTR Addition
  7532. ) PURE;
  7533. // Uses the given file path and the source path
  7534. // information to try and locate an existing file.
  7535. // The given file path is merged with elements
  7536. // of the source path and checked for existence.
  7537. // If a match is found the element used is returned.
  7538. // A starting element can be specified to restrict
  7539. // the search to a subset of the path elements;
  7540. // this can be useful when checking for multiple
  7541. // matches along the source path.
  7542. // The returned element can be 1, indicating
  7543. // the file was found directly and not on the path.
  7544. STDMETHOD(FindSourceFile)(
  7545. THIS_
  7546. IN ULONG StartElement,
  7547. IN PCSTR File,
  7548. IN ULONG Flags,
  7549. OUT OPTIONAL PULONG FoundElement,
  7550. OUT OPTIONAL PSTR Buffer,
  7551. IN ULONG BufferSize,
  7552. OUT OPTIONAL PULONG FoundSize
  7553. ) PURE;
  7554. // Retrieves all the line offset information
  7555. // for a particular source file. Buffer is
  7556. // first intialized to DEBUG_INVALID_OFFSET for
  7557. // every entry. Then for each piece of line
  7558. // symbol information Buffer[Line] set to
  7559. // Lines offset. This produces a per-line
  7560. // map of the offsets for the lines of the
  7561. // given file. Line numbers are decremented
  7562. // for the map so Buffer[0] contains the offset
  7563. // for line number 1.
  7564. // If there is no line information at all for
  7565. // the given file the method fails rather
  7566. // than returning a map of invalid offsets.
  7567. STDMETHOD(GetSourceFileLineOffsets)(
  7568. THIS_
  7569. IN PCSTR File,
  7570. OUT OPTIONAL /* size_is(BufferLines) */ PULONG64 Buffer,
  7571. IN ULONG BufferLines,
  7572. OUT OPTIONAL PULONG FileLines
  7573. ) PURE;
  7574. };
  7575. //
  7576. // GetModuleNameString strings.
  7577. //
  7578. #define DEBUG_MODNAME_IMAGE 0x00000000
  7579. #define DEBUG_MODNAME_MODULE 0x00000001
  7580. #define DEBUG_MODNAME_LOADED_IMAGE 0x00000002
  7581. #define DEBUG_MODNAME_SYMBOL_FILE 0x00000003
  7582. #define DEBUG_MODNAME_MAPPED_IMAGE 0x00000004
  7583. //
  7584. // Type options, used with Get/SetTypeOptions.
  7585. //
  7586. // Display PUSHORT and USHORT arrays in UNICODE
  7587. #define DEBUG_TYPEOPTS_UNICODE_DISPLAY 0x00000001
  7588. // Display LONG types in default base instead of decimal
  7589. #define DEBUG_TYPEOPTS_LONGSTATUS_DISPLAY 0x00000002
  7590. // Display integer types in default base instead of decimal
  7591. #define DEBUG_TYPEOPTS_FORCERADIX_OUTPUT 0x00000004
  7592. #undef INTERFACE
  7593. #define INTERFACE IDebugSymbols2
  7594. DECLARE_INTERFACE_(IDebugSymbols2, IUnknown)
  7595. {
  7596. // IUnknown.
  7597. STDMETHOD(QueryInterface)(
  7598. THIS_
  7599. IN REFIID InterfaceId,
  7600. OUT PVOID* Interface
  7601. ) PURE;
  7602. STDMETHOD_(ULONG, AddRef)(
  7603. THIS
  7604. ) PURE;
  7605. STDMETHOD_(ULONG, Release)(
  7606. THIS
  7607. ) PURE;
  7608. // IDebugSymbols.
  7609. // Controls the symbol options used during
  7610. // symbol operations.
  7611. // Uses the same flags as dbghelps SymSetOptions.
  7612. STDMETHOD(GetSymbolOptions)(
  7613. THIS_
  7614. OUT PULONG Options
  7615. ) PURE;
  7616. STDMETHOD(AddSymbolOptions)(
  7617. THIS_
  7618. IN ULONG Options
  7619. ) PURE;
  7620. STDMETHOD(RemoveSymbolOptions)(
  7621. THIS_
  7622. IN ULONG Options
  7623. ) PURE;
  7624. STDMETHOD(SetSymbolOptions)(
  7625. THIS_
  7626. IN ULONG Options
  7627. ) PURE;
  7628. STDMETHOD(GetNameByOffset)(
  7629. THIS_
  7630. IN ULONG64 Offset,
  7631. OUT OPTIONAL PSTR NameBuffer,
  7632. IN ULONG NameBufferSize,
  7633. OUT OPTIONAL PULONG NameSize,
  7634. OUT OPTIONAL PULONG64 Displacement
  7635. ) PURE;
  7636. // A symbol name may not be unique, particularly
  7637. // when overloaded functions exist which all
  7638. // have the same name. If GetOffsetByName
  7639. // finds multiple matches for the name it
  7640. // can return any one of them. In that
  7641. // case it will return S_FALSE to indicate
  7642. // that ambiguity was arbitrarily resolved.
  7643. // A caller can then use SearchSymbols to
  7644. // find all of the matches if it wishes to
  7645. // perform different disambiguation.
  7646. STDMETHOD(GetOffsetByName)(
  7647. THIS_
  7648. IN PCSTR Symbol,
  7649. OUT PULONG64 Offset
  7650. ) PURE;
  7651. // GetNearNameByOffset returns symbols
  7652. // located near the symbol closest to
  7653. // to the offset, such as the previous
  7654. // or next symbol. If Delta is zero it
  7655. // operates identically to GetNameByOffset.
  7656. // If Delta is nonzero and such a symbol
  7657. // does not exist an error is returned.
  7658. // The next symbol, if one exists, will
  7659. // always have a higher offset than the
  7660. // input offset so the displacement is
  7661. // always negative. The situation is
  7662. // reversed for the previous symbol.
  7663. STDMETHOD(GetNearNameByOffset)(
  7664. THIS_
  7665. IN ULONG64 Offset,
  7666. IN LONG Delta,
  7667. OUT OPTIONAL PSTR NameBuffer,
  7668. IN ULONG NameBufferSize,
  7669. OUT OPTIONAL PULONG NameSize,
  7670. OUT OPTIONAL PULONG64 Displacement
  7671. ) PURE;
  7672. STDMETHOD(GetLineByOffset)(
  7673. THIS_
  7674. IN ULONG64 Offset,
  7675. OUT OPTIONAL PULONG Line,
  7676. OUT OPTIONAL PSTR FileBuffer,
  7677. IN ULONG FileBufferSize,
  7678. OUT OPTIONAL PULONG FileSize,
  7679. OUT OPTIONAL PULONG64 Displacement
  7680. ) PURE;
  7681. STDMETHOD(GetOffsetByLine)(
  7682. THIS_
  7683. IN ULONG Line,
  7684. IN PCSTR File,
  7685. OUT PULONG64 Offset
  7686. ) PURE;
  7687. // Enumerates the engines list of modules
  7688. // loaded for the current process. This may
  7689. // or may not match the system module list
  7690. // for the process. Reload can be used to
  7691. // synchronize the engines list with the system
  7692. // if necessary.
  7693. // Some sessions also track recently unloaded
  7694. // code modules for help in analyzing failures
  7695. // where an attempt is made to call unloaded code.
  7696. // These modules are indexed after the loaded
  7697. // modules.
  7698. STDMETHOD(GetNumberModules)(
  7699. THIS_
  7700. OUT PULONG Loaded,
  7701. OUT PULONG Unloaded
  7702. ) PURE;
  7703. STDMETHOD(GetModuleByIndex)(
  7704. THIS_
  7705. IN ULONG Index,
  7706. OUT PULONG64 Base
  7707. ) PURE;
  7708. // The module name may not be unique.
  7709. // This method returns the first match.
  7710. STDMETHOD(GetModuleByModuleName)(
  7711. THIS_
  7712. IN PCSTR Name,
  7713. IN ULONG StartIndex,
  7714. OUT OPTIONAL PULONG Index,
  7715. OUT OPTIONAL PULONG64 Base
  7716. ) PURE;
  7717. // Offset can be any offset within
  7718. // the module extent. Extents may
  7719. // not be unique when including unloaded
  7720. // drivers. This method returns the
  7721. // first match.
  7722. STDMETHOD(GetModuleByOffset)(
  7723. THIS_
  7724. IN ULONG64 Offset,
  7725. IN ULONG StartIndex,
  7726. OUT OPTIONAL PULONG Index,
  7727. OUT OPTIONAL PULONG64 Base
  7728. ) PURE;
  7729. // If Index is DEBUG_ANY_ID the base address
  7730. // is used to look up the module instead.
  7731. STDMETHOD(GetModuleNames)(
  7732. THIS_
  7733. IN ULONG Index,
  7734. IN ULONG64 Base,
  7735. OUT OPTIONAL PSTR ImageNameBuffer,
  7736. IN ULONG ImageNameBufferSize,
  7737. OUT OPTIONAL PULONG ImageNameSize,
  7738. OUT OPTIONAL PSTR ModuleNameBuffer,
  7739. IN ULONG ModuleNameBufferSize,
  7740. OUT OPTIONAL PULONG ModuleNameSize,
  7741. OUT OPTIONAL PSTR LoadedImageNameBuffer,
  7742. IN ULONG LoadedImageNameBufferSize,
  7743. OUT OPTIONAL PULONG LoadedImageNameSize
  7744. ) PURE;
  7745. STDMETHOD(GetModuleParameters)(
  7746. THIS_
  7747. IN ULONG Count,
  7748. IN OPTIONAL /* size_is(Count) */ PULONG64 Bases,
  7749. IN ULONG Start,
  7750. OUT /* size_is(Count) */ PDEBUG_MODULE_PARAMETERS Params
  7751. ) PURE;
  7752. // Looks up the module from a <Module>!<Symbol>
  7753. // string.
  7754. STDMETHOD(GetSymbolModule)(
  7755. THIS_
  7756. IN PCSTR Symbol,
  7757. OUT PULONG64 Base
  7758. ) PURE;
  7759. // Returns the string name of a type.
  7760. STDMETHOD(GetTypeName)(
  7761. THIS_
  7762. IN ULONG64 Module,
  7763. IN ULONG TypeId,
  7764. OUT OPTIONAL PSTR NameBuffer,
  7765. IN ULONG NameBufferSize,
  7766. OUT OPTIONAL PULONG NameSize
  7767. ) PURE;
  7768. // Returns the ID for a type name.
  7769. STDMETHOD(GetTypeId)(
  7770. THIS_
  7771. IN ULONG64 Module,
  7772. IN PCSTR Name,
  7773. OUT PULONG TypeId
  7774. ) PURE;
  7775. STDMETHOD(GetTypeSize)(
  7776. THIS_
  7777. IN ULONG64 Module,
  7778. IN ULONG TypeId,
  7779. OUT PULONG Size
  7780. ) PURE;
  7781. // Given a type which can contain members
  7782. // this method returns the offset of a
  7783. // particular member within the type.
  7784. // TypeId should give the container type ID
  7785. // and Field gives the dot-separated path
  7786. // to the field of interest.
  7787. STDMETHOD(GetFieldOffset)(
  7788. THIS_
  7789. IN ULONG64 Module,
  7790. IN ULONG TypeId,
  7791. IN PCSTR Field,
  7792. OUT PULONG Offset
  7793. ) PURE;
  7794. STDMETHOD(GetSymbolTypeId)(
  7795. THIS_
  7796. IN PCSTR Symbol,
  7797. OUT PULONG TypeId,
  7798. OUT OPTIONAL PULONG64 Module
  7799. ) PURE;
  7800. // As with GetOffsetByName a symbol's
  7801. // name may be ambiguous. GetOffsetTypeId
  7802. // returns the type for the symbol closest
  7803. // to the given offset and can be used
  7804. // to avoid ambiguity.
  7805. STDMETHOD(GetOffsetTypeId)(
  7806. THIS_
  7807. IN ULONG64 Offset,
  7808. OUT PULONG TypeId,
  7809. OUT OPTIONAL PULONG64 Module
  7810. ) PURE;
  7811. // Helpers for virtual and physical data
  7812. // which combine creation of a location with
  7813. // the actual operation.
  7814. STDMETHOD(ReadTypedDataVirtual)(
  7815. THIS_
  7816. IN ULONG64 Offset,
  7817. IN ULONG64 Module,
  7818. IN ULONG TypeId,
  7819. OUT PVOID Buffer,
  7820. IN ULONG BufferSize,
  7821. OUT OPTIONAL PULONG BytesRead
  7822. ) PURE;
  7823. STDMETHOD(WriteTypedDataVirtual)(
  7824. THIS_
  7825. IN ULONG64 Offset,
  7826. IN ULONG64 Module,
  7827. IN ULONG TypeId,
  7828. IN PVOID Buffer,
  7829. IN ULONG BufferSize,
  7830. OUT OPTIONAL PULONG BytesWritten
  7831. ) PURE;
  7832. STDMETHOD(OutputTypedDataVirtual)(
  7833. THIS_
  7834. IN ULONG OutputControl,
  7835. IN ULONG64 Offset,
  7836. IN ULONG64 Module,
  7837. IN ULONG TypeId,
  7838. IN ULONG Flags
  7839. ) PURE;
  7840. STDMETHOD(ReadTypedDataPhysical)(
  7841. THIS_
  7842. IN ULONG64 Offset,
  7843. IN ULONG64 Module,
  7844. IN ULONG TypeId,
  7845. OUT PVOID Buffer,
  7846. IN ULONG BufferSize,
  7847. OUT OPTIONAL PULONG BytesRead
  7848. ) PURE;
  7849. STDMETHOD(WriteTypedDataPhysical)(
  7850. THIS_
  7851. IN ULONG64 Offset,
  7852. IN ULONG64 Module,
  7853. IN ULONG TypeId,
  7854. IN PVOID Buffer,
  7855. IN ULONG BufferSize,
  7856. OUT OPTIONAL PULONG BytesWritten
  7857. ) PURE;
  7858. STDMETHOD(OutputTypedDataPhysical)(
  7859. THIS_
  7860. IN ULONG OutputControl,
  7861. IN ULONG64 Offset,
  7862. IN ULONG64 Module,
  7863. IN ULONG TypeId,
  7864. IN ULONG Flags
  7865. ) PURE;
  7866. // Function arguments and scope block symbols
  7867. // can be retrieved relative to currently
  7868. // executing code. A caller can provide just
  7869. // a code offset for scoping purposes and look
  7870. // up names or the caller can provide a full frame
  7871. // and look up actual values. The values for
  7872. // scoped symbols are best-guess and may or may not
  7873. // be accurate depending on program optimizations,
  7874. // the machine architecture, the current point
  7875. // in the programs execution and so on.
  7876. // A caller can also provide a complete register
  7877. // context for setting a scope to a previous
  7878. // machine state such as a context saved for
  7879. // an exception. Usually this isnt necessary
  7880. // and the current register context is used.
  7881. STDMETHOD(GetScope)(
  7882. THIS_
  7883. OUT OPTIONAL PULONG64 InstructionOffset,
  7884. OUT OPTIONAL PDEBUG_STACK_FRAME ScopeFrame,
  7885. OUT OPTIONAL PVOID ScopeContext,
  7886. IN ULONG ScopeContextSize
  7887. ) PURE;
  7888. // If ScopeFrame or ScopeContext is non-NULL then
  7889. // InstructionOffset is ignored.
  7890. // If ScopeContext is NULL the current
  7891. // register context is used.
  7892. // If the scope identified by the given
  7893. // information is the same as before
  7894. // SetScope returns S_OK. If the scope
  7895. // information changes, such as when the
  7896. // scope moves between functions or scope
  7897. // blocks, SetScope returns S_FALSE.
  7898. STDMETHOD(SetScope)(
  7899. THIS_
  7900. IN ULONG64 InstructionOffset,
  7901. IN OPTIONAL PDEBUG_STACK_FRAME ScopeFrame,
  7902. IN OPTIONAL PVOID ScopeContext,
  7903. IN ULONG ScopeContextSize
  7904. ) PURE;
  7905. // ResetScope clears the scope information
  7906. // for situations where scoped symbols
  7907. // mask global symbols or when resetting
  7908. // from explicit information to the current
  7909. // information.
  7910. STDMETHOD(ResetScope)(
  7911. THIS
  7912. ) PURE;
  7913. // A scope symbol is tied to its particular
  7914. // scope and only is meaningful within the scope.
  7915. // The returned group can be updated by passing it back
  7916. // into the method for lower-cost
  7917. // incremental updates when stepping.
  7918. STDMETHOD(GetScopeSymbolGroup)(
  7919. THIS_
  7920. IN ULONG Flags,
  7921. IN OPTIONAL PDEBUG_SYMBOL_GROUP Update,
  7922. OUT PDEBUG_SYMBOL_GROUP* Symbols
  7923. ) PURE;
  7924. // Create a new symbol group.
  7925. STDMETHOD(CreateSymbolGroup)(
  7926. THIS_
  7927. OUT PDEBUG_SYMBOL_GROUP* Group
  7928. ) PURE;
  7929. // StartSymbolMatch matches symbol names
  7930. // against the given pattern using simple
  7931. // regular expressions. The search results
  7932. // are iterated through using GetNextSymbolMatch.
  7933. // When the caller is done examining results
  7934. // the match should be freed via EndSymbolMatch.
  7935. // If the match pattern contains a module name
  7936. // the search is restricted to a single module.
  7937. // Pattern matching is only done on symbol names,
  7938. // not module names.
  7939. // All active symbol match handles are invalidated
  7940. // when the set of loaded symbols changes.
  7941. STDMETHOD(StartSymbolMatch)(
  7942. THIS_
  7943. IN PCSTR Pattern,
  7944. OUT PULONG64 Handle
  7945. ) PURE;
  7946. // If Buffer is NULL the match does not
  7947. // advance.
  7948. STDMETHOD(GetNextSymbolMatch)(
  7949. THIS_
  7950. IN ULONG64 Handle,
  7951. OUT OPTIONAL PSTR Buffer,
  7952. IN ULONG BufferSize,
  7953. OUT OPTIONAL PULONG MatchSize,
  7954. OUT OPTIONAL PULONG64 Offset
  7955. ) PURE;
  7956. STDMETHOD(EndSymbolMatch)(
  7957. THIS_
  7958. IN ULONG64 Handle
  7959. ) PURE;
  7960. STDMETHOD(Reload)(
  7961. THIS_
  7962. IN PCSTR Module
  7963. ) PURE;
  7964. STDMETHOD(GetSymbolPath)(
  7965. THIS_
  7966. OUT OPTIONAL PSTR Buffer,
  7967. IN ULONG BufferSize,
  7968. OUT OPTIONAL PULONG PathSize
  7969. ) PURE;
  7970. STDMETHOD(SetSymbolPath)(
  7971. THIS_
  7972. IN PCSTR Path
  7973. ) PURE;
  7974. STDMETHOD(AppendSymbolPath)(
  7975. THIS_
  7976. IN PCSTR Addition
  7977. ) PURE;
  7978. // Manipulate the path for executable images.
  7979. // Some dump files need to load executable images
  7980. // in order to resolve dump information. This
  7981. // path controls where the engine looks for
  7982. // images.
  7983. STDMETHOD(GetImagePath)(
  7984. THIS_
  7985. OUT OPTIONAL PSTR Buffer,
  7986. IN ULONG BufferSize,
  7987. OUT OPTIONAL PULONG PathSize
  7988. ) PURE;
  7989. STDMETHOD(SetImagePath)(
  7990. THIS_
  7991. IN PCSTR Path
  7992. ) PURE;
  7993. STDMETHOD(AppendImagePath)(
  7994. THIS_
  7995. IN PCSTR Addition
  7996. ) PURE;
  7997. // Path routines for source file location
  7998. // methods.
  7999. STDMETHOD(GetSourcePath)(
  8000. THIS_
  8001. OUT OPTIONAL PSTR Buffer,
  8002. IN ULONG BufferSize,
  8003. OUT OPTIONAL PULONG PathSize
  8004. ) PURE;
  8005. // Gets the nth part of the source path.
  8006. STDMETHOD(GetSourcePathElement)(
  8007. THIS_
  8008. IN ULONG Index,
  8009. OUT OPTIONAL PSTR Buffer,
  8010. IN ULONG BufferSize,
  8011. OUT OPTIONAL PULONG ElementSize
  8012. ) PURE;
  8013. STDMETHOD(SetSourcePath)(
  8014. THIS_
  8015. IN PCSTR Path
  8016. ) PURE;
  8017. STDMETHOD(AppendSourcePath)(
  8018. THIS_
  8019. IN PCSTR Addition
  8020. ) PURE;
  8021. // Uses the given file path and the source path
  8022. // information to try and locate an existing file.
  8023. // The given file path is merged with elements
  8024. // of the source path and checked for existence.
  8025. // If a match is found the element used is returned.
  8026. // A starting element can be specified to restrict
  8027. // the search to a subset of the path elements;
  8028. // this can be useful when checking for multiple
  8029. // matches along the source path.
  8030. // The returned element can be 1, indicating
  8031. // the file was found directly and not on the path.
  8032. STDMETHOD(FindSourceFile)(
  8033. THIS_
  8034. IN ULONG StartElement,
  8035. IN PCSTR File,
  8036. IN ULONG Flags,
  8037. OUT OPTIONAL PULONG FoundElement,
  8038. OUT OPTIONAL PSTR Buffer,
  8039. IN ULONG BufferSize,
  8040. OUT OPTIONAL PULONG FoundSize
  8041. ) PURE;
  8042. // Retrieves all the line offset information
  8043. // for a particular source file. Buffer is
  8044. // first intialized to DEBUG_INVALID_OFFSET for
  8045. // every entry. Then for each piece of line
  8046. // symbol information Buffer[Line] set to
  8047. // Lines offset. This produces a per-line
  8048. // map of the offsets for the lines of the
  8049. // given file. Line numbers are decremented
  8050. // for the map so Buffer[0] contains the offset
  8051. // for line number 1.
  8052. // If there is no line information at all for
  8053. // the given file the method fails rather
  8054. // than returning a map of invalid offsets.
  8055. STDMETHOD(GetSourceFileLineOffsets)(
  8056. THIS_
  8057. IN PCSTR File,
  8058. OUT OPTIONAL /* size_is(BufferLines) */ PULONG64 Buffer,
  8059. IN ULONG BufferLines,
  8060. OUT OPTIONAL PULONG FileLines
  8061. ) PURE;
  8062. // IDebugSymbols2.
  8063. // If Index is DEBUG_ANY_ID the base address
  8064. // is used to look up the module instead.
  8065. // Item is specified as in VerQueryValue.
  8066. // Module version information is only
  8067. // available for loaded modules and may
  8068. // not be available in all debug sessions.
  8069. STDMETHOD(GetModuleVersionInformation)(
  8070. THIS_
  8071. IN ULONG Index,
  8072. IN ULONG64 Base,
  8073. IN PCSTR Item,
  8074. OUT OPTIONAL PVOID Buffer,
  8075. IN ULONG BufferSize,
  8076. OUT OPTIONAL PULONG VerInfoSize
  8077. ) PURE;
  8078. // Retrieves any available module name string
  8079. // such as module name or symbol file name.
  8080. // If Index is DEBUG_ANY_ID the base address
  8081. // is used to look up the module instead.
  8082. // If symbols are deferred an error will
  8083. // be returned.
  8084. // E_NOINTERFACE may be returned, indicating
  8085. // no information exists.
  8086. STDMETHOD(GetModuleNameString)(
  8087. THIS_
  8088. IN ULONG Which,
  8089. IN ULONG Index,
  8090. IN ULONG64 Base,
  8091. OUT OPTIONAL PSTR Buffer,
  8092. IN ULONG BufferSize,
  8093. OUT OPTIONAL PULONG NameSize
  8094. ) PURE;
  8095. // Returns the string name of a constant type.
  8096. STDMETHOD(GetConstantName)(
  8097. THIS_
  8098. IN ULONG64 Module,
  8099. IN ULONG TypeId,
  8100. IN ULONG64 Value,
  8101. OUT OPTIONAL PSTR NameBuffer,
  8102. IN ULONG NameBufferSize,
  8103. OUT OPTIONAL PULONG NameSize
  8104. ) PURE;
  8105. // Gets name of a field in a struct
  8106. // FieldNumber is 0 based index of field in a struct
  8107. // Method fails with E_INVALIDARG if FieldNumber is
  8108. // too high for the struct fields
  8109. STDMETHOD(GetFieldName)(
  8110. THIS_
  8111. IN ULONG64 Module,
  8112. IN ULONG TypeId,
  8113. IN ULONG FieldIndex,
  8114. OUT OPTIONAL PSTR NameBuffer,
  8115. IN ULONG NameBufferSize,
  8116. OUT OPTIONAL PULONG NameSize
  8117. ) PURE;
  8118. // Control options for typed values.
  8119. STDMETHOD(GetTypeOptions)(
  8120. THIS_
  8121. OUT PULONG Options
  8122. ) PURE;
  8123. STDMETHOD(AddTypeOptions)(
  8124. THIS_
  8125. IN ULONG Options
  8126. ) PURE;
  8127. STDMETHOD(RemoveTypeOptions)(
  8128. THIS_
  8129. IN ULONG Options
  8130. ) PURE;
  8131. STDMETHOD(SetTypeOptions)(
  8132. THIS_
  8133. IN ULONG Options
  8134. ) PURE;
  8135. };
  8136. //----------------------------------------------------------------------------
  8137. //
  8138. // IDebugSystemObjects
  8139. //
  8140. //----------------------------------------------------------------------------
  8141. #undef INTERFACE
  8142. #define INTERFACE IDebugSystemObjects
  8143. DECLARE_INTERFACE_(IDebugSystemObjects, IUnknown)
  8144. {
  8145. // IUnknown.
  8146. STDMETHOD(QueryInterface)(
  8147. THIS_
  8148. IN REFIID InterfaceId,
  8149. OUT PVOID* Interface
  8150. ) PURE;
  8151. STDMETHOD_(ULONG, AddRef)(
  8152. THIS
  8153. ) PURE;
  8154. STDMETHOD_(ULONG, Release)(
  8155. THIS
  8156. ) PURE;
  8157. // IDebugSystemObjects.
  8158. // In user mode debugging the debugger
  8159. // tracks all threads and processes and
  8160. // enumerates them through the following
  8161. // methods. When enumerating threads
  8162. // the threads are enumerated for the current
  8163. // process.
  8164. // Kernel mode debugging currently is
  8165. // limited to enumerating only the threads
  8166. // assigned to processors, not all of
  8167. // the threads in the system. Process
  8168. // enumeration is limited to a single
  8169. // virtual process representing kernel space.
  8170. // Returns the ID of the thread on which
  8171. // the last event occurred.
  8172. STDMETHOD(GetEventThread)(
  8173. THIS_
  8174. OUT PULONG Id
  8175. ) PURE;
  8176. STDMETHOD(GetEventProcess)(
  8177. THIS_
  8178. OUT PULONG Id
  8179. ) PURE;
  8180. // Controls implicit thread used by the
  8181. // debug engine. The debuggers current
  8182. // thread is just a piece of data held
  8183. // by the debugger for calls which use
  8184. // thread-specific information. In those
  8185. // calls the debuggers current thread is used.
  8186. // The debuggers current thread is not related
  8187. // to any system thread attribute.
  8188. // IDs for threads are small integer IDs
  8189. // maintained by the engine. They are not
  8190. // related to system thread IDs.
  8191. STDMETHOD(GetCurrentThreadId)(
  8192. THIS_
  8193. OUT PULONG Id
  8194. ) PURE;
  8195. STDMETHOD(SetCurrentThreadId)(
  8196. THIS_
  8197. IN ULONG Id
  8198. ) PURE;
  8199. // The current process is the process
  8200. // that owns the current thread.
  8201. STDMETHOD(GetCurrentProcessId)(
  8202. THIS_
  8203. OUT PULONG Id
  8204. ) PURE;
  8205. // Setting the current process automatically
  8206. // sets the current thread to the thread that
  8207. // was last current in that process.
  8208. STDMETHOD(SetCurrentProcessId)(
  8209. THIS_
  8210. IN ULONG Id
  8211. ) PURE;
  8212. // Gets the number of threads in the current process.
  8213. STDMETHOD(GetNumberThreads)(
  8214. THIS_
  8215. OUT PULONG Number
  8216. ) PURE;
  8217. // Gets thread count information for all processes
  8218. // and the largest number of threads in a single process.
  8219. STDMETHOD(GetTotalNumberThreads)(
  8220. THIS_
  8221. OUT PULONG Total,
  8222. OUT PULONG LargestProcess
  8223. ) PURE;
  8224. STDMETHOD(GetThreadIdsByIndex)(
  8225. THIS_
  8226. IN ULONG Start,
  8227. IN ULONG Count,
  8228. OUT OPTIONAL /* size_is(Count) */ PULONG Ids,
  8229. OUT OPTIONAL /* size_is(Count) */ PULONG SysIds
  8230. ) PURE;
  8231. // Gets the debugger ID for the thread
  8232. // currently running on the given
  8233. // processor. Only works in kernel
  8234. // debugging.
  8235. STDMETHOD(GetThreadIdByProcessor)(
  8236. THIS_
  8237. IN ULONG Processor,
  8238. OUT PULONG Id
  8239. ) PURE;
  8240. // Returns the offset of the current threads
  8241. // system data structure. When kernel debugging
  8242. // this is the offset of the KTHREAD.
  8243. // When user debugging it is the offset
  8244. // of the current TEB.
  8245. STDMETHOD(GetCurrentThreadDataOffset)(
  8246. THIS_
  8247. OUT PULONG64 Offset
  8248. ) PURE;
  8249. // Looks up a debugger thread ID for the given
  8250. // system thread data structure.
  8251. // Currently when kernel debugging this will fail
  8252. // if the thread is not executing on a processor.
  8253. STDMETHOD(GetThreadIdByDataOffset)(
  8254. THIS_
  8255. IN ULONG64 Offset,
  8256. OUT PULONG Id
  8257. ) PURE;
  8258. // Returns the offset of the current threads
  8259. // TEB. In user mode this is equivalent to
  8260. // the threads data offset.
  8261. STDMETHOD(GetCurrentThreadTeb)(
  8262. THIS_
  8263. OUT PULONG64 Offset
  8264. ) PURE;
  8265. // Looks up a debugger thread ID for the given TEB.
  8266. // Currently when kernel debugging this will fail
  8267. // if the thread is not executing on a processor.
  8268. STDMETHOD(GetThreadIdByTeb)(
  8269. THIS_
  8270. IN ULONG64 Offset,
  8271. OUT PULONG Id
  8272. ) PURE;
  8273. // Returns the system unique ID for the current thread.
  8274. // Not currently supported when kernel debugging.
  8275. STDMETHOD(GetCurrentThreadSystemId)(
  8276. THIS_
  8277. OUT PULONG SysId
  8278. ) PURE;
  8279. // Looks up a debugger thread ID for the given
  8280. // system thread ID.
  8281. // Currently when kernel debugging this will fail
  8282. // if the thread is not executing on a processor.
  8283. STDMETHOD(GetThreadIdBySystemId)(
  8284. THIS_
  8285. IN ULONG SysId,
  8286. OUT PULONG Id
  8287. ) PURE;
  8288. // Returns the handle of the current thread.
  8289. // In kernel mode the value returned is the
  8290. // index of the processor the thread is
  8291. // executing on plus one.
  8292. STDMETHOD(GetCurrentThreadHandle)(
  8293. THIS_
  8294. OUT PULONG64 Handle
  8295. ) PURE;
  8296. // Looks up a debugger thread ID for the given handle.
  8297. // Currently when kernel debugging this will fail
  8298. // if the thread is not executing on a processor.
  8299. STDMETHOD(GetThreadIdByHandle)(
  8300. THIS_
  8301. IN ULONG64 Handle,
  8302. OUT PULONG Id
  8303. ) PURE;
  8304. // Currently kernel mode sessions will only have
  8305. // a single process representing kernel space.
  8306. STDMETHOD(GetNumberProcesses)(
  8307. THIS_
  8308. OUT PULONG Number
  8309. ) PURE;
  8310. STDMETHOD(GetProcessIdsByIndex)(
  8311. THIS_
  8312. IN ULONG Start,
  8313. IN ULONG Count,
  8314. OUT OPTIONAL /* size_is(Count) */ PULONG Ids,
  8315. OUT OPTIONAL /* size_is(Count) */ PULONG SysIds
  8316. ) PURE;
  8317. // Returns the offset of the current processs
  8318. // system data structure. When kernel debugging
  8319. // this is the offset of the KPROCESS of
  8320. // the process that owns the current thread.
  8321. // When user debugging it is the offset
  8322. // of the current PEB.
  8323. STDMETHOD(GetCurrentProcessDataOffset)(
  8324. THIS_
  8325. OUT PULONG64 Offset
  8326. ) PURE;
  8327. // Looks up a debugger process ID for the given
  8328. // system process data structure.
  8329. // Not currently supported when kernel debugging.
  8330. STDMETHOD(GetProcessIdByDataOffset)(
  8331. THIS_
  8332. IN ULONG64 Offset,
  8333. OUT PULONG Id
  8334. ) PURE;
  8335. // Returns the offset of the current processs
  8336. // PEB. In user mode this is equivalent to
  8337. // the processs data offset.
  8338. STDMETHOD(GetCurrentProcessPeb)(
  8339. THIS_
  8340. OUT PULONG64 Offset
  8341. ) PURE;
  8342. // Looks up a debugger process ID for the given PEB.
  8343. // Not currently supported when kernel debugging.
  8344. STDMETHOD(GetProcessIdByPeb)(
  8345. THIS_
  8346. IN ULONG64 Offset,
  8347. OUT PULONG Id
  8348. ) PURE;
  8349. // Returns the system unique ID for the current process.
  8350. // Not currently supported when kernel debugging.
  8351. STDMETHOD(GetCurrentProcessSystemId)(
  8352. THIS_
  8353. OUT PULONG SysId
  8354. ) PURE;
  8355. // Looks up a debugger process ID for the given
  8356. // system process ID.
  8357. // Not currently supported when kernel debugging.
  8358. STDMETHOD(GetProcessIdBySystemId)(
  8359. THIS_
  8360. IN ULONG SysId,
  8361. OUT PULONG Id
  8362. ) PURE;
  8363. // Returns the handle of the current process.
  8364. // In kernel mode this is the kernel processs
  8365. // artificial handle used for symbol operations
  8366. // and so can only be used with dbghelp APIs.
  8367. STDMETHOD(GetCurrentProcessHandle)(
  8368. THIS_
  8369. OUT PULONG64 Handle
  8370. ) PURE;
  8371. // Looks up a debugger process ID for the given handle.
  8372. STDMETHOD(GetProcessIdByHandle)(
  8373. THIS_
  8374. IN ULONG64 Handle,
  8375. OUT PULONG Id
  8376. ) PURE;
  8377. // Retrieve the name of the executable loaded
  8378. // in the process. This may fail if no executable
  8379. // was identified.
  8380. STDMETHOD(GetCurrentProcessExecutableName)(
  8381. THIS_
  8382. OUT OPTIONAL PSTR Buffer,
  8383. IN ULONG BufferSize,
  8384. OUT OPTIONAL PULONG ExeSize
  8385. ) PURE;
  8386. };
  8387. #undef INTERFACE
  8388. #define INTERFACE IDebugSystemObjects2
  8389. DECLARE_INTERFACE_(IDebugSystemObjects2, IUnknown)
  8390. {
  8391. // IUnknown.
  8392. STDMETHOD(QueryInterface)(
  8393. THIS_
  8394. IN REFIID InterfaceId,
  8395. OUT PVOID* Interface
  8396. ) PURE;
  8397. STDMETHOD_(ULONG, AddRef)(
  8398. THIS
  8399. ) PURE;
  8400. STDMETHOD_(ULONG, Release)(
  8401. THIS
  8402. ) PURE;
  8403. // IDebugSystemObjects.
  8404. // In user mode debugging the debugger
  8405. // tracks all threads and processes and
  8406. // enumerates them through the following
  8407. // methods. When enumerating threads
  8408. // the threads are enumerated for the current
  8409. // process.
  8410. // Kernel mode debugging currently is
  8411. // limited to enumerating only the threads
  8412. // assigned to processors, not all of
  8413. // the threads in the system. Process
  8414. // enumeration is limited to a single
  8415. // virtual process representing kernel space.
  8416. // Returns the ID of the thread on which
  8417. // the last event occurred.
  8418. STDMETHOD(GetEventThread)(
  8419. THIS_
  8420. OUT PULONG Id
  8421. ) PURE;
  8422. STDMETHOD(GetEventProcess)(
  8423. THIS_
  8424. OUT PULONG Id
  8425. ) PURE;
  8426. // Controls implicit thread used by the
  8427. // debug engine. The debuggers current
  8428. // thread is just a piece of data held
  8429. // by the debugger for calls which use
  8430. // thread-specific information. In those
  8431. // calls the debuggers current thread is used.
  8432. // The debuggers current thread is not related
  8433. // to any system thread attribute.
  8434. // IDs for threads are small integer IDs
  8435. // maintained by the engine. They are not
  8436. // related to system thread IDs.
  8437. STDMETHOD(GetCurrentThreadId)(
  8438. THIS_
  8439. OUT PULONG Id
  8440. ) PURE;
  8441. STDMETHOD(SetCurrentThreadId)(
  8442. THIS_
  8443. IN ULONG Id
  8444. ) PURE;
  8445. // The current process is the process
  8446. // that owns the current thread.
  8447. STDMETHOD(GetCurrentProcessId)(
  8448. THIS_
  8449. OUT PULONG Id
  8450. ) PURE;
  8451. // Setting the current process automatically
  8452. // sets the current thread to the thread that
  8453. // was last current in that process.
  8454. STDMETHOD(SetCurrentProcessId)(
  8455. THIS_
  8456. IN ULONG Id
  8457. ) PURE;
  8458. // Gets the number of threads in the current process.
  8459. STDMETHOD(GetNumberThreads)(
  8460. THIS_
  8461. OUT PULONG Number
  8462. ) PURE;
  8463. // Gets thread count information for all processes
  8464. // and the largest number of threads in a single process.
  8465. STDMETHOD(GetTotalNumberThreads)(
  8466. THIS_
  8467. OUT PULONG Total,
  8468. OUT PULONG LargestProcess
  8469. ) PURE;
  8470. STDMETHOD(GetThreadIdsByIndex)(
  8471. THIS_
  8472. IN ULONG Start,
  8473. IN ULONG Count,
  8474. OUT OPTIONAL /* size_is(Count) */ PULONG Ids,
  8475. OUT OPTIONAL /* size_is(Count) */ PULONG SysIds
  8476. ) PURE;
  8477. // Gets the debugger ID for the thread
  8478. // currently running on the given
  8479. // processor. Only works in kernel
  8480. // debugging.
  8481. STDMETHOD(GetThreadIdByProcessor)(
  8482. THIS_
  8483. IN ULONG Processor,
  8484. OUT PULONG Id
  8485. ) PURE;
  8486. // Returns the offset of the current threads
  8487. // system data structure. When kernel debugging
  8488. // this is the offset of the KTHREAD.
  8489. // When user debugging it is the offset
  8490. // of the current TEB.
  8491. STDMETHOD(GetCurrentThreadDataOffset)(
  8492. THIS_
  8493. OUT PULONG64 Offset
  8494. ) PURE;
  8495. // Looks up a debugger thread ID for the given
  8496. // system thread data structure.
  8497. // Currently when kernel debugging this will fail
  8498. // if the thread is not executing on a processor.
  8499. STDMETHOD(GetThreadIdByDataOffset)(
  8500. THIS_
  8501. IN ULONG64 Offset,
  8502. OUT PULONG Id
  8503. ) PURE;
  8504. // Returns the offset of the current threads
  8505. // TEB. In user mode this is equivalent to
  8506. // the threads data offset.
  8507. STDMETHOD(GetCurrentThreadTeb)(
  8508. THIS_
  8509. OUT PULONG64 Offset
  8510. ) PURE;
  8511. // Looks up a debugger thread ID for the given TEB.
  8512. // Currently when kernel debugging this will fail
  8513. // if the thread is not executing on a processor.
  8514. STDMETHOD(GetThreadIdByTeb)(
  8515. THIS_
  8516. IN ULONG64 Offset,
  8517. OUT PULONG Id
  8518. ) PURE;
  8519. // Returns the system unique ID for the current thread.
  8520. // Not currently supported when kernel debugging.
  8521. STDMETHOD(GetCurrentThreadSystemId)(
  8522. THIS_
  8523. OUT PULONG SysId
  8524. ) PURE;
  8525. // Looks up a debugger thread ID for the given
  8526. // system thread ID.
  8527. // Currently when kernel debugging this will fail
  8528. // if the thread is not executing on a processor.
  8529. STDMETHOD(GetThreadIdBySystemId)(
  8530. THIS_
  8531. IN ULONG SysId,
  8532. OUT PULONG Id
  8533. ) PURE;
  8534. // Returns the handle of the current thread.
  8535. // In kernel mode the value returned is the
  8536. // index of the processor the thread is
  8537. // executing on plus one.
  8538. STDMETHOD(GetCurrentThreadHandle)(
  8539. THIS_
  8540. OUT PULONG64 Handle
  8541. ) PURE;
  8542. // Looks up a debugger thread ID for the given handle.
  8543. // Currently when kernel debugging this will fail
  8544. // if the thread is not executing on a processor.
  8545. STDMETHOD(GetThreadIdByHandle)(
  8546. THIS_
  8547. IN ULONG64 Handle,
  8548. OUT PULONG Id
  8549. ) PURE;
  8550. // Currently kernel mode sessions will only have
  8551. // a single process representing kernel space.
  8552. STDMETHOD(GetNumberProcesses)(
  8553. THIS_
  8554. OUT PULONG Number
  8555. ) PURE;
  8556. STDMETHOD(GetProcessIdsByIndex)(
  8557. THIS_
  8558. IN ULONG Start,
  8559. IN ULONG Count,
  8560. OUT OPTIONAL /* size_is(Count) */ PULONG Ids,
  8561. OUT OPTIONAL /* size_is(Count) */ PULONG SysIds
  8562. ) PURE;
  8563. // Returns the offset of the current processs
  8564. // system data structure. When kernel debugging
  8565. // this is the offset of the KPROCESS of
  8566. // the process that owns the current thread.
  8567. // When user debugging it is the offset
  8568. // of the current PEB.
  8569. STDMETHOD(GetCurrentProcessDataOffset)(
  8570. THIS_
  8571. OUT PULONG64 Offset
  8572. ) PURE;
  8573. // Looks up a debugger process ID for the given
  8574. // system process data structure.
  8575. // Not currently supported when kernel debugging.
  8576. STDMETHOD(GetProcessIdByDataOffset)(
  8577. THIS_
  8578. IN ULONG64 Offset,
  8579. OUT PULONG Id
  8580. ) PURE;
  8581. // Returns the offset of the current processs
  8582. // PEB. In user mode this is equivalent to
  8583. // the processs data offset.
  8584. STDMETHOD(GetCurrentProcessPeb)(
  8585. THIS_
  8586. OUT PULONG64 Offset
  8587. ) PURE;
  8588. // Looks up a debugger process ID for the given PEB.
  8589. // Not currently supported when kernel debugging.
  8590. STDMETHOD(GetProcessIdByPeb)(
  8591. THIS_
  8592. IN ULONG64 Offset,
  8593. OUT PULONG Id
  8594. ) PURE;
  8595. // Returns the system unique ID for the current process.
  8596. // Not currently supported when kernel debugging.
  8597. STDMETHOD(GetCurrentProcessSystemId)(
  8598. THIS_
  8599. OUT PULONG SysId
  8600. ) PURE;
  8601. // Looks up a debugger process ID for the given
  8602. // system process ID.
  8603. // Not currently supported when kernel debugging.
  8604. STDMETHOD(GetProcessIdBySystemId)(
  8605. THIS_
  8606. IN ULONG SysId,
  8607. OUT PULONG Id
  8608. ) PURE;
  8609. // Returns the handle of the current process.
  8610. // In kernel mode this is the kernel processs
  8611. // artificial handle used for symbol operations
  8612. // and so can only be used with dbghelp APIs.
  8613. STDMETHOD(GetCurrentProcessHandle)(
  8614. THIS_
  8615. OUT PULONG64 Handle
  8616. ) PURE;
  8617. // Looks up a debugger process ID for the given handle.
  8618. STDMETHOD(GetProcessIdByHandle)(
  8619. THIS_
  8620. IN ULONG64 Handle,
  8621. OUT PULONG Id
  8622. ) PURE;
  8623. // Retrieve the name of the executable loaded
  8624. // in the process. This may fail if no executable
  8625. // was identified.
  8626. STDMETHOD(GetCurrentProcessExecutableName)(
  8627. THIS_
  8628. OUT OPTIONAL PSTR Buffer,
  8629. IN ULONG BufferSize,
  8630. OUT OPTIONAL PULONG ExeSize
  8631. ) PURE;
  8632. // IDebugSystemObjects2.
  8633. // Return the number of seconds that the current
  8634. // process has been running.
  8635. STDMETHOD(GetCurrentProcessUpTime)(
  8636. THIS_
  8637. OUT PULONG UpTime
  8638. ) PURE;
  8639. // During kernel sessions the debugger retrieves
  8640. // some information from the system thread and process
  8641. // running on the current processor. For example,
  8642. // the debugger will retrieve virtual memory translation
  8643. // information for when the debugger needs to
  8644. // carry out its own virtual to physical translations.
  8645. // Occasionally it can be interesting to perform
  8646. // similar operations but on a process which isnt
  8647. // currently running. The follow methods allow a caller
  8648. // to override the data offsets used by the debugger
  8649. // so that other system threads and processes can
  8650. // be used instead. These values are defaulted to
  8651. // the thread and process running on the current
  8652. // processor each time the debuggee executes or
  8653. // the current processor changes.
  8654. // The thread and process settings are independent so
  8655. // it is possible to refer to a thread in a process
  8656. // other than the current process and vice versa.
  8657. // Setting an offset of zero will reload the
  8658. // default value.
  8659. STDMETHOD(GetImplicitThreadDataOffset)(
  8660. THIS_
  8661. OUT PULONG64 Offset
  8662. ) PURE;
  8663. STDMETHOD(SetImplicitThreadDataOffset)(
  8664. THIS_
  8665. IN ULONG64 Offset
  8666. ) PURE;
  8667. STDMETHOD(GetImplicitProcessDataOffset)(
  8668. THIS_
  8669. OUT PULONG64 Offset
  8670. ) PURE;
  8671. STDMETHOD(SetImplicitProcessDataOffset)(
  8672. THIS_
  8673. IN ULONG64 Offset
  8674. ) PURE;
  8675. };
  8676. #undef INTERFACE
  8677. #define INTERFACE IDebugSystemObjects3
  8678. DECLARE_INTERFACE_(IDebugSystemObjects3, IUnknown)
  8679. {
  8680. // IUnknown.
  8681. STDMETHOD(QueryInterface)(
  8682. THIS_
  8683. IN REFIID InterfaceId,
  8684. OUT PVOID* Interface
  8685. ) PURE;
  8686. STDMETHOD_(ULONG, AddRef)(
  8687. THIS
  8688. ) PURE;
  8689. STDMETHOD_(ULONG, Release)(
  8690. THIS
  8691. ) PURE;
  8692. // IDebugSystemObjects.
  8693. // In user mode debugging the debugger
  8694. // tracks all threads and processes and
  8695. // enumerates them through the following
  8696. // methods. When enumerating threads
  8697. // the threads are enumerated for the current
  8698. // process.
  8699. // Kernel mode debugging currently is
  8700. // limited to enumerating only the threads
  8701. // assigned to processors, not all of
  8702. // the threads in the system. Process
  8703. // enumeration is limited to a single
  8704. // virtual process representing kernel space.
  8705. // Returns the ID of the thread on which
  8706. // the last event occurred.
  8707. STDMETHOD(GetEventThread)(
  8708. THIS_
  8709. OUT PULONG Id
  8710. ) PURE;
  8711. STDMETHOD(GetEventProcess)(
  8712. THIS_
  8713. OUT PULONG Id
  8714. ) PURE;
  8715. // Controls implicit thread used by the
  8716. // debug engine. The debuggers current
  8717. // thread is just a piece of data held
  8718. // by the debugger for calls which use
  8719. // thread-specific information. In those
  8720. // calls the debuggers current thread is used.
  8721. // The debuggers current thread is not related
  8722. // to any system thread attribute.
  8723. // IDs for threads are small integer IDs
  8724. // maintained by the engine. They are not
  8725. // related to system thread IDs.
  8726. STDMETHOD(GetCurrentThreadId)(
  8727. THIS_
  8728. OUT PULONG Id
  8729. ) PURE;
  8730. STDMETHOD(SetCurrentThreadId)(
  8731. THIS_
  8732. IN ULONG Id
  8733. ) PURE;
  8734. // The current process is the process
  8735. // that owns the current thread.
  8736. STDMETHOD(GetCurrentProcessId)(
  8737. THIS_
  8738. OUT PULONG Id
  8739. ) PURE;
  8740. // Setting the current process automatically
  8741. // sets the current thread to the thread that
  8742. // was last current in that process.
  8743. STDMETHOD(SetCurrentProcessId)(
  8744. THIS_
  8745. IN ULONG Id
  8746. ) PURE;
  8747. // Gets the number of threads in the current process.
  8748. STDMETHOD(GetNumberThreads)(
  8749. THIS_
  8750. OUT PULONG Number
  8751. ) PURE;
  8752. // Gets thread count information for all processes
  8753. // and the largest number of threads in a single process.
  8754. STDMETHOD(GetTotalNumberThreads)(
  8755. THIS_
  8756. OUT PULONG Total,
  8757. OUT PULONG LargestProcess
  8758. ) PURE;
  8759. STDMETHOD(GetThreadIdsByIndex)(
  8760. THIS_
  8761. IN ULONG Start,
  8762. IN ULONG Count,
  8763. OUT OPTIONAL /* size_is(Count) */ PULONG Ids,
  8764. OUT OPTIONAL /* size_is(Count) */ PULONG SysIds
  8765. ) PURE;
  8766. // Gets the debugger ID for the thread
  8767. // currently running on the given
  8768. // processor. Only works in kernel
  8769. // debugging.
  8770. STDMETHOD(GetThreadIdByProcessor)(
  8771. THIS_
  8772. IN ULONG Processor,
  8773. OUT PULONG Id
  8774. ) PURE;
  8775. // Returns the offset of the current threads
  8776. // system data structure. When kernel debugging
  8777. // this is the offset of the KTHREAD.
  8778. // When user debugging it is the offset
  8779. // of the current TEB.
  8780. STDMETHOD(GetCurrentThreadDataOffset)(
  8781. THIS_
  8782. OUT PULONG64 Offset
  8783. ) PURE;
  8784. // Looks up a debugger thread ID for the given
  8785. // system thread data structure.
  8786. // Currently when kernel debugging this will fail
  8787. // if the thread is not executing on a processor.
  8788. STDMETHOD(GetThreadIdByDataOffset)(
  8789. THIS_
  8790. IN ULONG64 Offset,
  8791. OUT PULONG Id
  8792. ) PURE;
  8793. // Returns the offset of the current threads
  8794. // TEB. In user mode this is equivalent to
  8795. // the threads data offset.
  8796. STDMETHOD(GetCurrentThreadTeb)(
  8797. THIS_
  8798. OUT PULONG64 Offset
  8799. ) PURE;
  8800. // Looks up a debugger thread ID for the given TEB.
  8801. // Currently when kernel debugging this will fail
  8802. // if the thread is not executing on a processor.
  8803. STDMETHOD(GetThreadIdByTeb)(
  8804. THIS_
  8805. IN ULONG64 Offset,
  8806. OUT PULONG Id
  8807. ) PURE;
  8808. // Returns the system unique ID for the current thread.
  8809. // Not currently supported when kernel debugging.
  8810. STDMETHOD(GetCurrentThreadSystemId)(
  8811. THIS_
  8812. OUT PULONG SysId
  8813. ) PURE;
  8814. // Looks up a debugger thread ID for the given
  8815. // system thread ID.
  8816. // Currently when kernel debugging this will fail
  8817. // if the thread is not executing on a processor.
  8818. STDMETHOD(GetThreadIdBySystemId)(
  8819. THIS_
  8820. IN ULONG SysId,
  8821. OUT PULONG Id
  8822. ) PURE;
  8823. // Returns the handle of the current thread.
  8824. // In kernel mode the value returned is the
  8825. // index of the processor the thread is
  8826. // executing on plus one.
  8827. STDMETHOD(GetCurrentThreadHandle)(
  8828. THIS_
  8829. OUT PULONG64 Handle
  8830. ) PURE;
  8831. // Looks up a debugger thread ID for the given handle.
  8832. // Currently when kernel debugging this will fail
  8833. // if the thread is not executing on a processor.
  8834. STDMETHOD(GetThreadIdByHandle)(
  8835. THIS_
  8836. IN ULONG64 Handle,
  8837. OUT PULONG Id
  8838. ) PURE;
  8839. // Currently kernel mode sessions will only have
  8840. // a single process representing kernel space.
  8841. STDMETHOD(GetNumberProcesses)(
  8842. THIS_
  8843. OUT PULONG Number
  8844. ) PURE;
  8845. STDMETHOD(GetProcessIdsByIndex)(
  8846. THIS_
  8847. IN ULONG Start,
  8848. IN ULONG Count,
  8849. OUT OPTIONAL /* size_is(Count) */ PULONG Ids,
  8850. OUT OPTIONAL /* size_is(Count) */ PULONG SysIds
  8851. ) PURE;
  8852. // Returns the offset of the current processs
  8853. // system data structure. When kernel debugging
  8854. // this is the offset of the KPROCESS of
  8855. // the process that owns the current thread.
  8856. // When user debugging it is the offset
  8857. // of the current PEB.
  8858. STDMETHOD(GetCurrentProcessDataOffset)(
  8859. THIS_
  8860. OUT PULONG64 Offset
  8861. ) PURE;
  8862. // Looks up a debugger process ID for the given
  8863. // system process data structure.
  8864. // Not currently supported when kernel debugging.
  8865. STDMETHOD(GetProcessIdByDataOffset)(
  8866. THIS_
  8867. IN ULONG64 Offset,
  8868. OUT PULONG Id
  8869. ) PURE;
  8870. // Returns the offset of the current processs
  8871. // PEB. In user mode this is equivalent to
  8872. // the processs data offset.
  8873. STDMETHOD(GetCurrentProcessPeb)(
  8874. THIS_
  8875. OUT PULONG64 Offset
  8876. ) PURE;
  8877. // Looks up a debugger process ID for the given PEB.
  8878. // Not currently supported when kernel debugging.
  8879. STDMETHOD(GetProcessIdByPeb)(
  8880. THIS_
  8881. IN ULONG64 Offset,
  8882. OUT PULONG Id
  8883. ) PURE;
  8884. // Returns the system unique ID for the current process.
  8885. // Not currently supported when kernel debugging.
  8886. STDMETHOD(GetCurrentProcessSystemId)(
  8887. THIS_
  8888. OUT PULONG SysId
  8889. ) PURE;
  8890. // Looks up a debugger process ID for the given
  8891. // system process ID.
  8892. // Not currently supported when kernel debugging.
  8893. STDMETHOD(GetProcessIdBySystemId)(
  8894. THIS_
  8895. IN ULONG SysId,
  8896. OUT PULONG Id
  8897. ) PURE;
  8898. // Returns the handle of the current process.
  8899. // In kernel mode this is the kernel processs
  8900. // artificial handle used for symbol operations
  8901. // and so can only be used with dbghelp APIs.
  8902. STDMETHOD(GetCurrentProcessHandle)(
  8903. THIS_
  8904. OUT PULONG64 Handle
  8905. ) PURE;
  8906. // Looks up a debugger process ID for the given handle.
  8907. STDMETHOD(GetProcessIdByHandle)(
  8908. THIS_
  8909. IN ULONG64 Handle,
  8910. OUT PULONG Id
  8911. ) PURE;
  8912. // Retrieve the name of the executable loaded
  8913. // in the process. This may fail if no executable
  8914. // was identified.
  8915. STDMETHOD(GetCurrentProcessExecutableName)(
  8916. THIS_
  8917. OUT OPTIONAL PSTR Buffer,
  8918. IN ULONG BufferSize,
  8919. OUT OPTIONAL PULONG ExeSize
  8920. ) PURE;
  8921. // IDebugSystemObjects2.
  8922. // Return the number of seconds that the current
  8923. // process has been running.
  8924. STDMETHOD(GetCurrentProcessUpTime)(
  8925. THIS_
  8926. OUT PULONG UpTime
  8927. ) PURE;
  8928. // During kernel sessions the debugger retrieves
  8929. // some information from the system thread and process
  8930. // running on the current processor. For example,
  8931. // the debugger will retrieve virtual memory translation
  8932. // information for when the debugger needs to
  8933. // carry out its own virtual to physical translations.
  8934. // Occasionally it can be interesting to perform
  8935. // similar operations but on a process which isnt
  8936. // currently running. The follow methods allow a caller
  8937. // to override the data offsets used by the debugger
  8938. // so that other system threads and processes can
  8939. // be used instead. These values are defaulted to
  8940. // the thread and process running on the current
  8941. // processor each time the debuggee executes or
  8942. // the current processor changes.
  8943. // The thread and process settings are independent so
  8944. // it is possible to refer to a thread in a process
  8945. // other than the current process and vice versa.
  8946. // Setting an offset of zero will reload the
  8947. // default value.
  8948. STDMETHOD(GetImplicitThreadDataOffset)(
  8949. THIS_
  8950. OUT PULONG64 Offset
  8951. ) PURE;
  8952. STDMETHOD(SetImplicitThreadDataOffset)(
  8953. THIS_
  8954. IN ULONG64 Offset
  8955. ) PURE;
  8956. STDMETHOD(GetImplicitProcessDataOffset)(
  8957. THIS_
  8958. OUT PULONG64 Offset
  8959. ) PURE;
  8960. STDMETHOD(SetImplicitProcessDataOffset)(
  8961. THIS_
  8962. IN ULONG64 Offset
  8963. ) PURE;
  8964. // IDebugSystemObjects3.
  8965. STDMETHOD(GetEventSystem)(
  8966. THIS_
  8967. OUT PULONG Id
  8968. ) PURE;
  8969. STDMETHOD(GetCurrentSystemId)(
  8970. THIS_
  8971. OUT PULONG Id
  8972. ) PURE;
  8973. STDMETHOD(SetCurrentSystemId)(
  8974. THIS_
  8975. IN ULONG Id
  8976. ) PURE;
  8977. STDMETHOD(GetNumberSystems)(
  8978. THIS_
  8979. OUT PULONG Number
  8980. ) PURE;
  8981. STDMETHOD(GetSystemIdsByIndex)(
  8982. THIS_
  8983. IN ULONG Start,
  8984. IN ULONG Count,
  8985. OUT /* size_is(Count) */ PULONG Ids
  8986. ) PURE;
  8987. STDMETHOD(GetTotalNumberThreadsAndProcesses)(
  8988. THIS_
  8989. OUT PULONG TotalThreads,
  8990. OUT PULONG TotalProcesses,
  8991. OUT PULONG LargestProcessThreads,
  8992. OUT PULONG LargestSystemThreads,
  8993. OUT PULONG LargestSystemProcesses
  8994. ) PURE;
  8995. STDMETHOD(GetCurrentSystemServer)(
  8996. THIS_
  8997. OUT PULONG64 Server
  8998. ) PURE;
  8999. STDMETHOD(GetSystemByServer)(
  9000. THIS_
  9001. IN ULONG64 Server,
  9002. OUT PULONG Id
  9003. ) PURE;
  9004. STDMETHOD(GetCurrentSystemServerName)(
  9005. THIS_
  9006. OUT OPTIONAL PSTR Buffer,
  9007. IN ULONG BufferSize,
  9008. OUT OPTIONAL PULONG NameSize
  9009. ) PURE;
  9010. };
  9011. //----------------------------------------------------------------------------
  9012. //
  9013. // Debugger/debuggee communication.
  9014. //
  9015. // A distinguished exception, DBG_COMMAND_EXCEPTION (0x40010009),
  9016. // can be used by a debuggee to communicate with the debugger.
  9017. // The arguments of the exception must be:
  9018. // 1. Exception ID.
  9019. // 2. Command code.
  9020. // 3. Size of argument.
  9021. // 4. Pointer to argument.
  9022. //
  9023. // The arguments depend on the command code.
  9024. //
  9025. //----------------------------------------------------------------------------
  9026. #define DEBUG_COMMAND_EXCEPTION_ID 0xdbe00dbe
  9027. // Invalid command code.
  9028. #define DEBUG_CMDEX_INVALID 0x00000000
  9029. //
  9030. // The debugger can collect strings for display at the
  9031. // next event. A debuggee can use this to register information
  9032. // about a program situation before places where an event
  9033. // may occur, such as a risky operation or assertion.
  9034. // The strings are automatically flushed on the next
  9035. // event continuation. Strings are kept on a per-thread basis.
  9036. //
  9037. // When adding, the argument is the string to add.
  9038. // Reset has no arguments and clears all strings.
  9039. //
  9040. #define DEBUG_CMDEX_ADD_EVENT_STRING 0x00000001
  9041. #define DEBUG_CMDEX_RESET_EVENT_STRINGS 0x00000002
  9042. #ifndef DEBUG_NO_IMPLEMENTATION
  9043. FORCEINLINE void
  9044. DebugCommandException(ULONG Command, ULONG ArgSize, PVOID Arg)
  9045. {
  9046. ULONG_PTR ExArgs[4];
  9047. ExArgs[0] = DEBUG_COMMAND_EXCEPTION_ID;
  9048. ExArgs[1] = Command;
  9049. ExArgs[2] = ArgSize;
  9050. ExArgs[3] = (ULONG_PTR)Arg;
  9051. RaiseException(DBG_COMMAND_EXCEPTION, 0, 4, ExArgs);
  9052. }
  9053. #endif // #ifndef DEBUG_NO_IMPLEMENTATION
  9054. //----------------------------------------------------------------------------
  9055. //
  9056. // Extension callbacks.
  9057. //
  9058. //----------------------------------------------------------------------------
  9059. // Returns a version with the major version in
  9060. // the high word and the minor version in the low word.
  9061. #define DEBUG_EXTENSION_VERSION(Major, Minor) \
  9062. ((((Major) & 0xffff) << 16) | ((Minor) & 0xffff))
  9063. // Initialization routine. Called once when the extension DLL
  9064. // is loaded. Returns a version and returns flags detailing
  9065. // overall qualities of the extension DLL.
  9066. // A session may or may not be active at the time the DLL
  9067. // is loaded so initialization routines should not expect
  9068. // to be able to query session information.
  9069. typedef HRESULT (CALLBACK* PDEBUG_EXTENSION_INITIALIZE)
  9070. (OUT PULONG Version, OUT PULONG Flags);
  9071. // Exit routine. Called once just before the extension DLL is
  9072. // unloaded. As with initialization, a session may or
  9073. // may not be active at the time of the call.
  9074. typedef void (CALLBACK* PDEBUG_EXTENSION_UNINITIALIZE)
  9075. (void);
  9076. // A debuggee has been discovered for the session. It
  9077. // is not necessarily halted.
  9078. #define DEBUG_NOTIFY_SESSION_ACTIVE 0x00000000
  9079. // The session no longer has a debuggee.
  9080. #define DEBUG_NOTIFY_SESSION_INACTIVE 0x00000001
  9081. // The debuggee is halted and accessible.
  9082. #define DEBUG_NOTIFY_SESSION_ACCESSIBLE 0x00000002
  9083. // The debuggee is running or inaccessible.
  9084. #define DEBUG_NOTIFY_SESSION_INACCESSIBLE 0x00000003
  9085. typedef void (CALLBACK* PDEBUG_EXTENSION_NOTIFY)
  9086. (IN ULONG Notify, IN ULONG64 Argument);
  9087. // A PDEBUG_EXTENSION_CALL function can return this code
  9088. // to indicate that it was unable to handle the request
  9089. // and that the search for an extension function should
  9090. // continue down the extension DLL chain.
  9091. // Taken from STATUS_VALIDATE_CONTINUE
  9092. #define DEBUG_EXTENSION_CONTINUE_SEARCH \
  9093. HRESULT_FROM_NT(0xC0000271L)
  9094. // Every routine in an extension DLL has the following prototype.
  9095. // The extension may be called from multiple clients so it
  9096. // should not cache the client value between calls.
  9097. typedef HRESULT (CALLBACK* PDEBUG_EXTENSION_CALL)
  9098. (IN PDEBUG_CLIENT Client, IN OPTIONAL PCSTR Args);
  9099. //----------------------------------------------------------------------------
  9100. //
  9101. // Extension functions.
  9102. //
  9103. // Extension functions differ from extension callbacks in that
  9104. // they are arbitrary functions exported from an extension DLL
  9105. // for other code callers instead of for human invocation from
  9106. // debugger commands. Extension function pointers are retrieved
  9107. // for an extension DLL with IDebugControl::GetExtensionFunction.
  9108. //
  9109. // Extension function names must begin with _EFN_. Other than that
  9110. // they can have any name and prototype. Extension functions
  9111. // must be public exports of their extension DLL. They should
  9112. // have a typedef for their function pointer prototype in an
  9113. // extension header so that callers have a header file to include
  9114. // with a type that allows a correctly-formed invocation of the
  9115. // extension function.
  9116. //
  9117. // The engine does not perform any validation of calls to
  9118. // extension functions. Once the extension function pointer
  9119. // is retrieved with GetExtensionFunction all calls go
  9120. // directly between the caller and the extension function and
  9121. // are not mediated by the engine.
  9122. //
  9123. //----------------------------------------------------------------------------
  9124. #ifdef __cplusplus
  9125. };
  9126. //----------------------------------------------------------------------------
  9127. //
  9128. // C++ implementation helper classes.
  9129. //
  9130. //----------------------------------------------------------------------------
  9131. #ifndef DEBUG_NO_IMPLEMENTATION
  9132. //
  9133. // DebugBaseEventCallbacks provides a do-nothing base implementation
  9134. // of IDebugEventCallbacks. A program can derive their own
  9135. // event callbacks class from DebugBaseEventCallbacks and implement
  9136. // only the methods they are interested in. Programs must be
  9137. // careful to implement GetInterestMask appropriately.
  9138. //
  9139. class DebugBaseEventCallbacks : public IDebugEventCallbacks
  9140. {
  9141. public:
  9142. // IUnknown.
  9143. STDMETHOD(QueryInterface)(
  9144. THIS_
  9145. IN REFIID InterfaceId,
  9146. OUT PVOID* Interface
  9147. )
  9148. {
  9149. *Interface = NULL;
  9150. #if _MSC_VER >= 1100
  9151. if (IsEqualIID(InterfaceId, __uuidof(IUnknown)) ||
  9152. IsEqualIID(InterfaceId, __uuidof(IDebugEventCallbacks)))
  9153. #else
  9154. if (IsEqualIID(InterfaceId, IID_IUnknown) ||
  9155. IsEqualIID(InterfaceId, IID_IDebugEventCallbacks))
  9156. #endif
  9157. {
  9158. *Interface = (IDebugEventCallbacks *)this;
  9159. AddRef();
  9160. return S_OK;
  9161. }
  9162. else
  9163. {
  9164. return E_NOINTERFACE;
  9165. }
  9166. }
  9167. // IDebugEventCallbacks.
  9168. STDMETHOD(Breakpoint)(
  9169. THIS_
  9170. IN PDEBUG_BREAKPOINT Bp
  9171. )
  9172. {
  9173. UNREFERENCED_PARAMETER(Bp);
  9174. return DEBUG_STATUS_NO_CHANGE;
  9175. }
  9176. STDMETHOD(Exception)(
  9177. THIS_
  9178. IN PEXCEPTION_RECORD64 Exception,
  9179. IN ULONG FirstChance
  9180. )
  9181. {
  9182. UNREFERENCED_PARAMETER(Exception);
  9183. UNREFERENCED_PARAMETER(FirstChance);
  9184. return DEBUG_STATUS_NO_CHANGE;
  9185. }
  9186. STDMETHOD(CreateThread)(
  9187. THIS_
  9188. IN ULONG64 Handle,
  9189. IN ULONG64 DataOffset,
  9190. IN ULONG64 StartOffset
  9191. )
  9192. {
  9193. UNREFERENCED_PARAMETER(Handle);
  9194. UNREFERENCED_PARAMETER(DataOffset);
  9195. UNREFERENCED_PARAMETER(StartOffset);
  9196. return DEBUG_STATUS_NO_CHANGE;
  9197. }
  9198. STDMETHOD(ExitThread)(
  9199. THIS_
  9200. IN ULONG ExitCode
  9201. )
  9202. {
  9203. UNREFERENCED_PARAMETER(ExitCode);
  9204. return DEBUG_STATUS_NO_CHANGE;
  9205. }
  9206. STDMETHOD(CreateProcess)(
  9207. THIS_
  9208. IN ULONG64 ImageFileHandle,
  9209. IN ULONG64 Handle,
  9210. IN ULONG64 BaseOffset,
  9211. IN ULONG ModuleSize,
  9212. IN PCSTR ModuleName,
  9213. IN PCSTR ImageName,
  9214. IN ULONG CheckSum,
  9215. IN ULONG TimeDateStamp,
  9216. IN ULONG64 InitialThreadHandle,
  9217. IN ULONG64 ThreadDataOffset,
  9218. IN ULONG64 StartOffset
  9219. )
  9220. {
  9221. UNREFERENCED_PARAMETER(ImageFileHandle);
  9222. UNREFERENCED_PARAMETER(Handle);
  9223. UNREFERENCED_PARAMETER(BaseOffset);
  9224. UNREFERENCED_PARAMETER(ModuleSize);
  9225. UNREFERENCED_PARAMETER(ModuleName);
  9226. UNREFERENCED_PARAMETER(ImageName);
  9227. UNREFERENCED_PARAMETER(CheckSum);
  9228. UNREFERENCED_PARAMETER(TimeDateStamp);
  9229. UNREFERENCED_PARAMETER(InitialThreadHandle);
  9230. UNREFERENCED_PARAMETER(ThreadDataOffset);
  9231. UNREFERENCED_PARAMETER(StartOffset);
  9232. return DEBUG_STATUS_NO_CHANGE;
  9233. }
  9234. STDMETHOD(ExitProcess)(
  9235. THIS_
  9236. IN ULONG ExitCode
  9237. )
  9238. {
  9239. UNREFERENCED_PARAMETER(ExitCode);
  9240. return DEBUG_STATUS_NO_CHANGE;
  9241. }
  9242. STDMETHOD(LoadModule)(
  9243. THIS_
  9244. IN ULONG64 ImageFileHandle,
  9245. IN ULONG64 BaseOffset,
  9246. IN ULONG ModuleSize,
  9247. IN PCSTR ModuleName,
  9248. IN PCSTR ImageName,
  9249. IN ULONG CheckSum,
  9250. IN ULONG TimeDateStamp
  9251. )
  9252. {
  9253. UNREFERENCED_PARAMETER(ImageFileHandle);
  9254. UNREFERENCED_PARAMETER(BaseOffset);
  9255. UNREFERENCED_PARAMETER(ModuleSize);
  9256. UNREFERENCED_PARAMETER(ModuleName);
  9257. UNREFERENCED_PARAMETER(ImageName);
  9258. UNREFERENCED_PARAMETER(CheckSum);
  9259. UNREFERENCED_PARAMETER(TimeDateStamp);
  9260. return DEBUG_STATUS_NO_CHANGE;
  9261. }
  9262. STDMETHOD(UnloadModule)(
  9263. THIS_
  9264. IN PCSTR ImageBaseName,
  9265. IN ULONG64 BaseOffset
  9266. )
  9267. {
  9268. UNREFERENCED_PARAMETER(ImageBaseName);
  9269. UNREFERENCED_PARAMETER(BaseOffset);
  9270. return DEBUG_STATUS_NO_CHANGE;
  9271. }
  9272. STDMETHOD(SystemError)(
  9273. THIS_
  9274. IN ULONG Error,
  9275. IN ULONG Level
  9276. )
  9277. {
  9278. UNREFERENCED_PARAMETER(Error);
  9279. UNREFERENCED_PARAMETER(Level);
  9280. return DEBUG_STATUS_NO_CHANGE;
  9281. }
  9282. STDMETHOD(SessionStatus)(
  9283. THIS_
  9284. IN ULONG Status
  9285. )
  9286. {
  9287. UNREFERENCED_PARAMETER(Status);
  9288. return DEBUG_STATUS_NO_CHANGE;
  9289. }
  9290. STDMETHOD(ChangeDebuggeeState)(
  9291. THIS_
  9292. IN ULONG Flags,
  9293. IN ULONG64 Argument
  9294. )
  9295. {
  9296. UNREFERENCED_PARAMETER(Flags);
  9297. UNREFERENCED_PARAMETER(Argument);
  9298. return S_OK;
  9299. }
  9300. STDMETHOD(ChangeEngineState)(
  9301. THIS_
  9302. IN ULONG Flags,
  9303. IN ULONG64 Argument
  9304. )
  9305. {
  9306. UNREFERENCED_PARAMETER(Flags);
  9307. UNREFERENCED_PARAMETER(Argument);
  9308. return S_OK;
  9309. }
  9310. STDMETHOD(ChangeSymbolState)(
  9311. THIS_
  9312. IN ULONG Flags,
  9313. IN ULONG64 Argument
  9314. )
  9315. {
  9316. UNREFERENCED_PARAMETER(Flags);
  9317. UNREFERENCED_PARAMETER(Argument);
  9318. return S_OK;
  9319. }
  9320. };
  9321. #endif // #ifndef DEBUG_NO_IMPLEMENTATION
  9322. #endif // #ifdef __cplusplus
  9323. #endif // #ifndef __DBGENG_H__