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.

383 lines
9.7 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Low-level debugging service interfaces.
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999-2000.
  6. //
  7. //----------------------------------------------------------------------------
  8. #ifndef __DBGSVC_H__
  9. #define __DBGSVC_H__
  10. #include <stdarg.h>
  11. #include <objbase.h>
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. //----------------------------------------------------------------------------
  16. //
  17. // GUIDs and interface forward declarations.
  18. //
  19. //----------------------------------------------------------------------------
  20. /* a7ba24c4-e4fb-4625-a8fc-b1cb1fd51f53 */
  21. DEFINE_GUID(IID_IUserDebugServices, 0xa7ba24c4, 0xe4fb, 0x4625,
  22. 0xa8, 0xfc, 0xb1, 0xcb, 0x1f, 0xd5, 0x1f, 0x53);
  23. typedef interface DECLSPEC_UUID("a7ba24c4-e4fb-4625-a8fc-b1cb1fd51f53")
  24. IUserDebugServices* PUSER_DEBUG_SERVICES;
  25. //----------------------------------------------------------------------------
  26. //
  27. // IUserDebugServices.
  28. //
  29. //----------------------------------------------------------------------------
  30. // The service implementation does not implement Insert/RemoveCodeBreakpoints
  31. // directly, instead it is the caller's responsibility to handle them
  32. // via break instruction insertion and removal.
  33. #define DBGSVC_GENERIC_CODE_BREAKPOINTS 0x00000001
  34. // Handles returned in create process and create thread events
  35. // are not automatically closed. Instead it is the responsibility
  36. // of the caller to close them when they are no longer needed.
  37. #define DBGSVC_CLOSE_PROC_THREAD_HANDLES 0x00000002
  38. // Handle to ULONG64 and back.
  39. #define SERVICE_HANDLE(OsHandle) ((ULONG64)(OsHandle))
  40. #define OS_HANDLE(SvcHandle) ((HANDLE)(ULONG_PTR)(SvcHandle))
  41. typedef struct _USER_THREAD_INFO
  42. {
  43. ULONG64 Handle;
  44. ULONG Id;
  45. ULONG Reserved;
  46. } USER_THREAD_INFO, *PUSER_THREAD_INFO;
  47. #undef INTERFACE
  48. #define INTERFACE IUserDebugServices
  49. DECLARE_INTERFACE_(IUserDebugServices, IUnknown)
  50. {
  51. // IUnknown.
  52. STDMETHOD(QueryInterface)(
  53. THIS_
  54. IN REFIID InterfaceId,
  55. OUT PVOID* Interface
  56. ) PURE;
  57. STDMETHOD_(ULONG, AddRef)(
  58. THIS
  59. ) PURE;
  60. STDMETHOD_(ULONG, Release)(
  61. THIS
  62. ) PURE;
  63. // IUserDebugServices.
  64. STDMETHOD(Initialize)(
  65. THIS_
  66. OUT PULONG Flags
  67. ) PURE;
  68. STDMETHOD(Uninitialize)(
  69. THIS_
  70. IN BOOL Global
  71. ) PURE;
  72. STDMETHOD(GetTargetInfo)(
  73. THIS_
  74. OUT PULONG MachineType,
  75. OUT PULONG NumberProcessors,
  76. OUT PULONG PlatformId,
  77. OUT PULONG BuildNumber,
  78. OUT PULONG CheckedBuild,
  79. OUT PSTR CsdString,
  80. IN ULONG CsdStringSize,
  81. OUT PSTR BuildString,
  82. IN ULONG BuildStringSize
  83. ) PURE;
  84. STDMETHOD(GetProcessorId)(
  85. THIS_
  86. OUT PVOID Buffer,
  87. IN ULONG BufferSize,
  88. OUT PULONG BufferUsed
  89. ) PURE;
  90. STDMETHOD(GetFileVersionInformation)(
  91. THIS_
  92. IN PCSTR File,
  93. IN PCSTR Item,
  94. OUT OPTIONAL PVOID Buffer,
  95. IN ULONG BufferSize,
  96. OUT OPTIONAL PULONG VerInfoSize
  97. ) PURE;
  98. STDMETHOD(GetProcessIds)(
  99. THIS_
  100. OUT OPTIONAL /* size_is(Count) */ PULONG Ids,
  101. IN ULONG Count,
  102. OUT OPTIONAL PULONG ActualCount
  103. ) PURE;
  104. STDMETHOD(GetProcessIdByExecutableName)(
  105. THIS_
  106. IN PCSTR ExeName,
  107. IN ULONG Flags,
  108. OUT PULONG Id
  109. ) PURE;
  110. STDMETHOD(GetProcessDescription)(
  111. THIS_
  112. IN ULONG ProcessId,
  113. IN ULONG Flags,
  114. OUT OPTIONAL PSTR ExeName,
  115. IN ULONG ExeNameSize,
  116. OUT OPTIONAL PULONG ActualExeNameSize,
  117. OUT OPTIONAL PSTR Description,
  118. IN ULONG DescriptionSize,
  119. OUT OPTIONAL PULONG ActualDescriptionSize
  120. ) PURE;
  121. STDMETHOD(GetProcessInfo)(
  122. THIS_
  123. IN ULONG ProcessId,
  124. OUT OPTIONAL PULONG64 Handle,
  125. OUT OPTIONAL /* size_is(InfoCount) */ PUSER_THREAD_INFO Threads,
  126. IN ULONG InfoCount,
  127. OUT OPTIONAL PULONG ThreadCount
  128. ) PURE;
  129. STDMETHOD(AttachProcess)(
  130. THIS_
  131. IN ULONG ProcessId,
  132. IN ULONG AttachFlags,
  133. OUT PULONG64 ProcessHandle,
  134. OUT PULONG ProcessOptions
  135. ) PURE;
  136. STDMETHOD(DetachProcess)(
  137. THIS_
  138. IN ULONG ProcessId
  139. ) PURE;
  140. STDMETHOD(CreateProcess)(
  141. THIS_
  142. IN PSTR CommandLine,
  143. IN ULONG CreateFlags,
  144. OUT PULONG ProcessId,
  145. OUT PULONG ThreadId,
  146. OUT PULONG64 ProcessHandle,
  147. OUT PULONG64 ThreadHandle
  148. ) PURE;
  149. STDMETHOD(TerminateProcess)(
  150. THIS_
  151. IN ULONG64 Process,
  152. IN ULONG ExitCode
  153. ) PURE;
  154. STDMETHOD(AbandonProcess)(
  155. THIS_
  156. IN ULONG64 Process
  157. ) PURE;
  158. STDMETHOD(GetProcessExitCode)(
  159. THIS_
  160. IN ULONG64 Process,
  161. OUT PULONG ExitCode
  162. ) PURE;
  163. STDMETHOD(CloseHandle)(
  164. THIS_
  165. IN ULONG64 Handle
  166. ) PURE;
  167. STDMETHOD(SetProcessOptions)(
  168. THIS_
  169. IN ULONG64 Process,
  170. IN ULONG Options
  171. ) PURE;
  172. STDMETHOD(SetDebugObjectOptions)(
  173. THIS_
  174. IN ULONG64 DebugObject,
  175. IN ULONG Options
  176. ) PURE;
  177. STDMETHOD(GetProcessDebugObject)(
  178. THIS_
  179. IN ULONG64 Process,
  180. OUT PULONG64 DebugObject
  181. ) PURE;
  182. STDMETHOD(DuplicateHandle)(
  183. THIS_
  184. IN ULONG64 InProcess,
  185. IN ULONG64 InHandle,
  186. IN ULONG64 OutProcess,
  187. IN ULONG DesiredAccess,
  188. IN ULONG Inherit,
  189. IN ULONG Options,
  190. OUT PULONG64 OutHandle
  191. ) PURE;
  192. STDMETHOD(ReadVirtual)(
  193. THIS_
  194. IN ULONG64 Process,
  195. IN ULONG64 Offset,
  196. OUT PVOID Buffer,
  197. IN ULONG BufferSize,
  198. OUT OPTIONAL PULONG BytesRead
  199. ) PURE;
  200. STDMETHOD(WriteVirtual)(
  201. THIS_
  202. IN ULONG64 Process,
  203. IN ULONG64 Offset,
  204. IN PVOID Buffer,
  205. IN ULONG BufferSize,
  206. OUT OPTIONAL PULONG BytesWritten
  207. ) PURE;
  208. STDMETHOD(QueryVirtual)(
  209. THIS_
  210. IN ULONG64 Process,
  211. IN ULONG64 Offset,
  212. OUT PVOID Buffer,
  213. IN ULONG BufferSize,
  214. OUT OPTIONAL PULONG BufferUsed
  215. ) PURE;
  216. STDMETHOD(ProtectVirtual)(
  217. THIS_
  218. IN ULONG64 Process,
  219. IN ULONG64 Offset,
  220. IN ULONG64 Size,
  221. IN ULONG NewProtect,
  222. OUT PULONG OldProtect
  223. ) PURE;
  224. STDMETHOD(AllocVirtual)(
  225. THIS_
  226. IN ULONG64 Process,
  227. IN ULONG64 Offset,
  228. IN ULONG64 Size,
  229. IN ULONG Type,
  230. IN ULONG Protect,
  231. OUT PULONG64 AllocOffset
  232. ) PURE;
  233. STDMETHOD(FreeVirtual)(
  234. THIS_
  235. IN ULONG64 Process,
  236. IN ULONG64 Offset,
  237. IN ULONG64 Size,
  238. IN ULONG Type
  239. ) PURE;
  240. STDMETHOD(ReadHandleData)(
  241. THIS_
  242. IN ULONG64 Process,
  243. IN ULONG64 Handle,
  244. IN ULONG DataType,
  245. OUT OPTIONAL PVOID Buffer,
  246. IN ULONG BufferSize,
  247. OUT OPTIONAL PULONG DataSize
  248. ) PURE;
  249. STDMETHOD(SuspendThreads)(
  250. THIS_
  251. IN ULONG Count,
  252. IN /* size_is(Count) */ PULONG64 Threads,
  253. OUT OPTIONAL /* size_is(Count) */ PULONG SuspendCounts
  254. ) PURE;
  255. STDMETHOD(ResumeThreads)(
  256. THIS_
  257. IN ULONG Count,
  258. IN /* size_is(Count) */ PULONG64 Threads,
  259. OUT OPTIONAL /* size_is(Count) */ PULONG SuspendCounts
  260. ) PURE;
  261. STDMETHOD(GetContext)(
  262. THIS_
  263. IN ULONG64 Thread,
  264. IN ULONG Flags,
  265. IN ULONG FlagsOffset,
  266. OUT PVOID Context,
  267. IN ULONG ContextSize,
  268. OUT OPTIONAL PULONG ContextUsed
  269. ) PURE;
  270. STDMETHOD(SetContext)(
  271. THIS_
  272. IN ULONG64 Thread,
  273. IN PVOID Context,
  274. IN ULONG ContextSize,
  275. OUT OPTIONAL PULONG ContextUsed
  276. ) PURE;
  277. STDMETHOD(GetProcessDataOffset)(
  278. THIS_
  279. IN ULONG64 Process,
  280. OUT PULONG64 Offset
  281. ) PURE;
  282. STDMETHOD(GetThreadDataOffset)(
  283. THIS_
  284. IN ULONG64 Thread,
  285. OUT PULONG64 Offset
  286. ) PURE;
  287. STDMETHOD(DescribeSelector)(
  288. THIS_
  289. IN ULONG64 Thread,
  290. IN ULONG Selector,
  291. OUT PVOID Buffer,
  292. IN ULONG BufferSize,
  293. OUT OPTIONAL PULONG BufferUsed
  294. ) PURE;
  295. STDMETHOD(GetCurrentTimeDateN)(
  296. THIS_
  297. OUT PULONG64 TimeDate
  298. ) PURE;
  299. STDMETHOD(GetCurrentSystemUpTimeN)(
  300. THIS_
  301. OUT PULONG64 UpTime
  302. ) PURE;
  303. STDMETHOD(GetProcessUpTimeN)(
  304. THIS_
  305. IN ULONG64 Process,
  306. OUT PULONG64 UpTime
  307. ) PURE;
  308. STDMETHOD(RequestBreakIn)(
  309. THIS_
  310. IN ULONG64 Process
  311. ) PURE;
  312. STDMETHOD(WaitForEvent)(
  313. THIS_
  314. IN ULONG Timeout,
  315. OUT PVOID Buffer,
  316. IN ULONG BufferSize,
  317. OUT OPTIONAL PULONG BufferUsed
  318. ) PURE;
  319. STDMETHOD(ContinueEvent)(
  320. THIS_
  321. IN ULONG ContinueStatus
  322. ) PURE;
  323. STDMETHOD(InsertCodeBreakpoint)(
  324. THIS_
  325. IN ULONG64 Process,
  326. IN ULONG64 Offset,
  327. IN ULONG MachineType,
  328. OUT PVOID Storage,
  329. IN ULONG StorageSize
  330. ) PURE;
  331. STDMETHOD(RemoveCodeBreakpoint)(
  332. THIS_
  333. IN ULONG64 Process,
  334. IN ULONG64 Offset,
  335. IN ULONG MachineType,
  336. IN PVOID Storage,
  337. IN ULONG StorageSize
  338. ) PURE;
  339. STDMETHOD(GetFunctionTableListHead)(
  340. THIS_
  341. IN ULONG64 Process,
  342. OUT PULONG64 Offset
  343. ) PURE;
  344. STDMETHOD(GetOutOfProcessFunctionTable)(
  345. THIS_
  346. IN ULONG64 Process,
  347. IN PSTR Dll,
  348. IN ULONG64 Table,
  349. IN OPTIONAL PVOID Buffer,
  350. IN ULONG BufferSize,
  351. OUT OPTIONAL PULONG TableSize
  352. ) PURE;
  353. };
  354. #ifdef __cplusplus
  355. };
  356. #endif
  357. #endif // #ifndef __DBGSVC_H__