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.

295 lines
5.4 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Extension DLL support.
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997-2001.
  6. //
  7. //----------------------------------------------------------------------------
  8. #ifndef _EXTS_H_
  9. #define _EXTS_H_
  10. #define WOW64EXTS_FLUSH_CACHE 0
  11. #define WOW64EXTS_GET_CONTEXT 1
  12. #define WOW64EXTS_SET_CONTEXT 2
  13. #define WOW64EXTS_FLUSH_CACHE_WITH_HANDLE 3
  14. typedef VOID (*WOW64EXTSPROC)(ULONG64, ULONG64, ULONG64, ULONG64);
  15. typedef ULONG (CALLBACK* WMI_FORMAT_TRACE_DATA)
  16. (PDEBUG_CONTROL Ctrl, ULONG Mask, ULONG DataLen, PVOID Data);
  17. extern ULONG64 g_ExtThread;
  18. extern LPTSTR g_ExtensionSearchPath;
  19. extern WOW64EXTSPROC g_Wow64exts;
  20. extern WMI_FORMAT_TRACE_DATA g_WmiFormatTraceData;
  21. extern DEBUG_SCOPE g_ExtThreadSavedScope;
  22. extern BOOL g_ExtThreadScopeSaved;
  23. //
  24. // Functions prototyped specifically for compatibility with extension
  25. // callback prototypes. They can also be used directly.
  26. //
  27. VOID WDBGAPIV
  28. ExtOutput64(
  29. PCSTR lpFormat,
  30. ...
  31. );
  32. VOID WDBGAPIV
  33. ExtOutput32(
  34. PCSTR lpFormat,
  35. ...
  36. );
  37. ULONG64
  38. ExtGetExpression(
  39. PCSTR CommandString
  40. );
  41. ULONG
  42. ExtGetExpression32(
  43. PCSTR CommandString
  44. );
  45. void
  46. ExtGetSymbol(
  47. ULONG64 Offset,
  48. PCHAR Buffer,
  49. PULONG64 Displacement
  50. );
  51. void
  52. ExtGetSymbol32(
  53. ULONG Offset,
  54. PCHAR Buffer,
  55. PULONG Displacement
  56. );
  57. DWORD
  58. ExtDisasm(
  59. PULONG64 lpOffset,
  60. PCSTR lpBuffer,
  61. ULONG fShowEA
  62. );
  63. DWORD
  64. ExtDisasm32(
  65. PULONG lpOffset,
  66. PCSTR lpBuffer,
  67. ULONG fShowEA
  68. );
  69. BOOL
  70. ExtReadVirtualMemory(
  71. IN ULONG64 Address,
  72. OUT PUCHAR Buffer,
  73. IN ULONG Length,
  74. OUT PULONG BytesRead
  75. );
  76. BOOL
  77. ExtReadVirtualMemory32(
  78. IN ULONG Address,
  79. OUT PUCHAR Buffer,
  80. IN ULONG Length,
  81. OUT PULONG BytesRead
  82. );
  83. ULONG
  84. ExtWriteVirtualMemory(
  85. IN ULONG64 Address,
  86. IN LPCVOID Buffer,
  87. IN ULONG Length,
  88. OUT PULONG BytesWritten
  89. );
  90. ULONG
  91. ExtWriteVirtualMemory32(
  92. IN ULONG Address,
  93. IN LPCVOID Buffer,
  94. IN ULONG Length,
  95. OUT PULONG BytesWritten
  96. );
  97. BOOL
  98. ExtGetThreadContext(
  99. DWORD Processor,
  100. PVOID lpContext,
  101. DWORD cbSizeOfContext
  102. );
  103. BOOL
  104. ExtSetThreadContext(
  105. DWORD Processor,
  106. PVOID lpContext,
  107. DWORD cbSizeOfContext
  108. );
  109. BOOL
  110. ExtIoctl(
  111. USHORT IoctlType,
  112. LPVOID lpvData,
  113. DWORD cbSize
  114. );
  115. BOOL
  116. ExtIoctl32(
  117. USHORT IoctlType,
  118. LPVOID lpvData,
  119. DWORD cbSize
  120. );
  121. DWORD
  122. ExtCallStack(
  123. DWORD64 FramePointer,
  124. DWORD64 StackPointer,
  125. DWORD64 ProgramCounter,
  126. PEXTSTACKTRACE64 StackFrames,
  127. DWORD Frames
  128. );
  129. DWORD
  130. ExtCallStack32(
  131. DWORD FramePointer,
  132. DWORD StackPointer,
  133. DWORD ProgramCounter,
  134. PEXTSTACKTRACE32 StackFrames,
  135. DWORD Frames
  136. );
  137. BOOL
  138. ExtReadPhysicalMemory(
  139. ULONGLONG Address,
  140. PVOID Buffer,
  141. ULONG Length,
  142. PULONG BytesRead
  143. );
  144. BOOL
  145. ExtWritePhysicalMemory(
  146. ULONGLONG Address,
  147. LPCVOID Buffer,
  148. ULONG Length,
  149. PULONG BytesWritten
  150. );
  151. extern WINDBG_EXTENSION_APIS64 g_WindbgExtensions64;
  152. extern WINDBG_EXTENSION_APIS32 g_WindbgExtensions32;
  153. extern NTSD_EXTENSION_APIS g_NtsdExtensions64;
  154. extern NTSD_EXTENSION_APIS g_NtsdExtensions32;
  155. extern WINDBG_OLDKD_EXTENSION_APIS g_KdExtensions;
  156. BOOL
  157. bangSymPath(
  158. IN PCSTR args,
  159. IN BOOL Append,
  160. OUT PSTR string,
  161. IN ULONG len
  162. );
  163. void
  164. fnBangCmd(
  165. DebugClient* Client,
  166. PSTR argstring,
  167. PSTR *pNext,
  168. BOOL BuiltInOnly
  169. );
  170. VOID
  171. fnShell(
  172. PCSTR Args
  173. );
  174. enum ExtensionType
  175. {
  176. NTSD_EXTENSION_TYPE = 1,
  177. DEBUG_EXTENSION_TYPE,
  178. WINDBG_EXTENSION_TYPE,
  179. WINDBG_OLDKD_EXTENSION_TYPE,
  180. };
  181. typedef struct _EXTDLL
  182. {
  183. struct _EXTDLL *Next;
  184. HINSTANCE Dll;
  185. EXT_API_VERSION ApiVersion;
  186. BOOL UserLoaded;
  187. ExtensionType ExtensionType;
  188. PDEBUG_EXTENSION_NOTIFY Notify;
  189. PDEBUG_EXTENSION_UNINITIALIZE Uninit;
  190. PWINDBG_EXTENSION_DLL_INIT64 Init;
  191. PWINDBG_EXTENSION_API_VERSION ApiVersionRoutine;
  192. PWINDBG_CHECK_VERSION CheckVersionRoutine;
  193. // Array extends to contain the full name.
  194. char Name[1];
  195. } EXTDLL;
  196. extern EXTDLL* g_ExtDlls;
  197. LONG
  198. ExtensionExceptionFilter(
  199. struct _EXCEPTION_POINTERS *ExceptionInfo,
  200. PCSTR Module,
  201. PCSTR Func
  202. );
  203. EXTDLL*
  204. AddExtensionDll(
  205. char *Name,
  206. BOOL UserLoaded,
  207. char **End
  208. );
  209. BOOL
  210. LoadExtensionDll(
  211. EXTDLL *Ext
  212. );
  213. void
  214. DeferExtensionDll(
  215. EXTDLL *Match
  216. );
  217. void
  218. UnloadExtensionDll(
  219. EXTDLL *Match
  220. );
  221. BOOL
  222. CallAnyExtension(DebugClient* Client,
  223. EXTDLL* Ext, PSTR Function, PCSTR Arguments,
  224. BOOL ModuleSpecified, BOOL ShowWarnings,
  225. HRESULT* ExtStatus);
  226. void OutputModuleIdInfo(HMODULE Mod, PSTR ModFile, LPEXT_API_VERSION ApiVer);
  227. void OutputExtensions(DebugClient* Client, BOOL Versions);
  228. void LoadMachineExtensions(void);
  229. void NotifyExtensions(ULONG Notify, ULONG64 Argument);
  230. /*
  231. * _NT_DEBUG_OPTIONS support. Each OPTION_ define must have a corresponding
  232. * string in gpaszOptions, in the same order.
  233. */
  234. void ReadDebugOptions (BOOL fQuiet, char * pszOptionsStr);
  235. extern DWORD gdwOptions;
  236. #define OPTION_NOEXTWARNING 0x00000001
  237. #define OPTION_NOVERSIONCHECK 0x00000002
  238. #define OPTION_COUNT 2
  239. VOID
  240. LoadWow64ExtsIfNeeded(
  241. VOID
  242. );
  243. #endif // #ifndef _EXTS_H_