Source code of Windows XP (NT5)
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.

6844 lines
214 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. /* 5182e668-105e-416e-ad92-24ef800424ba */
  40. DEFINE_GUID(IID_IDebugControl, 0x5182e668, 0x105e, 0x416e,
  41. 0xad, 0x92, 0x24, 0xef, 0x80, 0x04, 0x24, 0xba);
  42. /* d4366723-44df-4bed-8c7e-4c05424f4588 */
  43. DEFINE_GUID(IID_IDebugControl2, 0xd4366723, 0x44df, 0x4bed,
  44. 0x8c, 0x7e, 0x4c, 0x05, 0x42, 0x4f, 0x45, 0x88);
  45. /* 88f7dfab-3ea7-4c3a-aefb-c4e8106173aa */
  46. DEFINE_GUID(IID_IDebugDataSpaces, 0x88f7dfab, 0x3ea7, 0x4c3a,
  47. 0xae, 0xfb, 0xc4, 0xe8, 0x10, 0x61, 0x73, 0xaa);
  48. /* 7a5e852f-96e9-468f-ac1b-0b3addc4a049 */
  49. DEFINE_GUID(IID_IDebugDataSpaces2, 0x7a5e852f, 0x96e9, 0x468f,
  50. 0xac, 0x1b, 0x0b, 0x3a, 0xdd, 0xc4, 0xa0, 0x49);
  51. /* 337be28b-5036-4d72-b6bf-c45fbb9f2eaa */
  52. DEFINE_GUID(IID_IDebugEventCallbacks, 0x337be28b, 0x5036, 0x4d72,
  53. 0xb6, 0xbf, 0xc4, 0x5f, 0xbb, 0x9f, 0x2e, 0xaa);
  54. /* 9f50e42c-f136-499e-9a97-73036c94ed2d */
  55. DEFINE_GUID(IID_IDebugInputCallbacks, 0x9f50e42c, 0xf136, 0x499e,
  56. 0x9a, 0x97, 0x73, 0x03, 0x6c, 0x94, 0xed, 0x2d);
  57. /* 4bf58045-d654-4c40-b0af-683090f356dc */
  58. DEFINE_GUID(IID_IDebugOutputCallbacks, 0x4bf58045, 0xd654, 0x4c40,
  59. 0xb0, 0xaf, 0x68, 0x30, 0x90, 0xf3, 0x56, 0xdc);
  60. /* ce289126-9e84-45a7-937e-67bb18691493 */
  61. DEFINE_GUID(IID_IDebugRegisters, 0xce289126, 0x9e84, 0x45a7,
  62. 0x93, 0x7e, 0x67, 0xbb, 0x18, 0x69, 0x14, 0x93);
  63. /* f2528316-0f1a-4431-aeed-11d096e1e2ab */
  64. DEFINE_GUID(IID_IDebugSymbolGroup, 0xf2528316, 0x0f1a, 0x4431,
  65. 0xae, 0xed, 0x11, 0xd0, 0x96, 0xe1, 0xe2, 0xab);
  66. /* 8c31e98c-983a-48a5-9016-6fe5d667a950 */
  67. DEFINE_GUID(IID_IDebugSymbols, 0x8c31e98c, 0x983a, 0x48a5,
  68. 0x90, 0x16, 0x6f, 0xe5, 0xd6, 0x67, 0xa9, 0x50);
  69. /* 3a707211-afdd-4495-ad4f-56fecdf8163f */
  70. DEFINE_GUID(IID_IDebugSymbols2, 0x3a707211, 0xafdd, 0x4495,
  71. 0xad, 0x4f, 0x56, 0xfe, 0xcd, 0xf8, 0x16, 0x3f);
  72. /* 6b86fe2c-2c4f-4f0c-9da2-174311acc327 */
  73. DEFINE_GUID(IID_IDebugSystemObjects, 0x6b86fe2c, 0x2c4f, 0x4f0c,
  74. 0x9d, 0xa2, 0x17, 0x43, 0x11, 0xac, 0xc3, 0x27);
  75. /* 0ae9f5ff-1852-4679-b055-494bee6407ee */
  76. DEFINE_GUID(IID_IDebugSystemObjects2, 0x0ae9f5ff, 0x1852, 0x4679,
  77. 0xb0, 0x55, 0x49, 0x4b, 0xee, 0x64, 0x07, 0xee);
  78. typedef interface DECLSPEC_UUID("f2df5f53-071f-47bd-9de6-5734c3fed689")
  79. IDebugAdvanced* PDEBUG_ADVANCED;
  80. typedef interface DECLSPEC_UUID("5bd9d474-5975-423a-b88b-65a8e7110e65")
  81. IDebugBreakpoint* PDEBUG_BREAKPOINT;
  82. typedef interface DECLSPEC_UUID("27fe5639-8407-4f47-8364-ee118fb08ac8")
  83. IDebugClient* PDEBUG_CLIENT;
  84. typedef interface DECLSPEC_UUID("edbed635-372e-4dab-bbfe-ed0d2f63be81")
  85. IDebugClient2* PDEBUG_CLIENT2;
  86. typedef interface DECLSPEC_UUID("5182e668-105e-416e-ad92-24ef800424ba")
  87. IDebugControl* PDEBUG_CONTROL;
  88. typedef interface DECLSPEC_UUID("d4366723-44df-4bed-8c7e-4c05424f4588")
  89. IDebugControl2* PDEBUG_CONTROL2;
  90. typedef interface DECLSPEC_UUID("88f7dfab-3ea7-4c3a-aefb-c4e8106173aa")
  91. IDebugDataSpaces* PDEBUG_DATA_SPACES;
  92. typedef interface DECLSPEC_UUID("7a5e852f-96e9-468f-ac1b-0b3addc4a049")
  93. IDebugDataSpaces2* PDEBUG_DATA_SPACES2;
  94. typedef interface DECLSPEC_UUID("337be28b-5036-4d72-b6bf-c45fbb9f2eaa")
  95. IDebugEventCallbacks* PDEBUG_EVENT_CALLBACKS;
  96. typedef interface DECLSPEC_UUID("9f50e42c-f136-499e-9a97-73036c94ed2d")
  97. IDebugInputCallbacks* PDEBUG_INPUT_CALLBACKS;
  98. typedef interface DECLSPEC_UUID("4bf58045-d654-4c40-b0af-683090f356dc")
  99. IDebugOutputCallbacks* PDEBUG_OUTPUT_CALLBACKS;
  100. typedef interface DECLSPEC_UUID("ce289126-9e84-45a7-937e-67bb18691493")
  101. IDebugRegisters* PDEBUG_REGISTERS;
  102. typedef interface DECLSPEC_UUID("f2528316-0f1a-4431-aeed-11d096e1e2ab")
  103. IDebugSymbolGroup* PDEBUG_SYMBOL_GROUP;
  104. typedef interface DECLSPEC_UUID("8c31e98c-983a-48a5-9016-6fe5d667a950")
  105. IDebugSymbols* PDEBUG_SYMBOLS;
  106. typedef interface DECLSPEC_UUID("3a707211-afdd-4495-ad4f-56fecdf8163f")
  107. IDebugSymbols2* PDEBUG_SYMBOLS2;
  108. typedef interface DECLSPEC_UUID("6b86fe2c-2c4f-4f0c-9da2-174311acc327")
  109. IDebugSystemObjects* PDEBUG_SYSTEM_OBJECTS;
  110. typedef interface DECLSPEC_UUID("0ae9f5ff-1852-4679-b055-494bee6407ee")
  111. IDebugSystemObjects2* PDEBUG_SYSTEM_OBJECTS2;
  112. //----------------------------------------------------------------------------
  113. //
  114. // Macros.
  115. //
  116. //----------------------------------------------------------------------------
  117. // Extends a 32-bit address into a 64-bit address.
  118. #define DEBUG_EXTEND64(Addr) ((ULONG64)(LONG64)(LONG)(Addr))
  119. //----------------------------------------------------------------------------
  120. //
  121. // Client creation functions.
  122. //
  123. //----------------------------------------------------------------------------
  124. // RemoteOptions specifies connection types and
  125. // their parameters. Supported strings are:
  126. // npipe:Server=<Machine>,Pipe=<Pipe name>
  127. // tcp:Server=<Machine>,Port=<IP port>
  128. STDAPI
  129. DebugConnect(
  130. IN PCSTR RemoteOptions,
  131. IN REFIID InterfaceId,
  132. OUT PVOID* Interface
  133. );
  134. STDAPI
  135. DebugCreate(
  136. IN REFIID InterfaceId,
  137. OUT PVOID* Interface
  138. );
  139. //----------------------------------------------------------------------------
  140. //
  141. // IDebugAdvanced.
  142. //
  143. //----------------------------------------------------------------------------
  144. #undef INTERFACE
  145. #define INTERFACE IDebugAdvanced
  146. DECLARE_INTERFACE_(IDebugAdvanced, IUnknown)
  147. {
  148. // IUnknown.
  149. STDMETHOD(QueryInterface)(
  150. THIS_
  151. IN REFIID InterfaceId,
  152. OUT PVOID* Interface
  153. ) PURE;
  154. STDMETHOD_(ULONG, AddRef)(
  155. THIS
  156. ) PURE;
  157. STDMETHOD_(ULONG, Release)(
  158. THIS
  159. ) PURE;
  160. // IDebugAdvanced.
  161. // Get/SetThreadContext offer control over
  162. // the full processor context for a thread.
  163. // Higher-level functions, such as the
  164. // IDebugRegisters interface, allow similar
  165. // access in simpler and more generic ways.
  166. // Get/SetThreadContext are useful when
  167. // large amounts of thread context must
  168. // be changed and processor-specific code
  169. // is not a problem.
  170. STDMETHOD(GetThreadContext)(
  171. THIS_
  172. OUT /* align_is(16) */ PVOID Context,
  173. IN ULONG ContextSize
  174. ) PURE;
  175. STDMETHOD(SetThreadContext)(
  176. THIS_
  177. IN /* align_is(16) */ PVOID Context,
  178. IN ULONG ContextSize
  179. ) PURE;
  180. };
  181. //----------------------------------------------------------------------------
  182. //
  183. // IDebugBreakpoint.
  184. //
  185. //----------------------------------------------------------------------------
  186. // Types of breakpoints.
  187. #define DEBUG_BREAKPOINT_CODE 0
  188. #define DEBUG_BREAKPOINT_DATA 1
  189. // Breakpoint flags.
  190. // Go-only breakpoints are only active when
  191. // the engine is in unrestricted execution
  192. // mode. They do not fire when the engine
  193. // is stepping.
  194. #define DEBUG_BREAKPOINT_GO_ONLY 0x00000001
  195. // A breakpoint is flagged as deferred as long as
  196. // its offset expression cannot be evaluated.
  197. // A deferred breakpoint is not active.
  198. #define DEBUG_BREAKPOINT_DEFERRED 0x00000002
  199. #define DEBUG_BREAKPOINT_ENABLED 0x00000004
  200. // The adder-only flag does not affect breakpoint
  201. // operation. It is just a marker to restrict
  202. // output and notifications for the breakpoint to
  203. // the client that added the breakpoint. Breakpoint
  204. // callbacks for adder-only breaks will only be delivered
  205. // to the adding client. The breakpoint can not
  206. // be enumerated and accessed by other clients.
  207. #define DEBUG_BREAKPOINT_ADDER_ONLY 0x00000008
  208. // Data breakpoint access types.
  209. // Different architectures support different
  210. // sets of these bits.
  211. #define DEBUG_BREAK_READ 0x00000001
  212. #define DEBUG_BREAK_WRITE 0x00000002
  213. #define DEBUG_BREAK_EXECUTE 0x00000004
  214. #define DEBUG_BREAK_IO 0x00000008
  215. // Structure for querying breakpoint information
  216. // all at once.
  217. typedef struct _DEBUG_BREAKPOINT_PARAMETERS
  218. {
  219. ULONG64 Offset;
  220. ULONG Id;
  221. ULONG BreakType;
  222. ULONG ProcType;
  223. ULONG Flags;
  224. ULONG DataSize;
  225. ULONG DataAccessType;
  226. ULONG PassCount;
  227. ULONG CurrentPassCount;
  228. ULONG MatchThread;
  229. ULONG CommandSize;
  230. ULONG OffsetExpressionSize;
  231. } DEBUG_BREAKPOINT_PARAMETERS, *PDEBUG_BREAKPOINT_PARAMETERS;
  232. #undef INTERFACE
  233. #define INTERFACE IDebugBreakpoint
  234. DECLARE_INTERFACE_(IDebugBreakpoint, IUnknown)
  235. {
  236. // IUnknown.
  237. STDMETHOD(QueryInterface)(
  238. THIS_
  239. IN REFIID InterfaceId,
  240. OUT PVOID* Interface
  241. ) PURE;
  242. STDMETHOD_(ULONG, AddRef)(
  243. THIS
  244. ) PURE;
  245. STDMETHOD_(ULONG, Release)(
  246. THIS
  247. ) PURE;
  248. // IDebugBreakpoint.
  249. // Retrieves debugger engine unique ID
  250. // for the breakpoint. This ID is
  251. // fixed as long as the breakpoint exists
  252. // but after that may be reused.
  253. STDMETHOD(GetId)(
  254. THIS_
  255. OUT PULONG Id
  256. ) PURE;
  257. // Retrieves the type of break and
  258. // processor type for the breakpoint.
  259. STDMETHOD(GetType)(
  260. THIS_
  261. OUT PULONG BreakType,
  262. OUT PULONG ProcType
  263. ) PURE;
  264. // Returns the client that called AddBreakpoint.
  265. STDMETHOD(GetAdder)(
  266. THIS_
  267. OUT PDEBUG_CLIENT* Adder
  268. ) PURE;
  269. STDMETHOD(GetFlags)(
  270. THIS_
  271. OUT PULONG Flags
  272. ) PURE;
  273. // Only certain flags can be changed. Flags
  274. // are: GO_ONLY, ENABLE.
  275. // Sets the given flags.
  276. STDMETHOD(AddFlags)(
  277. THIS_
  278. IN ULONG Flags
  279. ) PURE;
  280. // Clears the given flags.
  281. STDMETHOD(RemoveFlags)(
  282. THIS_
  283. IN ULONG Flags
  284. ) PURE;
  285. // Sets the flags.
  286. STDMETHOD(SetFlags)(
  287. THIS_
  288. IN ULONG Flags
  289. ) PURE;
  290. // Controls the offset of the breakpoint. The
  291. // interpretation of the offset value depends on
  292. // the type of breakpoint and its settings. It
  293. // may be a code address, a data address, an
  294. // I/O port, etc.
  295. STDMETHOD(GetOffset)(
  296. THIS_
  297. OUT PULONG64 Offset
  298. ) PURE;
  299. STDMETHOD(SetOffset)(
  300. THIS_
  301. IN ULONG64 Offset
  302. ) PURE;
  303. // Data breakpoint methods will fail is the
  304. // target platform does not support the
  305. // parameters used.
  306. // These methods only function for breakpoints
  307. // created as data breakpoints.
  308. STDMETHOD(GetDataParameters)(
  309. THIS_
  310. OUT PULONG Size,
  311. OUT PULONG AccessType
  312. ) PURE;
  313. STDMETHOD(SetDataParameters)(
  314. THIS_
  315. IN ULONG Size,
  316. IN ULONG AccessType
  317. ) PURE;
  318. // Pass count defaults to one.
  319. STDMETHOD(GetPassCount)(
  320. THIS_
  321. OUT PULONG Count
  322. ) PURE;
  323. STDMETHOD(SetPassCount)(
  324. THIS_
  325. IN ULONG Count
  326. ) PURE;
  327. // Gets the current number of times
  328. // the breakpoint has been hit since
  329. // it was last triggered.
  330. STDMETHOD(GetCurrentPassCount)(
  331. THIS_
  332. OUT PULONG Count
  333. ) PURE;
  334. // If a match thread is set this breakpoint will
  335. // only trigger if it occurs on the match thread.
  336. // Otherwise it triggers for all threads.
  337. // Thread restrictions are not currently supported
  338. // in kernel mode.
  339. STDMETHOD(GetMatchThreadId)(
  340. THIS_
  341. OUT PULONG Id
  342. ) PURE;
  343. STDMETHOD(SetMatchThreadId)(
  344. THIS_
  345. IN ULONG Thread
  346. ) PURE;
  347. // The command for a breakpoint is automatically
  348. // executed by the engine before the event
  349. // is propagated. If the breakpoint continues
  350. // execution the event will begin with a continue
  351. // status. If the breakpoint does not continue
  352. // the event will begin with a break status.
  353. // This allows breakpoint commands to participate
  354. // in the normal event status voting.
  355. // Breakpoint commands are only executed until
  356. // the first command that alters the execution
  357. // status, such as g, p and t.
  358. // Breakpoint commands are removed when the
  359. // current syntax changes.
  360. STDMETHOD(GetCommand)(
  361. THIS_
  362. OUT OPTIONAL PSTR Buffer,
  363. IN ULONG BufferSize,
  364. OUT OPTIONAL PULONG CommandSize
  365. ) PURE;
  366. STDMETHOD(SetCommand)(
  367. THIS_
  368. IN PCSTR Command
  369. ) PURE;
  370. // Offset expressions are evaluated immediately
  371. // and at module load and unload events. If the
  372. // evaluation is successful the breakpoints
  373. // offset is updated and the breakpoint is
  374. // handled normally. If the expression cannot
  375. // be evaluated the breakpoint is deferred.
  376. // Currently the only offset expression
  377. // supported is a module-relative symbol
  378. // of the form <Module>!<Symbol>.
  379. STDMETHOD(GetOffsetExpression)(
  380. THIS_
  381. OUT OPTIONAL PSTR Buffer,
  382. IN ULONG BufferSize,
  383. OUT OPTIONAL PULONG ExpressionSize
  384. ) PURE;
  385. STDMETHOD(SetOffsetExpression)(
  386. THIS_
  387. IN PCSTR Expression
  388. ) PURE;
  389. STDMETHOD(GetParameters)(
  390. THIS_
  391. OUT PDEBUG_BREAKPOINT_PARAMETERS Params
  392. ) PURE;
  393. };
  394. //----------------------------------------------------------------------------
  395. //
  396. // IDebugClient.
  397. //
  398. //----------------------------------------------------------------------------
  399. // Kernel attach flags.
  400. #define DEBUG_ATTACH_KERNEL_CONNECTION 0x00000000
  401. // Attach to the local machine. If this flag is not set
  402. // a connection is made to a separate target machine using
  403. // the given connection options.
  404. #define DEBUG_ATTACH_LOCAL_KERNEL 0x00000001
  405. // Attach to an eXDI driver.
  406. #define DEBUG_ATTACH_EXDI_DRIVER 0x00000002
  407. // GetRunningProcessSystemIdByExecutableName flags.
  408. // By default the match allows a tail match on
  409. // just the filename. The match returns the first hit
  410. // even if multiple matches exist.
  411. #define DEBUG_GET_PROC_DEFAULT 0x00000000
  412. // The name must match fully.
  413. #define DEBUG_GET_PROC_FULL_MATCH 0x00000001
  414. // The match must be the only match.
  415. #define DEBUG_GET_PROC_ONLY_MATCH 0x00000002
  416. // GetRunningProcessDescription flags.
  417. #define DEBUG_PROC_DESC_DEFAULT 0x00000000
  418. // Return only filenames, not full paths.
  419. #define DEBUG_PROC_DESC_NO_PATHS 0x00000001
  420. //
  421. // Attach flags.
  422. //
  423. // Call DebugActiveProcess when attaching.
  424. #define DEBUG_ATTACH_DEFAULT 0x00000000
  425. // When attaching to a process just examine
  426. // the process state and suspend the threads.
  427. // DebugActiveProcess is not called so the process
  428. // is not actually being debugged. This is useful
  429. // for debugging processes holding locks which
  430. // interfere with the operation of DebugActiveProcess
  431. // or in situations where it is not desirable to
  432. // actually set up as a debugger.
  433. #define DEBUG_ATTACH_NONINVASIVE 0x00000001
  434. // Attempt to attach to a process that was abandoned
  435. // when being debugged. This is only supported in
  436. // some system versions.
  437. // This flag also allows multiple debuggers to
  438. // attach to the same process, which can result
  439. // in numerous problems unless very carefully
  440. // managed.
  441. #define DEBUG_ATTACH_EXISTING 0x00000002
  442. // Process creation flags.
  443. // On Windows Whistler this flag prevents the debug
  444. // heap from being used in the new process.
  445. #define DEBUG_CREATE_PROCESS_NO_DEBUG_HEAP CREATE_UNICODE_ENVIRONMENT
  446. //
  447. // Process options.
  448. //
  449. // Indicates that the debuggee process should be
  450. // automatically detached when the debugger exits.
  451. // A debugger can explicitly detach on exit or this
  452. // flag can be set so that detach occurs regardless
  453. // of how the debugger exits.
  454. // This is only supported on some system versions.
  455. #define DEBUG_PROCESS_DETACH_ON_EXIT 0x00000001
  456. // Indicates that processes created by the current
  457. // process should not be debugged.
  458. // Modifying this flag is only supported on some
  459. // system versions.
  460. #define DEBUG_PROCESS_ONLY_THIS_PROCESS 0x00000002
  461. // ConnectSession flags.
  462. // Default connect.
  463. #define DEBUG_CONNECT_SESSION_DEFAULT 0x00000000
  464. // Do not output the debugger version.
  465. #define DEBUG_CONNECT_SESSION_NO_VERSION 0x00000001
  466. // Do not announce the connection.
  467. #define DEBUG_CONNECT_SESSION_NO_ANNOUNCE 0x00000002
  468. // OutputServers flags.
  469. // Debugger servers from StartSever.
  470. #define DEBUG_SERVERS_DEBUGGER 0x00000001
  471. // Process servers from StartProcessServer.
  472. #define DEBUG_SERVERS_PROCESS 0x00000002
  473. #define DEBUG_SERVERS_ALL 0x00000003
  474. // EndSession flags.
  475. // Perform cleanup for the session.
  476. #define DEBUG_END_PASSIVE 0x00000000
  477. // Actively terminate the session and then perform cleanup.
  478. #define DEBUG_END_ACTIVE_TERMINATE 0x00000001
  479. // If possible, detach from all processes and then perform cleanup.
  480. #define DEBUG_END_ACTIVE_DETACH 0x00000002
  481. // Perform whatever cleanup is possible that doesn't require
  482. // acquiring any locks. This is useful for situations where
  483. // a thread is currently using the engine but the application
  484. // needs to exit and still wants to give the engine
  485. // the opportunity to clean up as much as possible.
  486. // This may leave the engine in an indeterminate state so
  487. // further engine calls should not be made.
  488. // When making a reentrant EndSession call from a remote
  489. // client it is the callers responsibility to ensure
  490. // that the server can process the request. It is best
  491. // to avoid making such calls.
  492. #define DEBUG_END_REENTRANT 0x00000003
  493. // Output mask bits.
  494. // Normal output.
  495. #define DEBUG_OUTPUT_NORMAL 0x00000001
  496. // Error output.
  497. #define DEBUG_OUTPUT_ERROR 0x00000002
  498. // Warnings.
  499. #define DEBUG_OUTPUT_WARNING 0x00000004
  500. // Additional output.
  501. #define DEBUG_OUTPUT_VERBOSE 0x00000008
  502. // Prompt output.
  503. #define DEBUG_OUTPUT_PROMPT 0x00000010
  504. // Register dump before prompt.
  505. #define DEBUG_OUTPUT_PROMPT_REGISTERS 0x00000020
  506. // Warnings specific to extension operation.
  507. #define DEBUG_OUTPUT_EXTENSION_WARNING 0x00000040
  508. // Debuggee debug output, such as from OutputDebugString.
  509. #define DEBUG_OUTPUT_DEBUGGEE 0x00000080
  510. // Debuggee-generated prompt, such as from DbgPrompt.
  511. #define DEBUG_OUTPUT_DEBUGGEE_PROMPT 0x00000100
  512. // Internal debugger output, used mainly
  513. // for debugging the debugger. Output
  514. // may only occur in debug builds.
  515. // KD protocol output.
  516. #define DEBUG_IOUTPUT_KD_PROTOCOL 0x80000000
  517. // Remoting output.
  518. #define DEBUG_IOUTPUT_REMOTING 0x40000000
  519. // Breakpoint output.
  520. #define DEBUG_IOUTPUT_BREAKPOINT 0x20000000
  521. // Event output.
  522. #define DEBUG_IOUTPUT_EVENT 0x10000000
  523. // OutputIdentity flags.
  524. #define DEBUG_OUTPUT_IDENTITY_DEFAULT 0x00000000
  525. #undef INTERFACE
  526. #define INTERFACE IDebugClient
  527. DECLARE_INTERFACE_(IDebugClient, IUnknown)
  528. {
  529. // IUnknown.
  530. STDMETHOD(QueryInterface)(
  531. THIS_
  532. IN REFIID InterfaceId,
  533. OUT PVOID* Interface
  534. ) PURE;
  535. STDMETHOD_(ULONG, AddRef)(
  536. THIS
  537. ) PURE;
  538. STDMETHOD_(ULONG, Release)(
  539. THIS
  540. ) PURE;
  541. // IDebugClient.
  542. // The following set of methods start
  543. // the different kinds of debuggees.
  544. // Begins a debug session using the kernel
  545. // debugging protocol. This method selects
  546. // the protocol as the debuggee communication
  547. // mechanism but does not initiate the communication
  548. // itself.
  549. STDMETHOD(AttachKernel)(
  550. THIS_
  551. IN ULONG Flags,
  552. IN OPTIONAL PCSTR ConnectOptions
  553. ) PURE;
  554. STDMETHOD(GetKernelConnectionOptions)(
  555. THIS_
  556. OUT OPTIONAL PSTR Buffer,
  557. IN ULONG BufferSize,
  558. OUT OPTIONAL PULONG OptionsSize
  559. ) PURE;
  560. // Updates the connection options for a live
  561. // kernel connection. This can only be used
  562. // to modify parameters for the connection, not
  563. // to switch to a completely different kind of
  564. // connection.
  565. // This method is reentrant.
  566. STDMETHOD(SetKernelConnectionOptions)(
  567. THIS_
  568. IN PCSTR Options
  569. ) PURE;
  570. // Starts a process server for remote
  571. // user-mode process control.
  572. // The local process server is server zero.
  573. STDMETHOD(StartProcessServer)(
  574. THIS_
  575. IN ULONG Flags,
  576. IN PCSTR Options,
  577. IN PVOID Reserved
  578. ) PURE;
  579. STDMETHOD(ConnectProcessServer)(
  580. THIS_
  581. IN PCSTR RemoteOptions,
  582. OUT PULONG64 Server
  583. ) PURE;
  584. STDMETHOD(DisconnectProcessServer)(
  585. THIS_
  586. IN ULONG64 Server
  587. ) PURE;
  588. // Enumerates and describes processes
  589. // accessible through the given process server.
  590. STDMETHOD(GetRunningProcessSystemIds)(
  591. THIS_
  592. IN ULONG64 Server,
  593. OUT OPTIONAL /* size_is(Count) */ PULONG Ids,
  594. IN ULONG Count,
  595. OUT OPTIONAL PULONG ActualCount
  596. ) PURE;
  597. STDMETHOD(GetRunningProcessSystemIdByExecutableName)(
  598. THIS_
  599. IN ULONG64 Server,
  600. IN PCSTR ExeName,
  601. IN ULONG Flags,
  602. OUT PULONG Id
  603. ) PURE;
  604. STDMETHOD(GetRunningProcessDescription)(
  605. THIS_
  606. IN ULONG64 Server,
  607. IN ULONG SystemId,
  608. IN ULONG Flags,
  609. OUT OPTIONAL PSTR ExeName,
  610. IN ULONG ExeNameSize,
  611. OUT OPTIONAL PULONG ActualExeNameSize,
  612. OUT OPTIONAL PSTR Description,
  613. IN ULONG DescriptionSize,
  614. OUT OPTIONAL PULONG ActualDescriptionSize
  615. ) PURE;
  616. // Attaches to a running user-mode process.
  617. STDMETHOD(AttachProcess)(
  618. THIS_
  619. IN ULONG64 Server,
  620. IN ULONG ProcessId,
  621. IN ULONG AttachFlags
  622. ) PURE;
  623. // Creates a new user-mode process for debugging.
  624. // CreateFlags are as given to Win32s CreateProcess.
  625. // One of DEBUG_PROCESS or DEBUG_ONLY_THIS_PROCESS
  626. // must be specified.
  627. STDMETHOD(CreateProcess)(
  628. THIS_
  629. IN ULONG64 Server,
  630. IN PSTR CommandLine,
  631. IN ULONG CreateFlags
  632. ) PURE;
  633. // Creates or attaches to a user-mode process, or both.
  634. // If CommandLine is NULL this method operates as
  635. // AttachProcess does. If ProcessId is zero it
  636. // operates as CreateProcess does. If CommandLine is
  637. // non-NULL and ProcessId is non-zero the method first
  638. // starts a process with the given information but
  639. // in a suspended state. The engine then attaches to
  640. // the indicated process. Once the attach is successful
  641. // the suspended process is resumed. This provides
  642. // synchronization between the new process and the
  643. // attachment.
  644. STDMETHOD(CreateProcessAndAttach)(
  645. THIS_
  646. IN ULONG64 Server,
  647. IN OPTIONAL PSTR CommandLine,
  648. IN ULONG CreateFlags,
  649. IN ULONG ProcessId,
  650. IN ULONG AttachFlags
  651. ) PURE;
  652. // Gets and sets process control flags.
  653. STDMETHOD(GetProcessOptions)(
  654. THIS_
  655. OUT PULONG Options
  656. ) PURE;
  657. STDMETHOD(AddProcessOptions)(
  658. THIS_
  659. IN ULONG Options
  660. ) PURE;
  661. STDMETHOD(RemoveProcessOptions)(
  662. THIS_
  663. IN ULONG Options
  664. ) PURE;
  665. STDMETHOD(SetProcessOptions)(
  666. THIS_
  667. IN ULONG Options
  668. ) PURE;
  669. // Opens any kind of user- or kernel-mode dump file
  670. // and begins a debug session with the information
  671. // contained within it.
  672. STDMETHOD(OpenDumpFile)(
  673. THIS_
  674. IN PCSTR DumpFile
  675. ) PURE;
  676. // Writes a dump file from the current session information.
  677. // The kind of dump file written is determined by the
  678. // kind of session and the type qualifier given.
  679. // For example, if the current session is a kernel
  680. // debug session (DEBUG_CLASS_KERNEL) and the qualifier
  681. // is DEBUG_DUMP_SMALL a small kernel dump will be written.
  682. STDMETHOD(WriteDumpFile)(
  683. THIS_
  684. IN PCSTR DumpFile,
  685. IN ULONG Qualifier
  686. ) PURE;
  687. // Indicates that a remote client is ready to
  688. // begin participating in the current session.
  689. // HistoryLimit gives a character limit on
  690. // the amount of output history to be sent.
  691. STDMETHOD(ConnectSession)(
  692. THIS_
  693. IN ULONG Flags,
  694. IN ULONG HistoryLimit
  695. ) PURE;
  696. // Indicates that the engine should start accepting
  697. // remote connections. Options specifies connection types
  698. // and their parameters. Supported strings are:
  699. // npipe:Pipe=<Pipe name>
  700. // tcp:Port=<IP port>
  701. STDMETHOD(StartServer)(
  702. THIS_
  703. IN PCSTR Options
  704. ) PURE;
  705. // List the servers running on the given machine.
  706. // Uses the line prefix.
  707. STDMETHOD(OutputServers)(
  708. THIS_
  709. IN ULONG OutputControl,
  710. IN PCSTR Machine,
  711. IN ULONG Flags
  712. ) PURE;
  713. // Attempts to terminate all processes in the debuggers list.
  714. STDMETHOD(TerminateProcesses)(
  715. THIS
  716. ) PURE;
  717. // Attempts to detach from all processes in the debuggers list.
  718. // This requires OS support for debugger detach.
  719. STDMETHOD(DetachProcesses)(
  720. THIS
  721. ) PURE;
  722. // Stops the current debug session. If a process
  723. // was created or attached an active EndSession can
  724. // terminate or detach from it.
  725. // If a kernel connection was opened it will be closed but the
  726. // target machine is otherwise unaffected.
  727. STDMETHOD(EndSession)(
  728. THIS_
  729. IN ULONG Flags
  730. ) PURE;
  731. // If a process was started and ran to completion
  732. // this method can be used to retrieve its exit code.
  733. STDMETHOD(GetExitCode)(
  734. THIS_
  735. OUT PULONG Code
  736. ) PURE;
  737. // Client event callbacks are called on the thread
  738. // of the client. In order to give thread
  739. // execution to the engine for callbacks all
  740. // client threads should call DispatchCallbacks
  741. // when they are idle. Callbacks are only
  742. // received when a thread calls DispatchCallbacks
  743. // or WaitForEvent. WaitForEvent can only be
  744. // called by the thread that started the debug
  745. // session so all other client threads should
  746. // call DispatchCallbacks when possible.
  747. // DispatchCallbacks returns when ExitDispatch is used
  748. // to interrupt dispatch or when the timeout expires.
  749. // DispatchCallbacks dispatches callbacks for all
  750. // clients associated with the thread calling
  751. // DispatchCallbacks.
  752. // DispatchCallbacks returns S_FALSE when the
  753. // timeout expires.
  754. STDMETHOD(DispatchCallbacks)(
  755. THIS_
  756. IN ULONG Timeout
  757. ) PURE;
  758. // ExitDispatch can be used to interrupt callback
  759. // dispatch when a client thread is needed by the
  760. // client. This method is reentrant and can
  761. // be called from any thread.
  762. STDMETHOD(ExitDispatch)(
  763. THIS_
  764. IN PDEBUG_CLIENT Client
  765. ) PURE;
  766. // Clients are specific to the thread that
  767. // created them. Calls from other threads
  768. // fail immediately. The CreateClient method
  769. // is a notable exception; it allows creation
  770. // of a new client for a new thread.
  771. STDMETHOD(CreateClient)(
  772. THIS_
  773. OUT PDEBUG_CLIENT* Client
  774. ) PURE;
  775. STDMETHOD(GetInputCallbacks)(
  776. THIS_
  777. OUT PDEBUG_INPUT_CALLBACKS* Callbacks
  778. ) PURE;
  779. STDMETHOD(SetInputCallbacks)(
  780. THIS_
  781. IN PDEBUG_INPUT_CALLBACKS Callbacks
  782. ) PURE;
  783. // Output callback interfaces are described separately.
  784. STDMETHOD(GetOutputCallbacks)(
  785. THIS_
  786. OUT PDEBUG_OUTPUT_CALLBACKS* Callbacks
  787. ) PURE;
  788. STDMETHOD(SetOutputCallbacks)(
  789. THIS_
  790. IN PDEBUG_OUTPUT_CALLBACKS Callbacks
  791. ) PURE;
  792. // Output flags provide control over
  793. // the distribution of output among clients.
  794. // Output masks select which output streams
  795. // should be sent to the output callbacks.
  796. // Only Output calls with a mask that
  797. // contains one of the output mask bits
  798. // will be sent to the output callbacks.
  799. // These methods are reentrant.
  800. // If such access is not synchronized
  801. // disruptions in output may occur.
  802. STDMETHOD(GetOutputMask)(
  803. THIS_
  804. OUT PULONG Mask
  805. ) PURE;
  806. STDMETHOD(SetOutputMask)(
  807. THIS_
  808. IN ULONG Mask
  809. ) PURE;
  810. // These methods allow access to another clients
  811. // output mask. They are necessary for changing
  812. // a clients output mask when it is
  813. // waiting for events. These methods are reentrant
  814. // and can be called from any thread.
  815. STDMETHOD(GetOtherOutputMask)(
  816. THIS_
  817. IN PDEBUG_CLIENT Client,
  818. OUT PULONG Mask
  819. ) PURE;
  820. STDMETHOD(SetOtherOutputMask)(
  821. THIS_
  822. IN PDEBUG_CLIENT Client,
  823. IN ULONG Mask
  824. ) PURE;
  825. // Control the width of an output line for
  826. // commands which produce formatted output.
  827. // This setting is just a suggestion.
  828. STDMETHOD(GetOutputWidth)(
  829. THIS_
  830. OUT PULONG Columns
  831. ) PURE;
  832. STDMETHOD(SetOutputWidth)(
  833. THIS_
  834. IN ULONG Columns
  835. ) PURE;
  836. // Some of the engines output commands produce
  837. // multiple lines of output. A prefix can be
  838. // set that the engine will automatically output
  839. // for each line in that case, allowing a caller
  840. // to control indentation or identifying marks.
  841. // This is not a general setting for any output
  842. // with a newline in it. Methods which use
  843. // the line prefix are marked in their documentation.
  844. STDMETHOD(GetOutputLinePrefix)(
  845. THIS_
  846. OUT OPTIONAL PSTR Buffer,
  847. IN ULONG BufferSize,
  848. OUT OPTIONAL PULONG PrefixSize
  849. ) PURE;
  850. STDMETHOD(SetOutputLinePrefix)(
  851. THIS_
  852. IN OPTIONAL PCSTR Prefix
  853. ) PURE;
  854. // Returns a string describing the machine
  855. // and user this client represents. The
  856. // specific content of the string varies
  857. // with operating system. If the client is
  858. // remotely connected some network information
  859. // may also be present.
  860. STDMETHOD(GetIdentity)(
  861. THIS_
  862. OUT OPTIONAL PSTR Buffer,
  863. IN ULONG BufferSize,
  864. OUT OPTIONAL PULONG IdentitySize
  865. ) PURE;
  866. // Format is a printf-like format string
  867. // with one %s where the identity string should go.
  868. STDMETHOD(OutputIdentity)(
  869. THIS_
  870. IN ULONG OutputControl,
  871. IN ULONG Flags,
  872. IN PCSTR Format
  873. ) PURE;
  874. // Event callbacks allow a client to
  875. // receive notification about changes
  876. // during the debug session.
  877. STDMETHOD(GetEventCallbacks)(
  878. THIS_
  879. OUT PDEBUG_EVENT_CALLBACKS* Callbacks
  880. ) PURE;
  881. STDMETHOD(SetEventCallbacks)(
  882. THIS_
  883. IN PDEBUG_EVENT_CALLBACKS Callbacks
  884. ) PURE;
  885. // The engine sometimes merges compatible callback
  886. // requests to reduce callback overhead. This is
  887. // most noticeable with output as small pieces of
  888. // output are collected into larger groups to
  889. // reduce the overall number of output callback calls.
  890. // A client can use this method to force all pending
  891. // callbacks to be delivered. This is rarely necessary.
  892. STDMETHOD(FlushCallbacks)(
  893. THIS
  894. ) PURE;
  895. };
  896. // Per-dump-format control flags.
  897. #define DEBUG_FORMAT_DEFAULT 0x00000000
  898. #define DEBUG_FORMAT_USER_SMALL_FULL_MEMORY 0x00000001
  899. #define DEBUG_FORMAT_USER_SMALL_HANDLE_DATA 0x00000002
  900. //
  901. // Dump information file types.
  902. //
  903. // Single file containing packed page file information.
  904. #define DEBUG_DUMP_FILE_PAGE_FILE_DUMP 0x00000000
  905. #undef INTERFACE
  906. #define INTERFACE IDebugClient2
  907. DECLARE_INTERFACE_(IDebugClient2, IUnknown)
  908. {
  909. // IUnknown.
  910. STDMETHOD(QueryInterface)(
  911. THIS_
  912. IN REFIID InterfaceId,
  913. OUT PVOID* Interface
  914. ) PURE;
  915. STDMETHOD_(ULONG, AddRef)(
  916. THIS
  917. ) PURE;
  918. STDMETHOD_(ULONG, Release)(
  919. THIS
  920. ) PURE;
  921. // IDebugClient.
  922. // The following set of methods start
  923. // the different kinds of debuggees.
  924. // Begins a debug session using the kernel
  925. // debugging protocol. This method selects
  926. // the protocol as the debuggee communication
  927. // mechanism but does not initiate the communication
  928. // itself.
  929. STDMETHOD(AttachKernel)(
  930. THIS_
  931. IN ULONG Flags,
  932. IN OPTIONAL PCSTR ConnectOptions
  933. ) PURE;
  934. STDMETHOD(GetKernelConnectionOptions)(
  935. THIS_
  936. OUT OPTIONAL PSTR Buffer,
  937. IN ULONG BufferSize,
  938. OUT OPTIONAL PULONG OptionsSize
  939. ) PURE;
  940. // Updates the connection options for a live
  941. // kernel connection. This can only be used
  942. // to modify parameters for the connection, not
  943. // to switch to a completely different kind of
  944. // connection.
  945. // This method is reentrant.
  946. STDMETHOD(SetKernelConnectionOptions)(
  947. THIS_
  948. IN PCSTR Options
  949. ) PURE;
  950. // Starts a process server for remote
  951. // user-mode process control.
  952. // The local process server is server zero.
  953. STDMETHOD(StartProcessServer)(
  954. THIS_
  955. IN ULONG Flags,
  956. IN PCSTR Options,
  957. IN PVOID Reserved
  958. ) PURE;
  959. STDMETHOD(ConnectProcessServer)(
  960. THIS_
  961. IN PCSTR RemoteOptions,
  962. OUT PULONG64 Server
  963. ) PURE;
  964. STDMETHOD(DisconnectProcessServer)(
  965. THIS_
  966. IN ULONG64 Server
  967. ) PURE;
  968. // Enumerates and describes processes
  969. // accessible through the given process server.
  970. STDMETHOD(GetRunningProcessSystemIds)(
  971. THIS_
  972. IN ULONG64 Server,
  973. OUT OPTIONAL /* size_is(Count) */ PULONG Ids,
  974. IN ULONG Count,
  975. OUT OPTIONAL PULONG ActualCount
  976. ) PURE;
  977. STDMETHOD(GetRunningProcessSystemIdByExecutableName)(
  978. THIS_
  979. IN ULONG64 Server,
  980. IN PCSTR ExeName,
  981. IN ULONG Flags,
  982. OUT PULONG Id
  983. ) PURE;
  984. STDMETHOD(GetRunningProcessDescription)(
  985. THIS_
  986. IN ULONG64 Server,
  987. IN ULONG SystemId,
  988. IN ULONG Flags,
  989. OUT OPTIONAL PSTR ExeName,
  990. IN ULONG ExeNameSize,
  991. OUT OPTIONAL PULONG ActualExeNameSize,
  992. OUT OPTIONAL PSTR Description,
  993. IN ULONG DescriptionSize,
  994. OUT OPTIONAL PULONG ActualDescriptionSize
  995. ) PURE;
  996. // Attaches to a running user-mode process.
  997. STDMETHOD(AttachProcess)(
  998. THIS_
  999. IN ULONG64 Server,
  1000. IN ULONG ProcessId,
  1001. IN ULONG AttachFlags
  1002. ) PURE;
  1003. // Creates a new user-mode process for debugging.
  1004. // CreateFlags are as given to Win32s CreateProcess.
  1005. // One of DEBUG_PROCESS or DEBUG_ONLY_THIS_PROCESS
  1006. // must be specified.
  1007. STDMETHOD(CreateProcess)(
  1008. THIS_
  1009. IN ULONG64 Server,
  1010. IN PSTR CommandLine,
  1011. IN ULONG CreateFlags
  1012. ) PURE;
  1013. // Creates or attaches to a user-mode process, or both.
  1014. // If CommandLine is NULL this method operates as
  1015. // AttachProcess does. If ProcessId is zero it
  1016. // operates as CreateProcess does. If CommandLine is
  1017. // non-NULL and ProcessId is non-zero the method first
  1018. // starts a process with the given information but
  1019. // in a suspended state. The engine then attaches to
  1020. // the indicated process. Once the attach is successful
  1021. // the suspended process is resumed. This provides
  1022. // synchronization between the new process and the
  1023. // attachment.
  1024. STDMETHOD(CreateProcessAndAttach)(
  1025. THIS_
  1026. IN ULONG64 Server,
  1027. IN OPTIONAL PSTR CommandLine,
  1028. IN ULONG CreateFlags,
  1029. IN ULONG ProcessId,
  1030. IN ULONG AttachFlags
  1031. ) PURE;
  1032. // Gets and sets process control flags.
  1033. STDMETHOD(GetProcessOptions)(
  1034. THIS_
  1035. OUT PULONG Options
  1036. ) PURE;
  1037. STDMETHOD(AddProcessOptions)(
  1038. THIS_
  1039. IN ULONG Options
  1040. ) PURE;
  1041. STDMETHOD(RemoveProcessOptions)(
  1042. THIS_
  1043. IN ULONG Options
  1044. ) PURE;
  1045. STDMETHOD(SetProcessOptions)(
  1046. THIS_
  1047. IN ULONG Options
  1048. ) PURE;
  1049. // Opens any kind of user- or kernel-mode dump file
  1050. // and begins a debug session with the information
  1051. // contained within it.
  1052. STDMETHOD(OpenDumpFile)(
  1053. THIS_
  1054. IN PCSTR DumpFile
  1055. ) PURE;
  1056. // Writes a dump file from the current session information.
  1057. // The kind of dump file written is determined by the
  1058. // kind of session and the type qualifier given.
  1059. // For example, if the current session is a kernel
  1060. // debug session (DEBUG_CLASS_KERNEL) and the qualifier
  1061. // is DEBUG_DUMP_SMALL a small kernel dump will be written.
  1062. STDMETHOD(WriteDumpFile)(
  1063. THIS_
  1064. IN PCSTR DumpFile,
  1065. IN ULONG Qualifier
  1066. ) PURE;
  1067. // Indicates that a remote client is ready to
  1068. // begin participating in the current session.
  1069. // HistoryLimit gives a character limit on
  1070. // the amount of output history to be sent.
  1071. STDMETHOD(ConnectSession)(
  1072. THIS_
  1073. IN ULONG Flags,
  1074. IN ULONG HistoryLimit
  1075. ) PURE;
  1076. // Indicates that the engine should start accepting
  1077. // remote connections. Options specifies connection types
  1078. // and their parameters. Supported strings are:
  1079. // npipe:Pipe=<Pipe name>
  1080. // tcp:Port=<IP port>
  1081. STDMETHOD(StartServer)(
  1082. THIS_
  1083. IN PCSTR Options
  1084. ) PURE;
  1085. // List the servers running on the given machine.
  1086. // Uses the line prefix.
  1087. STDMETHOD(OutputServers)(
  1088. THIS_
  1089. IN ULONG OutputControl,
  1090. IN PCSTR Machine,
  1091. IN ULONG Flags
  1092. ) PURE;
  1093. // Attempts to terminate all processes in the debuggers list.
  1094. STDMETHOD(TerminateProcesses)(
  1095. THIS
  1096. ) PURE;
  1097. // Attempts to detach from all processes in the debuggers list.
  1098. // This requires OS support for debugger detach.
  1099. STDMETHOD(DetachProcesses)(
  1100. THIS
  1101. ) PURE;
  1102. // Stops the current debug session. If a process
  1103. // was created or attached an active EndSession can
  1104. // terminate or detach from it.
  1105. // If a kernel connection was opened it will be closed but the
  1106. // target machine is otherwise unaffected.
  1107. STDMETHOD(EndSession)(
  1108. THIS_
  1109. IN ULONG Flags
  1110. ) PURE;
  1111. // If a process was started and ran to completion
  1112. // this method can be used to retrieve its exit code.
  1113. STDMETHOD(GetExitCode)(
  1114. THIS_
  1115. OUT PULONG Code
  1116. ) PURE;
  1117. // Client event callbacks are called on the thread
  1118. // of the client. In order to give thread
  1119. // execution to the engine for callbacks all
  1120. // client threads should call DispatchCallbacks
  1121. // when they are idle. Callbacks are only
  1122. // received when a thread calls DispatchCallbacks
  1123. // or WaitForEvent. WaitForEvent can only be
  1124. // called by the thread that started the debug
  1125. // session so all other client threads should
  1126. // call DispatchCallbacks when possible.
  1127. // DispatchCallbacks returns when ExitDispatch is used
  1128. // to interrupt dispatch or when the timeout expires.
  1129. // DispatchCallbacks dispatches callbacks for all
  1130. // clients associated with the thread calling
  1131. // DispatchCallbacks.
  1132. // DispatchCallbacks returns S_FALSE when the
  1133. // timeout expires.
  1134. STDMETHOD(DispatchCallbacks)(
  1135. THIS_
  1136. IN ULONG Timeout
  1137. ) PURE;
  1138. // ExitDispatch can be used to interrupt callback
  1139. // dispatch when a client thread is needed by the
  1140. // client. This method is reentrant and can
  1141. // be called from any thread.
  1142. STDMETHOD(ExitDispatch)(
  1143. THIS_
  1144. IN PDEBUG_CLIENT Client
  1145. ) PURE;
  1146. // Clients are specific to the thread that
  1147. // created them. Calls from other threads
  1148. // fail immediately. The CreateClient method
  1149. // is a notable exception; it allows creation
  1150. // of a new client for a new thread.
  1151. STDMETHOD(CreateClient)(
  1152. THIS_
  1153. OUT PDEBUG_CLIENT* Client
  1154. ) PURE;
  1155. STDMETHOD(GetInputCallbacks)(
  1156. THIS_
  1157. OUT PDEBUG_INPUT_CALLBACKS* Callbacks
  1158. ) PURE;
  1159. STDMETHOD(SetInputCallbacks)(
  1160. THIS_
  1161. IN PDEBUG_INPUT_CALLBACKS Callbacks
  1162. ) PURE;
  1163. // Output callback interfaces are described separately.
  1164. STDMETHOD(GetOutputCallbacks)(
  1165. THIS_
  1166. OUT PDEBUG_OUTPUT_CALLBACKS* Callbacks
  1167. ) PURE;
  1168. STDMETHOD(SetOutputCallbacks)(
  1169. THIS_
  1170. IN PDEBUG_OUTPUT_CALLBACKS Callbacks
  1171. ) PURE;
  1172. // Output flags provide control over
  1173. // the distribution of output among clients.
  1174. // Output masks select which output streams
  1175. // should be sent to the output callbacks.
  1176. // Only Output calls with a mask that
  1177. // contains one of the output mask bits
  1178. // will be sent to the output callbacks.
  1179. // These methods are reentrant.
  1180. // If such access is not synchronized
  1181. // disruptions in output may occur.
  1182. STDMETHOD(GetOutputMask)(
  1183. THIS_
  1184. OUT PULONG Mask
  1185. ) PURE;
  1186. STDMETHOD(SetOutputMask)(
  1187. THIS_
  1188. IN ULONG Mask
  1189. ) PURE;
  1190. // These methods allow access to another clients
  1191. // output mask. They are necessary for changing
  1192. // a clients output mask when it is
  1193. // waiting for events. These methods are reentrant
  1194. // and can be called from any thread.
  1195. STDMETHOD(GetOtherOutputMask)(
  1196. THIS_
  1197. IN PDEBUG_CLIENT Client,
  1198. OUT PULONG Mask
  1199. ) PURE;
  1200. STDMETHOD(SetOtherOutputMask)(
  1201. THIS_
  1202. IN PDEBUG_CLIENT Client,
  1203. IN ULONG Mask
  1204. ) PURE;
  1205. // Control the width of an output line for
  1206. // commands which produce formatted output.
  1207. // This setting is just a suggestion.
  1208. STDMETHOD(GetOutputWidth)(
  1209. THIS_
  1210. OUT PULONG Columns
  1211. ) PURE;
  1212. STDMETHOD(SetOutputWidth)(
  1213. THIS_
  1214. IN ULONG Columns
  1215. ) PURE;
  1216. // Some of the engines output commands produce
  1217. // multiple lines of output. A prefix can be
  1218. // set that the engine will automatically output
  1219. // for each line in that case, allowing a caller
  1220. // to control indentation or identifying marks.
  1221. // This is not a general setting for any output
  1222. // with a newline in it. Methods which use
  1223. // the line prefix are marked in their documentation.
  1224. STDMETHOD(GetOutputLinePrefix)(
  1225. THIS_
  1226. OUT OPTIONAL PSTR Buffer,
  1227. IN ULONG BufferSize,
  1228. OUT OPTIONAL PULONG PrefixSize
  1229. ) PURE;
  1230. STDMETHOD(SetOutputLinePrefix)(
  1231. THIS_
  1232. IN OPTIONAL PCSTR Prefix
  1233. ) PURE;
  1234. // Returns a string describing the machine
  1235. // and user this client represents. The
  1236. // specific content of the string varies
  1237. // with operating system. If the client is
  1238. // remotely connected some network information
  1239. // may also be present.
  1240. STDMETHOD(GetIdentity)(
  1241. THIS_
  1242. OUT OPTIONAL PSTR Buffer,
  1243. IN ULONG BufferSize,
  1244. OUT OPTIONAL PULONG IdentitySize
  1245. ) PURE;
  1246. // Format is a printf-like format string
  1247. // with one %s where the identity string should go.
  1248. STDMETHOD(OutputIdentity)(
  1249. THIS_
  1250. IN ULONG OutputControl,
  1251. IN ULONG Flags,
  1252. IN PCSTR Format
  1253. ) PURE;
  1254. // Event callbacks allow a client to
  1255. // receive notification about changes
  1256. // during the debug session.
  1257. STDMETHOD(GetEventCallbacks)(
  1258. THIS_
  1259. OUT PDEBUG_EVENT_CALLBACKS* Callbacks
  1260. ) PURE;
  1261. STDMETHOD(SetEventCallbacks)(
  1262. THIS_
  1263. IN PDEBUG_EVENT_CALLBACKS Callbacks
  1264. ) PURE;
  1265. // The engine sometimes merges compatible callback
  1266. // requests to reduce callback overhead. This is
  1267. // most noticeable with output as small pieces of
  1268. // output are collected into larger groups to
  1269. // reduce the overall number of output callback calls.
  1270. // A client can use this method to force all pending
  1271. // callbacks to be delivered. This is rarely necessary.
  1272. STDMETHOD(FlushCallbacks)(
  1273. THIS
  1274. ) PURE;
  1275. // IDebugClient2.
  1276. // Functions similarly to WriteDumpFile with
  1277. // the addition of the ability to specify
  1278. // per-dump-format write control flags.
  1279. // Comment is not supported in all formats.
  1280. STDMETHOD(WriteDumpFile2)(
  1281. THIS_
  1282. IN PCSTR DumpFile,
  1283. IN ULONG Qualifier,
  1284. IN ULONG FormatFlags,
  1285. IN OPTIONAL PCSTR Comment
  1286. ) PURE;
  1287. // Registers additional files of supporting information
  1288. // for a dump file open. This method must be called
  1289. // before OpenDumpFile is called.
  1290. // The files registered may be opened at the time
  1291. // this method is called but generally will not
  1292. // be used until OpenDumpFile is called.
  1293. STDMETHOD(AddDumpInformationFile)(
  1294. THIS_
  1295. IN PCSTR InfoFile,
  1296. IN ULONG Type
  1297. ) PURE;
  1298. // Requests that the remote process server shut down.
  1299. STDMETHOD(EndProcessServer)(
  1300. THIS_
  1301. IN ULONG64 Server
  1302. ) PURE;
  1303. // Waits for a started process server to
  1304. // exit. Allows an application running a
  1305. // process server to monitor the process
  1306. // server so that it can tell when a remote
  1307. // client has asked for it to exit.
  1308. // Returns S_OK if the process server has
  1309. // shut down and S_FALSE for a timeout.
  1310. STDMETHOD(WaitForProcessServerEnd)(
  1311. THIS_
  1312. IN ULONG Timeout
  1313. ) PURE;
  1314. // Returns S_OK if the system is configured
  1315. // to allow kernel debugging.
  1316. STDMETHOD(IsKernelDebuggerEnabled)(
  1317. THIS
  1318. ) PURE;
  1319. // Attempts to terminate the current process.
  1320. // Exit process events for the process may be generated.
  1321. STDMETHOD(TerminateCurrentProcess)(
  1322. THIS
  1323. ) PURE;
  1324. // Attempts to detach from the current process.
  1325. // This requires OS support for debugger detach.
  1326. STDMETHOD(DetachCurrentProcess)(
  1327. THIS
  1328. ) PURE;
  1329. // Removes the process from the debuggers process
  1330. // list without making any other changes. The process
  1331. // will still be marked as being debugged and will
  1332. // not run. This allows a debugger to be shut down
  1333. // and a new debugger attached without taking the
  1334. // process out of the debugged state.
  1335. // This is only supported on some system versions.
  1336. STDMETHOD(AbandonCurrentProcess)(
  1337. THIS
  1338. ) PURE;
  1339. };
  1340. //----------------------------------------------------------------------------
  1341. //
  1342. // IDebugControl.
  1343. //
  1344. //----------------------------------------------------------------------------
  1345. // Execution status codes used for waiting,
  1346. // for returning current status and for
  1347. // event method return values.
  1348. #define DEBUG_STATUS_NO_CHANGE 0
  1349. #define DEBUG_STATUS_GO 1
  1350. #define DEBUG_STATUS_GO_HANDLED 2
  1351. #define DEBUG_STATUS_GO_NOT_HANDLED 3
  1352. #define DEBUG_STATUS_STEP_OVER 4
  1353. #define DEBUG_STATUS_STEP_INTO 5
  1354. #define DEBUG_STATUS_BREAK 6
  1355. #define DEBUG_STATUS_NO_DEBUGGEE 7
  1356. #define DEBUG_STATUS_STEP_BRANCH 8
  1357. #define DEBUG_STATUS_IGNORE_EVENT 9
  1358. #define DEBUG_STATUS_MASK 0xf
  1359. // This bit is added in DEBUG_CES_EXECUTION_STATUS
  1360. // notifications when the engines execution status
  1361. // is changing due to operations performed during
  1362. // a wait, such as making synchronous callbacks. If
  1363. // the bit is not set the execution status is changing
  1364. // due to a wait being satisfied.
  1365. #define DEBUG_STATUS_INSIDE_WAIT 0x100000000
  1366. // Output control flags.
  1367. // Output generated by methods called by this
  1368. // client will be sent only to this clients
  1369. // output callbacks.
  1370. #define DEBUG_OUTCTL_THIS_CLIENT 0x00000000
  1371. // Output will be sent to all clients.
  1372. #define DEBUG_OUTCTL_ALL_CLIENTS 0x00000001
  1373. // Output will be sent to all clients except
  1374. // the client generating the output.
  1375. #define DEBUG_OUTCTL_ALL_OTHER_CLIENTS 0x00000002
  1376. // Output will be discarded immediately and will not
  1377. // be logged or sent to callbacks.
  1378. #define DEBUG_OUTCTL_IGNORE 0x00000003
  1379. // Output will be logged but not sent to callbacks.
  1380. #define DEBUG_OUTCTL_LOG_ONLY 0x00000004
  1381. // All send control bits.
  1382. #define DEBUG_OUTCTL_SEND_MASK 0x00000007
  1383. // Do not place output from this client in
  1384. // the global log file.
  1385. #define DEBUG_OUTCTL_NOT_LOGGED 0x00000008
  1386. // Send output to clients regardless of whether the
  1387. // mask allows it or not.
  1388. #define DEBUG_OUTCTL_OVERRIDE_MASK 0x00000010
  1389. // Special value which means leave the output settings
  1390. // unchanged.
  1391. #define DEBUG_OUTCTL_AMBIENT 0xffffffff
  1392. // Interrupt types.
  1393. // Force a break in if the debuggee is running.
  1394. #define DEBUG_INTERRUPT_ACTIVE 0
  1395. // Notify but do not force a break in.
  1396. #define DEBUG_INTERRUPT_PASSIVE 1
  1397. // Try and get the current engine operation to
  1398. // complete so that the engine will be available
  1399. // again. If no wait is active this is the same
  1400. // as a passive interrupt. If a wait is active
  1401. // this will try to cause the wait to fail without
  1402. // breaking in to the debuggee. There is
  1403. // no guarantee that issuing an exit interrupt
  1404. // will cause the engine to become available
  1405. // as not all operations are arbitrarily
  1406. // interruptible.
  1407. #define DEBUG_INTERRUPT_EXIT 2
  1408. // OutputCurrentState flags. These flags
  1409. // allow a particular type of information
  1410. // to be displayed but do not guarantee
  1411. // that it will be displayed. Other global
  1412. // settings may override these flags or
  1413. // the particular state may not be available.
  1414. // For example, source line information may
  1415. // not be present so source line information
  1416. // may not be displayed.
  1417. #define DEBUG_CURRENT_DEFAULT 0x0000000f
  1418. #define DEBUG_CURRENT_SYMBOL 0x00000001
  1419. #define DEBUG_CURRENT_DISASM 0x00000002
  1420. #define DEBUG_CURRENT_REGISTERS 0x00000004
  1421. #define DEBUG_CURRENT_SOURCE_LINE 0x00000008
  1422. // Disassemble flags.
  1423. // Compute the effective address from current register
  1424. // information and display it.
  1425. #define DEBUG_DISASM_EFFECTIVE_ADDRESS 0x00000001
  1426. // If the current disassembly offset has an exact
  1427. // symbol match output the symbol.
  1428. #define DEBUG_DISASM_MATCHING_SYMBOLS 0x00000002
  1429. // Code interpretation levels for stepping
  1430. // and other operations.
  1431. #define DEBUG_LEVEL_SOURCE 0
  1432. #define DEBUG_LEVEL_ASSEMBLY 1
  1433. // Engine control flags.
  1434. #define DEBUG_ENGOPT_IGNORE_DBGHELP_VERSION 0x00000001
  1435. #define DEBUG_ENGOPT_IGNORE_EXTENSION_VERSIONS 0x00000002
  1436. // If neither allow nor disallow is specified
  1437. // the engine will pick one based on what kind
  1438. // of debugging is going on.
  1439. #define DEBUG_ENGOPT_ALLOW_NETWORK_PATHS 0x00000004
  1440. #define DEBUG_ENGOPT_DISALLOW_NETWORK_PATHS 0x00000008
  1441. #define DEBUG_ENGOPT_NETWORK_PATHS (0x00000004 | 0x00000008)
  1442. // Ignore loader-generated first-chance exceptions.
  1443. #define DEBUG_ENGOPT_IGNORE_LOADER_EXCEPTIONS 0x00000010
  1444. // Break in on a debuggees initial event. In user-mode
  1445. // this will break at the initial system breakpoint
  1446. // for every created process. In kernel-mode it
  1447. // will attempt break in on the target at the first
  1448. // WaitForEvent.
  1449. #define DEBUG_ENGOPT_INITIAL_BREAK 0x00000020
  1450. // Break in on the first module load for a debuggee.
  1451. #define DEBUG_ENGOPT_INITIAL_MODULE_BREAK 0x00000040
  1452. // Break in on a debuggees final event. In user-mode
  1453. // this will break on process exit for every process.
  1454. // In kernel-mode it currently does nothing.
  1455. #define DEBUG_ENGOPT_FINAL_BREAK 0x00000080
  1456. // By default Execute will repeat the last command
  1457. // if it is given an empty string. The flags to
  1458. // Execute can override this behavior for a single
  1459. // command or this engine option can be used to
  1460. // change the default globally.
  1461. #define DEBUG_ENGOPT_NO_EXECUTE_REPEAT 0x00000100
  1462. // Disable places in the engine that have fallback
  1463. // code when presented with incomplete information.
  1464. // 1. Fails minidump module loads unless matching
  1465. // executables can be mapped.
  1466. #define DEBUG_ENGOPT_FAIL_INCOMPLETE_INFORMATION 0x00000200
  1467. // Allow the debugger to manipulate page protections
  1468. // in order to insert code breakpoints on pages that
  1469. // do not have write access. This option is not on
  1470. // by default as it allows breakpoints to be set
  1471. // in potentially hazardous memory areas.
  1472. #define DEBUG_ENGOPT_ALLOW_READ_ONLY_BREAKPOINTS 0x00000400
  1473. // When using a software (bp/bu) breakpoint in code
  1474. // that will be executed by multiple threads it is
  1475. // possible for breakpoint management to cause the
  1476. // breakpoint to be missed or for spurious single-step
  1477. // exceptions to be generated. This flag suspends
  1478. // all but the active thread when doing breakpoint
  1479. // management and thereby avoids multithreading
  1480. // problems. Care must be taken when using it, though,
  1481. // as the suspension of threads can cause deadlocks
  1482. // if the suspended threads are holding resources that
  1483. // the active thread needs. Additionally, there
  1484. // are still rare situations where problems may
  1485. // occur, but setting this flag corrects nearly
  1486. // all multithreading issues with software breakpoints.
  1487. // Thread-restricted stepping and execution supersedes
  1488. // this flags effect.
  1489. // This flag is ignored in kernel sessions as there
  1490. // is no way to restrict processor execution.
  1491. #define DEBUG_ENGOPT_SYNCHRONIZE_BREAKPOINTS 0x00000800
  1492. // Disallows executing shell commands through the
  1493. // engine with .shell (!!).
  1494. #define DEBUG_ENGOPT_DISALLOW_SHELL_COMMANDS 0x00001000
  1495. #define DEBUG_ENGOPT_ALL 0x00001FFF
  1496. // General unspecified ID constant.
  1497. #define DEBUG_ANY_ID 0xffffffff
  1498. typedef struct _DEBUG_STACK_FRAME
  1499. {
  1500. ULONG64 InstructionOffset;
  1501. ULONG64 ReturnOffset;
  1502. ULONG64 FrameOffset;
  1503. ULONG64 StackOffset;
  1504. ULONG64 FuncTableEntry;
  1505. ULONG64 Params[4];
  1506. ULONG64 Reserved[6];
  1507. BOOL Virtual;
  1508. ULONG FrameNumber;
  1509. } DEBUG_STACK_FRAME, *PDEBUG_STACK_FRAME;
  1510. // OutputStackTrace flags.
  1511. // Display a small number of arguments for each call.
  1512. // These may or may not be the actual arguments depending
  1513. // on the architecture, particular function and
  1514. // point during the execution of the function.
  1515. // If the current code level is assembly arguments
  1516. // are dumped as hex values. If the code level is
  1517. // source the engine attempts to provide symbolic
  1518. // argument information.
  1519. #define DEBUG_STACK_ARGUMENTS 0x00000001
  1520. // Displays information about the functions
  1521. // frame such as __stdcall arguments, FPO
  1522. // information and whatever else is available.
  1523. #define DEBUG_STACK_FUNCTION_INFO 0x00000002
  1524. // Displays source line information for each
  1525. // frame of the stack trace.
  1526. #define DEBUG_STACK_SOURCE_LINE 0x00000004
  1527. // Show return, previous frame and other relevant address
  1528. // values for each frame.
  1529. #define DEBUG_STACK_FRAME_ADDRESSES 0x00000008
  1530. // Show column names.
  1531. #define DEBUG_STACK_COLUMN_NAMES 0x00000010
  1532. // Show non-volatile register context for each
  1533. // frame. This is only meaningful for some platforms.
  1534. #define DEBUG_STACK_NONVOLATILE_REGISTERS 0x00000020
  1535. // Show frame numbers
  1536. #define DEBUG_STACK_FRAME_NUMBERS 0x00000040
  1537. // Show parameters with type name
  1538. #define DEBUG_STACK_PARAMETERS 0x00000080
  1539. // Show just return address in stack frame addresses
  1540. #define DEBUG_STACK_FRAME_ADDRESSES_RA_ONLY 0x00000100
  1541. // Classes of debuggee. Each class
  1542. // has different qualifiers for specific
  1543. // kinds of debuggees.
  1544. #define DEBUG_CLASS_UNINITIALIZED 0
  1545. #define DEBUG_CLASS_KERNEL 1
  1546. #define DEBUG_CLASS_USER_WINDOWS 2
  1547. // Generic dump types. These can be used
  1548. // with either user or kernel sessions.
  1549. // Session-type-specific aliases are also
  1550. // provided.
  1551. #define DEBUG_DUMP_SMALL 1024
  1552. #define DEBUG_DUMP_DEFAULT 1025
  1553. #define DEBUG_DUMP_FULL 1026
  1554. // Specific types of kernel debuggees.
  1555. #define DEBUG_KERNEL_CONNECTION 0
  1556. #define DEBUG_KERNEL_LOCAL 1
  1557. #define DEBUG_KERNEL_EXDI_DRIVER 2
  1558. #define DEBUG_KERNEL_SMALL_DUMP DEBUG_DUMP_SMALL
  1559. #define DEBUG_KERNEL_DUMP DEBUG_DUMP_DEFAULT
  1560. #define DEBUG_KERNEL_FULL_DUMP DEBUG_DUMP_FULL
  1561. // Specific types of Windows user debuggees.
  1562. #define DEBUG_USER_WINDOWS_PROCESS 0
  1563. #define DEBUG_USER_WINDOWS_PROCESS_SERVER 1
  1564. #define DEBUG_USER_WINDOWS_SMALL_DUMP DEBUG_DUMP_SMALL
  1565. #define DEBUG_USER_WINDOWS_DUMP DEBUG_DUMP_DEFAULT
  1566. // Extension flags.
  1567. #define DEBUG_EXTENSION_AT_ENGINE 0x00000000
  1568. // Execute and ExecuteCommandFile flags.
  1569. // These flags only apply to the command
  1570. // text itself; output from the executed
  1571. // command is controlled by the output
  1572. // control parameter.
  1573. // Default execution. Command is logged
  1574. // but not output.
  1575. #define DEBUG_EXECUTE_DEFAULT 0x00000000
  1576. // Echo commands during execution. In
  1577. // ExecuteCommandFile also echoes the prompt
  1578. // for each line of the file.
  1579. #define DEBUG_EXECUTE_ECHO 0x00000001
  1580. // Do not log or output commands during execution.
  1581. // Overridden by DEBUG_EXECUTE_ECHO.
  1582. #define DEBUG_EXECUTE_NOT_LOGGED 0x00000002
  1583. // If this flag is not set an empty string
  1584. // to Execute will repeat the last Execute
  1585. // string.
  1586. #define DEBUG_EXECUTE_NO_REPEAT 0x00000004
  1587. // Specific event filter types. Some event
  1588. // filters have optional arguments to further
  1589. // qualify their operation.
  1590. #define DEBUG_FILTER_CREATE_THREAD 0x00000000
  1591. #define DEBUG_FILTER_EXIT_THREAD 0x00000001
  1592. #define DEBUG_FILTER_CREATE_PROCESS 0x00000002
  1593. #define DEBUG_FILTER_EXIT_PROCESS 0x00000003
  1594. // Argument is the name of a module to break on.
  1595. #define DEBUG_FILTER_LOAD_MODULE 0x00000004
  1596. // Argument is the base address of a specific module to break on.
  1597. #define DEBUG_FILTER_UNLOAD_MODULE 0x00000005
  1598. #define DEBUG_FILTER_SYSTEM_ERROR 0x00000006
  1599. // Initial breakpoint and initial module load are one-shot
  1600. // events that are triggered at the appropriate points in
  1601. // the beginning of a session. Their commands are executed
  1602. // and then further processing is controlled by the normal
  1603. // exception and load module filters.
  1604. #define DEBUG_FILTER_INITIAL_BREAKPOINT 0x00000007
  1605. #define DEBUG_FILTER_INITIAL_MODULE_LOAD 0x00000008
  1606. // The debug output filter allows the debugger to stop
  1607. // when output is produced so that the code causing
  1608. // output can be tracked down or synchronized with.
  1609. // This filter is not supported for live dual-machine
  1610. // kernel debugging.
  1611. #define DEBUG_FILTER_DEBUGGEE_OUTPUT 0x00000009
  1612. // Event filter execution options.
  1613. // Break in always.
  1614. #define DEBUG_FILTER_BREAK 0x00000000
  1615. // Break in on second-chance exceptions. For events
  1616. // that are not exceptions this is the same as BREAK.
  1617. #define DEBUG_FILTER_SECOND_CHANCE_BREAK 0x00000001
  1618. // Output a message about the event but continue.
  1619. #define DEBUG_FILTER_OUTPUT 0x00000002
  1620. // Continue the event.
  1621. #define DEBUG_FILTER_IGNORE 0x00000003
  1622. // Used to remove general exception filters.
  1623. #define DEBUG_FILTER_REMOVE 0x00000004
  1624. // Event filter continuation options. These options are
  1625. // only used when DEBUG_STATUS_GO is used to continue
  1626. // execution. If a specific go status such as
  1627. // DEBUG_STATUS_GO_NOT_HANDLED is used it controls
  1628. // the continuation.
  1629. #define DEBUG_FILTER_GO_HANDLED 0x00000000
  1630. #define DEBUG_FILTER_GO_NOT_HANDLED 0x00000001
  1631. // Specific event filter settings.
  1632. typedef struct _DEBUG_SPECIFIC_FILTER_PARAMETERS
  1633. {
  1634. ULONG ExecutionOption;
  1635. ULONG ContinueOption;
  1636. ULONG TextSize;
  1637. ULONG CommandSize;
  1638. // If ArgumentSize is zero this filter does
  1639. // not have an argument. An empty argument for
  1640. // a filter which does have an argument will take
  1641. // one byte for the terminator.
  1642. ULONG ArgumentSize;
  1643. } DEBUG_SPECIFIC_FILTER_PARAMETERS, *PDEBUG_SPECIFIC_FILTER_PARAMETERS;
  1644. // Exception event filter settings.
  1645. typedef struct _DEBUG_EXCEPTION_FILTER_PARAMETERS
  1646. {
  1647. ULONG ExecutionOption;
  1648. ULONG ContinueOption;
  1649. ULONG TextSize;
  1650. ULONG CommandSize;
  1651. ULONG SecondCommandSize;
  1652. ULONG ExceptionCode;
  1653. } DEBUG_EXCEPTION_FILTER_PARAMETERS, *PDEBUG_EXCEPTION_FILTER_PARAMETERS;
  1654. // Wait flags.
  1655. #define DEBUG_WAIT_DEFAULT 0x00000000
  1656. // Last event information structures.
  1657. typedef struct _DEBUG_LAST_EVENT_INFO_BREAKPOINT
  1658. {
  1659. ULONG Id;
  1660. } DEBUG_LAST_EVENT_INFO_BREAKPOINT, *PDEBUG_LAST_EVENT_INFO_BREAKPOINT;
  1661. typedef struct _DEBUG_LAST_EVENT_INFO_EXCEPTION
  1662. {
  1663. EXCEPTION_RECORD64 ExceptionRecord;
  1664. ULONG FirstChance;
  1665. } DEBUG_LAST_EVENT_INFO_EXCEPTION, *PDEBUG_LAST_EVENT_INFO_EXCEPTION;
  1666. typedef struct _DEBUG_LAST_EVENT_INFO_EXIT_THREAD
  1667. {
  1668. ULONG ExitCode;
  1669. } DEBUG_LAST_EVENT_INFO_EXIT_THREAD, *PDEBUG_LAST_EVENT_INFO_EXIT_THREAD;
  1670. typedef struct _DEBUG_LAST_EVENT_INFO_EXIT_PROCESS
  1671. {
  1672. ULONG ExitCode;
  1673. } DEBUG_LAST_EVENT_INFO_EXIT_PROCESS, *PDEBUG_LAST_EVENT_INFO_EXIT_PROCESS;
  1674. typedef struct _DEBUG_LAST_EVENT_INFO_LOAD_MODULE
  1675. {
  1676. ULONG64 Base;
  1677. } DEBUG_LAST_EVENT_INFO_LOAD_MODULE, *PDEBUG_LAST_EVENT_INFO_LOAD_MODULE;
  1678. typedef struct _DEBUG_LAST_EVENT_INFO_UNLOAD_MODULE
  1679. {
  1680. ULONG64 Base;
  1681. } DEBUG_LAST_EVENT_INFO_UNLOAD_MODULE, *PDEBUG_LAST_EVENT_INFO_UNLOAD_MODULE;
  1682. typedef struct _DEBUG_LAST_EVENT_INFO_SYSTEM_ERROR
  1683. {
  1684. ULONG Error;
  1685. ULONG Level;
  1686. } DEBUG_LAST_EVENT_INFO_SYSTEM_ERROR, *PDEBUG_LAST_EVENT_INFO_SYSTEM_ERROR;
  1687. // DEBUG_VALUE types.
  1688. #define DEBUG_VALUE_INVALID 0
  1689. #define DEBUG_VALUE_INT8 1
  1690. #define DEBUG_VALUE_INT16 2
  1691. #define DEBUG_VALUE_INT32 3
  1692. #define DEBUG_VALUE_INT64 4
  1693. #define DEBUG_VALUE_FLOAT32 5
  1694. #define DEBUG_VALUE_FLOAT64 6
  1695. #define DEBUG_VALUE_FLOAT80 7
  1696. #define DEBUG_VALUE_FLOAT82 8
  1697. #define DEBUG_VALUE_FLOAT128 9
  1698. #define DEBUG_VALUE_VECTOR64 10
  1699. #define DEBUG_VALUE_VECTOR128 11
  1700. // Count of type indices.
  1701. #define DEBUG_VALUE_TYPES 12
  1702. #if defined(_MSC_VER)
  1703. #if _MSC_VER >= 800
  1704. #if _MSC_VER >= 1200
  1705. #pragma warning(push)
  1706. #endif
  1707. #pragma warning(disable:4201) /* Nameless struct/union */
  1708. #endif
  1709. #endif
  1710. // Force the compiler to align DEBUG_VALUE.Type on a four-byte
  1711. // boundary so that it comes out to 32 bytes total.
  1712. #include <pshpack4.h>
  1713. typedef struct _DEBUG_VALUE
  1714. {
  1715. union
  1716. {
  1717. UCHAR I8;
  1718. USHORT I16;
  1719. ULONG I32;
  1720. struct
  1721. {
  1722. // Extra NAT indicator for IA64
  1723. // integer registers. NAT will
  1724. // always be false for other CPUs.
  1725. ULONG64 I64;
  1726. BOOL Nat;
  1727. };
  1728. float F32;
  1729. double F64;
  1730. UCHAR F80Bytes[10];
  1731. UCHAR F82Bytes[11];
  1732. UCHAR F128Bytes[16];
  1733. // Vector interpretations. The actual number
  1734. // of valid elements depends on the vector length.
  1735. UCHAR VI8[16];
  1736. USHORT VI16[8];
  1737. ULONG VI32[4];
  1738. ULONG64 VI64[2];
  1739. float VF32[4];
  1740. double VF64[2];
  1741. struct
  1742. {
  1743. ULONG LowPart;
  1744. ULONG HighPart;
  1745. } I64Parts32;
  1746. struct
  1747. {
  1748. ULONG64 LowPart;
  1749. LONG64 HighPart;
  1750. } F128Parts64;
  1751. // Allows raw byte access to content. Array
  1752. // can be indexed for as much data as Type
  1753. // describes. This array also serves to pad
  1754. // the structure out to 32 bytes and reserves
  1755. // space for future members.
  1756. UCHAR RawBytes[28];
  1757. };
  1758. ULONG Type;
  1759. } DEBUG_VALUE, *PDEBUG_VALUE;
  1760. #include <poppack.h>
  1761. #if defined(_MSC_VER)
  1762. #if _MSC_VER >= 800
  1763. #if _MSC_VER >= 1200
  1764. #pragma warning(pop)
  1765. #else
  1766. #pragma warning(disable:4201) /* Nameless struct/union */
  1767. #endif
  1768. #endif
  1769. #endif
  1770. #undef INTERFACE
  1771. #define INTERFACE IDebugControl
  1772. DECLARE_INTERFACE_(IDebugControl, IUnknown)
  1773. {
  1774. // IUnknown.
  1775. STDMETHOD(QueryInterface)(
  1776. THIS_
  1777. IN REFIID InterfaceId,
  1778. OUT PVOID* Interface
  1779. ) PURE;
  1780. STDMETHOD_(ULONG, AddRef)(
  1781. THIS
  1782. ) PURE;
  1783. STDMETHOD_(ULONG, Release)(
  1784. THIS
  1785. ) PURE;
  1786. // IDebugControl.
  1787. // Checks for a user interrupt, such a Ctrl-C
  1788. // or stop button.
  1789. // This method is reentrant.
  1790. STDMETHOD(GetInterrupt)(
  1791. THIS
  1792. ) PURE;
  1793. // Registers a user interrupt.
  1794. // This method is reentrant.
  1795. STDMETHOD(SetInterrupt)(
  1796. THIS_
  1797. IN ULONG Flags
  1798. ) PURE;
  1799. // Interrupting a user-mode process requires
  1800. // access to some system resources that the
  1801. // process may hold itself, preventing the
  1802. // interrupt from occurring. The engine
  1803. // will time-out pending interrupt requests
  1804. // and simulate an interrupt if necessary.
  1805. // These methods control the interrupt timeout.
  1806. STDMETHOD(GetInterruptTimeout)(
  1807. THIS_
  1808. OUT PULONG Seconds
  1809. ) PURE;
  1810. STDMETHOD(SetInterruptTimeout)(
  1811. THIS_
  1812. IN ULONG Seconds
  1813. ) PURE;
  1814. STDMETHOD(GetLogFile)(
  1815. THIS_
  1816. OUT OPTIONAL PSTR Buffer,
  1817. IN ULONG BufferSize,
  1818. OUT OPTIONAL PULONG FileSize,
  1819. OUT PBOOL Append
  1820. ) PURE;
  1821. // Opens a log file which collects all
  1822. // output. Output from every client except
  1823. // those that explicitly disable logging
  1824. // goes into the log.
  1825. // Opening a log file closes any log file
  1826. // already open.
  1827. STDMETHOD(OpenLogFile)(
  1828. THIS_
  1829. IN PCSTR File,
  1830. IN BOOL Append
  1831. ) PURE;
  1832. STDMETHOD(CloseLogFile)(
  1833. THIS
  1834. ) PURE;
  1835. // Controls what output is logged.
  1836. STDMETHOD(GetLogMask)(
  1837. THIS_
  1838. OUT PULONG Mask
  1839. ) PURE;
  1840. STDMETHOD(SetLogMask)(
  1841. THIS_
  1842. IN ULONG Mask
  1843. ) PURE;
  1844. // Input requests input from all clients.
  1845. // The first input that is returned is used
  1846. // to satisfy the call. Other returned
  1847. // input is discarded.
  1848. STDMETHOD(Input)(
  1849. THIS_
  1850. OUT PSTR Buffer,
  1851. IN ULONG BufferSize,
  1852. OUT OPTIONAL PULONG InputSize
  1853. ) PURE;
  1854. // This method is used by clients to return
  1855. // input when it is available. It will
  1856. // return S_OK if the input is used to
  1857. // satisfy an Input call and S_FALSE if
  1858. // the input is ignored.
  1859. // This method is reentrant.
  1860. STDMETHOD(ReturnInput)(
  1861. THIS_
  1862. IN PCSTR Buffer
  1863. ) PURE;
  1864. // Sends output through clients
  1865. // output callbacks if the mask is allowed
  1866. // by the current output control mask and
  1867. // according to the output distribution
  1868. // settings.
  1869. STDMETHODV(Output)(
  1870. THIS_
  1871. IN ULONG Mask,
  1872. IN PCSTR Format,
  1873. ...
  1874. ) PURE;
  1875. STDMETHOD(OutputVaList)(
  1876. THIS_
  1877. IN ULONG Mask,
  1878. IN PCSTR Format,
  1879. IN va_list Args
  1880. ) PURE;
  1881. // The following methods allow direct control
  1882. // over the distribution of the given output
  1883. // for situations where something other than
  1884. // the default is desired. These methods require
  1885. // extra work in the engine so they should
  1886. // only be used when necessary.
  1887. STDMETHODV(ControlledOutput)(
  1888. THIS_
  1889. IN ULONG OutputControl,
  1890. IN ULONG Mask,
  1891. IN PCSTR Format,
  1892. ...
  1893. ) PURE;
  1894. STDMETHOD(ControlledOutputVaList)(
  1895. THIS_
  1896. IN ULONG OutputControl,
  1897. IN ULONG Mask,
  1898. IN PCSTR Format,
  1899. IN va_list Args
  1900. ) PURE;
  1901. // Displays the standard command-line prompt
  1902. // followed by the given output. If Format
  1903. // is NULL no additional output is produced.
  1904. // Output is produced under the
  1905. // DEBUG_OUTPUT_PROMPT mask.
  1906. // This method only outputs the prompt; it
  1907. // does not get input.
  1908. STDMETHODV(OutputPrompt)(
  1909. THIS_
  1910. IN ULONG OutputControl,
  1911. IN OPTIONAL PCSTR Format,
  1912. ...
  1913. ) PURE;
  1914. STDMETHOD(OutputPromptVaList)(
  1915. THIS_
  1916. IN ULONG OutputControl,
  1917. IN OPTIONAL PCSTR Format,
  1918. IN va_list Args
  1919. ) PURE;
  1920. // Gets the text that would be displayed by OutputPrompt.
  1921. STDMETHOD(GetPromptText)(
  1922. THIS_
  1923. OUT OPTIONAL PSTR Buffer,
  1924. IN ULONG BufferSize,
  1925. OUT OPTIONAL PULONG TextSize
  1926. ) PURE;
  1927. // Outputs information about the current
  1928. // debuggee state such as a register
  1929. // summary, disassembly at the current PC,
  1930. // closest symbol and others.
  1931. // Uses the line prefix.
  1932. STDMETHOD(OutputCurrentState)(
  1933. THIS_
  1934. IN ULONG OutputControl,
  1935. IN ULONG Flags
  1936. ) PURE;
  1937. // Outputs the debugger and extension version
  1938. // information. This method is reentrant.
  1939. // Uses the line prefix.
  1940. STDMETHOD(OutputVersionInformation)(
  1941. THIS_
  1942. IN ULONG OutputControl
  1943. ) PURE;
  1944. // In user-mode debugging sessions the
  1945. // engine will set an event when
  1946. // exceptions are continued. This can
  1947. // be used to synchronize other processes
  1948. // with the debuggers handling of events.
  1949. // For example, this is used to support
  1950. // the e argument to ntsd.
  1951. STDMETHOD(GetNotifyEventHandle)(
  1952. THIS_
  1953. OUT PULONG64 Handle
  1954. ) PURE;
  1955. STDMETHOD(SetNotifyEventHandle)(
  1956. THIS_
  1957. IN ULONG64 Handle
  1958. ) PURE;
  1959. STDMETHOD(Assemble)(
  1960. THIS_
  1961. IN ULONG64 Offset,
  1962. IN PCSTR Instr,
  1963. OUT PULONG64 EndOffset
  1964. ) PURE;
  1965. STDMETHOD(Disassemble)(
  1966. THIS_
  1967. IN ULONG64 Offset,
  1968. IN ULONG Flags,
  1969. OUT OPTIONAL PSTR Buffer,
  1970. IN ULONG BufferSize,
  1971. OUT OPTIONAL PULONG DisassemblySize,
  1972. OUT PULONG64 EndOffset
  1973. ) PURE;
  1974. // Returns the value of the effective address
  1975. // computed for the last Disassemble, if there
  1976. // was one.
  1977. STDMETHOD(GetDisassembleEffectiveOffset)(
  1978. THIS_
  1979. OUT PULONG64 Offset
  1980. ) PURE;
  1981. // Uses the line prefix if necessary.
  1982. STDMETHOD(OutputDisassembly)(
  1983. THIS_
  1984. IN ULONG OutputControl,
  1985. IN ULONG64 Offset,
  1986. IN ULONG Flags,
  1987. OUT PULONG64 EndOffset
  1988. ) PURE;
  1989. // Produces multiple lines of disassembly output.
  1990. // There will be PreviousLines of disassembly before
  1991. // the given offset if a valid disassembly exists.
  1992. // In all, there will be TotalLines of output produced.
  1993. // The first and last line offsets are returned
  1994. // specially and all lines offsets can be retrieved
  1995. // through LineOffsets. LineOffsets will contain
  1996. // offsets for each line where disassembly started.
  1997. // When disassembly of a single instruction takes
  1998. // multiple lines the initial offset will be followed
  1999. // by DEBUG_INVALID_OFFSET.
  2000. // Uses the line prefix.
  2001. STDMETHOD(OutputDisassemblyLines)(
  2002. THIS_
  2003. IN ULONG OutputControl,
  2004. IN ULONG PreviousLines,
  2005. IN ULONG TotalLines,
  2006. IN ULONG64 Offset,
  2007. IN ULONG Flags,
  2008. OUT OPTIONAL PULONG OffsetLine,
  2009. OUT OPTIONAL PULONG64 StartOffset,
  2010. OUT OPTIONAL PULONG64 EndOffset,
  2011. OUT OPTIONAL /* size_is(TotalLines) */ PULONG64 LineOffsets
  2012. ) PURE;
  2013. // Returns the offset of the start of
  2014. // the instruction thats the given
  2015. // delta away from the instruction
  2016. // at the initial offset.
  2017. // This routine does not check for
  2018. // validity of the instruction or
  2019. // the memory containing it.
  2020. STDMETHOD(GetNearInstruction)(
  2021. THIS_
  2022. IN ULONG64 Offset,
  2023. IN LONG Delta,
  2024. OUT PULONG64 NearOffset
  2025. ) PURE;
  2026. // Offsets can be passed in as zero to use the current
  2027. // thread state.
  2028. STDMETHOD(GetStackTrace)(
  2029. THIS_
  2030. IN ULONG64 FrameOffset,
  2031. IN ULONG64 StackOffset,
  2032. IN ULONG64 InstructionOffset,
  2033. OUT /* size_is(FramesSize) */ PDEBUG_STACK_FRAME Frames,
  2034. IN ULONG FramesSize,
  2035. OUT OPTIONAL PULONG FramesFilled
  2036. ) PURE;
  2037. // Does a simple stack trace to determine
  2038. // what the current return address is.
  2039. STDMETHOD(GetReturnOffset)(
  2040. THIS_
  2041. OUT PULONG64 Offset
  2042. ) PURE;
  2043. // If Frames is NULL OutputStackTrace will
  2044. // use GetStackTrace to get FramesSize frames
  2045. // and then output them. The current register
  2046. // values for frame, stack and instruction offsets
  2047. // are used.
  2048. // Uses the line prefix.
  2049. STDMETHOD(OutputStackTrace)(
  2050. THIS_
  2051. IN ULONG OutputControl,
  2052. IN OPTIONAL /* size_is(FramesSize) */ PDEBUG_STACK_FRAME Frames,
  2053. IN ULONG FramesSize,
  2054. IN ULONG Flags
  2055. ) PURE;
  2056. // Returns information about the debuggee such
  2057. // as user vs. kernel, dump vs. live, etc.
  2058. STDMETHOD(GetDebuggeeType)(
  2059. THIS_
  2060. OUT PULONG Class,
  2061. OUT PULONG Qualifier
  2062. ) PURE;
  2063. // Returns the type of physical processors in
  2064. // the machine.
  2065. // Returns one of the IMAGE_FILE_MACHINE values.
  2066. STDMETHOD(GetActualProcessorType)(
  2067. THIS_
  2068. OUT PULONG Type
  2069. ) PURE;
  2070. // Returns the type of processor used in the
  2071. // current processor context.
  2072. STDMETHOD(GetExecutingProcessorType)(
  2073. THIS_
  2074. OUT PULONG Type
  2075. ) PURE;
  2076. // Query all the possible processor types that
  2077. // may be encountered during this debug session.
  2078. STDMETHOD(GetNumberPossibleExecutingProcessorTypes)(
  2079. THIS_
  2080. OUT PULONG Number
  2081. ) PURE;
  2082. STDMETHOD(GetPossibleExecutingProcessorTypes)(
  2083. THIS_
  2084. IN ULONG Start,
  2085. IN ULONG Count,
  2086. OUT /* size_is(Count) */ PULONG Types
  2087. ) PURE;
  2088. // Get the number of actual processors in
  2089. // the machine.
  2090. STDMETHOD(GetNumberProcessors)(
  2091. THIS_
  2092. OUT PULONG Number
  2093. ) PURE;
  2094. // PlatformId is one of the VER_PLATFORM values.
  2095. // Major and minor are as given in the NT
  2096. // kernel debugger protocol.
  2097. // ServicePackString and ServicePackNumber indicate the
  2098. // system service pack level. ServicePackNumber is not
  2099. // available in some sessions where the service pack level
  2100. // is only expressed as a string. The service pack information
  2101. // will be empty if the system does not have a service pack
  2102. // applied.
  2103. // The build string is string information identifying the
  2104. // particular build of the system. The build string is
  2105. // empty if the system has no particular identifying
  2106. // information.
  2107. STDMETHOD(GetSystemVersion)(
  2108. THIS_
  2109. OUT PULONG PlatformId,
  2110. OUT PULONG Major,
  2111. OUT PULONG Minor,
  2112. OUT OPTIONAL PSTR ServicePackString,
  2113. IN ULONG ServicePackStringSize,
  2114. OUT OPTIONAL PULONG ServicePackStringUsed,
  2115. OUT PULONG ServicePackNumber,
  2116. OUT OPTIONAL PSTR BuildString,
  2117. IN ULONG BuildStringSize,
  2118. OUT OPTIONAL PULONG BuildStringUsed
  2119. ) PURE;
  2120. // Returns the page size for the currently executing
  2121. // processor context. The page size may vary between
  2122. // processor types.
  2123. STDMETHOD(GetPageSize)(
  2124. THIS_
  2125. OUT PULONG Size
  2126. ) PURE;
  2127. // Returns S_OK if the current processor context uses
  2128. // 64-bit addresses, otherwise S_FALSE.
  2129. STDMETHOD(IsPointer64Bit)(
  2130. THIS
  2131. ) PURE;
  2132. // Reads the bugcheck data area and returns the
  2133. // current contents. This method only works
  2134. // in kernel debugging sessions.
  2135. STDMETHOD(ReadBugCheckData)(
  2136. THIS_
  2137. OUT PULONG Code,
  2138. OUT PULONG64 Arg1,
  2139. OUT PULONG64 Arg2,
  2140. OUT PULONG64 Arg3,
  2141. OUT PULONG64 Arg4
  2142. ) PURE;
  2143. // Query all the processor types supported by
  2144. // the engine. This is a complete list and is
  2145. // not related to the machine running the engine
  2146. // or the debuggee.
  2147. STDMETHOD(GetNumberSupportedProcessorTypes)(
  2148. THIS_
  2149. OUT PULONG Number
  2150. ) PURE;
  2151. STDMETHOD(GetSupportedProcessorTypes)(
  2152. THIS_
  2153. IN ULONG Start,
  2154. IN ULONG Count,
  2155. OUT /* size_is(Count) */ PULONG Types
  2156. ) PURE;
  2157. // Returns a full, descriptive name and an
  2158. // abbreviated name for a processor type.
  2159. STDMETHOD(GetProcessorTypeNames)(
  2160. THIS_
  2161. IN ULONG Type,
  2162. OUT OPTIONAL PSTR FullNameBuffer,
  2163. IN ULONG FullNameBufferSize,
  2164. OUT OPTIONAL PULONG FullNameSize,
  2165. OUT OPTIONAL PSTR AbbrevNameBuffer,
  2166. IN ULONG AbbrevNameBufferSize,
  2167. OUT OPTIONAL PULONG AbbrevNameSize
  2168. ) PURE;
  2169. // Gets and sets the type of processor to
  2170. // use when doing things like setting
  2171. // breakpoints, accessing registers,
  2172. // getting stack traces and so on.
  2173. STDMETHOD(GetEffectiveProcessorType)(
  2174. THIS_
  2175. OUT PULONG Type
  2176. ) PURE;
  2177. STDMETHOD(SetEffectiveProcessorType)(
  2178. THIS_
  2179. IN ULONG Type
  2180. ) PURE;
  2181. // Returns information about whether and how
  2182. // the debuggee is running. Status will
  2183. // be GO if the debuggee is running and
  2184. // BREAK if it isnt.
  2185. // If no debuggee exists the status is
  2186. // NO_DEBUGGEE.
  2187. // This method is reentrant.
  2188. STDMETHOD(GetExecutionStatus)(
  2189. THIS_
  2190. OUT PULONG Status
  2191. ) PURE;
  2192. // Changes the execution status of the
  2193. // engine from stopped to running.
  2194. // Status must be one of the go or step
  2195. // status values.
  2196. STDMETHOD(SetExecutionStatus)(
  2197. THIS_
  2198. IN ULONG Status
  2199. ) PURE;
  2200. // Controls what code interpretation level the debugger
  2201. // runs at. The debugger checks the code level when
  2202. // deciding whether to step by a source line or
  2203. // assembly instruction along with other related operations.
  2204. STDMETHOD(GetCodeLevel)(
  2205. THIS_
  2206. OUT PULONG Level
  2207. ) PURE;
  2208. STDMETHOD(SetCodeLevel)(
  2209. THIS_
  2210. IN ULONG Level
  2211. ) PURE;
  2212. // Gets and sets engine control flags.
  2213. // These methods are reentrant.
  2214. STDMETHOD(GetEngineOptions)(
  2215. THIS_
  2216. OUT PULONG Options
  2217. ) PURE;
  2218. STDMETHOD(AddEngineOptions)(
  2219. THIS_
  2220. IN ULONG Options
  2221. ) PURE;
  2222. STDMETHOD(RemoveEngineOptions)(
  2223. THIS_
  2224. IN ULONG Options
  2225. ) PURE;
  2226. STDMETHOD(SetEngineOptions)(
  2227. THIS_
  2228. IN ULONG Options
  2229. ) PURE;
  2230. // Gets and sets control values for
  2231. // handling system error events.
  2232. // If the system error level is less
  2233. // than or equal to the given levels
  2234. // the error may be displayed and
  2235. // the default break for the event
  2236. // may be set.
  2237. STDMETHOD(GetSystemErrorControl)(
  2238. THIS_
  2239. OUT PULONG OutputLevel,
  2240. OUT PULONG BreakLevel
  2241. ) PURE;
  2242. STDMETHOD(SetSystemErrorControl)(
  2243. THIS_
  2244. IN ULONG OutputLevel,
  2245. IN ULONG BreakLevel
  2246. ) PURE;
  2247. // The command processor supports simple
  2248. // string replacement macros in Evaluate and
  2249. // Execute. There are currently ten macro
  2250. // slots available. Slots 0-9 map to
  2251. // the command invocations $u0-$u9.
  2252. STDMETHOD(GetTextMacro)(
  2253. THIS_
  2254. IN ULONG Slot,
  2255. OUT OPTIONAL PSTR Buffer,
  2256. IN ULONG BufferSize,
  2257. OUT OPTIONAL PULONG MacroSize
  2258. ) PURE;
  2259. STDMETHOD(SetTextMacro)(
  2260. THIS_
  2261. IN ULONG Slot,
  2262. IN PCSTR Macro
  2263. ) PURE;
  2264. // Controls the default number radix used
  2265. // in expressions and commands.
  2266. STDMETHOD(GetRadix)(
  2267. THIS_
  2268. OUT PULONG Radix
  2269. ) PURE;
  2270. STDMETHOD(SetRadix)(
  2271. THIS_
  2272. IN ULONG Radix
  2273. ) PURE;
  2274. // Evaluates the given expression string and
  2275. // returns the resulting value.
  2276. // If DesiredType is DEBUG_VALUE_INVALID then
  2277. // the natural type is used.
  2278. // RemainderIndex, if provided, is set to the index
  2279. // of the first character in the input string that was
  2280. // not used when evaluating the expression.
  2281. STDMETHOD(Evaluate)(
  2282. THIS_
  2283. IN PCSTR Expression,
  2284. IN ULONG DesiredType,
  2285. OUT PDEBUG_VALUE Value,
  2286. OUT OPTIONAL PULONG RemainderIndex
  2287. ) PURE;
  2288. // Attempts to convert the input value to a value
  2289. // of the requested type in the output value.
  2290. // Conversions can fail if no conversion exists.
  2291. // Successful conversions may be lossy.
  2292. STDMETHOD(CoerceValue)(
  2293. THIS_
  2294. IN PDEBUG_VALUE In,
  2295. IN ULONG OutType,
  2296. OUT PDEBUG_VALUE Out
  2297. ) PURE;
  2298. STDMETHOD(CoerceValues)(
  2299. THIS_
  2300. IN ULONG Count,
  2301. IN /* size_is(Count) */ PDEBUG_VALUE In,
  2302. IN /* size_is(Count) */ PULONG OutTypes,
  2303. OUT /* size_is(Count) */ PDEBUG_VALUE Out
  2304. ) PURE;
  2305. // Executes the given command string.
  2306. // If the string has multiple commands
  2307. // Execute will not return until all
  2308. // of them have been executed. If this
  2309. // requires waiting for the debuggee to
  2310. // execute an internal wait will be done
  2311. // so Execute can take an arbitrary amount
  2312. // of time.
  2313. STDMETHOD(Execute)(
  2314. THIS_
  2315. IN ULONG OutputControl,
  2316. IN PCSTR Command,
  2317. IN ULONG Flags
  2318. ) PURE;
  2319. // Executes the given command file by
  2320. // reading a line at a time and processing
  2321. // it with Execute.
  2322. STDMETHOD(ExecuteCommandFile)(
  2323. THIS_
  2324. IN ULONG OutputControl,
  2325. IN PCSTR CommandFile,
  2326. IN ULONG Flags
  2327. ) PURE;
  2328. // Breakpoint interfaces are described
  2329. // elsewhere in this section.
  2330. STDMETHOD(GetNumberBreakpoints)(
  2331. THIS_
  2332. OUT PULONG Number
  2333. ) PURE;
  2334. // It is possible for this retrieval function to
  2335. // fail even with an index within the number of
  2336. // existing breakpoints if the breakpoint is
  2337. // a private breakpoint.
  2338. STDMETHOD(GetBreakpointByIndex)(
  2339. THIS_
  2340. IN ULONG Index,
  2341. OUT PDEBUG_BREAKPOINT* Bp
  2342. ) PURE;
  2343. STDMETHOD(GetBreakpointById)(
  2344. THIS_
  2345. IN ULONG Id,
  2346. OUT PDEBUG_BREAKPOINT* Bp
  2347. ) PURE;
  2348. // If Ids is non-NULL the Count breakpoints
  2349. // referred to in the Ids array are returned,
  2350. // otherwise breakpoints from index Start to
  2351. // Start + Count 1 are returned.
  2352. STDMETHOD(GetBreakpointParameters)(
  2353. THIS_
  2354. IN ULONG Count,
  2355. IN OPTIONAL /* size_is(Count) */ PULONG Ids,
  2356. IN ULONG Start,
  2357. OUT /* size_is(Count) */ PDEBUG_BREAKPOINT_PARAMETERS Params
  2358. ) PURE;
  2359. // Breakpoints are created empty and disabled.
  2360. // When their parameters have been set they
  2361. // should be enabled by setting the ENABLE flag.
  2362. // If DesiredId is DEBUG_ANY_ID then the
  2363. // engine picks an unused ID. If DesiredId
  2364. // is any other number the engine attempts
  2365. // to use the given ID for the breakpoint.
  2366. // If another breakpoint exists with that ID
  2367. // the call will fail.
  2368. STDMETHOD(AddBreakpoint)(
  2369. THIS_
  2370. IN ULONG Type,
  2371. IN ULONG DesiredId,
  2372. OUT PDEBUG_BREAKPOINT* Bp
  2373. ) PURE;
  2374. // Breakpoint interface is invalid after this call.
  2375. STDMETHOD(RemoveBreakpoint)(
  2376. THIS_
  2377. IN PDEBUG_BREAKPOINT Bp
  2378. ) PURE;
  2379. // Control and use extension DLLs.
  2380. STDMETHOD(AddExtension)(
  2381. THIS_
  2382. IN PCSTR Path,
  2383. IN ULONG Flags,
  2384. OUT PULONG64 Handle
  2385. ) PURE;
  2386. STDMETHOD(RemoveExtension)(
  2387. THIS_
  2388. IN ULONG64 Handle
  2389. ) PURE;
  2390. STDMETHOD(GetExtensionByPath)(
  2391. THIS_
  2392. IN PCSTR Path,
  2393. OUT PULONG64 Handle
  2394. ) PURE;
  2395. // If Handle is zero the extension
  2396. // chain is walked searching for the
  2397. // function.
  2398. STDMETHOD(CallExtension)(
  2399. THIS_
  2400. IN ULONG64 Handle,
  2401. IN PCSTR Function,
  2402. IN OPTIONAL PCSTR Arguments
  2403. ) PURE;
  2404. // GetExtensionFunction works like
  2405. // GetProcAddress on extension DLLs
  2406. // to allow raw function-call-level
  2407. // interaction with extension DLLs.
  2408. // Such functions do not need to
  2409. // follow the standard extension prototype
  2410. // if they are not going to be called
  2411. // through the text extension interface.
  2412. // _EFN_ is automatically prepended to
  2413. // the name string given.
  2414. // This function cannot be called remotely.
  2415. STDMETHOD(GetExtensionFunction)(
  2416. THIS_
  2417. IN ULONG64 Handle,
  2418. IN PCSTR FuncName,
  2419. OUT FARPROC* Function
  2420. ) PURE;
  2421. // These methods return alternate
  2422. // extension interfaces in order to allow
  2423. // interface-style extension DLLs to mix in
  2424. // older extension calls.
  2425. // Structure sizes must be initialized before
  2426. // the call.
  2427. // These methods cannot be called remotely.
  2428. STDMETHOD(GetWindbgExtensionApis32)(
  2429. THIS_
  2430. IN OUT PWINDBG_EXTENSION_APIS32 Api
  2431. ) PURE;
  2432. STDMETHOD(GetWindbgExtensionApis64)(
  2433. THIS_
  2434. IN OUT PWINDBG_EXTENSION_APIS64 Api
  2435. ) PURE;
  2436. // The engine provides a simple mechanism
  2437. // to filter common events. Arbitrarily complicated
  2438. // filtering can be done by registering event callbacks
  2439. // but simple event filtering only requires
  2440. // setting the options of one of the predefined
  2441. // event filters.
  2442. // Simple event filters are either for specific
  2443. // events and therefore have an enumerant or
  2444. // they are for an exception and are based on
  2445. // the exceptions code. Exception filters
  2446. // are further divided into exceptions specially
  2447. // handled by the engine, which is a fixed set,
  2448. // and arbitrary exceptions.
  2449. // All three groups of filters are indexed together
  2450. // with the specific filters first, then the specific
  2451. // exception filters and finally the arbitrary
  2452. // exception filters.
  2453. // The first specific exception is the default
  2454. // exception. If an exception event occurs for
  2455. // an exception without settings the default
  2456. // exception settings are used.
  2457. STDMETHOD(GetNumberEventFilters)(
  2458. THIS_
  2459. OUT PULONG SpecificEvents,
  2460. OUT PULONG SpecificExceptions,
  2461. OUT PULONG ArbitraryExceptions
  2462. ) PURE;
  2463. // Some filters have descriptive text associated with them.
  2464. STDMETHOD(GetEventFilterText)(
  2465. THIS_
  2466. IN ULONG Index,
  2467. OUT OPTIONAL PSTR Buffer,
  2468. IN ULONG BufferSize,
  2469. OUT OPTIONAL PULONG TextSize
  2470. ) PURE;
  2471. // All filters support executing a command when the
  2472. // event occurs.
  2473. STDMETHOD(GetEventFilterCommand)(
  2474. THIS_
  2475. IN ULONG Index,
  2476. OUT OPTIONAL PSTR Buffer,
  2477. IN ULONG BufferSize,
  2478. OUT OPTIONAL PULONG CommandSize
  2479. ) PURE;
  2480. STDMETHOD(SetEventFilterCommand)(
  2481. THIS_
  2482. IN ULONG Index,
  2483. IN PCSTR Command
  2484. ) PURE;
  2485. STDMETHOD(GetSpecificFilterParameters)(
  2486. THIS_
  2487. IN ULONG Start,
  2488. IN ULONG Count,
  2489. OUT /* size_is(Count) */ PDEBUG_SPECIFIC_FILTER_PARAMETERS Params
  2490. ) PURE;
  2491. STDMETHOD(SetSpecificFilterParameters)(
  2492. THIS_
  2493. IN ULONG Start,
  2494. IN ULONG Count,
  2495. IN /* size_is(Count) */ PDEBUG_SPECIFIC_FILTER_PARAMETERS Params
  2496. ) PURE;
  2497. // Some specific filters have arguments to further
  2498. // qualify their operation.
  2499. STDMETHOD(GetSpecificFilterArgument)(
  2500. THIS_
  2501. IN ULONG Index,
  2502. OUT OPTIONAL PSTR Buffer,
  2503. IN ULONG BufferSize,
  2504. OUT OPTIONAL PULONG ArgumentSize
  2505. ) PURE;
  2506. STDMETHOD(SetSpecificFilterArgument)(
  2507. THIS_
  2508. IN ULONG Index,
  2509. IN PCSTR Argument
  2510. ) PURE;
  2511. // If Codes is non-NULL Start is ignored.
  2512. STDMETHOD(GetExceptionFilterParameters)(
  2513. THIS_
  2514. IN ULONG Count,
  2515. IN OPTIONAL /* size_is(Count) */ PULONG Codes,
  2516. IN ULONG Start,
  2517. OUT /* size_is(Count) */ PDEBUG_EXCEPTION_FILTER_PARAMETERS Params
  2518. ) PURE;
  2519. // The codes in the parameter data control the application
  2520. // of the parameter data. If a code is not already in
  2521. // the set of filters it is added. If the ExecutionOption
  2522. // for a code is REMOVE then the filter is removed.
  2523. // Specific exception filters cannot be removed.
  2524. STDMETHOD(SetExceptionFilterParameters)(
  2525. THIS_
  2526. IN ULONG Count,
  2527. IN /* size_is(Count) */ PDEBUG_EXCEPTION_FILTER_PARAMETERS Params
  2528. ) PURE;
  2529. // Exception filters support an additional command for
  2530. // second-chance events.
  2531. STDMETHOD(GetExceptionFilterSecondCommand)(
  2532. THIS_
  2533. IN ULONG Index,
  2534. OUT OPTIONAL PSTR Buffer,
  2535. IN ULONG BufferSize,
  2536. OUT OPTIONAL PULONG CommandSize
  2537. ) PURE;
  2538. STDMETHOD(SetExceptionFilterSecondCommand)(
  2539. THIS_
  2540. IN ULONG Index,
  2541. IN PCSTR Command
  2542. ) PURE;
  2543. // Yields processing to the engine until
  2544. // an event occurs. This method may
  2545. // only be called by the thread that started
  2546. // the debug session.
  2547. // When an event occurs the engine carries
  2548. // out all event processing such as calling
  2549. // callbacks.
  2550. // If the callbacks indicate that execution should
  2551. // break the wait will return, otherwise it
  2552. // goes back to waiting for a new event.
  2553. // If the timeout expires, S_FALSE is returned.
  2554. // The timeout is not currently supported for
  2555. // kernel debugging.
  2556. STDMETHOD(WaitForEvent)(
  2557. THIS_
  2558. IN ULONG Flags,
  2559. IN ULONG Timeout
  2560. ) PURE;
  2561. // Retrieves information about the last event that occurred.
  2562. // EventType is one of the event callback mask bits.
  2563. // ExtraInformation contains additional event-specific
  2564. // information. Not all events have additional information.
  2565. STDMETHOD(GetLastEventInformation)(
  2566. THIS_
  2567. OUT PULONG Type,
  2568. OUT PULONG ProcessId,
  2569. OUT PULONG ThreadId,
  2570. OUT OPTIONAL PVOID ExtraInformation,
  2571. IN ULONG ExtraInformationSize,
  2572. OUT OPTIONAL PULONG ExtraInformationUsed,
  2573. OUT OPTIONAL PSTR Description,
  2574. IN ULONG DescriptionSize,
  2575. OUT OPTIONAL PULONG DescriptionUsed
  2576. ) PURE;
  2577. };
  2578. // OutputTextReplacements flags.
  2579. #define DEBUG_OUT_TEXT_REPL_DEFAULT 0x00000000
  2580. #undef INTERFACE
  2581. #define INTERFACE IDebugControl2
  2582. DECLARE_INTERFACE_(IDebugControl2, IUnknown)
  2583. {
  2584. // IUnknown.
  2585. STDMETHOD(QueryInterface)(
  2586. THIS_
  2587. IN REFIID InterfaceId,
  2588. OUT PVOID* Interface
  2589. ) PURE;
  2590. STDMETHOD_(ULONG, AddRef)(
  2591. THIS
  2592. ) PURE;
  2593. STDMETHOD_(ULONG, Release)(
  2594. THIS
  2595. ) PURE;
  2596. // IDebugControl.
  2597. // Checks for a user interrupt, such a Ctrl-C
  2598. // or stop button.
  2599. // This method is reentrant.
  2600. STDMETHOD(GetInterrupt)(
  2601. THIS
  2602. ) PURE;
  2603. // Registers a user interrupt.
  2604. // This method is reentrant.
  2605. STDMETHOD(SetInterrupt)(
  2606. THIS_
  2607. IN ULONG Flags
  2608. ) PURE;
  2609. // Interrupting a user-mode process requires
  2610. // access to some system resources that the
  2611. // process may hold itself, preventing the
  2612. // interrupt from occurring. The engine
  2613. // will time-out pending interrupt requests
  2614. // and simulate an interrupt if necessary.
  2615. // These methods control the interrupt timeout.
  2616. STDMETHOD(GetInterruptTimeout)(
  2617. THIS_
  2618. OUT PULONG Seconds
  2619. ) PURE;
  2620. STDMETHOD(SetInterruptTimeout)(
  2621. THIS_
  2622. IN ULONG Seconds
  2623. ) PURE;
  2624. STDMETHOD(GetLogFile)(
  2625. THIS_
  2626. OUT OPTIONAL PSTR Buffer,
  2627. IN ULONG BufferSize,
  2628. OUT OPTIONAL PULONG FileSize,
  2629. OUT PBOOL Append
  2630. ) PURE;
  2631. // Opens a log file which collects all
  2632. // output. Output from every client except
  2633. // those that explicitly disable logging
  2634. // goes into the log.
  2635. // Opening a log file closes any log file
  2636. // already open.
  2637. STDMETHOD(OpenLogFile)(
  2638. THIS_
  2639. IN PCSTR File,
  2640. IN BOOL Append
  2641. ) PURE;
  2642. STDMETHOD(CloseLogFile)(
  2643. THIS
  2644. ) PURE;
  2645. // Controls what output is logged.
  2646. STDMETHOD(GetLogMask)(
  2647. THIS_
  2648. OUT PULONG Mask
  2649. ) PURE;
  2650. STDMETHOD(SetLogMask)(
  2651. THIS_
  2652. IN ULONG Mask
  2653. ) PURE;
  2654. // Input requests input from all clients.
  2655. // The first input that is returned is used
  2656. // to satisfy the call. Other returned
  2657. // input is discarded.
  2658. STDMETHOD(Input)(
  2659. THIS_
  2660. OUT PSTR Buffer,
  2661. IN ULONG BufferSize,
  2662. OUT OPTIONAL PULONG InputSize
  2663. ) PURE;
  2664. // This method is used by clients to return
  2665. // input when it is available. It will
  2666. // return S_OK if the input is used to
  2667. // satisfy an Input call and S_FALSE if
  2668. // the input is ignored.
  2669. // This method is reentrant.
  2670. STDMETHOD(ReturnInput)(
  2671. THIS_
  2672. IN PCSTR Buffer
  2673. ) PURE;
  2674. // Sends output through clients
  2675. // output callbacks if the mask is allowed
  2676. // by the current output control mask and
  2677. // according to the output distribution
  2678. // settings.
  2679. STDMETHODV(Output)(
  2680. THIS_
  2681. IN ULONG Mask,
  2682. IN PCSTR Format,
  2683. ...
  2684. ) PURE;
  2685. STDMETHOD(OutputVaList)(
  2686. THIS_
  2687. IN ULONG Mask,
  2688. IN PCSTR Format,
  2689. IN va_list Args
  2690. ) PURE;
  2691. // The following methods allow direct control
  2692. // over the distribution of the given output
  2693. // for situations where something other than
  2694. // the default is desired. These methods require
  2695. // extra work in the engine so they should
  2696. // only be used when necessary.
  2697. STDMETHODV(ControlledOutput)(
  2698. THIS_
  2699. IN ULONG OutputControl,
  2700. IN ULONG Mask,
  2701. IN PCSTR Format,
  2702. ...
  2703. ) PURE;
  2704. STDMETHOD(ControlledOutputVaList)(
  2705. THIS_
  2706. IN ULONG OutputControl,
  2707. IN ULONG Mask,
  2708. IN PCSTR Format,
  2709. IN va_list Args
  2710. ) PURE;
  2711. // Displays the standard command-line prompt
  2712. // followed by the given output. If Format
  2713. // is NULL no additional output is produced.
  2714. // Output is produced under the
  2715. // DEBUG_OUTPUT_PROMPT mask.
  2716. // This method only outputs the prompt; it
  2717. // does not get input.
  2718. STDMETHODV(OutputPrompt)(
  2719. THIS_
  2720. IN ULONG OutputControl,
  2721. IN OPTIONAL PCSTR Format,
  2722. ...
  2723. ) PURE;
  2724. STDMETHOD(OutputPromptVaList)(
  2725. THIS_
  2726. IN ULONG OutputControl,
  2727. IN OPTIONAL PCSTR Format,
  2728. IN va_list Args
  2729. ) PURE;
  2730. // Gets the text that would be displayed by OutputPrompt.
  2731. STDMETHOD(GetPromptText)(
  2732. THIS_
  2733. OUT OPTIONAL PSTR Buffer,
  2734. IN ULONG BufferSize,
  2735. OUT OPTIONAL PULONG TextSize
  2736. ) PURE;
  2737. // Outputs information about the current
  2738. // debuggee state such as a register
  2739. // summary, disassembly at the current PC,
  2740. // closest symbol and others.
  2741. // Uses the line prefix.
  2742. STDMETHOD(OutputCurrentState)(
  2743. THIS_
  2744. IN ULONG OutputControl,
  2745. IN ULONG Flags
  2746. ) PURE;
  2747. // Outputs the debugger and extension version
  2748. // information. This method is reentrant.
  2749. // Uses the line prefix.
  2750. STDMETHOD(OutputVersionInformation)(
  2751. THIS_
  2752. IN ULONG OutputControl
  2753. ) PURE;
  2754. // In user-mode debugging sessions the
  2755. // engine will set an event when
  2756. // exceptions are continued. This can
  2757. // be used to synchronize other processes
  2758. // with the debuggers handling of events.
  2759. // For example, this is used to support
  2760. // the e argument to ntsd.
  2761. STDMETHOD(GetNotifyEventHandle)(
  2762. THIS_
  2763. OUT PULONG64 Handle
  2764. ) PURE;
  2765. STDMETHOD(SetNotifyEventHandle)(
  2766. THIS_
  2767. IN ULONG64 Handle
  2768. ) PURE;
  2769. STDMETHOD(Assemble)(
  2770. THIS_
  2771. IN ULONG64 Offset,
  2772. IN PCSTR Instr,
  2773. OUT PULONG64 EndOffset
  2774. ) PURE;
  2775. STDMETHOD(Disassemble)(
  2776. THIS_
  2777. IN ULONG64 Offset,
  2778. IN ULONG Flags,
  2779. OUT OPTIONAL PSTR Buffer,
  2780. IN ULONG BufferSize,
  2781. OUT OPTIONAL PULONG DisassemblySize,
  2782. OUT PULONG64 EndOffset
  2783. ) PURE;
  2784. // Returns the value of the effective address
  2785. // computed for the last Disassemble, if there
  2786. // was one.
  2787. STDMETHOD(GetDisassembleEffectiveOffset)(
  2788. THIS_
  2789. OUT PULONG64 Offset
  2790. ) PURE;
  2791. // Uses the line prefix if necessary.
  2792. STDMETHOD(OutputDisassembly)(
  2793. THIS_
  2794. IN ULONG OutputControl,
  2795. IN ULONG64 Offset,
  2796. IN ULONG Flags,
  2797. OUT PULONG64 EndOffset
  2798. ) PURE;
  2799. // Produces multiple lines of disassembly output.
  2800. // There will be PreviousLines of disassembly before
  2801. // the given offset if a valid disassembly exists.
  2802. // In all, there will be TotalLines of output produced.
  2803. // The first and last line offsets are returned
  2804. // specially and all lines offsets can be retrieved
  2805. // through LineOffsets. LineOffsets will contain
  2806. // offsets for each line where disassembly started.
  2807. // When disassembly of a single instruction takes
  2808. // multiple lines the initial offset will be followed
  2809. // by DEBUG_INVALID_OFFSET.
  2810. // Uses the line prefix.
  2811. STDMETHOD(OutputDisassemblyLines)(
  2812. THIS_
  2813. IN ULONG OutputControl,
  2814. IN ULONG PreviousLines,
  2815. IN ULONG TotalLines,
  2816. IN ULONG64 Offset,
  2817. IN ULONG Flags,
  2818. OUT OPTIONAL PULONG OffsetLine,
  2819. OUT OPTIONAL PULONG64 StartOffset,
  2820. OUT OPTIONAL PULONG64 EndOffset,
  2821. OUT OPTIONAL /* size_is(TotalLines) */ PULONG64 LineOffsets
  2822. ) PURE;
  2823. // Returns the offset of the start of
  2824. // the instruction thats the given
  2825. // delta away from the instruction
  2826. // at the initial offset.
  2827. // This routine does not check for
  2828. // validity of the instruction or
  2829. // the memory containing it.
  2830. STDMETHOD(GetNearInstruction)(
  2831. THIS_
  2832. IN ULONG64 Offset,
  2833. IN LONG Delta,
  2834. OUT PULONG64 NearOffset
  2835. ) PURE;
  2836. // Offsets can be passed in as zero to use the current
  2837. // thread state.
  2838. STDMETHOD(GetStackTrace)(
  2839. THIS_
  2840. IN ULONG64 FrameOffset,
  2841. IN ULONG64 StackOffset,
  2842. IN ULONG64 InstructionOffset,
  2843. OUT /* size_is(FramesSize) */ PDEBUG_STACK_FRAME Frames,
  2844. IN ULONG FramesSize,
  2845. OUT OPTIONAL PULONG FramesFilled
  2846. ) PURE;
  2847. // Does a simple stack trace to determine
  2848. // what the current return address is.
  2849. STDMETHOD(GetReturnOffset)(
  2850. THIS_
  2851. OUT PULONG64 Offset
  2852. ) PURE;
  2853. // If Frames is NULL OutputStackTrace will
  2854. // use GetStackTrace to get FramesSize frames
  2855. // and then output them. The current register
  2856. // values for frame, stack and instruction offsets
  2857. // are used.
  2858. // Uses the line prefix.
  2859. STDMETHOD(OutputStackTrace)(
  2860. THIS_
  2861. IN ULONG OutputControl,
  2862. IN OPTIONAL /* size_is(FramesSize) */ PDEBUG_STACK_FRAME Frames,
  2863. IN ULONG FramesSize,
  2864. IN ULONG Flags
  2865. ) PURE;
  2866. // Returns information about the debuggee such
  2867. // as user vs. kernel, dump vs. live, etc.
  2868. STDMETHOD(GetDebuggeeType)(
  2869. THIS_
  2870. OUT PULONG Class,
  2871. OUT PULONG Qualifier
  2872. ) PURE;
  2873. // Returns the type of physical processors in
  2874. // the machine.
  2875. // Returns one of the IMAGE_FILE_MACHINE values.
  2876. STDMETHOD(GetActualProcessorType)(
  2877. THIS_
  2878. OUT PULONG Type
  2879. ) PURE;
  2880. // Returns the type of processor used in the
  2881. // current processor context.
  2882. STDMETHOD(GetExecutingProcessorType)(
  2883. THIS_
  2884. OUT PULONG Type
  2885. ) PURE;
  2886. // Query all the possible processor types that
  2887. // may be encountered during this debug session.
  2888. STDMETHOD(GetNumberPossibleExecutingProcessorTypes)(
  2889. THIS_
  2890. OUT PULONG Number
  2891. ) PURE;
  2892. STDMETHOD(GetPossibleExecutingProcessorTypes)(
  2893. THIS_
  2894. IN ULONG Start,
  2895. IN ULONG Count,
  2896. OUT /* size_is(Count) */ PULONG Types
  2897. ) PURE;
  2898. // Get the number of actual processors in
  2899. // the machine.
  2900. STDMETHOD(GetNumberProcessors)(
  2901. THIS_
  2902. OUT PULONG Number
  2903. ) PURE;
  2904. // PlatformId is one of the VER_PLATFORM values.
  2905. // Major and minor are as given in the NT
  2906. // kernel debugger protocol.
  2907. // ServicePackString and ServicePackNumber indicate the
  2908. // system service pack level. ServicePackNumber is not
  2909. // available in some sessions where the service pack level
  2910. // is only expressed as a string. The service pack information
  2911. // will be empty if the system does not have a service pack
  2912. // applied.
  2913. // The build string is string information identifying the
  2914. // particular build of the system. The build string is
  2915. // empty if the system has no particular identifying
  2916. // information.
  2917. STDMETHOD(GetSystemVersion)(
  2918. THIS_
  2919. OUT PULONG PlatformId,
  2920. OUT PULONG Major,
  2921. OUT PULONG Minor,
  2922. OUT OPTIONAL PSTR ServicePackString,
  2923. IN ULONG ServicePackStringSize,
  2924. OUT OPTIONAL PULONG ServicePackStringUsed,
  2925. OUT PULONG ServicePackNumber,
  2926. OUT OPTIONAL PSTR BuildString,
  2927. IN ULONG BuildStringSize,
  2928. OUT OPTIONAL PULONG BuildStringUsed
  2929. ) PURE;
  2930. // Returns the page size for the currently executing
  2931. // processor context. The page size may vary between
  2932. // processor types.
  2933. STDMETHOD(GetPageSize)(
  2934. THIS_
  2935. OUT PULONG Size
  2936. ) PURE;
  2937. // Returns S_OK if the current processor context uses
  2938. // 64-bit addresses, otherwise S_FALSE.
  2939. STDMETHOD(IsPointer64Bit)(
  2940. THIS
  2941. ) PURE;
  2942. // Reads the bugcheck data area and returns the
  2943. // current contents. This method only works
  2944. // in kernel debugging sessions.
  2945. STDMETHOD(ReadBugCheckData)(
  2946. THIS_
  2947. OUT PULONG Code,
  2948. OUT PULONG64 Arg1,
  2949. OUT PULONG64 Arg2,
  2950. OUT PULONG64 Arg3,
  2951. OUT PULONG64 Arg4
  2952. ) PURE;
  2953. // Query all the processor types supported by
  2954. // the engine. This is a complete list and is
  2955. // not related to the machine running the engine
  2956. // or the debuggee.
  2957. STDMETHOD(GetNumberSupportedProcessorTypes)(
  2958. THIS_
  2959. OUT PULONG Number
  2960. ) PURE;
  2961. STDMETHOD(GetSupportedProcessorTypes)(
  2962. THIS_
  2963. IN ULONG Start,
  2964. IN ULONG Count,
  2965. OUT /* size_is(Count) */ PULONG Types
  2966. ) PURE;
  2967. // Returns a full, descriptive name and an
  2968. // abbreviated name for a processor type.
  2969. STDMETHOD(GetProcessorTypeNames)(
  2970. THIS_
  2971. IN ULONG Type,
  2972. OUT OPTIONAL PSTR FullNameBuffer,
  2973. IN ULONG FullNameBufferSize,
  2974. OUT OPTIONAL PULONG FullNameSize,
  2975. OUT OPTIONAL PSTR AbbrevNameBuffer,
  2976. IN ULONG AbbrevNameBufferSize,
  2977. OUT OPTIONAL PULONG AbbrevNameSize
  2978. ) PURE;
  2979. // Gets and sets the type of processor to
  2980. // use when doing things like setting
  2981. // breakpoints, accessing registers,
  2982. // getting stack traces and so on.
  2983. STDMETHOD(GetEffectiveProcessorType)(
  2984. THIS_
  2985. OUT PULONG Type
  2986. ) PURE;
  2987. STDMETHOD(SetEffectiveProcessorType)(
  2988. THIS_
  2989. IN ULONG Type
  2990. ) PURE;
  2991. // Returns information about whether and how
  2992. // the debuggee is running. Status will
  2993. // be GO if the debuggee is running and
  2994. // BREAK if it isnt.
  2995. // If no debuggee exists the status is
  2996. // NO_DEBUGGEE.
  2997. // This method is reentrant.
  2998. STDMETHOD(GetExecutionStatus)(
  2999. THIS_
  3000. OUT PULONG Status
  3001. ) PURE;
  3002. // Changes the execution status of the
  3003. // engine from stopped to running.
  3004. // Status must be one of the go or step
  3005. // status values.
  3006. STDMETHOD(SetExecutionStatus)(
  3007. THIS_
  3008. IN ULONG Status
  3009. ) PURE;
  3010. // Controls what code interpretation level the debugger
  3011. // runs at. The debugger checks the code level when
  3012. // deciding whether to step by a source line or
  3013. // assembly instruction along with other related operations.
  3014. STDMETHOD(GetCodeLevel)(
  3015. THIS_
  3016. OUT PULONG Level
  3017. ) PURE;
  3018. STDMETHOD(SetCodeLevel)(
  3019. THIS_
  3020. IN ULONG Level
  3021. ) PURE;
  3022. // Gets and sets engine control flags.
  3023. // These methods are reentrant.
  3024. STDMETHOD(GetEngineOptions)(
  3025. THIS_
  3026. OUT PULONG Options
  3027. ) PURE;
  3028. STDMETHOD(AddEngineOptions)(
  3029. THIS_
  3030. IN ULONG Options
  3031. ) PURE;
  3032. STDMETHOD(RemoveEngineOptions)(
  3033. THIS_
  3034. IN ULONG Options
  3035. ) PURE;
  3036. STDMETHOD(SetEngineOptions)(
  3037. THIS_
  3038. IN ULONG Options
  3039. ) PURE;
  3040. // Gets and sets control values for
  3041. // handling system error events.
  3042. // If the system error level is less
  3043. // than or equal to the given levels
  3044. // the error may be displayed and
  3045. // the default break for the event
  3046. // may be set.
  3047. STDMETHOD(GetSystemErrorControl)(
  3048. THIS_
  3049. OUT PULONG OutputLevel,
  3050. OUT PULONG BreakLevel
  3051. ) PURE;
  3052. STDMETHOD(SetSystemErrorControl)(
  3053. THIS_
  3054. IN ULONG OutputLevel,
  3055. IN ULONG BreakLevel
  3056. ) PURE;
  3057. // The command processor supports simple
  3058. // string replacement macros in Evaluate and
  3059. // Execute. There are currently ten macro
  3060. // slots available. Slots 0-9 map to
  3061. // the command invocations $u0-$u9.
  3062. STDMETHOD(GetTextMacro)(
  3063. THIS_
  3064. IN ULONG Slot,
  3065. OUT OPTIONAL PSTR Buffer,
  3066. IN ULONG BufferSize,
  3067. OUT OPTIONAL PULONG MacroSize
  3068. ) PURE;
  3069. STDMETHOD(SetTextMacro)(
  3070. THIS_
  3071. IN ULONG Slot,
  3072. IN PCSTR Macro
  3073. ) PURE;
  3074. // Controls the default number radix used
  3075. // in expressions and commands.
  3076. STDMETHOD(GetRadix)(
  3077. THIS_
  3078. OUT PULONG Radix
  3079. ) PURE;
  3080. STDMETHOD(SetRadix)(
  3081. THIS_
  3082. IN ULONG Radix
  3083. ) PURE;
  3084. // Evaluates the given expression string and
  3085. // returns the resulting value.
  3086. // If DesiredType is DEBUG_VALUE_INVALID then
  3087. // the natural type is used.
  3088. // RemainderIndex, if provided, is set to the index
  3089. // of the first character in the input string that was
  3090. // not used when evaluating the expression.
  3091. STDMETHOD(Evaluate)(
  3092. THIS_
  3093. IN PCSTR Expression,
  3094. IN ULONG DesiredType,
  3095. OUT PDEBUG_VALUE Value,
  3096. OUT OPTIONAL PULONG RemainderIndex
  3097. ) PURE;
  3098. // Attempts to convert the input value to a value
  3099. // of the requested type in the output value.
  3100. // Conversions can fail if no conversion exists.
  3101. // Successful conversions may be lossy.
  3102. STDMETHOD(CoerceValue)(
  3103. THIS_
  3104. IN PDEBUG_VALUE In,
  3105. IN ULONG OutType,
  3106. OUT PDEBUG_VALUE Out
  3107. ) PURE;
  3108. STDMETHOD(CoerceValues)(
  3109. THIS_
  3110. IN ULONG Count,
  3111. IN /* size_is(Count) */ PDEBUG_VALUE In,
  3112. IN /* size_is(Count) */ PULONG OutTypes,
  3113. OUT /* size_is(Count) */ PDEBUG_VALUE Out
  3114. ) PURE;
  3115. // Executes the given command string.
  3116. // If the string has multiple commands
  3117. // Execute will not return until all
  3118. // of them have been executed. If this
  3119. // requires waiting for the debuggee to
  3120. // execute an internal wait will be done
  3121. // so Execute can take an arbitrary amount
  3122. // of time.
  3123. STDMETHOD(Execute)(
  3124. THIS_
  3125. IN ULONG OutputControl,
  3126. IN PCSTR Command,
  3127. IN ULONG Flags
  3128. ) PURE;
  3129. // Executes the given command file by
  3130. // reading a line at a time and processing
  3131. // it with Execute.
  3132. STDMETHOD(ExecuteCommandFile)(
  3133. THIS_
  3134. IN ULONG OutputControl,
  3135. IN PCSTR CommandFile,
  3136. IN ULONG Flags
  3137. ) PURE;
  3138. // Breakpoint interfaces are described
  3139. // elsewhere in this section.
  3140. STDMETHOD(GetNumberBreakpoints)(
  3141. THIS_
  3142. OUT PULONG Number
  3143. ) PURE;
  3144. // It is possible for this retrieval function to
  3145. // fail even with an index within the number of
  3146. // existing breakpoints if the breakpoint is
  3147. // a private breakpoint.
  3148. STDMETHOD(GetBreakpointByIndex)(
  3149. THIS_
  3150. IN ULONG Index,
  3151. OUT PDEBUG_BREAKPOINT* Bp
  3152. ) PURE;
  3153. STDMETHOD(GetBreakpointById)(
  3154. THIS_
  3155. IN ULONG Id,
  3156. OUT PDEBUG_BREAKPOINT* Bp
  3157. ) PURE;
  3158. // If Ids is non-NULL the Count breakpoints
  3159. // referred to in the Ids array are returned,
  3160. // otherwise breakpoints from index Start to
  3161. // Start + Count 1 are returned.
  3162. STDMETHOD(GetBreakpointParameters)(
  3163. THIS_
  3164. IN ULONG Count,
  3165. IN OPTIONAL /* size_is(Count) */ PULONG Ids,
  3166. IN ULONG Start,
  3167. OUT /* size_is(Count) */ PDEBUG_BREAKPOINT_PARAMETERS Params
  3168. ) PURE;
  3169. // Breakpoints are created empty and disabled.
  3170. // When their parameters have been set they
  3171. // should be enabled by setting the ENABLE flag.
  3172. // If DesiredId is DEBUG_ANY_ID then the
  3173. // engine picks an unused ID. If DesiredId
  3174. // is any other number the engine attempts
  3175. // to use the given ID for the breakpoint.
  3176. // If another breakpoint exists with that ID
  3177. // the call will fail.
  3178. STDMETHOD(AddBreakpoint)(
  3179. THIS_
  3180. IN ULONG Type,
  3181. IN ULONG DesiredId,
  3182. OUT PDEBUG_BREAKPOINT* Bp
  3183. ) PURE;
  3184. // Breakpoint interface is invalid after this call.
  3185. STDMETHOD(RemoveBreakpoint)(
  3186. THIS_
  3187. IN PDEBUG_BREAKPOINT Bp
  3188. ) PURE;
  3189. // Control and use extension DLLs.
  3190. STDMETHOD(AddExtension)(
  3191. THIS_
  3192. IN PCSTR Path,
  3193. IN ULONG Flags,
  3194. OUT PULONG64 Handle
  3195. ) PURE;
  3196. STDMETHOD(RemoveExtension)(
  3197. THIS_
  3198. IN ULONG64 Handle
  3199. ) PURE;
  3200. STDMETHOD(GetExtensionByPath)(
  3201. THIS_
  3202. IN PCSTR Path,
  3203. OUT PULONG64 Handle
  3204. ) PURE;
  3205. // If Handle is zero the extension
  3206. // chain is walked searching for the
  3207. // function.
  3208. STDMETHOD(CallExtension)(
  3209. THIS_
  3210. IN ULONG64 Handle,
  3211. IN PCSTR Function,
  3212. IN OPTIONAL PCSTR Arguments
  3213. ) PURE;
  3214. // GetExtensionFunction works like
  3215. // GetProcAddress on extension DLLs
  3216. // to allow raw function-call-level
  3217. // interaction with extension DLLs.
  3218. // Such functions do not need to
  3219. // follow the standard extension prototype
  3220. // if they are not going to be called
  3221. // through the text extension interface.
  3222. // This function cannot be called remotely.
  3223. STDMETHOD(GetExtensionFunction)(
  3224. THIS_
  3225. IN ULONG64 Handle,
  3226. IN PCSTR FuncName,
  3227. OUT FARPROC* Function
  3228. ) PURE;
  3229. // These methods return alternate
  3230. // extension interfaces in order to allow
  3231. // interface-style extension DLLs to mix in
  3232. // older extension calls.
  3233. // Structure sizes must be initialized before
  3234. // the call.
  3235. // These methods cannot be called remotely.
  3236. STDMETHOD(GetWindbgExtensionApis32)(
  3237. THIS_
  3238. IN OUT PWINDBG_EXTENSION_APIS32 Api
  3239. ) PURE;
  3240. STDMETHOD(GetWindbgExtensionApis64)(
  3241. THIS_
  3242. IN OUT PWINDBG_EXTENSION_APIS64 Api
  3243. ) PURE;
  3244. // The engine provides a simple mechanism
  3245. // to filter common events. Arbitrarily complicated
  3246. // filtering can be done by registering event callbacks
  3247. // but simple event filtering only requires
  3248. // setting the options of one of the predefined
  3249. // event filters.
  3250. // Simple event filters are either for specific
  3251. // events and therefore have an enumerant or
  3252. // they are for an exception and are based on
  3253. // the exceptions code. Exception filters
  3254. // are further divided into exceptions specially
  3255. // handled by the engine, which is a fixed set,
  3256. // and arbitrary exceptions.
  3257. // All three groups of filters are indexed together
  3258. // with the specific filters first, then the specific
  3259. // exception filters and finally the arbitrary
  3260. // exception filters.
  3261. // The first specific exception is the default
  3262. // exception. If an exception event occurs for
  3263. // an exception without settings the default
  3264. // exception settings are used.
  3265. STDMETHOD(GetNumberEventFilters)(
  3266. THIS_
  3267. OUT PULONG SpecificEvents,
  3268. OUT PULONG SpecificExceptions,
  3269. OUT PULONG ArbitraryExceptions
  3270. ) PURE;
  3271. // Some filters have descriptive text associated with them.
  3272. STDMETHOD(GetEventFilterText)(
  3273. THIS_
  3274. IN ULONG Index,
  3275. OUT OPTIONAL PSTR Buffer,
  3276. IN ULONG BufferSize,
  3277. OUT OPTIONAL PULONG TextSize
  3278. ) PURE;
  3279. // All filters support executing a command when the
  3280. // event occurs.
  3281. STDMETHOD(GetEventFilterCommand)(
  3282. THIS_
  3283. IN ULONG Index,
  3284. OUT OPTIONAL PSTR Buffer,
  3285. IN ULONG BufferSize,
  3286. OUT OPTIONAL PULONG CommandSize
  3287. ) PURE;
  3288. STDMETHOD(SetEventFilterCommand)(
  3289. THIS_
  3290. IN ULONG Index,
  3291. IN PCSTR Command
  3292. ) PURE;
  3293. STDMETHOD(GetSpecificFilterParameters)(
  3294. THIS_
  3295. IN ULONG Start,
  3296. IN ULONG Count,
  3297. OUT /* size_is(Count) */ PDEBUG_SPECIFIC_FILTER_PARAMETERS Params
  3298. ) PURE;
  3299. STDMETHOD(SetSpecificFilterParameters)(
  3300. THIS_
  3301. IN ULONG Start,
  3302. IN ULONG Count,
  3303. IN /* size_is(Count) */ PDEBUG_SPECIFIC_FILTER_PARAMETERS Params
  3304. ) PURE;
  3305. // Some specific filters have arguments to further
  3306. // qualify their operation.
  3307. STDMETHOD(GetSpecificFilterArgument)(
  3308. THIS_
  3309. IN ULONG Index,
  3310. OUT OPTIONAL PSTR Buffer,
  3311. IN ULONG BufferSize,
  3312. OUT OPTIONAL PULONG ArgumentSize
  3313. ) PURE;
  3314. STDMETHOD(SetSpecificFilterArgument)(
  3315. THIS_
  3316. IN ULONG Index,
  3317. IN PCSTR Argument
  3318. ) PURE;
  3319. // If Codes is non-NULL Start is ignored.
  3320. STDMETHOD(GetExceptionFilterParameters)(
  3321. THIS_
  3322. IN ULONG Count,
  3323. IN OPTIONAL /* size_is(Count) */ PULONG Codes,
  3324. IN ULONG Start,
  3325. OUT /* size_is(Count) */ PDEBUG_EXCEPTION_FILTER_PARAMETERS Params
  3326. ) PURE;
  3327. // The codes in the parameter data control the application
  3328. // of the parameter data. If a code is not already in
  3329. // the set of filters it is added. If the ExecutionOption
  3330. // for a code is REMOVE then the filter is removed.
  3331. // Specific exception filters cannot be removed.
  3332. STDMETHOD(SetExceptionFilterParameters)(
  3333. THIS_
  3334. IN ULONG Count,
  3335. IN /* size_is(Count) */ PDEBUG_EXCEPTION_FILTER_PARAMETERS Params
  3336. ) PURE;
  3337. // Exception filters support an additional command for
  3338. // second-chance events.
  3339. STDMETHOD(GetExceptionFilterSecondCommand)(
  3340. THIS_
  3341. IN ULONG Index,
  3342. OUT OPTIONAL PSTR Buffer,
  3343. IN ULONG BufferSize,
  3344. OUT OPTIONAL PULONG CommandSize
  3345. ) PURE;
  3346. STDMETHOD(SetExceptionFilterSecondCommand)(
  3347. THIS_
  3348. IN ULONG Index,
  3349. IN PCSTR Command
  3350. ) PURE;
  3351. // Yields processing to the engine until
  3352. // an event occurs. This method may
  3353. // only be called by the thread that started
  3354. // the debug session.
  3355. // When an event occurs the engine carries
  3356. // out all event processing such as calling
  3357. // callbacks.
  3358. // If the callbacks indicate that execution should
  3359. // break the wait will return, otherwise it
  3360. // goes back to waiting for a new event.
  3361. // If the timeout expires, S_FALSE is returned.
  3362. // The timeout is not currently supported for
  3363. // kernel debugging.
  3364. STDMETHOD(WaitForEvent)(
  3365. THIS_
  3366. IN ULONG Flags,
  3367. IN ULONG Timeout
  3368. ) PURE;
  3369. // Retrieves information about the last event that occurred.
  3370. // EventType is one of the event callback mask bits.
  3371. // ExtraInformation contains additional event-specific
  3372. // information. Not all events have additional information.
  3373. STDMETHOD(GetLastEventInformation)(
  3374. THIS_
  3375. OUT PULONG Type,
  3376. OUT PULONG ProcessId,
  3377. OUT PULONG ThreadId,
  3378. OUT OPTIONAL PVOID ExtraInformation,
  3379. IN ULONG ExtraInformationSize,
  3380. OUT OPTIONAL PULONG ExtraInformationUsed,
  3381. OUT OPTIONAL PSTR Description,
  3382. IN ULONG DescriptionSize,
  3383. OUT OPTIONAL PULONG DescriptionUsed
  3384. ) PURE;
  3385. // IDebugControl2.
  3386. STDMETHOD(GetCurrentTimeDate)(
  3387. THIS_
  3388. OUT PULONG TimeDate
  3389. ) PURE;
  3390. // Retrieves the number of seconds since the
  3391. // machine started running.
  3392. STDMETHOD(GetCurrentSystemUpTime)(
  3393. THIS_
  3394. OUT PULONG UpTime
  3395. ) PURE;
  3396. // If the current session is a dump session,
  3397. // retrieves any extended format information.
  3398. STDMETHOD(GetDumpFormatFlags)(
  3399. THIS_
  3400. OUT PULONG FormatFlags
  3401. ) PURE;
  3402. // The debugger has been enhanced to allow
  3403. // arbitrary text replacements in addition
  3404. // to the simple $u0-$u9 text macros.
  3405. // Text replacement takes a given source
  3406. // text in commands and converts it to the
  3407. // given destination text. Replacements
  3408. // are named by their source text so that
  3409. // only one replacement for a source text
  3410. // string can exist.
  3411. STDMETHOD(GetNumberTextReplacements)(
  3412. THIS_
  3413. OUT PULONG NumRepl
  3414. ) PURE;
  3415. // If SrcText is non-NULL the replacement
  3416. // is looked up by source text, otherwise
  3417. // Index is used to get the Nth replacement.
  3418. STDMETHOD(GetTextReplacement)(
  3419. THIS_
  3420. IN OPTIONAL PCSTR SrcText,
  3421. IN ULONG Index,
  3422. OUT OPTIONAL PSTR SrcBuffer,
  3423. IN ULONG SrcBufferSize,
  3424. OUT OPTIONAL PULONG SrcSize,
  3425. OUT OPTIONAL PSTR DstBuffer,
  3426. IN ULONG DstBufferSize,
  3427. OUT OPTIONAL PULONG DstSize
  3428. ) PURE;
  3429. // Setting the destination text to
  3430. // NULL removes the alias.
  3431. STDMETHOD(SetTextReplacement)(
  3432. THIS_
  3433. IN PCSTR SrcText,
  3434. IN OPTIONAL PCSTR DstText
  3435. ) PURE;
  3436. STDMETHOD(RemoveTextReplacements)(
  3437. THIS
  3438. ) PURE;
  3439. // Outputs the complete list of current
  3440. // replacements.
  3441. STDMETHOD(OutputTextReplacements)(
  3442. THIS_
  3443. IN ULONG OutputControl,
  3444. IN ULONG Flags
  3445. ) PURE;
  3446. };
  3447. //----------------------------------------------------------------------------
  3448. //
  3449. // IDebugDataSpaces.
  3450. //
  3451. //----------------------------------------------------------------------------
  3452. // Data space indices for callbacks and other methods.
  3453. #define DEBUG_DATA_SPACE_VIRTUAL 0
  3454. #define DEBUG_DATA_SPACE_PHYSICAL 1
  3455. #define DEBUG_DATA_SPACE_CONTROL 2
  3456. #define DEBUG_DATA_SPACE_IO 3
  3457. #define DEBUG_DATA_SPACE_MSR 4
  3458. #define DEBUG_DATA_SPACE_BUS_DATA 5
  3459. #define DEBUG_DATA_SPACE_DEBUGGER_DATA 6
  3460. // Count of data spaces.
  3461. #define DEBUG_DATA_SPACE_COUNT 7
  3462. // Indices for ReadDebuggerData interface
  3463. #define DEBUG_DATA_KernBase 24
  3464. #define DEBUG_DATA_BreakpointWithStatusAddr 32
  3465. #define DEBUG_DATA_SavedContextAddr 40
  3466. #define DEBUG_DATA_KiCallUserModeAddr 56
  3467. #define DEBUG_DATA_KeUserCallbackDispatcherAddr 64
  3468. #define DEBUG_DATA_PsLoadedModuleListAddr 72
  3469. #define DEBUG_DATA_PsActiveProcessHeadAddr 80
  3470. #define DEBUG_DATA_PspCidTableAddr 88
  3471. #define DEBUG_DATA_ExpSystemResourcesListAddr 96
  3472. #define DEBUG_DATA_ExpPagedPoolDescriptorAddr 104
  3473. #define DEBUG_DATA_ExpNumberOfPagedPoolsAddr 112
  3474. #define DEBUG_DATA_KeTimeIncrementAddr 120
  3475. #define DEBUG_DATA_KeBugCheckCallbackListHeadAddr 128
  3476. #define DEBUG_DATA_KiBugcheckDataAddr 136
  3477. #define DEBUG_DATA_IopErrorLogListHeadAddr 144
  3478. #define DEBUG_DATA_ObpRootDirectoryObjectAddr 152
  3479. #define DEBUG_DATA_ObpTypeObjectTypeAddr 160
  3480. #define DEBUG_DATA_MmSystemCacheStartAddr 168
  3481. #define DEBUG_DATA_MmSystemCacheEndAddr 176
  3482. #define DEBUG_DATA_MmSystemCacheWsAddr 184
  3483. #define DEBUG_DATA_MmPfnDatabaseAddr 192
  3484. #define DEBUG_DATA_MmSystemPtesStartAddr 200
  3485. #define DEBUG_DATA_MmSystemPtesEndAddr 208
  3486. #define DEBUG_DATA_MmSubsectionBaseAddr 216
  3487. #define DEBUG_DATA_MmNumberOfPagingFilesAddr 224
  3488. #define DEBUG_DATA_MmLowestPhysicalPageAddr 232
  3489. #define DEBUG_DATA_MmHighestPhysicalPageAddr 240
  3490. #define DEBUG_DATA_MmNumberOfPhysicalPagesAddr 248
  3491. #define DEBUG_DATA_MmMaximumNonPagedPoolInBytesAddr 256
  3492. #define DEBUG_DATA_MmNonPagedSystemStartAddr 264
  3493. #define DEBUG_DATA_MmNonPagedPoolStartAddr 272
  3494. #define DEBUG_DATA_MmNonPagedPoolEndAddr 280
  3495. #define DEBUG_DATA_MmPagedPoolStartAddr 288
  3496. #define DEBUG_DATA_MmPagedPoolEndAddr 296
  3497. #define DEBUG_DATA_MmPagedPoolInformationAddr 304
  3498. #define DEBUG_DATA_MmPageSize 312
  3499. #define DEBUG_DATA_MmSizeOfPagedPoolInBytesAddr 320
  3500. #define DEBUG_DATA_MmTotalCommitLimitAddr 328
  3501. #define DEBUG_DATA_MmTotalCommittedPagesAddr 336
  3502. #define DEBUG_DATA_MmSharedCommitAddr 344
  3503. #define DEBUG_DATA_MmDriverCommitAddr 352
  3504. #define DEBUG_DATA_MmProcessCommitAddr 360
  3505. #define DEBUG_DATA_MmPagedPoolCommitAddr 368
  3506. #define DEBUG_DATA_MmExtendedCommitAddr 376
  3507. #define DEBUG_DATA_MmZeroedPageListHeadAddr 384
  3508. #define DEBUG_DATA_MmFreePageListHeadAddr 392
  3509. #define DEBUG_DATA_MmStandbyPageListHeadAddr 400
  3510. #define DEBUG_DATA_MmModifiedPageListHeadAddr 408
  3511. #define DEBUG_DATA_MmModifiedNoWritePageListHeadAddr 416
  3512. #define DEBUG_DATA_MmAvailablePagesAddr 424
  3513. #define DEBUG_DATA_MmResidentAvailablePagesAddr 432
  3514. #define DEBUG_DATA_PoolTrackTableAddr 440
  3515. #define DEBUG_DATA_NonPagedPoolDescriptorAddr 448
  3516. #define DEBUG_DATA_MmHighestUserAddressAddr 456
  3517. #define DEBUG_DATA_MmSystemRangeStartAddr 464
  3518. #define DEBUG_DATA_MmUserProbeAddressAddr 472
  3519. #define DEBUG_DATA_KdPrintCircularBufferAddr 480
  3520. #define DEBUG_DATA_KdPrintCircularBufferEndAddr 488
  3521. #define DEBUG_DATA_KdPrintWritePointerAddr 496
  3522. #define DEBUG_DATA_KdPrintRolloverCountAddr 504
  3523. #define DEBUG_DATA_MmLoadedUserImageListAddr 512
  3524. #define DEBUG_DATA_NtBuildLabAddr 520
  3525. #define DEBUG_DATA_KiNormalSystemCall 528
  3526. #define DEBUG_DATA_KiProcessorBlockAddr 536
  3527. #define DEBUG_DATA_MmUnloadedDriversAddr 544
  3528. #define DEBUG_DATA_MmLastUnloadedDriverAddr 552
  3529. #define DEBUG_DATA_MmTriageActionTakenAddr 560
  3530. #define DEBUG_DATA_MmSpecialPoolTagAddr 568
  3531. #define DEBUG_DATA_KernelVerifierAddr 576
  3532. #define DEBUG_DATA_MmVerifierDataAddr 584
  3533. #define DEBUG_DATA_MmAllocatedNonPagedPoolAddr 592
  3534. #define DEBUG_DATA_MmPeakCommitmentAddr 600
  3535. #define DEBUG_DATA_MmTotalCommitLimitMaximumAddr 608
  3536. #define DEBUG_DATA_CmNtCSDVersionAddr 616
  3537. #define DEBUG_DATA_MmPhysicalMemoryBlockAddr 624
  3538. #define DEBUG_DATA_PaeEnabled 100000
  3539. #define DEBUG_DATA_SharedUserData 100008
  3540. //
  3541. // Processor information structures.
  3542. //
  3543. typedef struct _DEBUG_PROCESSOR_IDENTIFICATION_ALPHA
  3544. {
  3545. ULONG Type;
  3546. ULONG Revision;
  3547. } DEBUG_PROCESSOR_IDENTIFICATION_ALPHA, *PDEBUG_PROCESSOR_IDENTIFICATION_ALPHA;
  3548. typedef struct _DEBUG_PROCESSOR_IDENTIFICATION_AMD64
  3549. {
  3550. ULONG Family;
  3551. ULONG Model;
  3552. ULONG Stepping;
  3553. CHAR VendorString[16];
  3554. } DEBUG_PROCESSOR_IDENTIFICATION_AMD64, *PDEBUG_PROCESSOR_IDENTIFICATION_AMD64;
  3555. typedef struct _DEBUG_PROCESSOR_IDENTIFICATION_IA64
  3556. {
  3557. ULONG Model;
  3558. ULONG Revision;
  3559. ULONG Family;
  3560. ULONG ArchRev;
  3561. CHAR VendorString[16];
  3562. } DEBUG_PROCESSOR_IDENTIFICATION_IA64, *PDEBUG_PROCESSOR_IDENTIFICATION_IA64;
  3563. typedef struct _DEBUG_PROCESSOR_IDENTIFICATION_X86
  3564. {
  3565. ULONG Family;
  3566. ULONG Model;
  3567. ULONG Stepping;
  3568. CHAR VendorString[16];
  3569. } DEBUG_PROCESSOR_IDENTIFICATION_X86, *PDEBUG_PROCESSOR_IDENTIFICATION_X86;
  3570. typedef union _DEBUG_PROCESSOR_IDENTIFICATION_ALL
  3571. {
  3572. DEBUG_PROCESSOR_IDENTIFICATION_ALPHA Alpha;
  3573. DEBUG_PROCESSOR_IDENTIFICATION_AMD64 Amd64;
  3574. DEBUG_PROCESSOR_IDENTIFICATION_IA64 Ia64;
  3575. DEBUG_PROCESSOR_IDENTIFICATION_X86 X86;
  3576. } DEBUG_PROCESSOR_IDENTIFICATION_ALL, *PDEBUG_PROCESSOR_IDENTIFICATION_ALL;
  3577. // Indices for ReadProcessorSystemData.
  3578. #define DEBUG_DATA_KPCR_OFFSET 0
  3579. #define DEBUG_DATA_KPRCB_OFFSET 1
  3580. #define DEBUG_DATA_KTHREAD_OFFSET 2
  3581. #define DEBUG_DATA_BASE_TRANSLATION_VIRTUAL_OFFSET 3
  3582. #define DEBUG_DATA_PROCESSOR_IDENTIFICATION 4
  3583. #undef INTERFACE
  3584. #define INTERFACE IDebugDataSpaces
  3585. DECLARE_INTERFACE_(IDebugDataSpaces, IUnknown)
  3586. {
  3587. // IUnknown.
  3588. STDMETHOD(QueryInterface)(
  3589. THIS_
  3590. IN REFIID InterfaceId,
  3591. OUT PVOID* Interface
  3592. ) PURE;
  3593. STDMETHOD_(ULONG, AddRef)(
  3594. THIS
  3595. ) PURE;
  3596. STDMETHOD_(ULONG, Release)(
  3597. THIS
  3598. ) PURE;
  3599. // IDebugDataSpaces.
  3600. STDMETHOD(ReadVirtual)(
  3601. THIS_
  3602. IN ULONG64 Offset,
  3603. OUT PVOID Buffer,
  3604. IN ULONG BufferSize,
  3605. OUT OPTIONAL PULONG BytesRead
  3606. ) PURE;
  3607. STDMETHOD(WriteVirtual)(
  3608. THIS_
  3609. IN ULONG64 Offset,
  3610. IN PVOID Buffer,
  3611. IN ULONG BufferSize,
  3612. OUT OPTIONAL PULONG BytesWritten
  3613. ) PURE;
  3614. // SearchVirtual searches the given virtual
  3615. // address range for the given pattern. PatternSize
  3616. // gives the byte length of the pattern and PatternGranularity
  3617. // controls the granularity of comparisons during
  3618. // the search.
  3619. // For example, a DWORD-granular search would
  3620. // use a pattern granularity of four to search by DWORD
  3621. // increments.
  3622. STDMETHOD(SearchVirtual)(
  3623. THIS_
  3624. IN ULONG64 Offset,
  3625. IN ULONG64 Length,
  3626. IN PVOID Pattern,
  3627. IN ULONG PatternSize,
  3628. IN ULONG PatternGranularity,
  3629. OUT PULONG64 MatchOffset
  3630. ) PURE;
  3631. // These methods are identical to Read/WriteVirtual
  3632. // except that they avoid the kernel virtual memory
  3633. // cache entirely and are therefore useful for reading
  3634. // virtual memory which is inherently volatile, such
  3635. // as memory-mapped device areas, without contaminating
  3636. // or invalidating the cache.
  3637. // In user-mode they are the same as Read/WriteVirtual.
  3638. STDMETHOD(ReadVirtualUncached)(
  3639. THIS_
  3640. IN ULONG64 Offset,
  3641. OUT PVOID Buffer,
  3642. IN ULONG BufferSize,
  3643. OUT OPTIONAL PULONG BytesRead
  3644. ) PURE;
  3645. STDMETHOD(WriteVirtualUncached)(
  3646. THIS_
  3647. IN ULONG64 Offset,
  3648. IN PVOID Buffer,
  3649. IN ULONG BufferSize,
  3650. OUT OPTIONAL PULONG BytesWritten
  3651. ) PURE;
  3652. // The following two methods are convenience
  3653. // methods for accessing pointer values.
  3654. // They automatically convert between native pointers
  3655. // and canonical 64-bit values as necessary.
  3656. // These routines stop at the first failure.
  3657. STDMETHOD(ReadPointersVirtual)(
  3658. THIS_
  3659. IN ULONG Count,
  3660. IN ULONG64 Offset,
  3661. OUT /* size_is(Count) */ PULONG64 Ptrs
  3662. ) PURE;
  3663. STDMETHOD(WritePointersVirtual)(
  3664. THIS_
  3665. IN ULONG Count,
  3666. IN ULONG64 Offset,
  3667. IN /* size_is(Count) */ PULONG64 Ptrs
  3668. ) PURE;
  3669. // All non-virtual data spaces are only
  3670. // available when kernel debugging.
  3671. STDMETHOD(ReadPhysical)(
  3672. THIS_
  3673. IN ULONG64 Offset,
  3674. OUT PVOID Buffer,
  3675. IN ULONG BufferSize,
  3676. OUT OPTIONAL PULONG BytesRead
  3677. ) PURE;
  3678. STDMETHOD(WritePhysical)(
  3679. THIS_
  3680. IN ULONG64 Offset,
  3681. IN PVOID Buffer,
  3682. IN ULONG BufferSize,
  3683. OUT OPTIONAL PULONG BytesWritten
  3684. ) PURE;
  3685. STDMETHOD(ReadControl)(
  3686. THIS_
  3687. IN ULONG Processor,
  3688. IN ULONG64 Offset,
  3689. OUT PVOID Buffer,
  3690. IN ULONG BufferSize,
  3691. OUT OPTIONAL PULONG BytesRead
  3692. ) PURE;
  3693. STDMETHOD(WriteControl)(
  3694. THIS_
  3695. IN ULONG Processor,
  3696. IN ULONG64 Offset,
  3697. IN PVOID Buffer,
  3698. IN ULONG BufferSize,
  3699. OUT OPTIONAL PULONG BytesWritten
  3700. ) PURE;
  3701. STDMETHOD(ReadIo)(
  3702. THIS_
  3703. IN ULONG InterfaceType,
  3704. IN ULONG BusNumber,
  3705. IN ULONG AddressSpace,
  3706. IN ULONG64 Offset,
  3707. OUT PVOID Buffer,
  3708. IN ULONG BufferSize,
  3709. OUT OPTIONAL PULONG BytesRead
  3710. ) PURE;
  3711. STDMETHOD(WriteIo)(
  3712. THIS_
  3713. IN ULONG InterfaceType,
  3714. IN ULONG BusNumber,
  3715. IN ULONG AddressSpace,
  3716. IN ULONG64 Offset,
  3717. IN PVOID Buffer,
  3718. IN ULONG BufferSize,
  3719. OUT OPTIONAL PULONG BytesWritten
  3720. ) PURE;
  3721. STDMETHOD(ReadMsr)(
  3722. THIS_
  3723. IN ULONG Msr,
  3724. OUT PULONG64 Value
  3725. ) PURE;
  3726. STDMETHOD(WriteMsr)(
  3727. THIS_
  3728. IN ULONG Msr,
  3729. IN ULONG64 Value
  3730. ) PURE;
  3731. STDMETHOD(ReadBusData)(
  3732. THIS_
  3733. IN ULONG BusDataType,
  3734. IN ULONG BusNumber,
  3735. IN ULONG SlotNumber,
  3736. IN ULONG Offset,
  3737. OUT PVOID Buffer,
  3738. IN ULONG BufferSize,
  3739. OUT OPTIONAL PULONG BytesRead
  3740. ) PURE;
  3741. STDMETHOD(WriteBusData)(
  3742. THIS_
  3743. IN ULONG BusDataType,
  3744. IN ULONG BusNumber,
  3745. IN ULONG SlotNumber,
  3746. IN ULONG Offset,
  3747. IN PVOID Buffer,
  3748. IN ULONG BufferSize,
  3749. OUT OPTIONAL PULONG BytesWritten
  3750. ) PURE;
  3751. STDMETHOD(CheckLowMemory)(
  3752. THIS
  3753. ) PURE;
  3754. STDMETHOD(ReadDebuggerData)(
  3755. THIS_
  3756. IN ULONG Index,
  3757. OUT PVOID Buffer,
  3758. IN ULONG BufferSize,
  3759. OUT OPTIONAL PULONG DataSize
  3760. ) PURE;
  3761. STDMETHOD(ReadProcessorSystemData)(
  3762. THIS_
  3763. IN ULONG Processor,
  3764. IN ULONG Index,
  3765. OUT PVOID Buffer,
  3766. IN ULONG BufferSize,
  3767. OUT OPTIONAL PULONG DataSize
  3768. ) PURE;
  3769. };
  3770. //
  3771. // Handle data types and structures.
  3772. //
  3773. #define DEBUG_HANDLE_DATA_TYPE_BASIC 0
  3774. #define DEBUG_HANDLE_DATA_TYPE_TYPE_NAME 1
  3775. #define DEBUG_HANDLE_DATA_TYPE_OBJECT_NAME 2
  3776. #define DEBUG_HANDLE_DATA_TYPE_HANDLE_COUNT 3
  3777. typedef struct _DEBUG_HANDLE_DATA_BASIC
  3778. {
  3779. ULONG TypeNameSize;
  3780. ULONG ObjectNameSize;
  3781. ULONG Attributes;
  3782. ULONG GrantedAccess;
  3783. ULONG HandleCount;
  3784. ULONG PointerCount;
  3785. } DEBUG_HANDLE_DATA_BASIC, *PDEBUG_HANDLE_DATA_BASIC;
  3786. #undef INTERFACE
  3787. #define INTERFACE IDebugDataSpaces2
  3788. DECLARE_INTERFACE_(IDebugDataSpaces2, IUnknown)
  3789. {
  3790. // IUnknown.
  3791. STDMETHOD(QueryInterface)(
  3792. THIS_
  3793. IN REFIID InterfaceId,
  3794. OUT PVOID* Interface
  3795. ) PURE;
  3796. STDMETHOD_(ULONG, AddRef)(
  3797. THIS
  3798. ) PURE;
  3799. STDMETHOD_(ULONG, Release)(
  3800. THIS
  3801. ) PURE;
  3802. // IDebugDataSpaces.
  3803. STDMETHOD(ReadVirtual)(
  3804. THIS_
  3805. IN ULONG64 Offset,
  3806. OUT PVOID Buffer,
  3807. IN ULONG BufferSize,
  3808. OUT OPTIONAL PULONG BytesRead
  3809. ) PURE;
  3810. STDMETHOD(WriteVirtual)(
  3811. THIS_
  3812. IN ULONG64 Offset,
  3813. IN PVOID Buffer,
  3814. IN ULONG BufferSize,
  3815. OUT OPTIONAL PULONG BytesWritten
  3816. ) PURE;
  3817. // SearchVirtual searches the given virtual
  3818. // address range for the given pattern. PatternSize
  3819. // gives the byte length of the pattern and PatternGranularity
  3820. // controls the granularity of comparisons during
  3821. // the search.
  3822. // For example, a DWORD-granular search would
  3823. // use a pattern granularity of four to search by DWORD
  3824. // increments.
  3825. STDMETHOD(SearchVirtual)(
  3826. THIS_
  3827. IN ULONG64 Offset,
  3828. IN ULONG64 Length,
  3829. IN PVOID Pattern,
  3830. IN ULONG PatternSize,
  3831. IN ULONG PatternGranularity,
  3832. OUT PULONG64 MatchOffset
  3833. ) PURE;
  3834. // These methods are identical to Read/WriteVirtual
  3835. // except that they avoid the kernel virtual memory
  3836. // cache entirely and are therefore useful for reading
  3837. // virtual memory which is inherently volatile, such
  3838. // as memory-mapped device areas, without contaminating
  3839. // or invalidating the cache.
  3840. // In user-mode they are the same as Read/WriteVirtual.
  3841. STDMETHOD(ReadVirtualUncached)(
  3842. THIS_
  3843. IN ULONG64 Offset,
  3844. OUT PVOID Buffer,
  3845. IN ULONG BufferSize,
  3846. OUT OPTIONAL PULONG BytesRead
  3847. ) PURE;
  3848. STDMETHOD(WriteVirtualUncached)(
  3849. THIS_
  3850. IN ULONG64 Offset,
  3851. IN PVOID Buffer,
  3852. IN ULONG BufferSize,
  3853. OUT OPTIONAL PULONG BytesWritten
  3854. ) PURE;
  3855. // The following two methods are convenience
  3856. // methods for accessing pointer values.
  3857. // They automatically convert between native pointers
  3858. // and canonical 64-bit values as necessary.
  3859. // These routines stop at the first failure.
  3860. STDMETHOD(ReadPointersVirtual)(
  3861. THIS_
  3862. IN ULONG Count,
  3863. IN ULONG64 Offset,
  3864. OUT /* size_is(Count) */ PULONG64 Ptrs
  3865. ) PURE;
  3866. STDMETHOD(WritePointersVirtual)(
  3867. THIS_
  3868. IN ULONG Count,
  3869. IN ULONG64 Offset,
  3870. IN /* size_is(Count) */ PULONG64 Ptrs
  3871. ) PURE;
  3872. // All non-virtual data spaces are only
  3873. // available when kernel debugging.
  3874. STDMETHOD(ReadPhysical)(
  3875. THIS_
  3876. IN ULONG64 Offset,
  3877. OUT PVOID Buffer,
  3878. IN ULONG BufferSize,
  3879. OUT OPTIONAL PULONG BytesRead
  3880. ) PURE;
  3881. STDMETHOD(WritePhysical)(
  3882. THIS_
  3883. IN ULONG64 Offset,
  3884. IN PVOID Buffer,
  3885. IN ULONG BufferSize,
  3886. OUT OPTIONAL PULONG BytesWritten
  3887. ) PURE;
  3888. STDMETHOD(ReadControl)(
  3889. THIS_
  3890. IN ULONG Processor,
  3891. IN ULONG64 Offset,
  3892. OUT PVOID Buffer,
  3893. IN ULONG BufferSize,
  3894. OUT OPTIONAL PULONG BytesRead
  3895. ) PURE;
  3896. STDMETHOD(WriteControl)(
  3897. THIS_
  3898. IN ULONG Processor,
  3899. IN ULONG64 Offset,
  3900. IN PVOID Buffer,
  3901. IN ULONG BufferSize,
  3902. OUT OPTIONAL PULONG BytesWritten
  3903. ) PURE;
  3904. STDMETHOD(ReadIo)(
  3905. THIS_
  3906. IN ULONG InterfaceType,
  3907. IN ULONG BusNumber,
  3908. IN ULONG AddressSpace,
  3909. IN ULONG64 Offset,
  3910. OUT PVOID Buffer,
  3911. IN ULONG BufferSize,
  3912. OUT OPTIONAL PULONG BytesRead
  3913. ) PURE;
  3914. STDMETHOD(WriteIo)(
  3915. THIS_
  3916. IN ULONG InterfaceType,
  3917. IN ULONG BusNumber,
  3918. IN ULONG AddressSpace,
  3919. IN ULONG64 Offset,
  3920. IN PVOID Buffer,
  3921. IN ULONG BufferSize,
  3922. OUT OPTIONAL PULONG BytesWritten
  3923. ) PURE;
  3924. STDMETHOD(ReadMsr)(
  3925. THIS_
  3926. IN ULONG Msr,
  3927. OUT PULONG64 Value
  3928. ) PURE;
  3929. STDMETHOD(WriteMsr)(
  3930. THIS_
  3931. IN ULONG Msr,
  3932. IN ULONG64 Value
  3933. ) PURE;
  3934. STDMETHOD(ReadBusData)(
  3935. THIS_
  3936. IN ULONG BusDataType,
  3937. IN ULONG BusNumber,
  3938. IN ULONG SlotNumber,
  3939. IN ULONG Offset,
  3940. OUT PVOID Buffer,
  3941. IN ULONG BufferSize,
  3942. OUT OPTIONAL PULONG BytesRead
  3943. ) PURE;
  3944. STDMETHOD(WriteBusData)(
  3945. THIS_
  3946. IN ULONG BusDataType,
  3947. IN ULONG BusNumber,
  3948. IN ULONG SlotNumber,
  3949. IN ULONG Offset,
  3950. IN PVOID Buffer,
  3951. IN ULONG BufferSize,
  3952. OUT OPTIONAL PULONG BytesWritten
  3953. ) PURE;
  3954. STDMETHOD(CheckLowMemory)(
  3955. THIS
  3956. ) PURE;
  3957. STDMETHOD(ReadDebuggerData)(
  3958. THIS_
  3959. IN ULONG Index,
  3960. OUT PVOID Buffer,
  3961. IN ULONG BufferSize,
  3962. OUT OPTIONAL PULONG DataSize
  3963. ) PURE;
  3964. STDMETHOD(ReadProcessorSystemData)(
  3965. THIS_
  3966. IN ULONG Processor,
  3967. IN ULONG Index,
  3968. OUT PVOID Buffer,
  3969. IN ULONG BufferSize,
  3970. OUT OPTIONAL PULONG DataSize
  3971. ) PURE;
  3972. // IDebugDataSpaces2.
  3973. STDMETHOD(VirtualToPhysical)(
  3974. THIS_
  3975. IN ULONG64 Virtual,
  3976. OUT PULONG64 Physical
  3977. ) PURE;
  3978. // Returns the physical addresses for the
  3979. // N levels of the systems paging structures.
  3980. // Level zero is the starting base physical
  3981. // address for virtual translations.
  3982. // Levels one-(N-1) will point to the appropriate
  3983. // paging descriptor for the virtual address at
  3984. // the given level of the paging hierarchy. The
  3985. // exact number of levels depends on many factors.
  3986. // The last level will be the fully translated
  3987. // physical address, matching what VirtualToPhysical
  3988. // returns. If the address can only be partially
  3989. // translated S_FALSE is returned.
  3990. STDMETHOD(GetVirtualTranslationPhysicalOffsets)(
  3991. THIS_
  3992. IN ULONG64 Virtual,
  3993. OUT OPTIONAL /* size_is(OffsetsSize) */ PULONG64 Offsets,
  3994. IN ULONG OffsetsSize,
  3995. OUT OPTIONAL PULONG Levels
  3996. ) PURE;
  3997. // System handle data is accessible in certain
  3998. // debug sessions. The particular data available
  3999. // varies from session to session and platform
  4000. // to platform.
  4001. STDMETHOD(ReadHandleData)(
  4002. THIS_
  4003. IN ULONG64 Handle,
  4004. IN ULONG DataType,
  4005. OUT OPTIONAL PVOID Buffer,
  4006. IN ULONG BufferSize,
  4007. OUT OPTIONAL PULONG DataSize
  4008. ) PURE;
  4009. // Fills memory with the given pattern.
  4010. // The fill stops at the first non-writable byte.
  4011. STDMETHOD(FillVirtual)(
  4012. THIS_
  4013. IN ULONG64 Start,
  4014. IN ULONG Size,
  4015. IN PVOID Pattern,
  4016. IN ULONG PatternSize,
  4017. OUT OPTIONAL PULONG Filled
  4018. ) PURE;
  4019. STDMETHOD(FillPhysical)(
  4020. THIS_
  4021. IN ULONG64 Start,
  4022. IN ULONG Size,
  4023. IN PVOID Pattern,
  4024. IN ULONG PatternSize,
  4025. OUT OPTIONAL PULONG Filled
  4026. ) PURE;
  4027. // Queries virtual memory mapping information given
  4028. // an address similarly to the Win32 API VirtualQuery.
  4029. // MEMORY_BASIC_INFORMATION64 is defined in crash.h.
  4030. // This method currently only works for user-mode sessions.
  4031. STDMETHOD(QueryVirtual)(
  4032. THIS_
  4033. IN ULONG64 Offset,
  4034. OUT PMEMORY_BASIC_INFORMATION64 Info
  4035. ) PURE;
  4036. };
  4037. //----------------------------------------------------------------------------
  4038. //
  4039. // IDebugEventCallbacks.
  4040. //
  4041. //----------------------------------------------------------------------------
  4042. // Interest mask bits.
  4043. #define DEBUG_EVENT_BREAKPOINT 0x00000001
  4044. #define DEBUG_EVENT_EXCEPTION 0x00000002
  4045. #define DEBUG_EVENT_CREATE_THREAD 0x00000004
  4046. #define DEBUG_EVENT_EXIT_THREAD 0x00000008
  4047. #define DEBUG_EVENT_CREATE_PROCESS 0x00000010
  4048. #define DEBUG_EVENT_EXIT_PROCESS 0x00000020
  4049. #define DEBUG_EVENT_LOAD_MODULE 0x00000040
  4050. #define DEBUG_EVENT_UNLOAD_MODULE 0x00000080
  4051. #define DEBUG_EVENT_SYSTEM_ERROR 0x00000100
  4052. #define DEBUG_EVENT_SESSION_STATUS 0x00000200
  4053. #define DEBUG_EVENT_CHANGE_DEBUGGEE_STATE 0x00000400
  4054. #define DEBUG_EVENT_CHANGE_ENGINE_STATE 0x00000800
  4055. #define DEBUG_EVENT_CHANGE_SYMBOL_STATE 0x00001000
  4056. // SessionStatus flags.
  4057. // A debuggee has been discovered for the session.
  4058. #define DEBUG_SESSION_ACTIVE 0x00000000
  4059. // The session has been ended by EndSession.
  4060. #define DEBUG_SESSION_END_SESSION_ACTIVE_TERMINATE 0x00000001
  4061. #define DEBUG_SESSION_END_SESSION_ACTIVE_DETACH 0x00000002
  4062. #define DEBUG_SESSION_END_SESSION_PASSIVE 0x00000003
  4063. // The debuggee has run to completion. User-mode only.
  4064. #define DEBUG_SESSION_END 0x00000004
  4065. // The target machine has rebooted. Kernel-mode only.
  4066. #define DEBUG_SESSION_REBOOT 0x00000005
  4067. // The target machine has hibernated. Kernel-mode only.
  4068. #define DEBUG_SESSION_HIBERNATE 0x00000006
  4069. // The engine was unable to continue the session.
  4070. #define DEBUG_SESSION_FAILURE 0x00000007
  4071. // ChangeDebuggeeState flags.
  4072. // The debuggees state has changed generally, such
  4073. // as when the debuggee has been executing.
  4074. // Argument is zero.
  4075. #define DEBUG_CDS_ALL 0xffffffff
  4076. // Registers have changed. If only a single register
  4077. // changed, argument is the index of the register.
  4078. // Otherwise it is DEBUG_ANY_ID.
  4079. #define DEBUG_CDS_REGISTERS 0x00000001
  4080. // Data spaces have changed. If only a single
  4081. // space was affected, argument is the data
  4082. // space. Otherwise it is DEBUG_ANY_ID.
  4083. #define DEBUG_CDS_DATA 0x00000002
  4084. // ChangeEngineState flags.
  4085. // The engine state has changed generally.
  4086. // Argument is zero.
  4087. #define DEBUG_CES_ALL 0xffffffff
  4088. // Current thread changed. This may imply a change
  4089. // of process also. Argument is the ID of the new
  4090. // current thread.
  4091. #define DEBUG_CES_CURRENT_THREAD 0x00000001
  4092. // Effective processor changed. Argument is the
  4093. // new processor type.
  4094. #define DEBUG_CES_EFFECTIVE_PROCESSOR 0x00000002
  4095. // Breakpoints changed. If only a single breakpoint
  4096. // changed, argument is the ID of the breakpoint.
  4097. // Otherwise it is DEBUG_ANY_ID.
  4098. #define DEBUG_CES_BREAKPOINTS 0x00000004
  4099. // Code interpretation level changed. Argument is
  4100. // the new level.
  4101. #define DEBUG_CES_CODE_LEVEL 0x00000008
  4102. // Execution status changed. Argument is the new
  4103. // execution status.
  4104. #define DEBUG_CES_EXECUTION_STATUS 0x00000010
  4105. // Engine options have changed. Argument is the new
  4106. // options value.
  4107. #define DEBUG_CES_ENGINE_OPTIONS 0x00000020
  4108. // Log file information has changed. Argument
  4109. // is TRUE if a log file was opened and FALSE if
  4110. // a log file was closed.
  4111. #define DEBUG_CES_LOG_FILE 0x00000040
  4112. // Default number radix has changed. Argument
  4113. // is the new radix.
  4114. #define DEBUG_CES_RADIX 0x00000080
  4115. // Event filters changed. If only a single filter
  4116. // changed the argument is the filter's index,
  4117. // otherwise it is DEBUG_ANY_ID.
  4118. #define DEBUG_CES_EVENT_FILTERS 0x00000100
  4119. // Process options have changed. Argument is the new
  4120. // options value.
  4121. #define DEBUG_CES_PROCESS_OPTIONS 0x00000200
  4122. // Extensions have been added or removed.
  4123. #define DEBUG_CES_EXTENSIONS 0x00000400
  4124. // ChangeSymbolState flags.
  4125. // Symbol state has changed generally, such
  4126. // as after reload operations. Argument is zero.
  4127. #define DEBUG_CSS_ALL 0xffffffff
  4128. // Modules have been loaded. If only a
  4129. // single module changed, argument is the
  4130. // base address of the module. Otherwise
  4131. // it is zero.
  4132. #define DEBUG_CSS_LOADS 0x00000001
  4133. // Modules have been unloaded. If only a
  4134. // single module changed, argument is the
  4135. // base address of the module. Otherwise
  4136. // it is zero.
  4137. #define DEBUG_CSS_UNLOADS 0x00000002
  4138. // Current symbol scope changed.
  4139. #define DEBUG_CSS_SCOPE 0x00000004
  4140. // Paths have changed.
  4141. #define DEBUG_CSS_PATHS 0x00000008
  4142. // Symbol options have changed. Argument is the new
  4143. // options value.
  4144. #define DEBUG_CSS_SYMBOL_OPTIONS 0x00000010
  4145. // Type options have changed. Argument is the new
  4146. // options value.
  4147. #define DEBUG_CSS_TYPE_OPTIONS 0x00000020
  4148. #undef INTERFACE
  4149. #define INTERFACE IDebugEventCallbacks
  4150. DECLARE_INTERFACE_(IDebugEventCallbacks, IUnknown)
  4151. {
  4152. // IUnknown.
  4153. STDMETHOD(QueryInterface)(
  4154. THIS_
  4155. IN REFIID InterfaceId,
  4156. OUT PVOID* Interface
  4157. ) PURE;
  4158. STDMETHOD_(ULONG, AddRef)(
  4159. THIS
  4160. ) PURE;
  4161. STDMETHOD_(ULONG, Release)(
  4162. THIS
  4163. ) PURE;
  4164. // IDebugEventCallbacks.
  4165. // The engine calls GetInterestMask once when
  4166. // the event callbacks are set for a client.
  4167. STDMETHOD(GetInterestMask)(
  4168. THIS_
  4169. OUT PULONG Mask
  4170. ) PURE;
  4171. // A breakpoint event is generated when
  4172. // a breakpoint exception is received and
  4173. // it can be mapped to an existing breakpoint.
  4174. // The callback method is given a reference
  4175. // to the breakpoint and should release it when
  4176. // it is done with it.
  4177. STDMETHOD(Breakpoint)(
  4178. THIS_
  4179. IN PDEBUG_BREAKPOINT Bp
  4180. ) PURE;
  4181. // Exceptions include breaks which cannot
  4182. // be mapped to an existing breakpoint
  4183. // instance.
  4184. STDMETHOD(Exception)(
  4185. THIS_
  4186. IN PEXCEPTION_RECORD64 Exception,
  4187. IN ULONG FirstChance
  4188. ) PURE;
  4189. // Any of these values can be zero if they
  4190. // cannot be provided by the engine.
  4191. // Currently the kernel does not return thread
  4192. // or process change events.
  4193. STDMETHOD(CreateThread)(
  4194. THIS_
  4195. IN ULONG64 Handle,
  4196. IN ULONG64 DataOffset,
  4197. IN ULONG64 StartOffset
  4198. ) PURE;
  4199. STDMETHOD(ExitThread)(
  4200. THIS_
  4201. IN ULONG ExitCode
  4202. ) PURE;
  4203. // Any of these values can be zero if they
  4204. // cannot be provided by the engine.
  4205. STDMETHOD(CreateProcess)(
  4206. THIS_
  4207. IN ULONG64 ImageFileHandle,
  4208. IN ULONG64 Handle,
  4209. IN ULONG64 BaseOffset,
  4210. IN ULONG ModuleSize,
  4211. IN PCSTR ModuleName,
  4212. IN PCSTR ImageName,
  4213. IN ULONG CheckSum,
  4214. IN ULONG TimeDateStamp,
  4215. IN ULONG64 InitialThreadHandle,
  4216. IN ULONG64 ThreadDataOffset,
  4217. IN ULONG64 StartOffset
  4218. ) PURE;
  4219. STDMETHOD(ExitProcess)(
  4220. THIS_
  4221. IN ULONG ExitCode
  4222. ) PURE;
  4223. // Any of these values may be zero.
  4224. STDMETHOD(LoadModule)(
  4225. THIS_
  4226. IN ULONG64 ImageFileHandle,
  4227. IN ULONG64 BaseOffset,
  4228. IN ULONG ModuleSize,
  4229. IN PCSTR ModuleName,
  4230. IN PCSTR ImageName,
  4231. IN ULONG CheckSum,
  4232. IN ULONG TimeDateStamp
  4233. ) PURE;
  4234. STDMETHOD(UnloadModule)(
  4235. THIS_
  4236. IN PCSTR ImageBaseName,
  4237. IN ULONG64 BaseOffset
  4238. ) PURE;
  4239. STDMETHOD(SystemError)(
  4240. THIS_
  4241. IN ULONG Error,
  4242. IN ULONG Level
  4243. ) PURE;
  4244. // Session status is synchronous like the other
  4245. // wait callbacks but it is called as the state
  4246. // of the session is changing rather than at
  4247. // specific events so its return value does not
  4248. // influence waiting. Implementations should just
  4249. // return DEBUG_STATUS_NO_CHANGE.
  4250. // Also, because some of the status
  4251. // notifications are very early or very
  4252. // late in the session lifetime there may not be
  4253. // current processes or threads when the notification
  4254. // is generated.
  4255. STDMETHOD(SessionStatus)(
  4256. THIS_
  4257. IN ULONG Status
  4258. ) PURE;
  4259. // The following callbacks are informational
  4260. // callbacks notifying the provider about
  4261. // changes in debug state. The return value
  4262. // of these callbacks is ignored. Implementations
  4263. // can not call back into the engine.
  4264. // Debuggee state, such as registers or data spaces,
  4265. // has changed.
  4266. STDMETHOD(ChangeDebuggeeState)(
  4267. THIS_
  4268. IN ULONG Flags,
  4269. IN ULONG64 Argument
  4270. ) PURE;
  4271. // Engine state has changed.
  4272. STDMETHOD(ChangeEngineState)(
  4273. THIS_
  4274. IN ULONG Flags,
  4275. IN ULONG64 Argument
  4276. ) PURE;
  4277. // Symbol state has changed.
  4278. STDMETHOD(ChangeSymbolState)(
  4279. THIS_
  4280. IN ULONG Flags,
  4281. IN ULONG64 Argument
  4282. ) PURE;
  4283. };
  4284. //----------------------------------------------------------------------------
  4285. //
  4286. // IDebugInputCallbacks.
  4287. //
  4288. //----------------------------------------------------------------------------
  4289. #undef INTERFACE
  4290. #define INTERFACE IDebugInputCallbacks
  4291. DECLARE_INTERFACE_(IDebugInputCallbacks, IUnknown)
  4292. {
  4293. // IUnknown.
  4294. STDMETHOD(QueryInterface)(
  4295. THIS_
  4296. IN REFIID InterfaceId,
  4297. OUT PVOID* Interface
  4298. ) PURE;
  4299. STDMETHOD_(ULONG, AddRef)(
  4300. THIS
  4301. ) PURE;
  4302. STDMETHOD_(ULONG, Release)(
  4303. THIS
  4304. ) PURE;
  4305. // IDebugInputCallbacks.
  4306. // A call to the StartInput method is a request for
  4307. // a line of input from any client. The returned input
  4308. // should always be zero-terminated. The buffer size
  4309. // provided is only a guideline. A client can return
  4310. // more if necessary and the engine will truncate it
  4311. // before returning from IDebugControl::Input.
  4312. // The return value is ignored.
  4313. STDMETHOD(StartInput)(
  4314. THIS_
  4315. IN ULONG BufferSize
  4316. ) PURE;
  4317. // The return value is ignored.
  4318. STDMETHOD(EndInput)(
  4319. THIS
  4320. ) PURE;
  4321. };
  4322. //----------------------------------------------------------------------------
  4323. //
  4324. // IDebugOutputCallbacks.
  4325. //
  4326. //----------------------------------------------------------------------------
  4327. #undef INTERFACE
  4328. #define INTERFACE IDebugOutputCallbacks
  4329. DECLARE_INTERFACE_(IDebugOutputCallbacks, IUnknown)
  4330. {
  4331. // IUnknown.
  4332. STDMETHOD(QueryInterface)(
  4333. THIS_
  4334. IN REFIID InterfaceId,
  4335. OUT PVOID* Interface
  4336. ) PURE;
  4337. STDMETHOD_(ULONG, AddRef)(
  4338. THIS
  4339. ) PURE;
  4340. STDMETHOD_(ULONG, Release)(
  4341. THIS
  4342. ) PURE;
  4343. // IDebugOutputCallbacks.
  4344. // This method is only called if the supplied mask
  4345. // is allowed by the clients output control.
  4346. // The return value is ignored.
  4347. STDMETHOD(Output)(
  4348. THIS_
  4349. IN ULONG Mask,
  4350. IN PCSTR Text
  4351. ) PURE;
  4352. };
  4353. //----------------------------------------------------------------------------
  4354. //
  4355. // IDebugRegisters.
  4356. //
  4357. //----------------------------------------------------------------------------
  4358. #define DEBUG_REGISTER_SUB_REGISTER 0x00000001
  4359. #define DEBUG_REGISTERS_DEFAULT 0x00000000
  4360. #define DEBUG_REGISTERS_INT32 0x00000001
  4361. #define DEBUG_REGISTERS_INT64 0x00000002
  4362. #define DEBUG_REGISTERS_FLOAT 0x00000004
  4363. #define DEBUG_REGISTERS_ALL 0x00000007
  4364. typedef struct _DEBUG_REGISTER_DESCRIPTION
  4365. {
  4366. // DEBUG_VALUE type.
  4367. ULONG Type;
  4368. ULONG Flags;
  4369. // If this is a subregister the full
  4370. // registers description index is
  4371. // given in SubregMaster. The length, mask
  4372. // and shift describe how the subregisters
  4373. // bits fit into the full register.
  4374. ULONG SubregMaster;
  4375. ULONG SubregLength;
  4376. ULONG64 SubregMask;
  4377. ULONG SubregShift;
  4378. ULONG Reserved0;
  4379. } DEBUG_REGISTER_DESCRIPTION, *PDEBUG_REGISTER_DESCRIPTION;
  4380. #undef INTERFACE
  4381. #define INTERFACE IDebugRegisters
  4382. DECLARE_INTERFACE_(IDebugRegisters, IUnknown)
  4383. {
  4384. // IUnknown.
  4385. STDMETHOD(QueryInterface)(
  4386. THIS_
  4387. IN REFIID InterfaceId,
  4388. OUT PVOID* Interface
  4389. ) PURE;
  4390. STDMETHOD_(ULONG, AddRef)(
  4391. THIS
  4392. ) PURE;
  4393. STDMETHOD_(ULONG, Release)(
  4394. THIS
  4395. ) PURE;
  4396. // IDebugRegisters.
  4397. STDMETHOD(GetNumberRegisters)(
  4398. THIS_
  4399. OUT PULONG Number
  4400. ) PURE;
  4401. STDMETHOD(GetDescription)(
  4402. THIS_
  4403. IN ULONG Register,
  4404. OUT OPTIONAL PSTR NameBuffer,
  4405. IN ULONG NameBufferSize,
  4406. OUT OPTIONAL PULONG NameSize,
  4407. OUT OPTIONAL PDEBUG_REGISTER_DESCRIPTION Desc
  4408. ) PURE;
  4409. STDMETHOD(GetIndexByName)(
  4410. THIS_
  4411. IN PCSTR Name,
  4412. OUT PULONG Index
  4413. ) PURE;
  4414. STDMETHOD(GetValue)(
  4415. THIS_
  4416. IN ULONG Register,
  4417. OUT PDEBUG_VALUE Value
  4418. ) PURE;
  4419. // SetValue makes a best effort at coercing
  4420. // the given value into the given registers
  4421. // value type. If the given value is larger
  4422. // than the register can hold the least
  4423. // significant bits will be dropped. Float
  4424. // to int and int to float will be done
  4425. // if necessary. Subregister bits will be
  4426. // inserted into the master register.
  4427. STDMETHOD(SetValue)(
  4428. THIS_
  4429. IN ULONG Register,
  4430. IN PDEBUG_VALUE Value
  4431. ) PURE;
  4432. // Gets Count register values. If Indices is
  4433. // non-NULL it must contain Count register
  4434. // indices which control the registers affected.
  4435. // If Indices is NULL the registers from Start
  4436. // to Start + Count 1 are retrieved.
  4437. STDMETHOD(GetValues)(
  4438. THIS_
  4439. IN ULONG Count,
  4440. IN OPTIONAL /* size_is(Count) */ PULONG Indices,
  4441. IN ULONG Start,
  4442. OUT /* size_is(Count) */ PDEBUG_VALUE Values
  4443. ) PURE;
  4444. STDMETHOD(SetValues)(
  4445. THIS_
  4446. IN ULONG Count,
  4447. IN OPTIONAL /* size_is(Count) */ PULONG Indices,
  4448. IN ULONG Start,
  4449. IN /* size_is(Count) */ PDEBUG_VALUE Values
  4450. ) PURE;
  4451. // Outputs a group of registers in a well-formatted
  4452. // way thats specific to the platforms register set.
  4453. // Uses the line prefix.
  4454. STDMETHOD(OutputRegisters)(
  4455. THIS_
  4456. IN ULONG OutputControl,
  4457. IN ULONG Flags
  4458. ) PURE;
  4459. // Abstracted pieces of processor information.
  4460. // The mapping of these values to architectural
  4461. // registers is architecture-specific and their
  4462. // interpretation and existence may vary. They
  4463. // are intended to be directly compatible with
  4464. // calls which take this information, such as
  4465. // stack walking.
  4466. STDMETHOD(GetInstructionOffset)(
  4467. THIS_
  4468. OUT PULONG64 Offset
  4469. ) PURE;
  4470. STDMETHOD(GetStackOffset)(
  4471. THIS_
  4472. OUT PULONG64 Offset
  4473. ) PURE;
  4474. STDMETHOD(GetFrameOffset)(
  4475. THIS_
  4476. OUT PULONG64 Offset
  4477. ) PURE;
  4478. };
  4479. //----------------------------------------------------------------------------
  4480. //
  4481. // IDebugSymbolGroup
  4482. //
  4483. //----------------------------------------------------------------------------
  4484. // OutputSymbols flags.
  4485. // Default output contains <Name>**NAME**<Offset>**OFF**<Value>**VALUE**
  4486. // per symbol.
  4487. #define DEBUG_OUTPUT_SYMBOLS_DEFAULT 0x00000000
  4488. #define DEBUG_OUTPUT_SYMBOLS_NO_NAMES 0x00000001
  4489. #define DEBUG_OUTPUT_SYMBOLS_NO_OFFSETS 0x00000002
  4490. #define DEBUG_OUTPUT_SYMBOLS_NO_VALUES 0x00000004
  4491. #define DEBUG_OUTPUT_SYMBOLS_NO_TYPES 0x00000010
  4492. #define DEBUG_OUTPUT_NAME_END "**NAME**"
  4493. #define DEBUG_OUTPUT_OFFSET_END "**OFF**"
  4494. #define DEBUG_OUTPUT_VALUE_END "**VALUE**"
  4495. #define DEBUG_OUTPUT_TYPE_END "**TYPE**"
  4496. // DEBUG_SYMBOL_PARAMETERS flags.
  4497. // Cumulative expansion level, takes four bits.
  4498. #define DEBUG_SYMBOL_EXPANSION_LEVEL_MASK 0x0000000f
  4499. // Symbols subelements follow.
  4500. #define DEBUG_SYMBOL_EXPANDED 0x00000010
  4501. // Symbols value is read-only.
  4502. #define DEBUG_SYMBOL_READ_ONLY 0x00000020
  4503. // Symbol subelements are array elements.
  4504. #define DEBUG_SYMBOL_IS_ARRAY 0x00000040
  4505. // Symbol is a float value.
  4506. #define DEBUG_SYMBOL_IS_FLOAT 0x00000080
  4507. // Symbol is a scope argument.
  4508. #define DEBUG_SYMBOL_IS_ARGUMENT 0x00000100
  4509. // Symbol is a scope argument.
  4510. #define DEBUG_SYMBOL_IS_LOCAL 0x00000200
  4511. typedef struct _DEBUG_SYMBOL_PARAMETERS
  4512. {
  4513. ULONG64 Module;
  4514. ULONG TypeId;
  4515. // ParentSymbol may be DEBUG_ANY_ID when unknown.
  4516. ULONG ParentSymbol;
  4517. // A subelement of a symbol can be a field, such
  4518. // as in structs, unions or classes; or an array
  4519. // element count for arrays.
  4520. ULONG SubElements;
  4521. ULONG Flags;
  4522. ULONG64 Reserved;
  4523. } DEBUG_SYMBOL_PARAMETERS, *PDEBUG_SYMBOL_PARAMETERS;
  4524. #undef INTERFACE
  4525. #define INTERFACE IDebugSymbolGroup
  4526. DECLARE_INTERFACE_(IDebugSymbolGroup, IUnknown)
  4527. {
  4528. // IUnknown.
  4529. STDMETHOD(QueryInterface)(
  4530. THIS_
  4531. IN REFIID InterfaceId,
  4532. OUT PVOID* Interface
  4533. ) PURE;
  4534. STDMETHOD_(ULONG, AddRef)(
  4535. THIS
  4536. ) PURE;
  4537. STDMETHOD_(ULONG, Release)(
  4538. THIS
  4539. ) PURE;
  4540. // IDebugSymbolGroup.
  4541. STDMETHOD(GetNumberSymbols)(
  4542. THIS_
  4543. OUT PULONG Number
  4544. ) PURE;
  4545. STDMETHOD(AddSymbol)(
  4546. THIS_
  4547. IN PCSTR Name,
  4548. OUT PULONG Index
  4549. ) PURE;
  4550. STDMETHOD(RemoveSymbolByName)(
  4551. THIS_
  4552. IN PCSTR Name
  4553. ) PURE;
  4554. STDMETHOD(RemoveSymbolByIndex)(
  4555. THIS_
  4556. IN ULONG Index
  4557. ) PURE;
  4558. STDMETHOD(GetSymbolName)(
  4559. THIS_
  4560. IN ULONG Index,
  4561. OUT OPTIONAL PSTR Buffer,
  4562. IN ULONG BufferSize,
  4563. OUT OPTIONAL PULONG NameSize
  4564. ) PURE;
  4565. STDMETHOD(GetSymbolParameters)(
  4566. THIS_
  4567. IN ULONG Start,
  4568. IN ULONG Count,
  4569. OUT /* size_is(Count) */ PDEBUG_SYMBOL_PARAMETERS Params
  4570. ) PURE;
  4571. STDMETHOD(ExpandSymbol)(
  4572. THIS_
  4573. IN ULONG Index,
  4574. IN BOOL Expand
  4575. ) PURE;
  4576. // Uses the line prefix.
  4577. STDMETHOD(OutputSymbols)(
  4578. THIS_
  4579. IN ULONG OutputControl,
  4580. IN ULONG Flags,
  4581. IN ULONG Start,
  4582. IN ULONG Count
  4583. ) PURE;
  4584. STDMETHOD(WriteSymbol)(
  4585. THIS_
  4586. IN ULONG Index,
  4587. IN PCSTR Value
  4588. ) PURE;
  4589. STDMETHOD(OutputAsType)(
  4590. THIS_
  4591. IN ULONG Index,
  4592. IN PCSTR Type
  4593. ) PURE;
  4594. };
  4595. //----------------------------------------------------------------------------
  4596. //
  4597. // IDebugSymbols.
  4598. //
  4599. //----------------------------------------------------------------------------
  4600. //
  4601. // Information about a module.
  4602. //
  4603. // Flags.
  4604. #define DEBUG_MODULE_LOADED 0x00000000
  4605. #define DEBUG_MODULE_UNLOADED 0x00000001
  4606. // Symbol types.
  4607. #define DEBUG_SYMTYPE_NONE 0
  4608. #define DEBUG_SYMTYPE_COFF 1
  4609. #define DEBUG_SYMTYPE_CODEVIEW 2
  4610. #define DEBUG_SYMTYPE_PDB 3
  4611. #define DEBUG_SYMTYPE_EXPORT 4
  4612. #define DEBUG_SYMTYPE_DEFERRED 5
  4613. #define DEBUG_SYMTYPE_SYM 6
  4614. #define DEBUG_SYMTYPE_DIA 7
  4615. typedef struct _DEBUG_MODULE_PARAMETERS
  4616. {
  4617. ULONG64 Base;
  4618. ULONG Size;
  4619. ULONG TimeDateStamp;
  4620. ULONG Checksum;
  4621. ULONG Flags;
  4622. ULONG SymbolType;
  4623. ULONG ImageNameSize;
  4624. ULONG ModuleNameSize;
  4625. ULONG LoadedImageNameSize;
  4626. ULONG SymbolFileNameSize;
  4627. ULONG MappedImageNameSize;
  4628. ULONG64 Reserved[2];
  4629. } DEBUG_MODULE_PARAMETERS, *PDEBUG_MODULE_PARAMETERS;
  4630. // Scope arguments are function arguments
  4631. // and thus only change when the scope
  4632. // crosses functions.
  4633. #define DEBUG_SCOPE_GROUP_ARGUMENTS 0x00000001
  4634. // Scope locals are locals declared in a particular
  4635. // scope and are only defined within that scope.
  4636. #define DEBUG_SCOPE_GROUP_LOCALS 0x00000002
  4637. // All symbols in the scope.
  4638. #define DEBUG_SCOPE_GROUP_ALL 0x00000003
  4639. // Typed data output control flags.
  4640. #define DEBUG_OUTTYPE_DEFAULT 0x00000000
  4641. #define DEBUG_OUTTYPE_NO_INDENT 0x00000001
  4642. #define DEBUG_OUTTYPE_NO_OFFSET 0x00000002
  4643. #define DEBUG_OUTTYPE_VERBOSE 0x00000004
  4644. #define DEBUG_OUTTYPE_COMPACT_OUTPUT 0x00000008
  4645. #define DEBUG_OUTTYPE_RECURSION_LEVEL(Max) (((Max) & 0xf) << 4)
  4646. #define DEBUG_OUTTYPE_ADDRESS_OF_FIELD 0x00010000
  4647. #define DEBUG_OUTTYPE_ADDRESS_AT_END 0x00020000
  4648. #define DEBUG_OUTTYPE_BLOCK_RECURSE 0x00200000
  4649. // FindSourceFile flags.
  4650. #define DEBUG_FIND_SOURCE_DEFAULT 0x00000000
  4651. // Returns fully-qualified paths only. If this
  4652. // is not set the path returned may be relative.
  4653. #define DEBUG_FIND_SOURCE_FULL_PATH 0x00000001
  4654. // Scans all the path elements for a match and
  4655. // returns the one that has the most similarity
  4656. // between the given file and the matching element.
  4657. #define DEBUG_FIND_SOURCE_BEST_MATCH 0x00000002
  4658. // A special value marking an offset that should not
  4659. // be treated as a valid offset. This is only used
  4660. // in special situations where it is unlikely that
  4661. // this value would be a valid offset.
  4662. #define DEBUG_INVALID_OFFSET ((ULONG64)-1)
  4663. #undef INTERFACE
  4664. #define INTERFACE IDebugSymbols
  4665. DECLARE_INTERFACE_(IDebugSymbols, IUnknown)
  4666. {
  4667. // IUnknown.
  4668. STDMETHOD(QueryInterface)(
  4669. THIS_
  4670. IN REFIID InterfaceId,
  4671. OUT PVOID* Interface
  4672. ) PURE;
  4673. STDMETHOD_(ULONG, AddRef)(
  4674. THIS
  4675. ) PURE;
  4676. STDMETHOD_(ULONG, Release)(
  4677. THIS
  4678. ) PURE;
  4679. // IDebugSymbols.
  4680. // Controls the symbol options used during
  4681. // symbol operations.
  4682. // Uses the same flags as dbghelps SymSetOptions.
  4683. STDMETHOD(GetSymbolOptions)(
  4684. THIS_
  4685. OUT PULONG Options
  4686. ) PURE;
  4687. STDMETHOD(AddSymbolOptions)(
  4688. THIS_
  4689. IN ULONG Options
  4690. ) PURE;
  4691. STDMETHOD(RemoveSymbolOptions)(
  4692. THIS_
  4693. IN ULONG Options
  4694. ) PURE;
  4695. STDMETHOD(SetSymbolOptions)(
  4696. THIS_
  4697. IN ULONG Options
  4698. ) PURE;
  4699. STDMETHOD(GetNameByOffset)(
  4700. THIS_
  4701. IN ULONG64 Offset,
  4702. OUT OPTIONAL PSTR NameBuffer,
  4703. IN ULONG NameBufferSize,
  4704. OUT OPTIONAL PULONG NameSize,
  4705. OUT OPTIONAL PULONG64 Displacement
  4706. ) PURE;
  4707. // A symbol name may not be unique, particularly
  4708. // when overloaded functions exist which all
  4709. // have the same name. If GetOffsetByName
  4710. // finds multiple matches for the name it
  4711. // can return any one of them. In that
  4712. // case it will return S_FALSE to indicate
  4713. // that ambiguity was arbitrarily resolved.
  4714. // A caller can then use SearchSymbols to
  4715. // find all of the matches if it wishes to
  4716. // perform different disambiguation.
  4717. STDMETHOD(GetOffsetByName)(
  4718. THIS_
  4719. IN PCSTR Symbol,
  4720. OUT PULONG64 Offset
  4721. ) PURE;
  4722. // GetNearNameByOffset returns symbols
  4723. // located near the symbol closest to
  4724. // to the offset, such as the previous
  4725. // or next symbol. If Delta is zero it
  4726. // operates identically to GetNameByOffset.
  4727. // If Delta is nonzero and such a symbol
  4728. // does not exist an error is returned.
  4729. // The next symbol, if one exists, will
  4730. // always have a higher offset than the
  4731. // input offset so the displacement is
  4732. // always negative. The situation is
  4733. // reversed for the previous symbol.
  4734. STDMETHOD(GetNearNameByOffset)(
  4735. THIS_
  4736. IN ULONG64 Offset,
  4737. IN LONG Delta,
  4738. OUT OPTIONAL PSTR NameBuffer,
  4739. IN ULONG NameBufferSize,
  4740. OUT OPTIONAL PULONG NameSize,
  4741. OUT OPTIONAL PULONG64 Displacement
  4742. ) PURE;
  4743. STDMETHOD(GetLineByOffset)(
  4744. THIS_
  4745. IN ULONG64 Offset,
  4746. OUT OPTIONAL PULONG Line,
  4747. OUT OPTIONAL PSTR FileBuffer,
  4748. IN ULONG FileBufferSize,
  4749. OUT OPTIONAL PULONG FileSize,
  4750. OUT OPTIONAL PULONG64 Displacement
  4751. ) PURE;
  4752. STDMETHOD(GetOffsetByLine)(
  4753. THIS_
  4754. IN ULONG Line,
  4755. IN PCSTR File,
  4756. OUT PULONG64 Offset
  4757. ) PURE;
  4758. // Enumerates the engines list of modules
  4759. // loaded for the current process. This may
  4760. // or may not match the system module list
  4761. // for the process. Reload can be used to
  4762. // synchronize the engines list with the system
  4763. // if necessary.
  4764. // Some sessions also track recently unloaded
  4765. // code modules for help in analyzing failures
  4766. // where an attempt is made to call unloaded code.
  4767. // These modules are indexed after the loaded
  4768. // modules.
  4769. STDMETHOD(GetNumberModules)(
  4770. THIS_
  4771. OUT PULONG Loaded,
  4772. OUT PULONG Unloaded
  4773. ) PURE;
  4774. STDMETHOD(GetModuleByIndex)(
  4775. THIS_
  4776. IN ULONG Index,
  4777. OUT PULONG64 Base
  4778. ) PURE;
  4779. // The module name may not be unique.
  4780. // This method returns the first match.
  4781. STDMETHOD(GetModuleByModuleName)(
  4782. THIS_
  4783. IN PCSTR Name,
  4784. IN ULONG StartIndex,
  4785. OUT OPTIONAL PULONG Index,
  4786. OUT OPTIONAL PULONG64 Base
  4787. ) PURE;
  4788. // Offset can be any offset within
  4789. // the module extent. Extents may
  4790. // not be unique when including unloaded
  4791. // drivers. This method returns the
  4792. // first match.
  4793. STDMETHOD(GetModuleByOffset)(
  4794. THIS_
  4795. IN ULONG64 Offset,
  4796. IN ULONG StartIndex,
  4797. OUT OPTIONAL PULONG Index,
  4798. OUT OPTIONAL PULONG64 Base
  4799. ) PURE;
  4800. // If Index is DEBUG_ANY_ID the base address
  4801. // is used to look up the module instead.
  4802. STDMETHOD(GetModuleNames)(
  4803. THIS_
  4804. IN ULONG Index,
  4805. IN ULONG64 Base,
  4806. OUT OPTIONAL PSTR ImageNameBuffer,
  4807. IN ULONG ImageNameBufferSize,
  4808. OUT OPTIONAL PULONG ImageNameSize,
  4809. OUT OPTIONAL PSTR ModuleNameBuffer,
  4810. IN ULONG ModuleNameBufferSize,
  4811. OUT OPTIONAL PULONG ModuleNameSize,
  4812. OUT OPTIONAL PSTR LoadedImageNameBuffer,
  4813. IN ULONG LoadedImageNameBufferSize,
  4814. OUT OPTIONAL PULONG LoadedImageNameSize
  4815. ) PURE;
  4816. STDMETHOD(GetModuleParameters)(
  4817. THIS_
  4818. IN ULONG Count,
  4819. IN OPTIONAL /* size_is(Count) */ PULONG64 Bases,
  4820. IN ULONG Start,
  4821. OUT /* size_is(Count) */ PDEBUG_MODULE_PARAMETERS Params
  4822. ) PURE;
  4823. // Looks up the module from a <Module>!<Symbol>
  4824. // string.
  4825. STDMETHOD(GetSymbolModule)(
  4826. THIS_
  4827. IN PCSTR Symbol,
  4828. OUT PULONG64 Base
  4829. ) PURE;
  4830. // Returns the string name of a type.
  4831. STDMETHOD(GetTypeName)(
  4832. THIS_
  4833. IN ULONG64 Module,
  4834. IN ULONG TypeId,
  4835. OUT OPTIONAL PSTR NameBuffer,
  4836. IN ULONG NameBufferSize,
  4837. OUT OPTIONAL PULONG NameSize
  4838. ) PURE;
  4839. // Returns the ID for a type name.
  4840. STDMETHOD(GetTypeId)(
  4841. THIS_
  4842. IN ULONG64 Module,
  4843. IN PCSTR Name,
  4844. OUT PULONG TypeId
  4845. ) PURE;
  4846. STDMETHOD(GetTypeSize)(
  4847. THIS_
  4848. IN ULONG64 Module,
  4849. IN ULONG TypeId,
  4850. OUT PULONG Size
  4851. ) PURE;
  4852. // Given a type which can contain members
  4853. // this method returns the offset of a
  4854. // particular member within the type.
  4855. // TypeId should give the container type ID
  4856. // and Field gives the dot-separated path
  4857. // to the field of interest.
  4858. STDMETHOD(GetFieldOffset)(
  4859. THIS_
  4860. IN ULONG64 Module,
  4861. IN ULONG TypeId,
  4862. IN PCSTR Field,
  4863. OUT PULONG Offset
  4864. ) PURE;
  4865. STDMETHOD(GetSymbolTypeId)(
  4866. THIS_
  4867. IN PCSTR Symbol,
  4868. OUT PULONG TypeId,
  4869. OUT OPTIONAL PULONG64 Module
  4870. ) PURE;
  4871. // As with GetOffsetByName a symbol's
  4872. // name may be ambiguous. GetOffsetTypeId
  4873. // returns the type for the symbol closest
  4874. // to the given offset and can be used
  4875. // to avoid ambiguity.
  4876. STDMETHOD(GetOffsetTypeId)(
  4877. THIS_
  4878. IN ULONG64 Offset,
  4879. OUT PULONG TypeId,
  4880. OUT OPTIONAL PULONG64 Module
  4881. ) PURE;
  4882. // Helpers for virtual and physical data
  4883. // which combine creation of a location with
  4884. // the actual operation.
  4885. STDMETHOD(ReadTypedDataVirtual)(
  4886. THIS_
  4887. IN ULONG64 Offset,
  4888. IN ULONG64 Module,
  4889. IN ULONG TypeId,
  4890. OUT PVOID Buffer,
  4891. IN ULONG BufferSize,
  4892. OUT OPTIONAL PULONG BytesRead
  4893. ) PURE;
  4894. STDMETHOD(WriteTypedDataVirtual)(
  4895. THIS_
  4896. IN ULONG64 Offset,
  4897. IN ULONG64 Module,
  4898. IN ULONG TypeId,
  4899. IN PVOID Buffer,
  4900. IN ULONG BufferSize,
  4901. OUT OPTIONAL PULONG BytesWritten
  4902. ) PURE;
  4903. STDMETHOD(OutputTypedDataVirtual)(
  4904. THIS_
  4905. IN ULONG OutputControl,
  4906. IN ULONG64 Offset,
  4907. IN ULONG64 Module,
  4908. IN ULONG TypeId,
  4909. IN ULONG Flags
  4910. ) PURE;
  4911. STDMETHOD(ReadTypedDataPhysical)(
  4912. THIS_
  4913. IN ULONG64 Offset,
  4914. IN ULONG64 Module,
  4915. IN ULONG TypeId,
  4916. OUT PVOID Buffer,
  4917. IN ULONG BufferSize,
  4918. OUT OPTIONAL PULONG BytesRead
  4919. ) PURE;
  4920. STDMETHOD(WriteTypedDataPhysical)(
  4921. THIS_
  4922. IN ULONG64 Offset,
  4923. IN ULONG64 Module,
  4924. IN ULONG TypeId,
  4925. IN PVOID Buffer,
  4926. IN ULONG BufferSize,
  4927. OUT OPTIONAL PULONG BytesWritten
  4928. ) PURE;
  4929. STDMETHOD(OutputTypedDataPhysical)(
  4930. THIS_
  4931. IN ULONG OutputControl,
  4932. IN ULONG64 Offset,
  4933. IN ULONG64 Module,
  4934. IN ULONG TypeId,
  4935. IN ULONG Flags
  4936. ) PURE;
  4937. // Function arguments and scope block symbols
  4938. // can be retrieved relative to currently
  4939. // executing code. A caller can provide just
  4940. // a code offset for scoping purposes and look
  4941. // up names or the caller can provide a full frame
  4942. // and look up actual values. The values for
  4943. // scoped symbols are best-guess and may or may not
  4944. // be accurate depending on program optimizations,
  4945. // the machine architecture, the current point
  4946. // in the programs execution and so on.
  4947. // A caller can also provide a complete register
  4948. // context for setting a scope to a previous
  4949. // machine state such as a context saved for
  4950. // an exception. Usually this isnt necessary
  4951. // and the current register context is used.
  4952. STDMETHOD(GetScope)(
  4953. THIS_
  4954. OUT OPTIONAL PULONG64 InstructionOffset,
  4955. OUT OPTIONAL PDEBUG_STACK_FRAME ScopeFrame,
  4956. OUT OPTIONAL PVOID ScopeContext,
  4957. IN ULONG ScopeContextSize
  4958. ) PURE;
  4959. // If ScopeFrame or ScopeContext is non-NULL then
  4960. // InstructionOffset is ignored.
  4961. // If ScopeContext is NULL the current
  4962. // register context is used.
  4963. // If the scope identified by the given
  4964. // information is the same as before
  4965. // SetScope returns S_OK. If the scope
  4966. // information changes, such as when the
  4967. // scope moves between functions or scope
  4968. // blocks, SetScope returns S_FALSE.
  4969. STDMETHOD(SetScope)(
  4970. THIS_
  4971. IN ULONG64 InstructionOffset,
  4972. IN OPTIONAL PDEBUG_STACK_FRAME ScopeFrame,
  4973. IN OPTIONAL PVOID ScopeContext,
  4974. IN ULONG ScopeContextSize
  4975. ) PURE;
  4976. // ResetScope clears the scope information
  4977. // for situations where scoped symbols
  4978. // mask global symbols or when resetting
  4979. // from explicit information to the current
  4980. // information.
  4981. STDMETHOD(ResetScope)(
  4982. THIS
  4983. ) PURE;
  4984. // A scope symbol is tied to its particular
  4985. // scope and only is meaningful within the scope.
  4986. // The returned group can be updated by passing it back
  4987. // into the method for lower-cost
  4988. // incremental updates when stepping.
  4989. STDMETHOD(GetScopeSymbolGroup)(
  4990. THIS_
  4991. IN ULONG Flags,
  4992. IN OPTIONAL PDEBUG_SYMBOL_GROUP Update,
  4993. OUT PDEBUG_SYMBOL_GROUP* Symbols
  4994. ) PURE;
  4995. // Create a new symbol group.
  4996. STDMETHOD(CreateSymbolGroup)(
  4997. THIS_
  4998. OUT PDEBUG_SYMBOL_GROUP* Group
  4999. ) PURE;
  5000. // StartSymbolMatch matches symbol names
  5001. // against the given pattern using simple
  5002. // regular expressions. The search results
  5003. // are iterated through using GetNextSymbolMatch.
  5004. // When the caller is done examining results
  5005. // the match should be freed via EndSymbolMatch.
  5006. // If the match pattern contains a module name
  5007. // the search is restricted to a single module.
  5008. // Pattern matching is only done on symbol names,
  5009. // not module names.
  5010. // All active symbol match handles are invalidated
  5011. // when the set of loaded symbols changes.
  5012. STDMETHOD(StartSymbolMatch)(
  5013. THIS_
  5014. IN PCSTR Pattern,
  5015. OUT PULONG64 Handle
  5016. ) PURE;
  5017. // If Buffer is NULL the match does not
  5018. // advance.
  5019. STDMETHOD(GetNextSymbolMatch)(
  5020. THIS_
  5021. IN ULONG64 Handle,
  5022. OUT OPTIONAL PSTR Buffer,
  5023. IN ULONG BufferSize,
  5024. OUT OPTIONAL PULONG MatchSize,
  5025. OUT OPTIONAL PULONG64 Offset
  5026. ) PURE;
  5027. STDMETHOD(EndSymbolMatch)(
  5028. THIS_
  5029. IN ULONG64 Handle
  5030. ) PURE;
  5031. STDMETHOD(Reload)(
  5032. THIS_
  5033. IN PCSTR Module
  5034. ) PURE;
  5035. STDMETHOD(GetSymbolPath)(
  5036. THIS_
  5037. OUT OPTIONAL PSTR Buffer,
  5038. IN ULONG BufferSize,
  5039. OUT OPTIONAL PULONG PathSize
  5040. ) PURE;
  5041. STDMETHOD(SetSymbolPath)(
  5042. THIS_
  5043. IN PCSTR Path
  5044. ) PURE;
  5045. STDMETHOD(AppendSymbolPath)(
  5046. THIS_
  5047. IN PCSTR Addition
  5048. ) PURE;
  5049. // Manipulate the path for executable images.
  5050. // Some dump files need to load executable images
  5051. // in order to resolve dump information. This
  5052. // path controls where the engine looks for
  5053. // images.
  5054. STDMETHOD(GetImagePath)(
  5055. THIS_
  5056. OUT OPTIONAL PSTR Buffer,
  5057. IN ULONG BufferSize,
  5058. OUT OPTIONAL PULONG PathSize
  5059. ) PURE;
  5060. STDMETHOD(SetImagePath)(
  5061. THIS_
  5062. IN PCSTR Path
  5063. ) PURE;
  5064. STDMETHOD(AppendImagePath)(
  5065. THIS_
  5066. IN PCSTR Addition
  5067. ) PURE;
  5068. // Path routines for source file location
  5069. // methods.
  5070. STDMETHOD(GetSourcePath)(
  5071. THIS_
  5072. OUT OPTIONAL PSTR Buffer,
  5073. IN ULONG BufferSize,
  5074. OUT OPTIONAL PULONG PathSize
  5075. ) PURE;
  5076. // Gets the nth part of the source path.
  5077. STDMETHOD(GetSourcePathElement)(
  5078. THIS_
  5079. IN ULONG Index,
  5080. OUT OPTIONAL PSTR Buffer,
  5081. IN ULONG BufferSize,
  5082. OUT OPTIONAL PULONG ElementSize
  5083. ) PURE;
  5084. STDMETHOD(SetSourcePath)(
  5085. THIS_
  5086. IN PCSTR Path
  5087. ) PURE;
  5088. STDMETHOD(AppendSourcePath)(
  5089. THIS_
  5090. IN PCSTR Addition
  5091. ) PURE;
  5092. // Uses the given file path and the source path
  5093. // information to try and locate an existing file.
  5094. // The given file path is merged with elements
  5095. // of the source path and checked for existence.
  5096. // If a match is found the element used is returned.
  5097. // A starting element can be specified to restrict
  5098. // the search to a subset of the path elements;
  5099. // this can be useful when checking for multiple
  5100. // matches along the source path.
  5101. // The returned element can be 1, indicating
  5102. // the file was found directly and not on the path.
  5103. STDMETHOD(FindSourceFile)(
  5104. THIS_
  5105. IN ULONG StartElement,
  5106. IN PCSTR File,
  5107. IN ULONG Flags,
  5108. OUT OPTIONAL PULONG FoundElement,
  5109. OUT OPTIONAL PSTR Buffer,
  5110. IN ULONG BufferSize,
  5111. OUT OPTIONAL PULONG FoundSize
  5112. ) PURE;
  5113. // Retrieves all the line offset information
  5114. // for a particular source file. Buffer is
  5115. // first intialized to DEBUG_INVALID_OFFSET for
  5116. // every entry. Then for each piece of line
  5117. // symbol information Buffer[Line] set to
  5118. // Lines offset. This produces a per-line
  5119. // map of the offsets for the lines of the
  5120. // given file. Line numbers are decremented
  5121. // for the map so Buffer[0] contains the offset
  5122. // for line number 1.
  5123. // If there is no line information at all for
  5124. // the given file the method fails rather
  5125. // than returning a map of invalid offsets.
  5126. STDMETHOD(GetSourceFileLineOffsets)(
  5127. THIS_
  5128. IN PCSTR File,
  5129. OUT OPTIONAL /* size_is(BufferLines) */ PULONG64 Buffer,
  5130. IN ULONG BufferLines,
  5131. OUT OPTIONAL PULONG FileLines
  5132. ) PURE;
  5133. };
  5134. //
  5135. // GetModuleNameString strings.
  5136. //
  5137. #define DEBUG_MODNAME_IMAGE 0x00000000
  5138. #define DEBUG_MODNAME_MODULE 0x00000001
  5139. #define DEBUG_MODNAME_LOADED_IMAGE 0x00000002
  5140. #define DEBUG_MODNAME_SYMBOL_FILE 0x00000003
  5141. #define DEBUG_MODNAME_MAPPED_IMAGE 0x00000004
  5142. //
  5143. // Type options, used with Get/SetTypeOptions.
  5144. //
  5145. // Display PUSHORT and USHORT arrays in UNICODE
  5146. #define DEBUG_TYPEOPTS_UNICODE_DISPLAY 0x00000001
  5147. #undef INTERFACE
  5148. #define INTERFACE IDebugSymbols2
  5149. DECLARE_INTERFACE_(IDebugSymbols2, IUnknown)
  5150. {
  5151. // IUnknown.
  5152. STDMETHOD(QueryInterface)(
  5153. THIS_
  5154. IN REFIID InterfaceId,
  5155. OUT PVOID* Interface
  5156. ) PURE;
  5157. STDMETHOD_(ULONG, AddRef)(
  5158. THIS
  5159. ) PURE;
  5160. STDMETHOD_(ULONG, Release)(
  5161. THIS
  5162. ) PURE;
  5163. // IDebugSymbols.
  5164. // Controls the symbol options used during
  5165. // symbol operations.
  5166. // Uses the same flags as dbghelps SymSetOptions.
  5167. STDMETHOD(GetSymbolOptions)(
  5168. THIS_
  5169. OUT PULONG Options
  5170. ) PURE;
  5171. STDMETHOD(AddSymbolOptions)(
  5172. THIS_
  5173. IN ULONG Options
  5174. ) PURE;
  5175. STDMETHOD(RemoveSymbolOptions)(
  5176. THIS_
  5177. IN ULONG Options
  5178. ) PURE;
  5179. STDMETHOD(SetSymbolOptions)(
  5180. THIS_
  5181. IN ULONG Options
  5182. ) PURE;
  5183. STDMETHOD(GetNameByOffset)(
  5184. THIS_
  5185. IN ULONG64 Offset,
  5186. OUT OPTIONAL PSTR NameBuffer,
  5187. IN ULONG NameBufferSize,
  5188. OUT OPTIONAL PULONG NameSize,
  5189. OUT OPTIONAL PULONG64 Displacement
  5190. ) PURE;
  5191. // A symbol name may not be unique, particularly
  5192. // when overloaded functions exist which all
  5193. // have the same name. If GetOffsetByName
  5194. // finds multiple matches for the name it
  5195. // can return any one of them. In that
  5196. // case it will return S_FALSE to indicate
  5197. // that ambiguity was arbitrarily resolved.
  5198. // A caller can then use SearchSymbols to
  5199. // find all of the matches if it wishes to
  5200. // perform different disambiguation.
  5201. STDMETHOD(GetOffsetByName)(
  5202. THIS_
  5203. IN PCSTR Symbol,
  5204. OUT PULONG64 Offset
  5205. ) PURE;
  5206. // GetNearNameByOffset returns symbols
  5207. // located near the symbol closest to
  5208. // to the offset, such as the previous
  5209. // or next symbol. If Delta is zero it
  5210. // operates identically to GetNameByOffset.
  5211. // If Delta is nonzero and such a symbol
  5212. // does not exist an error is returned.
  5213. // The next symbol, if one exists, will
  5214. // always have a higher offset than the
  5215. // input offset so the displacement is
  5216. // always negative. The situation is
  5217. // reversed for the previous symbol.
  5218. STDMETHOD(GetNearNameByOffset)(
  5219. THIS_
  5220. IN ULONG64 Offset,
  5221. IN LONG Delta,
  5222. OUT OPTIONAL PSTR NameBuffer,
  5223. IN ULONG NameBufferSize,
  5224. OUT OPTIONAL PULONG NameSize,
  5225. OUT OPTIONAL PULONG64 Displacement
  5226. ) PURE;
  5227. STDMETHOD(GetLineByOffset)(
  5228. THIS_
  5229. IN ULONG64 Offset,
  5230. OUT OPTIONAL PULONG Line,
  5231. OUT OPTIONAL PSTR FileBuffer,
  5232. IN ULONG FileBufferSize,
  5233. OUT OPTIONAL PULONG FileSize,
  5234. OUT OPTIONAL PULONG64 Displacement
  5235. ) PURE;
  5236. STDMETHOD(GetOffsetByLine)(
  5237. THIS_
  5238. IN ULONG Line,
  5239. IN PCSTR File,
  5240. OUT PULONG64 Offset
  5241. ) PURE;
  5242. // Enumerates the engines list of modules
  5243. // loaded for the current process. This may
  5244. // or may not match the system module list
  5245. // for the process. Reload can be used to
  5246. // synchronize the engines list with the system
  5247. // if necessary.
  5248. // Some sessions also track recently unloaded
  5249. // code modules for help in analyzing failures
  5250. // where an attempt is made to call unloaded code.
  5251. // These modules are indexed after the loaded
  5252. // modules.
  5253. STDMETHOD(GetNumberModules)(
  5254. THIS_
  5255. OUT PULONG Loaded,
  5256. OUT PULONG Unloaded
  5257. ) PURE;
  5258. STDMETHOD(GetModuleByIndex)(
  5259. THIS_
  5260. IN ULONG Index,
  5261. OUT PULONG64 Base
  5262. ) PURE;
  5263. // The module name may not be unique.
  5264. // This method returns the first match.
  5265. STDMETHOD(GetModuleByModuleName)(
  5266. THIS_
  5267. IN PCSTR Name,
  5268. IN ULONG StartIndex,
  5269. OUT OPTIONAL PULONG Index,
  5270. OUT OPTIONAL PULONG64 Base
  5271. ) PURE;
  5272. // Offset can be any offset within
  5273. // the module extent. Extents may
  5274. // not be unique when including unloaded
  5275. // drivers. This method returns the
  5276. // first match.
  5277. STDMETHOD(GetModuleByOffset)(
  5278. THIS_
  5279. IN ULONG64 Offset,
  5280. IN ULONG StartIndex,
  5281. OUT OPTIONAL PULONG Index,
  5282. OUT OPTIONAL PULONG64 Base
  5283. ) PURE;
  5284. // If Index is DEBUG_ANY_ID the base address
  5285. // is used to look up the module instead.
  5286. STDMETHOD(GetModuleNames)(
  5287. THIS_
  5288. IN ULONG Index,
  5289. IN ULONG64 Base,
  5290. OUT OPTIONAL PSTR ImageNameBuffer,
  5291. IN ULONG ImageNameBufferSize,
  5292. OUT OPTIONAL PULONG ImageNameSize,
  5293. OUT OPTIONAL PSTR ModuleNameBuffer,
  5294. IN ULONG ModuleNameBufferSize,
  5295. OUT OPTIONAL PULONG ModuleNameSize,
  5296. OUT OPTIONAL PSTR LoadedImageNameBuffer,
  5297. IN ULONG LoadedImageNameBufferSize,
  5298. OUT OPTIONAL PULONG LoadedImageNameSize
  5299. ) PURE;
  5300. STDMETHOD(GetModuleParameters)(
  5301. THIS_
  5302. IN ULONG Count,
  5303. IN OPTIONAL /* size_is(Count) */ PULONG64 Bases,
  5304. IN ULONG Start,
  5305. OUT /* size_is(Count) */ PDEBUG_MODULE_PARAMETERS Params
  5306. ) PURE;
  5307. // Looks up the module from a <Module>!<Symbol>
  5308. // string.
  5309. STDMETHOD(GetSymbolModule)(
  5310. THIS_
  5311. IN PCSTR Symbol,
  5312. OUT PULONG64 Base
  5313. ) PURE;
  5314. // Returns the string name of a type.
  5315. STDMETHOD(GetTypeName)(
  5316. THIS_
  5317. IN ULONG64 Module,
  5318. IN ULONG TypeId,
  5319. OUT OPTIONAL PSTR NameBuffer,
  5320. IN ULONG NameBufferSize,
  5321. OUT OPTIONAL PULONG NameSize
  5322. ) PURE;
  5323. // Returns the ID for a type name.
  5324. STDMETHOD(GetTypeId)(
  5325. THIS_
  5326. IN ULONG64 Module,
  5327. IN PCSTR Name,
  5328. OUT PULONG TypeId
  5329. ) PURE;
  5330. STDMETHOD(GetTypeSize)(
  5331. THIS_
  5332. IN ULONG64 Module,
  5333. IN ULONG TypeId,
  5334. OUT PULONG Size
  5335. ) PURE;
  5336. // Given a type which can contain members
  5337. // this method returns the offset of a
  5338. // particular member within the type.
  5339. // TypeId should give the container type ID
  5340. // and Field gives the dot-separated path
  5341. // to the field of interest.
  5342. STDMETHOD(GetFieldOffset)(
  5343. THIS_
  5344. IN ULONG64 Module,
  5345. IN ULONG TypeId,
  5346. IN PCSTR Field,
  5347. OUT PULONG Offset
  5348. ) PURE;
  5349. STDMETHOD(GetSymbolTypeId)(
  5350. THIS_
  5351. IN PCSTR Symbol,
  5352. OUT PULONG TypeId,
  5353. OUT OPTIONAL PULONG64 Module
  5354. ) PURE;
  5355. // As with GetOffsetByName a symbol's
  5356. // name may be ambiguous. GetOffsetTypeId
  5357. // returns the type for the symbol closest
  5358. // to the given offset and can be used
  5359. // to avoid ambiguity.
  5360. STDMETHOD(GetOffsetTypeId)(
  5361. THIS_
  5362. IN ULONG64 Offset,
  5363. OUT PULONG TypeId,
  5364. OUT OPTIONAL PULONG64 Module
  5365. ) PURE;
  5366. // Helpers for virtual and physical data
  5367. // which combine creation of a location with
  5368. // the actual operation.
  5369. STDMETHOD(ReadTypedDataVirtual)(
  5370. THIS_
  5371. IN ULONG64 Offset,
  5372. IN ULONG64 Module,
  5373. IN ULONG TypeId,
  5374. OUT PVOID Buffer,
  5375. IN ULONG BufferSize,
  5376. OUT OPTIONAL PULONG BytesRead
  5377. ) PURE;
  5378. STDMETHOD(WriteTypedDataVirtual)(
  5379. THIS_
  5380. IN ULONG64 Offset,
  5381. IN ULONG64 Module,
  5382. IN ULONG TypeId,
  5383. IN PVOID Buffer,
  5384. IN ULONG BufferSize,
  5385. OUT OPTIONAL PULONG BytesWritten
  5386. ) PURE;
  5387. STDMETHOD(OutputTypedDataVirtual)(
  5388. THIS_
  5389. IN ULONG OutputControl,
  5390. IN ULONG64 Offset,
  5391. IN ULONG64 Module,
  5392. IN ULONG TypeId,
  5393. IN ULONG Flags
  5394. ) PURE;
  5395. STDMETHOD(ReadTypedDataPhysical)(
  5396. THIS_
  5397. IN ULONG64 Offset,
  5398. IN ULONG64 Module,
  5399. IN ULONG TypeId,
  5400. OUT PVOID Buffer,
  5401. IN ULONG BufferSize,
  5402. OUT OPTIONAL PULONG BytesRead
  5403. ) PURE;
  5404. STDMETHOD(WriteTypedDataPhysical)(
  5405. THIS_
  5406. IN ULONG64 Offset,
  5407. IN ULONG64 Module,
  5408. IN ULONG TypeId,
  5409. IN PVOID Buffer,
  5410. IN ULONG BufferSize,
  5411. OUT OPTIONAL PULONG BytesWritten
  5412. ) PURE;
  5413. STDMETHOD(OutputTypedDataPhysical)(
  5414. THIS_
  5415. IN ULONG OutputControl,
  5416. IN ULONG64 Offset,
  5417. IN ULONG64 Module,
  5418. IN ULONG TypeId,
  5419. IN ULONG Flags
  5420. ) PURE;
  5421. // Function arguments and scope block symbols
  5422. // can be retrieved relative to currently
  5423. // executing code. A caller can provide just
  5424. // a code offset for scoping purposes and look
  5425. // up names or the caller can provide a full frame
  5426. // and look up actual values. The values for
  5427. // scoped symbols are best-guess and may or may not
  5428. // be accurate depending on program optimizations,
  5429. // the machine architecture, the current point
  5430. // in the programs execution and so on.
  5431. // A caller can also provide a complete register
  5432. // context for setting a scope to a previous
  5433. // machine state such as a context saved for
  5434. // an exception. Usually this isnt necessary
  5435. // and the current register context is used.
  5436. STDMETHOD(GetScope)(
  5437. THIS_
  5438. OUT OPTIONAL PULONG64 InstructionOffset,
  5439. OUT OPTIONAL PDEBUG_STACK_FRAME ScopeFrame,
  5440. OUT OPTIONAL PVOID ScopeContext,
  5441. IN ULONG ScopeContextSize
  5442. ) PURE;
  5443. // If ScopeFrame or ScopeContext is non-NULL then
  5444. // InstructionOffset is ignored.
  5445. // If ScopeContext is NULL the current
  5446. // register context is used.
  5447. // If the scope identified by the given
  5448. // information is the same as before
  5449. // SetScope returns S_OK. If the scope
  5450. // information changes, such as when the
  5451. // scope moves between functions or scope
  5452. // blocks, SetScope returns S_FALSE.
  5453. STDMETHOD(SetScope)(
  5454. THIS_
  5455. IN ULONG64 InstructionOffset,
  5456. IN OPTIONAL PDEBUG_STACK_FRAME ScopeFrame,
  5457. IN OPTIONAL PVOID ScopeContext,
  5458. IN ULONG ScopeContextSize
  5459. ) PURE;
  5460. // ResetScope clears the scope information
  5461. // for situations where scoped symbols
  5462. // mask global symbols or when resetting
  5463. // from explicit information to the current
  5464. // information.
  5465. STDMETHOD(ResetScope)(
  5466. THIS
  5467. ) PURE;
  5468. // A scope symbol is tied to its particular
  5469. // scope and only is meaningful within the scope.
  5470. // The returned group can be updated by passing it back
  5471. // into the method for lower-cost
  5472. // incremental updates when stepping.
  5473. STDMETHOD(GetScopeSymbolGroup)(
  5474. THIS_
  5475. IN ULONG Flags,
  5476. IN OPTIONAL PDEBUG_SYMBOL_GROUP Update,
  5477. OUT PDEBUG_SYMBOL_GROUP* Symbols
  5478. ) PURE;
  5479. // Create a new symbol group.
  5480. STDMETHOD(CreateSymbolGroup)(
  5481. THIS_
  5482. OUT PDEBUG_SYMBOL_GROUP* Group
  5483. ) PURE;
  5484. // StartSymbolMatch matches symbol names
  5485. // against the given pattern using simple
  5486. // regular expressions. The search results
  5487. // are iterated through using GetNextSymbolMatch.
  5488. // When the caller is done examining results
  5489. // the match should be freed via EndSymbolMatch.
  5490. // If the match pattern contains a module name
  5491. // the search is restricted to a single module.
  5492. // Pattern matching is only done on symbol names,
  5493. // not module names.
  5494. // All active symbol match handles are invalidated
  5495. // when the set of loaded symbols changes.
  5496. STDMETHOD(StartSymbolMatch)(
  5497. THIS_
  5498. IN PCSTR Pattern,
  5499. OUT PULONG64 Handle
  5500. ) PURE;
  5501. // If Buffer is NULL the match does not
  5502. // advance.
  5503. STDMETHOD(GetNextSymbolMatch)(
  5504. THIS_
  5505. IN ULONG64 Handle,
  5506. OUT OPTIONAL PSTR Buffer,
  5507. IN ULONG BufferSize,
  5508. OUT OPTIONAL PULONG MatchSize,
  5509. OUT OPTIONAL PULONG64 Offset
  5510. ) PURE;
  5511. STDMETHOD(EndSymbolMatch)(
  5512. THIS_
  5513. IN ULONG64 Handle
  5514. ) PURE;
  5515. STDMETHOD(Reload)(
  5516. THIS_
  5517. IN PCSTR Module
  5518. ) PURE;
  5519. STDMETHOD(GetSymbolPath)(
  5520. THIS_
  5521. OUT OPTIONAL PSTR Buffer,
  5522. IN ULONG BufferSize,
  5523. OUT OPTIONAL PULONG PathSize
  5524. ) PURE;
  5525. STDMETHOD(SetSymbolPath)(
  5526. THIS_
  5527. IN PCSTR Path
  5528. ) PURE;
  5529. STDMETHOD(AppendSymbolPath)(
  5530. THIS_
  5531. IN PCSTR Addition
  5532. ) PURE;
  5533. // Manipulate the path for executable images.
  5534. // Some dump files need to load executable images
  5535. // in order to resolve dump information. This
  5536. // path controls where the engine looks for
  5537. // images.
  5538. STDMETHOD(GetImagePath)(
  5539. THIS_
  5540. OUT OPTIONAL PSTR Buffer,
  5541. IN ULONG BufferSize,
  5542. OUT OPTIONAL PULONG PathSize
  5543. ) PURE;
  5544. STDMETHOD(SetImagePath)(
  5545. THIS_
  5546. IN PCSTR Path
  5547. ) PURE;
  5548. STDMETHOD(AppendImagePath)(
  5549. THIS_
  5550. IN PCSTR Addition
  5551. ) PURE;
  5552. // Path routines for source file location
  5553. // methods.
  5554. STDMETHOD(GetSourcePath)(
  5555. THIS_
  5556. OUT OPTIONAL PSTR Buffer,
  5557. IN ULONG BufferSize,
  5558. OUT OPTIONAL PULONG PathSize
  5559. ) PURE;
  5560. // Gets the nth part of the source path.
  5561. STDMETHOD(GetSourcePathElement)(
  5562. THIS_
  5563. IN ULONG Index,
  5564. OUT OPTIONAL PSTR Buffer,
  5565. IN ULONG BufferSize,
  5566. OUT OPTIONAL PULONG ElementSize
  5567. ) PURE;
  5568. STDMETHOD(SetSourcePath)(
  5569. THIS_
  5570. IN PCSTR Path
  5571. ) PURE;
  5572. STDMETHOD(AppendSourcePath)(
  5573. THIS_
  5574. IN PCSTR Addition
  5575. ) PURE;
  5576. // Uses the given file path and the source path
  5577. // information to try and locate an existing file.
  5578. // The given file path is merged with elements
  5579. // of the source path and checked for existence.
  5580. // If a match is found the element used is returned.
  5581. // A starting element can be specified to restrict
  5582. // the search to a subset of the path elements;
  5583. // this can be useful when checking for multiple
  5584. // matches along the source path.
  5585. // The returned element can be 1, indicating
  5586. // the file was found directly and not on the path.
  5587. STDMETHOD(FindSourceFile)(
  5588. THIS_
  5589. IN ULONG StartElement,
  5590. IN PCSTR File,
  5591. IN ULONG Flags,
  5592. OUT OPTIONAL PULONG FoundElement,
  5593. OUT OPTIONAL PSTR Buffer,
  5594. IN ULONG BufferSize,
  5595. OUT OPTIONAL PULONG FoundSize
  5596. ) PURE;
  5597. // Retrieves all the line offset information
  5598. // for a particular source file. Buffer is
  5599. // first intialized to DEBUG_INVALID_OFFSET for
  5600. // every entry. Then for each piece of line
  5601. // symbol information Buffer[Line] set to
  5602. // Lines offset. This produces a per-line
  5603. // map of the offsets for the lines of the
  5604. // given file. Line numbers are decremented
  5605. // for the map so Buffer[0] contains the offset
  5606. // for line number 1.
  5607. // If there is no line information at all for
  5608. // the given file the method fails rather
  5609. // than returning a map of invalid offsets.
  5610. STDMETHOD(GetSourceFileLineOffsets)(
  5611. THIS_
  5612. IN PCSTR File,
  5613. OUT OPTIONAL /* size_is(BufferLines) */ PULONG64 Buffer,
  5614. IN ULONG BufferLines,
  5615. OUT OPTIONAL PULONG FileLines
  5616. ) PURE;
  5617. // IDebugSymbols2.
  5618. // If Index is DEBUG_ANY_ID the base address
  5619. // is used to look up the module instead.
  5620. // Item is specified as in VerQueryValue.
  5621. // Module version information is only
  5622. // available for loaded modules and may
  5623. // not be available in all debug sessions.
  5624. STDMETHOD(GetModuleVersionInformation)(
  5625. THIS_
  5626. IN ULONG Index,
  5627. IN ULONG64 Base,
  5628. IN PCSTR Item,
  5629. OUT OPTIONAL PVOID Buffer,
  5630. IN ULONG BufferSize,
  5631. OUT OPTIONAL PULONG VerInfoSize
  5632. ) PURE;
  5633. // Retrieves any available module name string
  5634. // such as module name or symbol file name.
  5635. // If Index is DEBUG_ANY_ID the base address
  5636. // is used to look up the module instead.
  5637. // If symbols are deferred an error will
  5638. // be returned.
  5639. // E_NOINTERFACE may be returned, indicating
  5640. // no information exists.
  5641. STDMETHOD(GetModuleNameString)(
  5642. THIS_
  5643. IN ULONG Which,
  5644. IN ULONG Index,
  5645. IN ULONG64 Base,
  5646. OUT OPTIONAL PSTR Buffer,
  5647. IN ULONG BufferSize,
  5648. OUT OPTIONAL PULONG NameSize
  5649. ) PURE;
  5650. // Returns the string name of a constant type.
  5651. STDMETHOD(GetConstantName)(
  5652. THIS_
  5653. IN ULONG64 Module,
  5654. IN ULONG TypeId,
  5655. IN ULONG64 Value,
  5656. OUT OPTIONAL PSTR NameBuffer,
  5657. IN ULONG NameBufferSize,
  5658. OUT OPTIONAL PULONG NameSize
  5659. ) PURE;
  5660. // Gets name of a field in a struct
  5661. // FieldNumber is 0 based index of field in a struct
  5662. // Method fails with E_INVALIDARG if FieldNumber is
  5663. // too high for the struct fields
  5664. STDMETHOD(GetFieldName)(
  5665. THIS_
  5666. IN ULONG64 Module,
  5667. IN ULONG TypeId,
  5668. IN ULONG FieldIndex,
  5669. OUT OPTIONAL PSTR NameBuffer,
  5670. IN ULONG NameBufferSize,
  5671. OUT OPTIONAL PULONG NameSize
  5672. ) PURE;
  5673. // Control options for typed values.
  5674. STDMETHOD(GetTypeOptions)(
  5675. THIS_
  5676. OUT PULONG Options
  5677. ) PURE;
  5678. STDMETHOD(AddTypeOptions)(
  5679. THIS_
  5680. IN ULONG Options
  5681. ) PURE;
  5682. STDMETHOD(RemoveTypeOptions)(
  5683. THIS_
  5684. IN ULONG Options
  5685. ) PURE;
  5686. STDMETHOD(SetTypeOptions)(
  5687. THIS_
  5688. IN ULONG Options
  5689. ) PURE;
  5690. };
  5691. //----------------------------------------------------------------------------
  5692. //
  5693. // IDebugSystemObjects
  5694. //
  5695. //----------------------------------------------------------------------------
  5696. #undef INTERFACE
  5697. #define INTERFACE IDebugSystemObjects
  5698. DECLARE_INTERFACE_(IDebugSystemObjects, IUnknown)
  5699. {
  5700. // IUnknown.
  5701. STDMETHOD(QueryInterface)(
  5702. THIS_
  5703. IN REFIID InterfaceId,
  5704. OUT PVOID* Interface
  5705. ) PURE;
  5706. STDMETHOD_(ULONG, AddRef)(
  5707. THIS
  5708. ) PURE;
  5709. STDMETHOD_(ULONG, Release)(
  5710. THIS
  5711. ) PURE;
  5712. // IDebugSystemObjects.
  5713. // In user mode debugging the debugger
  5714. // tracks all threads and processes and
  5715. // enumerates them through the following
  5716. // methods. When enumerating threads
  5717. // the threads are enumerated for the current
  5718. // process.
  5719. // Kernel mode debugging currently is
  5720. // limited to enumerating only the threads
  5721. // assigned to processors, not all of
  5722. // the threads in the system. Process
  5723. // enumeration is limited to a single
  5724. // virtual process representing kernel space.
  5725. // Returns the ID of the thread on which
  5726. // the last event occurred.
  5727. STDMETHOD(GetEventThread)(
  5728. THIS_
  5729. OUT PULONG Id
  5730. ) PURE;
  5731. STDMETHOD(GetEventProcess)(
  5732. THIS_
  5733. OUT PULONG Id
  5734. ) PURE;
  5735. // Controls implicit thread used by the
  5736. // debug engine. The debuggers current
  5737. // thread is just a piece of data held
  5738. // by the debugger for calls which use
  5739. // thread-specific information. In those
  5740. // calls the debuggers current thread is used.
  5741. // The debuggers current thread is not related
  5742. // to any system thread attribute.
  5743. // IDs for threads are small integer IDs
  5744. // maintained by the engine. They are not
  5745. // related to system thread IDs.
  5746. STDMETHOD(GetCurrentThreadId)(
  5747. THIS_
  5748. OUT PULONG Id
  5749. ) PURE;
  5750. STDMETHOD(SetCurrentThreadId)(
  5751. THIS_
  5752. IN ULONG Id
  5753. ) PURE;
  5754. // The current process is the process
  5755. // that owns the current thread.
  5756. STDMETHOD(GetCurrentProcessId)(
  5757. THIS_
  5758. OUT PULONG Id
  5759. ) PURE;
  5760. // Setting the current process automatically
  5761. // sets the current thread to the thread that
  5762. // was last current in that process.
  5763. STDMETHOD(SetCurrentProcessId)(
  5764. THIS_
  5765. IN ULONG Id
  5766. ) PURE;
  5767. // Gets the number of threads in the current process.
  5768. STDMETHOD(GetNumberThreads)(
  5769. THIS_
  5770. OUT PULONG Number
  5771. ) PURE;
  5772. // Gets thread count information for all processes
  5773. // and the largest number of threads in a single process.
  5774. STDMETHOD(GetTotalNumberThreads)(
  5775. THIS_
  5776. OUT PULONG Total,
  5777. OUT PULONG LargestProcess
  5778. ) PURE;
  5779. STDMETHOD(GetThreadIdsByIndex)(
  5780. THIS_
  5781. IN ULONG Start,
  5782. IN ULONG Count,
  5783. OUT OPTIONAL /* size_is(Count) */ PULONG Ids,
  5784. OUT OPTIONAL /* size_is(Count) */ PULONG SysIds
  5785. ) PURE;
  5786. // Gets the debugger ID for the thread
  5787. // currently running on the given
  5788. // processor. Only works in kernel
  5789. // debugging.
  5790. STDMETHOD(GetThreadIdByProcessor)(
  5791. THIS_
  5792. IN ULONG Processor,
  5793. OUT PULONG Id
  5794. ) PURE;
  5795. // Returns the offset of the current threads
  5796. // system data structure. When kernel debugging
  5797. // this is the offset of the KTHREAD.
  5798. // When user debugging it is the offset
  5799. // of the current TEB.
  5800. STDMETHOD(GetCurrentThreadDataOffset)(
  5801. THIS_
  5802. OUT PULONG64 Offset
  5803. ) PURE;
  5804. // Looks up a debugger thread ID for the given
  5805. // system thread data structure.
  5806. // Currently when kernel debugging this will fail
  5807. // if the thread is not executing on a processor.
  5808. STDMETHOD(GetThreadIdByDataOffset)(
  5809. THIS_
  5810. IN ULONG64 Offset,
  5811. OUT PULONG Id
  5812. ) PURE;
  5813. // Returns the offset of the current threads
  5814. // TEB. In user mode this is equivalent to
  5815. // the threads data offset.
  5816. STDMETHOD(GetCurrentThreadTeb)(
  5817. THIS_
  5818. OUT PULONG64 Offset
  5819. ) PURE;
  5820. // Looks up a debugger thread ID for the given TEB.
  5821. // Currently when kernel debugging this will fail
  5822. // if the thread is not executing on a processor.
  5823. STDMETHOD(GetThreadIdByTeb)(
  5824. THIS_
  5825. IN ULONG64 Offset,
  5826. OUT PULONG Id
  5827. ) PURE;
  5828. // Returns the system unique ID for the current thread.
  5829. // Not currently supported when kernel debugging.
  5830. STDMETHOD(GetCurrentThreadSystemId)(
  5831. THIS_
  5832. OUT PULONG SysId
  5833. ) PURE;
  5834. // Looks up a debugger thread ID for the given
  5835. // system thread ID.
  5836. // Currently when kernel debugging this will fail
  5837. // if the thread is not executing on a processor.
  5838. STDMETHOD(GetThreadIdBySystemId)(
  5839. THIS_
  5840. IN ULONG SysId,
  5841. OUT PULONG Id
  5842. ) PURE;
  5843. // Returns the handle of the current thread.
  5844. // In kernel mode the value returned is the
  5845. // index of the processor the thread is
  5846. // executing on plus one.
  5847. STDMETHOD(GetCurrentThreadHandle)(
  5848. THIS_
  5849. OUT PULONG64 Handle
  5850. ) PURE;
  5851. // Looks up a debugger thread ID for the given handle.
  5852. // Currently when kernel debugging this will fail
  5853. // if the thread is not executing on a processor.
  5854. STDMETHOD(GetThreadIdByHandle)(
  5855. THIS_
  5856. IN ULONG64 Handle,
  5857. OUT PULONG Id
  5858. ) PURE;
  5859. // Currently kernel mode sessions will only have
  5860. // a single process representing kernel space.
  5861. STDMETHOD(GetNumberProcesses)(
  5862. THIS_
  5863. OUT PULONG Number
  5864. ) PURE;
  5865. STDMETHOD(GetProcessIdsByIndex)(
  5866. THIS_
  5867. IN ULONG Start,
  5868. IN ULONG Count,
  5869. OUT OPTIONAL /* size_is(Count) */ PULONG Ids,
  5870. OUT OPTIONAL /* size_is(Count) */ PULONG SysIds
  5871. ) PURE;
  5872. // Returns the offset of the current processs
  5873. // system data structure. When kernel debugging
  5874. // this is the offset of the KPROCESS of
  5875. // the process that owns the current thread.
  5876. // When user debugging it is the offset
  5877. // of the current PEB.
  5878. STDMETHOD(GetCurrentProcessDataOffset)(
  5879. THIS_
  5880. OUT PULONG64 Offset
  5881. ) PURE;
  5882. // Looks up a debugger process ID for the given
  5883. // system process data structure.
  5884. // Not currently supported when kernel debugging.
  5885. STDMETHOD(GetProcessIdByDataOffset)(
  5886. THIS_
  5887. IN ULONG64 Offset,
  5888. OUT PULONG Id
  5889. ) PURE;
  5890. // Returns the offset of the current processs
  5891. // PEB. In user mode this is equivalent to
  5892. // the processs data offset.
  5893. STDMETHOD(GetCurrentProcessPeb)(
  5894. THIS_
  5895. OUT PULONG64 Offset
  5896. ) PURE;
  5897. // Looks up a debugger process ID for the given PEB.
  5898. // Not currently supported when kernel debugging.
  5899. STDMETHOD(GetProcessIdByPeb)(
  5900. THIS_
  5901. IN ULONG64 Offset,
  5902. OUT PULONG Id
  5903. ) PURE;
  5904. // Returns the system unique ID for the current process.
  5905. // Not currently supported when kernel debugging.
  5906. STDMETHOD(GetCurrentProcessSystemId)(
  5907. THIS_
  5908. OUT PULONG SysId
  5909. ) PURE;
  5910. // Looks up a debugger process ID for the given
  5911. // system process ID.
  5912. // Not currently supported when kernel debugging.
  5913. STDMETHOD(GetProcessIdBySystemId)(
  5914. THIS_
  5915. IN ULONG SysId,
  5916. OUT PULONG Id
  5917. ) PURE;
  5918. // Returns the handle of the current process.
  5919. // In kernel mode this is the kernel processs
  5920. // artificial handle used for symbol operations
  5921. // and so can only be used with dbghelp APIs.
  5922. STDMETHOD(GetCurrentProcessHandle)(
  5923. THIS_
  5924. OUT PULONG64 Handle
  5925. ) PURE;
  5926. // Looks up a debugger process ID for the given handle.
  5927. STDMETHOD(GetProcessIdByHandle)(
  5928. THIS_
  5929. IN ULONG64 Handle,
  5930. OUT PULONG Id
  5931. ) PURE;
  5932. // Retrieve the name of the executable loaded
  5933. // in the process. This may fail if no executable
  5934. // was identified.
  5935. STDMETHOD(GetCurrentProcessExecutableName)(
  5936. THIS_
  5937. OUT OPTIONAL PSTR Buffer,
  5938. IN ULONG BufferSize,
  5939. OUT OPTIONAL PULONG ExeSize
  5940. ) PURE;
  5941. };
  5942. #undef INTERFACE
  5943. #define INTERFACE IDebugSystemObjects2
  5944. DECLARE_INTERFACE_(IDebugSystemObjects2, IUnknown)
  5945. {
  5946. // IUnknown.
  5947. STDMETHOD(QueryInterface)(
  5948. THIS_
  5949. IN REFIID InterfaceId,
  5950. OUT PVOID* Interface
  5951. ) PURE;
  5952. STDMETHOD_(ULONG, AddRef)(
  5953. THIS
  5954. ) PURE;
  5955. STDMETHOD_(ULONG, Release)(
  5956. THIS
  5957. ) PURE;
  5958. // IDebugSystemObjects.
  5959. // In user mode debugging the debugger
  5960. // tracks all threads and processes and
  5961. // enumerates them through the following
  5962. // methods. When enumerating threads
  5963. // the threads are enumerated for the current
  5964. // process.
  5965. // Kernel mode debugging currently is
  5966. // limited to enumerating only the threads
  5967. // assigned to processors, not all of
  5968. // the threads in the system. Process
  5969. // enumeration is limited to a single
  5970. // virtual process representing kernel space.
  5971. // Returns the ID of the thread on which
  5972. // the last event occurred.
  5973. STDMETHOD(GetEventThread)(
  5974. THIS_
  5975. OUT PULONG Id
  5976. ) PURE;
  5977. STDMETHOD(GetEventProcess)(
  5978. THIS_
  5979. OUT PULONG Id
  5980. ) PURE;
  5981. // Controls implicit thread used by the
  5982. // debug engine. The debuggers current
  5983. // thread is just a piece of data held
  5984. // by the debugger for calls which use
  5985. // thread-specific information. In those
  5986. // calls the debuggers current thread is used.
  5987. // The debuggers current thread is not related
  5988. // to any system thread attribute.
  5989. // IDs for threads are small integer IDs
  5990. // maintained by the engine. They are not
  5991. // related to system thread IDs.
  5992. STDMETHOD(GetCurrentThreadId)(
  5993. THIS_
  5994. OUT PULONG Id
  5995. ) PURE;
  5996. STDMETHOD(SetCurrentThreadId)(
  5997. THIS_
  5998. IN ULONG Id
  5999. ) PURE;
  6000. // The current process is the process
  6001. // that owns the current thread.
  6002. STDMETHOD(GetCurrentProcessId)(
  6003. THIS_
  6004. OUT PULONG Id
  6005. ) PURE;
  6006. // Setting the current process automatically
  6007. // sets the current thread to the thread that
  6008. // was last current in that process.
  6009. STDMETHOD(SetCurrentProcessId)(
  6010. THIS_
  6011. IN ULONG Id
  6012. ) PURE;
  6013. // Gets the number of threads in the current process.
  6014. STDMETHOD(GetNumberThreads)(
  6015. THIS_
  6016. OUT PULONG Number
  6017. ) PURE;
  6018. // Gets thread count information for all processes
  6019. // and the largest number of threads in a single process.
  6020. STDMETHOD(GetTotalNumberThreads)(
  6021. THIS_
  6022. OUT PULONG Total,
  6023. OUT PULONG LargestProcess
  6024. ) PURE;
  6025. STDMETHOD(GetThreadIdsByIndex)(
  6026. THIS_
  6027. IN ULONG Start,
  6028. IN ULONG Count,
  6029. OUT OPTIONAL /* size_is(Count) */ PULONG Ids,
  6030. OUT OPTIONAL /* size_is(Count) */ PULONG SysIds
  6031. ) PURE;
  6032. // Gets the debugger ID for the thread
  6033. // currently running on the given
  6034. // processor. Only works in kernel
  6035. // debugging.
  6036. STDMETHOD(GetThreadIdByProcessor)(
  6037. THIS_
  6038. IN ULONG Processor,
  6039. OUT PULONG Id
  6040. ) PURE;
  6041. // Returns the offset of the current threads
  6042. // system data structure. When kernel debugging
  6043. // this is the offset of the KTHREAD.
  6044. // When user debugging it is the offset
  6045. // of the current TEB.
  6046. STDMETHOD(GetCurrentThreadDataOffset)(
  6047. THIS_
  6048. OUT PULONG64 Offset
  6049. ) PURE;
  6050. // Looks up a debugger thread ID for the given
  6051. // system thread data structure.
  6052. // Currently when kernel debugging this will fail
  6053. // if the thread is not executing on a processor.
  6054. STDMETHOD(GetThreadIdByDataOffset)(
  6055. THIS_
  6056. IN ULONG64 Offset,
  6057. OUT PULONG Id
  6058. ) PURE;
  6059. // Returns the offset of the current threads
  6060. // TEB. In user mode this is equivalent to
  6061. // the threads data offset.
  6062. STDMETHOD(GetCurrentThreadTeb)(
  6063. THIS_
  6064. OUT PULONG64 Offset
  6065. ) PURE;
  6066. // Looks up a debugger thread ID for the given TEB.
  6067. // Currently when kernel debugging this will fail
  6068. // if the thread is not executing on a processor.
  6069. STDMETHOD(GetThreadIdByTeb)(
  6070. THIS_
  6071. IN ULONG64 Offset,
  6072. OUT PULONG Id
  6073. ) PURE;
  6074. // Returns the system unique ID for the current thread.
  6075. // Not currently supported when kernel debugging.
  6076. STDMETHOD(GetCurrentThreadSystemId)(
  6077. THIS_
  6078. OUT PULONG SysId
  6079. ) PURE;
  6080. // Looks up a debugger thread ID for the given
  6081. // system thread ID.
  6082. // Currently when kernel debugging this will fail
  6083. // if the thread is not executing on a processor.
  6084. STDMETHOD(GetThreadIdBySystemId)(
  6085. THIS_
  6086. IN ULONG SysId,
  6087. OUT PULONG Id
  6088. ) PURE;
  6089. // Returns the handle of the current thread.
  6090. // In kernel mode the value returned is the
  6091. // index of the processor the thread is
  6092. // executing on plus one.
  6093. STDMETHOD(GetCurrentThreadHandle)(
  6094. THIS_
  6095. OUT PULONG64 Handle
  6096. ) PURE;
  6097. // Looks up a debugger thread ID for the given handle.
  6098. // Currently when kernel debugging this will fail
  6099. // if the thread is not executing on a processor.
  6100. STDMETHOD(GetThreadIdByHandle)(
  6101. THIS_
  6102. IN ULONG64 Handle,
  6103. OUT PULONG Id
  6104. ) PURE;
  6105. // Currently kernel mode sessions will only have
  6106. // a single process representing kernel space.
  6107. STDMETHOD(GetNumberProcesses)(
  6108. THIS_
  6109. OUT PULONG Number
  6110. ) PURE;
  6111. STDMETHOD(GetProcessIdsByIndex)(
  6112. THIS_
  6113. IN ULONG Start,
  6114. IN ULONG Count,
  6115. OUT OPTIONAL /* size_is(Count) */ PULONG Ids,
  6116. OUT OPTIONAL /* size_is(Count) */ PULONG SysIds
  6117. ) PURE;
  6118. // Returns the offset of the current processs
  6119. // system data structure. When kernel debugging
  6120. // this is the offset of the KPROCESS of
  6121. // the process that owns the current thread.
  6122. // When user debugging it is the offset
  6123. // of the current PEB.
  6124. STDMETHOD(GetCurrentProcessDataOffset)(
  6125. THIS_
  6126. OUT PULONG64 Offset
  6127. ) PURE;
  6128. // Looks up a debugger process ID for the given
  6129. // system process data structure.
  6130. // Not currently supported when kernel debugging.
  6131. STDMETHOD(GetProcessIdByDataOffset)(
  6132. THIS_
  6133. IN ULONG64 Offset,
  6134. OUT PULONG Id
  6135. ) PURE;
  6136. // Returns the offset of the current processs
  6137. // PEB. In user mode this is equivalent to
  6138. // the processs data offset.
  6139. STDMETHOD(GetCurrentProcessPeb)(
  6140. THIS_
  6141. OUT PULONG64 Offset
  6142. ) PURE;
  6143. // Looks up a debugger process ID for the given PEB.
  6144. // Not currently supported when kernel debugging.
  6145. STDMETHOD(GetProcessIdByPeb)(
  6146. THIS_
  6147. IN ULONG64 Offset,
  6148. OUT PULONG Id
  6149. ) PURE;
  6150. // Returns the system unique ID for the current process.
  6151. // Not currently supported when kernel debugging.
  6152. STDMETHOD(GetCurrentProcessSystemId)(
  6153. THIS_
  6154. OUT PULONG SysId
  6155. ) PURE;
  6156. // Looks up a debugger process ID for the given
  6157. // system process ID.
  6158. // Not currently supported when kernel debugging.
  6159. STDMETHOD(GetProcessIdBySystemId)(
  6160. THIS_
  6161. IN ULONG SysId,
  6162. OUT PULONG Id
  6163. ) PURE;
  6164. // Returns the handle of the current process.
  6165. // In kernel mode this is the kernel processs
  6166. // artificial handle used for symbol operations
  6167. // and so can only be used with dbghelp APIs.
  6168. STDMETHOD(GetCurrentProcessHandle)(
  6169. THIS_
  6170. OUT PULONG64 Handle
  6171. ) PURE;
  6172. // Looks up a debugger process ID for the given handle.
  6173. STDMETHOD(GetProcessIdByHandle)(
  6174. THIS_
  6175. IN ULONG64 Handle,
  6176. OUT PULONG Id
  6177. ) PURE;
  6178. // Retrieve the name of the executable loaded
  6179. // in the process. This may fail if no executable
  6180. // was identified.
  6181. STDMETHOD(GetCurrentProcessExecutableName)(
  6182. THIS_
  6183. OUT OPTIONAL PSTR Buffer,
  6184. IN ULONG BufferSize,
  6185. OUT OPTIONAL PULONG ExeSize
  6186. ) PURE;
  6187. // IDebugSystemObjects2.
  6188. // Return the number of seconds that the current
  6189. // process has been running.
  6190. STDMETHOD(GetCurrentProcessUpTime)(
  6191. THIS_
  6192. OUT PULONG UpTime
  6193. ) PURE;
  6194. // During kernel sessions the debugger retrieves
  6195. // some information from the system thread and process
  6196. // running on the current processor. For example,
  6197. // the debugger will retrieve virtual memory translation
  6198. // information for when the debugger needs to
  6199. // carry out its own virtual to physical translations.
  6200. // Occasionally it can be interesting to perform
  6201. // similar operations but on a process which isnt
  6202. // currently running. The follow methods allow a caller
  6203. // to override the data offsets used by the debugger
  6204. // so that other system threads and processes can
  6205. // be used instead. These values are defaulted to
  6206. // the thread and process running on the current
  6207. // processor each time the debuggee executes or
  6208. // the current processor changes.
  6209. // The thread and process settings are independent so
  6210. // it is possible to refer to a thread in a process
  6211. // other than the current process and vice versa.
  6212. // Setting an offset of zero will reload the
  6213. // default value.
  6214. STDMETHOD(GetImplicitThreadDataOffset)(
  6215. THIS_
  6216. OUT PULONG64 Offset
  6217. ) PURE;
  6218. STDMETHOD(SetImplicitThreadDataOffset)(
  6219. THIS_
  6220. IN ULONG64 Offset
  6221. ) PURE;
  6222. STDMETHOD(GetImplicitProcessDataOffset)(
  6223. THIS_
  6224. OUT PULONG64 Offset
  6225. ) PURE;
  6226. STDMETHOD(SetImplicitProcessDataOffset)(
  6227. THIS_
  6228. IN ULONG64 Offset
  6229. ) PURE;
  6230. };
  6231. //----------------------------------------------------------------------------
  6232. //
  6233. // Extension callbacks.
  6234. //
  6235. //----------------------------------------------------------------------------
  6236. // Returns a version with the major version in
  6237. // the high word and the minor version in the low word.
  6238. #define DEBUG_EXTENSION_VERSION(Major, Minor) \
  6239. ((((Major) & 0xffff) << 16) | ((Minor) & 0xffff))
  6240. // Initialization routine. Called once when the extension DLL
  6241. // is loaded. Returns a version and returns flags detailing
  6242. // overall qualities of the extension DLL.
  6243. // A session may or may not be active at the time the DLL
  6244. // is loaded so initialization routines should not expect
  6245. // to be able to query session information.
  6246. typedef HRESULT (CALLBACK* PDEBUG_EXTENSION_INITIALIZE)
  6247. (OUT PULONG Version, OUT PULONG Flags);
  6248. // Exit routine. Called once just before the extension DLL is
  6249. // unloaded. As with initialization, a session may or
  6250. // may not be active at the time of the call.
  6251. typedef void (CALLBACK* PDEBUG_EXTENSION_UNINITIALIZE)
  6252. (void);
  6253. // A debuggee has been discovered for the session. It
  6254. // is not necessarily halted.
  6255. #define DEBUG_NOTIFY_SESSION_ACTIVE 0x00000000
  6256. // The session no longer has a debuggee.
  6257. #define DEBUG_NOTIFY_SESSION_INACTIVE 0x00000001
  6258. // The debuggee is halted and accessible.
  6259. #define DEBUG_NOTIFY_SESSION_ACCESSIBLE 0x00000002
  6260. // The debuggee is running or inaccessible.
  6261. #define DEBUG_NOTIFY_SESSION_INACCESSIBLE 0x00000003
  6262. typedef void (CALLBACK* PDEBUG_EXTENSION_NOTIFY)
  6263. (IN ULONG Notify, IN ULONG64 Argument);
  6264. // A PDEBUG_EXTENSION_CALL function can return this code
  6265. // to indicate that it was unable to handle the request
  6266. // and that the search for an extension function should
  6267. // continue down the extension DLL chain.
  6268. // Taken from STATUS_VALIDATE_CONTINUE
  6269. #define DEBUG_EXTENSION_CONTINUE_SEARCH \
  6270. HRESULT_FROM_NT(0xC0000271L)
  6271. // Every routine in an extension DLL has the following prototype.
  6272. // The extension may be called from multiple clients so it
  6273. // should not cache the client value between calls.
  6274. typedef HRESULT (CALLBACK* PDEBUG_EXTENSION_CALL)
  6275. (IN PDEBUG_CLIENT Client, IN OPTIONAL PCSTR Args);
  6276. //----------------------------------------------------------------------------
  6277. //
  6278. // Extension functions.
  6279. //
  6280. // Extension functions differ from extension callbacks in that
  6281. // they are arbitrary functions exported from an extension DLL
  6282. // for other code callers instead of for human invocation from
  6283. // debugger commands. Extension function pointers are retrieved
  6284. // for an extension DLL with IDebugControl::GetExtensionFunction.
  6285. //
  6286. // Extension function names must begin with _EFN_. Other than that
  6287. // they can have any name and prototype. Extension functions
  6288. // must be public exports of their extension DLL. They should
  6289. // have a typedef for their function pointer prototype in an
  6290. // extension header so that callers have a header file to include
  6291. // with a type that allows a correctly-formed invocation of the
  6292. // extension function.
  6293. //
  6294. // The engine does not perform any validation of calls to
  6295. // extension functions. Once the extension function pointer
  6296. // is retrieved with GetExtensionFunction all calls go
  6297. // directly between the caller and the extension function and
  6298. // are not mediated by the engine.
  6299. //
  6300. //----------------------------------------------------------------------------
  6301. #ifdef __cplusplus
  6302. };
  6303. //----------------------------------------------------------------------------
  6304. //
  6305. // C++ implementation helper classes.
  6306. //
  6307. //----------------------------------------------------------------------------
  6308. #ifndef DEBUG_NO_IMPLEMENTATION
  6309. //
  6310. // DebugBaseEventCallbacks provides a do-nothing base implementation
  6311. // of IDebugEventCallbacks. A program can derive their own
  6312. // event callbacks class from DebugBaseEventCallbacks and implement
  6313. // only the methods they are interested in. Programs must be
  6314. // careful to implement GetInterestMask appropriately.
  6315. //
  6316. class DebugBaseEventCallbacks : public IDebugEventCallbacks
  6317. {
  6318. public:
  6319. // IUnknown.
  6320. STDMETHOD(QueryInterface)(
  6321. THIS_
  6322. IN REFIID InterfaceId,
  6323. OUT PVOID* Interface
  6324. )
  6325. {
  6326. *Interface = NULL;
  6327. #if _MSC_VER >= 1100
  6328. if (IsEqualIID(InterfaceId, __uuidof(IUnknown)) ||
  6329. IsEqualIID(InterfaceId, __uuidof(IDebugEventCallbacks)))
  6330. #else
  6331. if (IsEqualIID(InterfaceId, IID_IUnknown) ||
  6332. IsEqualIID(InterfaceId, IID_IDebugEventCallbacks))
  6333. #endif
  6334. {
  6335. *Interface = (IDebugEventCallbacks *)this;
  6336. AddRef();
  6337. return S_OK;
  6338. }
  6339. else
  6340. {
  6341. return E_NOINTERFACE;
  6342. }
  6343. }
  6344. // IDebugEventCallbacks.
  6345. STDMETHOD(Breakpoint)(
  6346. THIS_
  6347. IN PDEBUG_BREAKPOINT Bp
  6348. )
  6349. {
  6350. UNREFERENCED_PARAMETER(Bp);
  6351. return DEBUG_STATUS_NO_CHANGE;
  6352. }
  6353. STDMETHOD(Exception)(
  6354. THIS_
  6355. IN PEXCEPTION_RECORD64 Exception,
  6356. IN ULONG FirstChance
  6357. )
  6358. {
  6359. UNREFERENCED_PARAMETER(Exception);
  6360. UNREFERENCED_PARAMETER(FirstChance);
  6361. return DEBUG_STATUS_NO_CHANGE;
  6362. }
  6363. STDMETHOD(CreateThread)(
  6364. THIS_
  6365. IN ULONG64 Handle,
  6366. IN ULONG64 DataOffset,
  6367. IN ULONG64 StartOffset
  6368. )
  6369. {
  6370. UNREFERENCED_PARAMETER(Handle);
  6371. UNREFERENCED_PARAMETER(DataOffset);
  6372. UNREFERENCED_PARAMETER(StartOffset);
  6373. return DEBUG_STATUS_NO_CHANGE;
  6374. }
  6375. STDMETHOD(ExitThread)(
  6376. THIS_
  6377. IN ULONG ExitCode
  6378. )
  6379. {
  6380. UNREFERENCED_PARAMETER(ExitCode);
  6381. return DEBUG_STATUS_NO_CHANGE;
  6382. }
  6383. STDMETHOD(CreateProcess)(
  6384. THIS_
  6385. IN ULONG64 ImageFileHandle,
  6386. IN ULONG64 Handle,
  6387. IN ULONG64 BaseOffset,
  6388. IN ULONG ModuleSize,
  6389. IN PCSTR ModuleName,
  6390. IN PCSTR ImageName,
  6391. IN ULONG CheckSum,
  6392. IN ULONG TimeDateStamp,
  6393. IN ULONG64 InitialThreadHandle,
  6394. IN ULONG64 ThreadDataOffset,
  6395. IN ULONG64 StartOffset
  6396. )
  6397. {
  6398. UNREFERENCED_PARAMETER(ImageFileHandle);
  6399. UNREFERENCED_PARAMETER(Handle);
  6400. UNREFERENCED_PARAMETER(BaseOffset);
  6401. UNREFERENCED_PARAMETER(ModuleSize);
  6402. UNREFERENCED_PARAMETER(ModuleName);
  6403. UNREFERENCED_PARAMETER(ImageName);
  6404. UNREFERENCED_PARAMETER(CheckSum);
  6405. UNREFERENCED_PARAMETER(TimeDateStamp);
  6406. UNREFERENCED_PARAMETER(InitialThreadHandle);
  6407. UNREFERENCED_PARAMETER(ThreadDataOffset);
  6408. UNREFERENCED_PARAMETER(StartOffset);
  6409. return DEBUG_STATUS_NO_CHANGE;
  6410. }
  6411. STDMETHOD(ExitProcess)(
  6412. THIS_
  6413. IN ULONG ExitCode
  6414. )
  6415. {
  6416. UNREFERENCED_PARAMETER(ExitCode);
  6417. return DEBUG_STATUS_NO_CHANGE;
  6418. }
  6419. STDMETHOD(LoadModule)(
  6420. THIS_
  6421. IN ULONG64 ImageFileHandle,
  6422. IN ULONG64 BaseOffset,
  6423. IN ULONG ModuleSize,
  6424. IN PCSTR ModuleName,
  6425. IN PCSTR ImageName,
  6426. IN ULONG CheckSum,
  6427. IN ULONG TimeDateStamp
  6428. )
  6429. {
  6430. UNREFERENCED_PARAMETER(ImageFileHandle);
  6431. UNREFERENCED_PARAMETER(BaseOffset);
  6432. UNREFERENCED_PARAMETER(ModuleSize);
  6433. UNREFERENCED_PARAMETER(ModuleName);
  6434. UNREFERENCED_PARAMETER(ImageName);
  6435. UNREFERENCED_PARAMETER(CheckSum);
  6436. UNREFERENCED_PARAMETER(TimeDateStamp);
  6437. return DEBUG_STATUS_NO_CHANGE;
  6438. }
  6439. STDMETHOD(UnloadModule)(
  6440. THIS_
  6441. IN PCSTR ImageBaseName,
  6442. IN ULONG64 BaseOffset
  6443. )
  6444. {
  6445. UNREFERENCED_PARAMETER(ImageBaseName);
  6446. UNREFERENCED_PARAMETER(BaseOffset);
  6447. return DEBUG_STATUS_NO_CHANGE;
  6448. }
  6449. STDMETHOD(SystemError)(
  6450. THIS_
  6451. IN ULONG Error,
  6452. IN ULONG Level
  6453. )
  6454. {
  6455. UNREFERENCED_PARAMETER(Error);
  6456. UNREFERENCED_PARAMETER(Level);
  6457. return DEBUG_STATUS_NO_CHANGE;
  6458. }
  6459. STDMETHOD(SessionStatus)(
  6460. THIS_
  6461. IN ULONG Status
  6462. )
  6463. {
  6464. UNREFERENCED_PARAMETER(Status);
  6465. return DEBUG_STATUS_NO_CHANGE;
  6466. }
  6467. STDMETHOD(ChangeDebuggeeState)(
  6468. THIS_
  6469. IN ULONG Flags,
  6470. IN ULONG64 Argument
  6471. )
  6472. {
  6473. UNREFERENCED_PARAMETER(Flags);
  6474. UNREFERENCED_PARAMETER(Argument);
  6475. return S_OK;
  6476. }
  6477. STDMETHOD(ChangeEngineState)(
  6478. THIS_
  6479. IN ULONG Flags,
  6480. IN ULONG64 Argument
  6481. )
  6482. {
  6483. UNREFERENCED_PARAMETER(Flags);
  6484. UNREFERENCED_PARAMETER(Argument);
  6485. return S_OK;
  6486. }
  6487. STDMETHOD(ChangeSymbolState)(
  6488. THIS_
  6489. IN ULONG Flags,
  6490. IN ULONG64 Argument
  6491. )
  6492. {
  6493. UNREFERENCED_PARAMETER(Flags);
  6494. UNREFERENCED_PARAMETER(Argument);
  6495. return S_OK;
  6496. }
  6497. };
  6498. #endif // #ifndef DEBUG_NO_IMPLEMENTATION
  6499. #endif // #ifdef __cplusplus
  6500. #endif // #ifndef __DBGENG_H__