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

211 lines
6.2 KiB

  1. /*
  2. * dbgdll.h - Main header file of DBG DLL.
  3. *
  4. */
  5. #ifdef i386
  6. extern PX86CONTEXT px86;
  7. #endif
  8. extern DECLSPEC_IMPORT VDMLDT_ENTRY *ExpLdt;
  9. #define SEGMENT_IS_BIG(sel) (ExpLdt[(sel & ~0x7)/sizeof(VDMLDT_ENTRY)].HighWord.Bits.Default_Big)
  10. extern DWORD IntelMemoryBase;
  11. extern DWORD VdmDbgTraceFlags;
  12. extern BOOL fDebugged;
  13. extern VDMCONTEXT vcContext;
  14. extern WORD EventFlags;
  15. extern VDMINTERNALINFO viInfo;
  16. extern DWORD EventParams[4];
  17. extern VDM_BREAKPOINT VdmBreakPoints[MAX_VDM_BREAKPOINTS];
  18. #define MAX_MODULE 64
  19. #define MAX_DBG_FRAME 10
  20. typedef struct _trapframe {
  21. WORD wCode; /* Noise from DbgDispatchBop */
  22. WORD wAX; /* AX at time of fault */
  23. WORD wDS; /* DS at time of fault */
  24. WORD wRetIP; /* Noise from DPMI */
  25. WORD wRetCS; /* Noise from DPMI */
  26. WORD wErrCode; /* Noise from 16-bit kernel */
  27. WORD wIP; /* IP at time of fault */
  28. WORD wCS; /* CS at time of fault */
  29. WORD wFlags; /* Flags at time of fault */
  30. WORD wSP; /* SS at time of fault */
  31. WORD wSS; /* SP at time of fault */
  32. } TFRAME16;
  33. typedef TFRAME16 UNALIGNED *PTFRAME16;
  34. typedef struct _faultframe {
  35. WORD wES; /* ES at time of fault */
  36. WORD wDS; /* DS at time of fault */
  37. WORD wDI; /* DI at time of fault */
  38. WORD wSI; /* SI at time of fault */
  39. WORD wTempBP; /* Noise from 16-bit kernel stack frame */
  40. WORD wTempSP; /* Noise from 16-bit kernel stack frame */
  41. WORD wBX; /* BX at time of fault */
  42. WORD wDX; /* DX at time of fault */
  43. WORD wCX; /* CX at time of fault */
  44. WORD wAX; /* AX at time of fault */
  45. WORD wBP; /* BP at time of fault */
  46. WORD npszMsg; /* Noise from 16-bit kernel */
  47. WORD wPrevIP; /* Noise from DPMI */
  48. WORD wPrevCS; /* Noise from DPMI */
  49. WORD wRetIP; /* Noise from DPMI */
  50. WORD wRetCS; /* Noise from DPMI */
  51. WORD wErrCode; /* Noise from 16-bit kernel */
  52. WORD wIP; /* IP at time of fault */
  53. WORD wCS; /* CS at time of fault */
  54. WORD wFlags; /* Flags at time of fault */
  55. WORD wSP; /* SS at time of fault */
  56. WORD wSS; /* SP at time of fault */
  57. } FFRAME16;
  58. typedef FFRAME16 UNALIGNED *PFFRAME16;
  59. typedef struct _newtaskframe {
  60. DWORD dwNoise; /* Noise from InitTask */
  61. DWORD dwModulePath; /* Module path address */
  62. DWORD dwModuleName; /* Module name address */
  63. WORD hModule; /* 16-bit Module handle */
  64. WORD hTask; /* 16-bit Task handle */
  65. WORD wFlags; /* Flags at time to task start */
  66. WORD wDX; /* DX at time of task start */
  67. WORD wBX; /* BX at time of task start */
  68. WORD wES; /* ES at time of task start */
  69. WORD wCX; /* CX at time of task start */
  70. WORD wAX; /* AX at time of task start */
  71. WORD wDI; /* DI at time of task start */
  72. WORD wSI; /* SI at time of task start */
  73. WORD wDS; /* DS at time of task start */
  74. WORD wBP; /* BP at time of task start */
  75. WORD wIP; /* IP for task start */
  76. WORD wCS; /* CS for task start */
  77. } NTFRAME16;
  78. typedef NTFRAME16 UNALIGNED *PNTFRAME16;
  79. #pragma pack(2)
  80. typedef struct _stoptaskframe {
  81. WORD wCode; /* Noise from BOP Dispatcher */
  82. DWORD dwModulePath; /* Module path address */
  83. DWORD dwModuleName; /* Module name address */
  84. WORD hModule; /* 16-bit Module handle */
  85. WORD hTask; /* 16-bit Task handle */
  86. } STFRAME16;
  87. typedef STFRAME16 UNALIGNED *PSTFRAME16;
  88. typedef struct _newdllframe {
  89. WORD wCode; /* Noise from DbgDispatchBop */
  90. DWORD dwModulePath; /* Module path address */
  91. DWORD dwModuleName; /* Module name address */
  92. WORD hModule; /* 16-bit Module handle */
  93. WORD hTask; /* 16-bit Task handle */
  94. WORD wDS; /* DS at time of dll start */
  95. WORD wAX; /* AX at time of dll start */
  96. WORD wIP; /* IP at time of dll start */
  97. WORD wCS; /* CS at time of dll start */
  98. WORD wFlags; /* Flags at time of dll start */
  99. } NDFRAME16;
  100. typedef NDFRAME16 UNALIGNED *PNDFRAME16;
  101. #pragma pack()
  102. VOID
  103. DbgAttach(
  104. VOID
  105. );
  106. VOID
  107. FlushVdmBreakPoints(
  108. VOID
  109. );
  110. BOOL
  111. SendVDMEvent(
  112. WORD wEventType
  113. );
  114. VOID
  115. DbgGetContext(
  116. VOID
  117. );
  118. void
  119. DbgSetTemporaryBP(
  120. WORD Seg,
  121. DWORD Offset,
  122. BOOL mode
  123. );
  124. void SegmentLoad(
  125. LPSTR lpModuleName,
  126. LPSTR lpPathName,
  127. WORD Selector,
  128. WORD Segment,
  129. BOOL fData
  130. );
  131. void SegmentMove(
  132. WORD OldSelector,
  133. WORD NewSelector
  134. );
  135. void SegmentFree(
  136. WORD Selector,
  137. BOOL fBPRelease
  138. );
  139. void ModuleLoad(
  140. LPSTR lpModuleName,
  141. LPSTR lpPathName,
  142. WORD Segment,
  143. DWORD Length
  144. );
  145. void ModuleSegmentMove(
  146. LPSTR lpModuleName,
  147. LPSTR lpPathName,
  148. WORD ModuleSegment,
  149. WORD OldSelector,
  150. WORD NewSelector,
  151. DWORD Length
  152. );
  153. void ModuleFree(
  154. LPSTR lpModuleName,
  155. LPSTR lpPathName
  156. );
  157. BOOL DbgGPFault2(
  158. PFFRAME16 pFFrame
  159. );
  160. BOOL DbgDivOverflow2(
  161. PTFRAME16 pTFrame
  162. );
  163. VOID
  164. RestoreVDMContext(
  165. VDMCONTEXT *vcContext
  166. );
  167. VOID
  168. DbgDosAppStart(
  169. WORD wCS,
  170. WORD wIP
  171. );
  172. BOOL
  173. DbgDllStart(
  174. PNDFRAME16 pNDFrame
  175. );
  176. BOOL
  177. DbgTaskStop(
  178. PSTFRAME16 pSTFrame
  179. );