Windows NT 4.0 source code leak
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.

427 lines
7.8 KiB

4 years ago
  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. dbgnt.h
  5. Abstract:
  6. This module contains prototypes and data structures that
  7. are needed by the NT specific portion of DmKd.
  8. Author:
  9. Wesley Witt (wesw) 2-Aug-1993
  10. Environment:
  11. Revision History:
  12. --*/
  13. #include "crash.h"
  14. #ifndef _KDH_
  15. #define _KDH_
  16. #ifndef OPTIONAL
  17. #define OPTIONAL
  18. #endif
  19. #ifndef ARGUMENT_PRESENT
  20. #define ARGUMENT_PRESENT(ArgumentPointer) ((CHAR *)(ArgumentPointer) != (CHAR *)(NULL) )
  21. #endif
  22. #ifndef STATUS_SUCCESS
  23. #define STATUS_SUCCESS ((DWORD)0x00000000L)
  24. #define STATUS_UNSUCCESSFUL ((DWORD)0xC0000001L)
  25. #define STATUS_BUFFER_OVERFLOW ((DWORD)0x80000005L)
  26. #define STATUS_INVALID_PARAMETER ((DWORD)0xC000000DL)
  27. #define STATUS_WAIT_RETURN ((DWORD)0xF0000001L)
  28. #endif
  29. extern DBGKD_WAIT_STATE_CHANGE sc;
  30. #define KD_PROCESSID 1
  31. #define KD_THREADID (sc.Processor + 1)
  32. extern DWORD DmKdState;
  33. //
  34. // DmKdState defines
  35. //
  36. #define S_UNINITIALIZED 0
  37. #define S_REBOOTED 1
  38. #define S_INITIALIZED 2
  39. #define S_READY 3
  40. //---------------------------------------------------------------------------
  41. // prototypes for: SUPPORT.C
  42. //---------------------------------------------------------------------------
  43. VOID
  44. ClearBps(
  45. VOID
  46. );
  47. DWORD
  48. DmKdReadPhysicalMemory(
  49. IN PHYSICAL_ADDRESS TargetBaseAddress,
  50. OUT PVOID UserInterfaceBuffer,
  51. IN ULONG TransferCount,
  52. OUT PULONG ActualBytesRead OPTIONAL
  53. );
  54. DWORD
  55. DmKdWritePhysicalMemory(
  56. IN PHYSICAL_ADDRESS TargetBaseAddress,
  57. OUT PVOID UserInterfaceBuffer,
  58. IN ULONG TransferCount,
  59. OUT PULONG ActualBytesWritten OPTIONAL
  60. );
  61. DWORD
  62. DmKdReboot( VOID );
  63. DWORD
  64. DmKdCrash( DWORD BugCheckCode );
  65. DWORD
  66. DmKdGetContext(
  67. IN USHORT Processor,
  68. IN OUT PCONTEXT Context
  69. );
  70. DWORD
  71. DmKdSetContext(
  72. IN USHORT Processor,
  73. IN CONST CONTEXT *Context
  74. );
  75. DWORD
  76. DmKdWriteBreakPoint(
  77. IN PVOID BreakPointAddress,
  78. OUT PULONG BreakPointHandle
  79. );
  80. DWORD
  81. DmKdRestoreBreakPoint(
  82. IN ULONG BreakPointHandle
  83. );
  84. DWORD
  85. DmKdReadIoSpace(
  86. IN PVOID IoAddress,
  87. OUT PVOID ReturnedData,
  88. IN ULONG DataSize
  89. );
  90. DWORD
  91. DmKdWriteIoSpace(
  92. IN PVOID IoAddress,
  93. IN ULONG DataValue,
  94. IN ULONG DataSize
  95. );
  96. DWORD
  97. DmKdReadIoSpaceEx(
  98. IN PVOID IoAddress,
  99. OUT PVOID ReturnedData,
  100. IN ULONG DataSize,
  101. IN ULONG InterfaceType,
  102. IN ULONG BusNumber,
  103. IN ULONG AddressSpace
  104. );
  105. DWORD
  106. DmKdWriteIoSpaceEx(
  107. IN PVOID IoAddress,
  108. IN ULONG DataValue,
  109. IN ULONG DataSize,
  110. IN ULONG InterfaceType,
  111. IN ULONG BusNumber,
  112. IN ULONG AddressSpace
  113. );
  114. DWORD
  115. DmKdReadVirtualMemory(
  116. IN PVOID TargetBaseAddress,
  117. OUT PVOID UserInterfaceBuffer,
  118. IN ULONG TransferCount,
  119. OUT PULONG ActualBytesRead OPTIONAL
  120. );
  121. DWORD
  122. DmKdReadVirtualMemoryNow(
  123. IN PVOID TargetBaseAddress,
  124. OUT PVOID UserInterfaceBuffer,
  125. IN ULONG TransferCount,
  126. OUT PULONG ActualBytesRead OPTIONAL
  127. );
  128. DWORD
  129. DmKdWriteVirtualMemory(
  130. IN PVOID TargetBaseAddress,
  131. OUT PVOID UserInterfaceBuffer,
  132. IN ULONG TransferCount,
  133. OUT PULONG ActualBytesWritten OPTIONAL
  134. );
  135. DWORD
  136. DmKdReadControlSpace(
  137. IN USHORT Processor,
  138. IN PVOID TargetBaseAddress,
  139. OUT PVOID UserInterfaceBuffer,
  140. IN ULONG TransferCount,
  141. OUT PULONG ActualBytesRead OPTIONAL
  142. );
  143. DWORD
  144. DmKdWriteControlSpace(
  145. IN USHORT Processor,
  146. IN PVOID TargetBaseAddress,
  147. OUT PVOID UserInterfaceBuffer,
  148. IN ULONG TransferCount,
  149. OUT PULONG ActualBytesWritten OPTIONAL
  150. );
  151. DWORD
  152. DmKdContinue (
  153. IN DWORD ContinueStatus
  154. );
  155. DWORD
  156. DmKdContinue2 (
  157. IN DWORD ContinueStatus,
  158. IN PDBGKD_CONTROL_SET ControlSet
  159. );
  160. DWORD
  161. DmKdSetSpecialCalls (
  162. IN ULONG NumSpecialCalls,
  163. IN PULONG Calls
  164. );
  165. DWORD
  166. DmKdSetInternalBp (
  167. ULONG addr,
  168. ULONG flags
  169. );
  170. DWORD
  171. DmKdGetInternalBp (
  172. ULONG addr,
  173. PULONG flags,
  174. PULONG calls,
  175. PULONG minInstr,
  176. PULONG maxInstr,
  177. PULONG totInstr,
  178. PULONG maxCPS
  179. );
  180. DWORD
  181. DmKdGetVersion (
  182. PDBGKD_GET_VERSION GetVersion
  183. );
  184. DWORD
  185. DmKdPageIn(
  186. ULONG Address
  187. );
  188. DWORD
  189. DmKdWriteBreakPointEx(
  190. IN ULONG BreakPointCount,
  191. IN OUT PDBGKD_WRITE_BREAKPOINT BreakPoints,
  192. IN DWORD ContinueStatus
  193. );
  194. DWORD
  195. DmKdRestoreBreakPointEx(
  196. IN ULONG BreakPointCount,
  197. IN PDBGKD_RESTORE_BREAKPOINT BreakPointHandles
  198. );
  199. //---------------------------------------------------------------------------
  200. // prototypes for: COM.C
  201. //---------------------------------------------------------------------------
  202. BOOLEAN
  203. DmKdInitComPort(
  204. BOOLEAN KdModemControl
  205. );
  206. BOOLEAN
  207. DmKdWriteComPort(
  208. IN PUCHAR Buffer,
  209. IN ULONG SizeOfBuffer,
  210. IN PULONG BytesWritten
  211. );
  212. BOOLEAN
  213. DmKdReadComPort(
  214. IN PUCHAR Buffer,
  215. IN ULONG SizeOfBuffer,
  216. IN PULONG BytesRead
  217. );
  218. VOID
  219. DmKdCheckComStatus (
  220. );
  221. //---------------------------------------------------------------------------
  222. // prototypes for: PACKET.C
  223. //---------------------------------------------------------------------------
  224. VOID
  225. DmKdWriteControlPacket(
  226. IN USHORT PacketType,
  227. IN ULONG PacketId OPTIONAL
  228. );
  229. ULONG
  230. DmKdComputeChecksum (
  231. IN PUCHAR Buffer,
  232. IN ULONG Length
  233. );
  234. BOOL
  235. DmKdSynchronizeTarget ( VOID );
  236. VOID
  237. DmKdSendBreakin( VOID );
  238. BOOL
  239. DmKdWritePacket(
  240. IN PVOID PacketData,
  241. IN USHORT PacketDataLength,
  242. IN USHORT PacketType,
  243. IN PVOID MorePacketData OPTIONAL,
  244. IN USHORT MorePacketDataLength OPTIONAL
  245. );
  246. BOOL
  247. DmKdReadPacketLeader(
  248. IN ULONG PacketType,
  249. OUT PULONG PacketLeader
  250. );
  251. BOOL
  252. DmKdWaitForPacket(
  253. IN USHORT PacketType,
  254. OUT PVOID Packet
  255. );
  256. DWORD
  257. DmKdWaitStateChange(
  258. OUT PDBGKD_WAIT_STATE_CHANGE StateChange,
  259. OUT PVOID Buffer,
  260. IN ULONG BufferLength
  261. );
  262. //---------------------------------------------------------------------------
  263. // prototypes for: CACHE.C
  264. //---------------------------------------------------------------------------
  265. ULONG
  266. DmKdReadCachedVirtualMemory (
  267. IN ULONG BaseAddress,
  268. IN ULONG TransferCount,
  269. IN PUCHAR UserBuffer,
  270. IN PULONG BytesRead,
  271. IN ULONG NonDiscardable
  272. );
  273. VOID
  274. DmKdInitVirtualCacheEntry (
  275. IN ULONG BaseAddress,
  276. IN ULONG Length,
  277. IN PUCHAR UserBuffer,
  278. IN ULONG NonDiscardable
  279. );
  280. VOID
  281. DmKdWriteCachedVirtualMemory (
  282. IN ULONG BaseAddress,
  283. IN ULONG TransferCount,
  284. IN PUCHAR UserBuffer
  285. );
  286. VOID
  287. DmKdPurgeCachedVirtualMemory (
  288. BOOL fPurgeNonDiscardable
  289. );
  290. VOID
  291. DmKdSetCacheDecodePTEs (
  292. BOOL Flag
  293. );
  294. VOID
  295. DmKdSetMaxCacheSize(
  296. IN ULONG MaxCacheSize
  297. );
  298. BOOL
  299. DmpInitialize (
  300. IN LPSTR FileName,
  301. OUT PCONTEXT *Context,
  302. OUT PEXCEPTION_RECORD *Exception,
  303. OUT PVOID *DmpHeader
  304. );
  305. VOID
  306. DmpUnInitialize (
  307. VOID
  308. );
  309. DWORD
  310. DmpReadMemory (
  311. IN PVOID BaseAddress,
  312. IN PVOID Buffer,
  313. IN ULONG Size
  314. );
  315. DWORD
  316. DmpWriteMemory (
  317. IN PVOID BaseAddress,
  318. IN PVOID Buffer,
  319. IN ULONG Size
  320. );
  321. typedef struct tagKDOPTIONS {
  322. LPSTR keyword; // data keyword
  323. USHORT id; // data identifier
  324. USHORT typ; // data type
  325. DWORD value; // data value, beware usage depends on typ field
  326. } KDOPTIONS, *PKDOPTIONS;
  327. #define KDT_DWORD 0
  328. #define KDT_STRING 1
  329. #define KDO_BAUDRATE 0 // these constants must be consecutive because
  330. #define KDO_PORT 1 // they are used as indexes into the kdoptions
  331. #define KDO_CACHE 2 // array of structures.
  332. #define KDO_VERBOSE 3
  333. #define KDO_INITIALBP 4
  334. #define KDO_DEFER 5
  335. #define KDO_USEMODEM 6
  336. #define KDO_LOGFILEAPPEND 7
  337. #define KDO_GOEXIT 8
  338. #define KDO_SYMBOLPATH 9
  339. #define KDO_LOGFILENAME 10
  340. #define KDO_CRASHDUMP 11
  341. #define MAXKDOPTIONS (sizeof(KdOptions) / sizeof(KDOPTIONS))
  342. extern KDOPTIONS KdOptions[];
  343. #endif