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.

316 lines
15 KiB

  1. /**INC+**********************************************************************/
  2. /* Header: wtrcint.h */
  3. /* */
  4. /* Purpose: Interal tracing functions header - Windows specific */
  5. /* */
  6. /* Copyright(C) Microsoft Corporation 1997 */
  7. /* */
  8. /****************************************************************************/
  9. /** Changes:
  10. * $Log: Y:/logs/h/dcl/wtrcint.h_v $
  11. *
  12. * Rev 1.8 29 Aug 1997 09:22:56 ENH
  13. * SFR1259: Changed SystemError
  14. *
  15. * Rev 1.7 22 Aug 1997 15:11:18 SJ
  16. * SFR1291: Win16 Trace DLL doesn't write integers to ini file properly
  17. *
  18. * Rev 1.6 10 Jul 1997 18:09:44 AK
  19. * SFR1016: Initial changes to support Unicode
  20. *
  21. * Rev 1.5 10 Jul 1997 17:26:14 KH
  22. * SFR1022: Get 16-bit trace working
  23. **/
  24. /**INC-**********************************************************************/
  25. #ifndef _H_WTRCINT
  26. #define _H_WTRCINT
  27. #ifdef VER_HOST
  28. #include <wosiapi.h>
  29. #endif /* VER_HOST */
  30. /****************************************************************************/
  31. /* */
  32. /* CONSTANTS */
  33. /* */
  34. /****************************************************************************/
  35. /****************************************************************************/
  36. /* Notification constants. */
  37. /****************************************************************************/
  38. #define TRC_TRACE_DLL_INITIALIZE 0
  39. #define TRC_TRACE_DLL_TERMINATE 1
  40. #define TRC_PROCESS_ATTACH_NOTIFY 2
  41. #define TRC_PROCESS_DETACH_NOTIFY 3
  42. #define TRC_THREAD_ATTACH_NOTIFY 4
  43. #define TRC_THREAD_DETACH_NOTIFY 5
  44. #define TRC_SYMBOLS_LOADING_NOTIFY 6
  45. #define TRC_SYMBOLS_LOADED_NOTIFY 7
  46. #define TRC_SYMBOLS_UNLOAD_NOTIFY 8
  47. #define TRC_FILES_RESET 9
  48. /****************************************************************************/
  49. /* Trace internal error return values. */
  50. /****************************************************************************/
  51. #define TRC_RC(N) ((DCUINT16)N + TRC_BASE_RC)
  52. #define TRC_RC_CREATE_MAPPING_FAILED TRC_RC( 1)
  53. #define TRC_RC_MAP_VIEW_FAILED TRC_RC( 2)
  54. #define TRC_RC_CREATE_FILE_FAILED TRC_RC( 3)
  55. #define TRC_RC_IO_ERROR TRC_RC( 4)
  56. #define TRC_RC_CREATE_MUTEX_FAILED TRC_RC( 5)
  57. #define TRC_RC_SYMBOL_LOAD_FAILED TRC_RC( 6)
  58. #define TRC_RC_SYMBOL_UNLOAD_FAILED TRC_RC( 7)
  59. #define TRC_RC_SET_SEC_INFO_FAILED TRC_RC( 8)
  60. /****************************************************************************/
  61. /* Assert box text */
  62. /****************************************************************************/
  63. #define TRC_ASSERT_TEXT _T("%s\n\nFunction %s in file %s at line %d.\n")
  64. #define TRC_ASSERT_TEXT2 _T("\n(Press Retry to debug the application)")
  65. /****************************************************************************/
  66. /* Registry buffer constants. */
  67. /****************************************************************************/
  68. #define TRC_MAX_SUBKEY 256
  69. /****************************************************************************/
  70. /* Internal trace status flags. These are maintained on a per process */
  71. /* basis and are stored in the <trcProcessStatus> field. */
  72. /* */
  73. /* TRC_STATUS_SYMBOLS_LOADED : are the debug symbols loaded. */
  74. /****************************************************************************/
  75. #define TRC_STATUS_SYMBOLS_LOADED DCFLAG32(1)
  76. /****************************************************************************/
  77. /* Carriage return and line feed pair. */
  78. /****************************************************************************/
  79. #define TRC_CRLF _T("\r\n")
  80. /****************************************************************************/
  81. /* Trace format definitions. These are used for printing various parts of */
  82. /* the trace lines. */
  83. /* */
  84. /* MODL is the module name. */
  85. /* STCK is the stack format (offset, bp, parm1-4). */
  86. /* */
  87. /****************************************************************************/
  88. #define TRC_MODL_FMT _T("%8.8s")
  89. #define TRC_STCK_FMT _T("%08x %08x %08x %08x %08x %08x %08x")
  90. #ifdef VER_HOST
  91. /****************************************************************************/
  92. /* Specific values for trace escape codes */
  93. /****************************************************************************/
  94. #define TRC_ESC(code) (OSI_TRC_ESC_FIRST + code)
  95. #define TRC_ESC_SET_TRACE TRC_ESC(0) /* Set new trace level & filter */
  96. #define TRC_ESC_GET_TRACE TRC_ESC(1) /* Get latest kernel trace data */
  97. #endif /* VER_HOST */
  98. /****************************************************************************/
  99. /* */
  100. /* TYPEDEFS */
  101. /* */
  102. /****************************************************************************/
  103. /****************************************************************************/
  104. /* TRC_SHARED_DATA */
  105. /* =============== */
  106. /* The pointer to the start of the shared data memory mapped file is cast */
  107. /* as a PTRC_SHARED_DATA. */
  108. /* */
  109. /* */
  110. /* trcConfig - a trace configuration structure which contains the */
  111. /* trace level, prefix list etc. */
  112. /* trcIndicator - which trace MMF is in use. */
  113. /* trcOffset - the current offset from the start of the trace */
  114. /* file. */
  115. /* trcpOutputBuffer - the trace output buffer. */
  116. /* trcpModuleFileName - the module file name of the trace DLL. */
  117. /* trcpStorageBuffer - the kernel mode trace output buffer. */
  118. /* */
  119. /****************************************************************************/
  120. typedef struct tagTRC_SHARED_DATA
  121. {
  122. TRC_CONFIG trcConfig;
  123. TRC_FILTER trcFilter;
  124. DCUINT trcIndicator;
  125. DCUINT32 trcOffset;
  126. DCTCHAR trcpOutputBuffer[TRC_LINE_BUFFER_SIZE];
  127. DCTCHAR trcpModuleFileName[TRC_FILE_NAME_SIZE];
  128. DCTCHAR trcpStorageBuffer[TRC_KRNL_BUFFER_SIZE];
  129. } TRC_SHARED_DATA;
  130. typedef TRC_SHARED_DATA DCPTR PTRC_SHARED_DATA;
  131. #ifdef VER_HOST
  132. /**STRUCT+*******************************************************************/
  133. /* STRUCTURE: TRC_CHANGE_CONFIG */
  134. /* */
  135. /* DESCRIPTION: */
  136. /* */
  137. /* This structure is used to pass the new trace settings to the OSI task. */
  138. /****************************************************************************/
  139. typedef struct tagTRC_CHANGE_CONFIG
  140. {
  141. OSI_ESCAPE_HEADER header; /* Common escape header */
  142. TRC_CONFIG config; /* New tracing configuration */
  143. TRC_FILTER filter; /* New filter configuration */
  144. } TRC_CHANGE_CONFIG, DCPTR PTRC_CHANGE_CONFIG;
  145. /**STRUCT-*******************************************************************/
  146. /**STRUCT+*******************************************************************/
  147. /* STRUCTURE: TRC_GET_OUTPUT */
  148. /* */
  149. /* DESCRIPTION: */
  150. /* */
  151. /* This structure is used to pass the latest kernel mode tracing to user */
  152. /* space. */
  153. /****************************************************************************/
  154. typedef struct tagTRC_GET_OUTPUT
  155. {
  156. OSI_ESCAPE_HEADER header; /* Common escape header */
  157. PDCTCHAR buffer; /* Latest buffer of trace output */
  158. DCUINT32 length; /* Length of data in the buffer */
  159. DCUINT32 linesLost; /* Lines lost from kernel trace */
  160. } TRC_GET_OUTPUT, DCPTR PTRC_GET_OUTPUT;
  161. /**STRUCT-*******************************************************************/
  162. #endif /* VER_HOST */
  163. /****************************************************************************/
  164. /* */
  165. /* FUNCTIONS */
  166. /* */
  167. /****************************************************************************/
  168. /****************************************************************************/
  169. /* */
  170. /* TRCBlankFile */
  171. /* TRCCloseAllFiles */
  172. /* TRCCloseSharedData */
  173. /* TRCCloseSingleFile */
  174. /* TRCDetermineIndicator */
  175. /* TRCDetermineOffset */
  176. /* TRCDisplayAssertBox */
  177. /* TRCGetCurrentDate */
  178. /* TRCGetCurrentTime */
  179. /* TRCGetFileTime */
  180. /* TRCSystemError */
  181. /* TRCOpenAllFiles */
  182. /* TRCOpenSharedData */
  183. /* TRCOpenSingleFile */
  184. /* TRCOutputToFile */
  185. /* TRCReadEntry */
  186. /* TRCReadProfInt */
  187. /* TRCReadProfString */
  188. /* TRCStackTrace */
  189. /* TRCSymbolsLoad */
  190. /* TRCSymbolsUnload */
  191. /* TRCWriteEntry */
  192. /* TRCWriteProfInt */
  193. /* TRCWriteProfString */
  194. /* */
  195. /****************************************************************************/
  196. DCVOID DCINTERNAL TRCMaybeSwapFile(DCUINT length);
  197. DCVOID DCINTERNAL TRCExitProcess(DCUINT32 exitCode);
  198. DCVOID DCINTERNAL TRCBlankFile(DCUINT fileNumber);
  199. DCVOID DCINTERNAL TRCCloseAllFiles(DCVOID);
  200. DCVOID DCINTERNAL TRCCloseSharedData(DCVOID);
  201. DCVOID DCINTERNAL TRCCloseSingleFile(DCUINT fileNumber, DCUINT seconds);
  202. DCVOID DCINTERNAL TRCDetermineIndicator(DCVOID);
  203. DCUINT32 DCINTERNAL TRCDetermineOffset(DCUINT32 fileNum);
  204. DCVOID DCINTERNAL TRCDisplayAssertBox(PDCTCHAR pText);
  205. DCVOID DCINTERNAL TRCGetCurrentDate(PDC_DATE pDate);
  206. DCVOID DCINTERNAL TRCGetCurrentTime(PDC_TIME pTime);
  207. DCVOID DCINTERNAL TRCGetKernelTrace(DCVOID);
  208. #ifndef DLL_DISP
  209. DCBOOL DCINTERNAL TRCGetFileTime(DCUINT fileNumber,
  210. PDCFILETIME pFileTime);
  211. DCUINT DCINTERNAL TRCReadEntry(HKEY topLevelKey,
  212. PDCTCHAR pEntry,
  213. PDCVOID pBuffer,
  214. DCINT bufferSize,
  215. DCINT32 expectedDataType);
  216. DCUINT DCINTERNAL TRCWriteEntry(HKEY topLevelKey,
  217. PDCTCHAR pEntry,
  218. PDCTCHAR pData,
  219. DCINT dataSize,
  220. DCINT32 dataType);
  221. #endif
  222. DCVOID DCINTERNAL TRCSystemError(DCUINT traceComponent,
  223. DCUINT lineNumber,
  224. PDCTCHAR funcName,
  225. PDCTCHAR fileName,
  226. PDCTCHAR string);
  227. DCUINT DCINTERNAL TRCOpenAllFiles(DCVOID);
  228. DCUINT DCINTERNAL TRCOpenSharedData(DCVOID);
  229. DCUINT DCINTERNAL TRCOpenSingleFile(DCUINT fileNumber);
  230. DCVOID DCINTERNAL TRCOutputToFile(PDCTCHAR pText,
  231. DCUINT length,
  232. DCUINT traceLevel);
  233. DCVOID DCINTERNAL TRCOutputToUser(PDCTCHAR pText,
  234. DCUINT32 length,
  235. DCUINT32 traceLevel);
  236. DCUINT DCINTERNAL TRCReadProfInt(PDCTCHAR pEntry,
  237. PDCUINT32 pValue);
  238. DCUINT DCINTERNAL TRCReadProfString(PDCTCHAR pEntry,
  239. PDCTCHAR pBuffer,
  240. DCINT16 bufferSize);
  241. DCVOID DCINTERNAL TRCStackTrace(DCUINT traceLevel);
  242. DCUINT DCINTERNAL TRCSymbolsLoad(DCVOID);
  243. DCUINT DCINTERNAL TRCSymbolsUnload(DCVOID);
  244. DCUINT DCINTERNAL TRCWriteProfInt(PDCTCHAR pEntry,
  245. PDCUINT32 pValue);
  246. DCUINT DCINTERNAL TRCWriteProfString(PDCTCHAR pEntry,
  247. PDCTCHAR pBuffer);
  248. DCUINT DCINTERNAL TRCGetModuleFileName(PDCTCHAR pModuleName,
  249. UINT cchModuleName);
  250. /****************************************************************************/
  251. /* Get the platform specific definitions */
  252. /****************************************************************************/
  253. #ifdef OS_WIN16
  254. #include <dtrcint.h>
  255. #else
  256. #include <ntrcint.h>
  257. #endif
  258. #endif /* _H_WTRCINT */