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.

262 lines
7.3 KiB

  1. /*++
  2. Copyright (c) 1997-2000 Microsoft Corporation
  3. Module Name:
  4. traceint.h
  5. Abstract:
  6. Trace formatting internal definitions.
  7. Revision History:
  8. --*/
  9. #ifdef __cplusplus
  10. extern "C"{
  11. #endif
  12. #ifndef _TRACEINT_
  13. #define _TRACEINT_
  14. #define MAXLOGFILES 16
  15. #define MAXSTR 1024
  16. #define MAXFORMAT 1024
  17. #define MAXTYPE 256
  18. #define MAXGUIDS 128
  19. #define UC(x) ((UINT)((x) & 0xFF))
  20. #define NTOHS(x) ((UC(x) * 256) + UC((x) >> 8))
  21. #ifndef IsEqualGUID
  22. #define IsEqualGUID(guid1, guid2) \
  23. (!memcmp((guid1), (guid2), sizeof(GUID)))
  24. #endif
  25. #define InitializeListHead(ListHead) (\
  26. (ListHead)->Flink = (ListHead)->Blink = (ListHead))
  27. #define InsertTailList(ListHead,Entry) {\
  28. PLIST_ENTRY _EX_Blink;\
  29. PLIST_ENTRY _EX_ListHead;\
  30. _EX_ListHead = (ListHead);\
  31. _EX_Blink = _EX_ListHead->Blink;\
  32. (Entry)->Flink = _EX_ListHead;\
  33. (Entry)->Blink = _EX_Blink;\
  34. _EX_Blink->Flink = (Entry);\
  35. _EX_ListHead->Blink = (Entry);\
  36. }
  37. #define RemoveEntryList(Entry) {\
  38. PLIST_ENTRY _EX_Blink;\
  39. PLIST_ENTRY _EX_Flink;\
  40. _EX_Flink = (Entry)->Flink;\
  41. _EX_Blink = (Entry)->Blink;\
  42. _EX_Blink->Flink = _EX_Flink;\
  43. _EX_Flink->Blink = _EX_Blink;\
  44. }
  45. #define GUID_TYPE_HEADER _T("Header")
  46. #define GUID_TYPE_UNKNOWN _T("Unknown")
  47. #define GUID_TYPE_OBSOLETE _T("ObsoleteGUID")
  48. #define STR_ItemChar _T("ItemChar")
  49. #define STR_ItemUChar _T("ItemUChar")
  50. #define STR_ItemCharShort _T("ItemCharShort")
  51. #define STR_ItemCharSign _T("ItemCharSign")
  52. #define STR_ItemDouble _T("ItemDouble")
  53. #define STR_ItemShort _T("ItemShort")
  54. #define STR_ItemUShort _T("ItemUShort")
  55. #define STR_ItemLong _T("ItemLong")
  56. #define STR_ItemULong _T("ItemULong")
  57. #define STR_ItemULongX _T("ItemULongX")
  58. #define STR_ItemLongLong _T("ItemLongLong")
  59. #define STR_ItemULongLong _T("ItemULongLong")
  60. #define STR_ItemString _T("ItemString")
  61. #define STR_ItemWString _T("ItemWString")
  62. #define STR_ItemRString _T("ItemRString")
  63. #define STR_ItemRWString _T("ItemRWString")
  64. #define STR_ItemPString _T("ItemPString")
  65. #define STR_ItemPWString _T("ItemPWString")
  66. #define STR_ItemMLString _T("ItemMLString")
  67. #define STR_ItemNWString _T("ItemNWString")
  68. #define STR_ItemPtr _T("ItemPtr")
  69. #define STR_ItemDSString _T("ItemDSString")
  70. #define STR_ItemDSWString _T("ItemDSWString")
  71. #define STR_ItemSid _T("ItemSid")
  72. #define STR_ItemChar4 _T("ItemChar4")
  73. #define STR_ItemIPAddr _T("ItemIPAddr")
  74. #define STR_ItemIPV6Addr _T("ItemIPV6Addr")
  75. #define STR_ItemMACAddr _T("ItemMACAddr")
  76. #define STR_ItemPort _T("ItemPort")
  77. #define STR_ItemNWString _T("ItemNWString")
  78. #define STR_ItemListLong _T("ItemListLong")
  79. #define STR_ItemListShort _T("ItemListShort")
  80. #define STR_ItemListByte _T("ItemListByte")
  81. #define STR_ItemNTerror _T("ItemNTerror")
  82. #define STR_ItemMerror _T("ItemMerror")
  83. #define STR_ItemTimestamp _T("ItemTimestamp")
  84. #define STR_ItemHRESULT _T("ItemHRESULT")
  85. #define STR_ItemNTSTATUS _T("ItemNTSTATUS")
  86. #define STR_ItemWINERROR _T("ItemWINERROR")
  87. #define STR_ItemNETEVENT _T("ItemNETEVENT")
  88. #define STR_ItemGuid _T("ItemGuid")
  89. #define STR_ItemWaitTime _T("ItemWaitTime")
  90. #define STR_ItemTimeDelta _T("ItemTimeDelta")
  91. #define STR_ItemSetLong _T("ItemSetLong")
  92. #define STR_ItemSetShort _T("ItemSetShort")
  93. #define STR_ItemSetByte _T("ItemSetByte")
  94. #define STR_ItemCharHidden _T("ItemCharHidden")
  95. #define STR_ItemWChar _T("ItemWChar")
  96. #define STR_ItemHexDump _T("ItemHexDump")
  97. typedef struct _MOF_INFO
  98. {
  99. LIST_ENTRY Entry;
  100. LPTSTR strDescription; // Class Name
  101. ULONG EventCount;
  102. GUID Guid;
  103. PLIST_ENTRY ItemHeader;
  104. LPTSTR strType;
  105. LONG TypeIndex;
  106. ULONG TypeOfType;
  107. LPTSTR TypeFormat;
  108. LPTSTR FunctionName ;
  109. LPTSTR ComponentName ;
  110. LPTSTR SubComponentName ;
  111. LPTSTR TraceFlagsName ;
  112. LPTSTR TraceLevelsName ;
  113. INT Indent;
  114. } MOF_INFO, *PMOF_INFO;
  115. typedef struct _MOF_TYPE
  116. {
  117. TCHAR strType[MAXSTR];
  118. LONG TypeIndex;
  119. ULONG TypeType;
  120. TCHAR TypeFormat[MAXFORMAT];
  121. } MOF_TYPE, *PMOF_TYPE;
  122. typedef enum _ITEM_TYPE
  123. {
  124. ItemChar,
  125. ItemUChar,
  126. ItemCharShort,
  127. ItemCharSign,
  128. ItemShort,
  129. ItemUShort,
  130. ItemLong,
  131. ItemULong,
  132. ItemULongX,
  133. ItemLongLong,
  134. ItemULongLong,
  135. ItemString,
  136. ItemWString,
  137. ItemRString,
  138. ItemRWString,
  139. ItemPString,
  140. ItemPWString,
  141. ItemDSString,
  142. ItemDSWString,
  143. ItemSid,
  144. ItemChar4,
  145. ItemIPAddr,
  146. ItemIPV6Addr,
  147. ItemMACAddr,
  148. ItemPort,
  149. ItemMLString,
  150. ItemNWString, // Non-null terminated Wide Char String
  151. ItemPtr,
  152. ItemListLong, // Sort of Enumerated List, field is a long
  153. ItemListShort, // Sort of Enumerated List, field is a Short
  154. ItemListByte, // Sort of Enumerated List, field is a Byte
  155. ItemNTerror, // Convert an NT error number to the usual error string
  156. ItemMerror, // Convert an error number to a module message
  157. ItemTimestamp, // Convert a LongLong to a timestamp string
  158. ItemGuid, // convert a GUID to the usual string
  159. ItemNTSTATUS,
  160. ItemWINERROR,
  161. ItemNETEVENT,
  162. ItemWaitTime,
  163. ItemTimeDelta,
  164. ItemSetLong,
  165. ItemSetShort,
  166. ItemSetByte,
  167. ItemDouble,
  168. ItemHRESULT,
  169. ItemCharHidden, //Just a block of chars ( name from ETW)
  170. ItemWChar,
  171. ItemHexDump,
  172. ItemUnknown
  173. } ITEM_TYPE;
  174. typedef struct _ITEM_DESC *PITEM_DESC;
  175. typedef struct _ITEM_DESC
  176. {
  177. LIST_ENTRY Entry;
  178. LPTSTR strDescription;
  179. ULONG DataSize;
  180. LPTSTR ItemList;
  181. ITEM_TYPE ItemType;
  182. } ITEM_DESC;
  183. //
  184. // Now the routines we export
  185. //
  186. #ifndef TRACE_API
  187. #ifdef TRACE_EXPORTS
  188. #define TRACE_API __declspec(dllexport)
  189. #else
  190. #define TRACE_API __declspec(dllimport)
  191. #endif
  192. #endif
  193. TRACE_API void
  194. MapGuidToName(
  195. OUT PLIST_ENTRY * HeadEventList,
  196. IN LPGUID pGuid,
  197. IN ULONG nType,
  198. OUT LPTSTR wstr
  199. );
  200. TRACE_API ULONG
  201. UserDefinedGuid(
  202. OUT PLIST_ENTRY HeadEventList,
  203. IN LPGUID Guid,
  204. OUT LPTSTR wstr
  205. );
  206. TRACE_API VOID
  207. AddMofInfo(
  208. PLIST_ENTRY HeadEventList,
  209. const GUID * Guid,
  210. LPTSTR strType,
  211. ULONG typeIndex,
  212. LPTSTR strDesc,
  213. ITEM_TYPE ItemType,
  214. TCHAR * ItemList,
  215. ULONG TypeOfType,
  216. LPTSTR strFormat
  217. );
  218. // the following segment is used to impose our own formatting via a copy of RtlTraceFormat,
  219. // but which fixes up selected formats that we cannot handle correctly.
  220. NTSTATUS
  221. TraceFormatMessage(
  222. IN PWSTR MessageFormat,
  223. IN ULONG MaximumWidth OPTIONAL,
  224. IN BOOLEAN IgnoreInserts,
  225. IN BOOLEAN ArgumentsAreAnsi,
  226. IN BOOLEAN ArgumentsAreAnArray,
  227. IN va_list *Arguments,
  228. OUT PWSTR Buffer,
  229. IN ULONG Length,
  230. OUT PULONG ReturnLength OPTIONAL
  231. );
  232. #endif // #ifndef _TRACEINT_
  233. #ifdef __cplusplus
  234. }
  235. #endif