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.

247 lines
6.7 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 STR_ItemChar _T("ItemChar")
  48. #define STR_ItemUChar _T("ItemUChar")
  49. #define STR_ItemCharShort _T("ItemCharShort")
  50. #define STR_ItemCharSign _T("ItemCharSign")
  51. #define STR_ItemDouble _T("ItemDouble")
  52. #define STR_ItemShort _T("ItemShort")
  53. #define STR_ItemUShort _T("ItemUShort")
  54. #define STR_ItemLong _T("ItemLong")
  55. #define STR_ItemULong _T("ItemULong")
  56. #define STR_ItemULongX _T("ItemULongX")
  57. #define STR_ItemLongLong _T("ItemLongLong")
  58. #define STR_ItemULongLong _T("ItemULongLong")
  59. #define STR_ItemString _T("ItemString")
  60. #define STR_ItemWString _T("ItemWString")
  61. #define STR_ItemRString _T("ItemRString")
  62. #define STR_ItemRWString _T("ItemRWString")
  63. #define STR_ItemPString _T("ItemPString")
  64. #define STR_ItemPWString _T("ItemPWString")
  65. #define STR_ItemMLString _T("ItemMLString")
  66. #define STR_ItemNWString _T("ItemNWString")
  67. #define STR_ItemPtr _T("ItemPtr")
  68. #define STR_ItemDSString _T("ItemDSString")
  69. #define STR_ItemDSWString _T("ItemDSWString")
  70. #define STR_ItemSid _T("ItemSid")
  71. #define STR_ItemChar4 _T("ItemChar4")
  72. #define STR_ItemIPAddr _T("ItemIPAddr")
  73. #define STR_ItemPort _T("ItemPort")
  74. #define STR_ItemNWString _T("ItemNWString")
  75. #define STR_ItemListLong _T("ItemListLong")
  76. #define STR_ItemListShort _T("ItemListShort")
  77. #define STR_ItemListByte _T("ItemListByte")
  78. #define STR_ItemNTerror _T("ItemNTerror")
  79. #define STR_ItemMerror _T("ItemMerror")
  80. #define STR_ItemTimestamp _T("ItemTimestamp")
  81. #define STR_ItemHRESULT _T("ItemHRESULT")
  82. #define STR_ItemNTSTATUS _T("ItemNTSTATUS")
  83. #define STR_ItemWINERROR _T("ItemWINERROR")
  84. #define STR_ItemNETEVENT _T("ItemNETEVENT")
  85. #define STR_ItemGuid _T("ItemGuid")
  86. #define STR_ItemWaitTime _T("ItemWaitTime")
  87. #define STR_ItemTimeDelta _T("ItemTimeDelta")
  88. #define STR_ItemSetLong _T("ItemSetLong")
  89. #define STR_ItemSetShort _T("ItemSetShort")
  90. #define STR_ItemSetByte _T("ItemSetByte")
  91. #define STR_ItemCharHidden _T("ItemCharHidden")
  92. typedef struct _MOF_INFO
  93. {
  94. LIST_ENTRY Entry;
  95. LPTSTR strDescription; // Class Name
  96. ULONG EventCount;
  97. GUID Guid;
  98. PLIST_ENTRY ItemHeader;
  99. LPTSTR strType;
  100. LONG TypeIndex;
  101. ULONG TypeOfType;
  102. LPTSTR TypeFormat;
  103. INT Indent;
  104. } MOF_INFO, *PMOF_INFO;
  105. typedef struct _MOF_TYPE
  106. {
  107. TCHAR strType[MAXSTR];
  108. LONG TypeIndex;
  109. ULONG TypeType;
  110. TCHAR TypeFormat[MAXFORMAT];
  111. } MOF_TYPE, *PMOF_TYPE;
  112. typedef enum _ITEM_TYPE
  113. {
  114. ItemChar,
  115. ItemUChar,
  116. ItemCharShort,
  117. ItemCharSign,
  118. ItemShort,
  119. ItemUShort,
  120. ItemLong,
  121. ItemULong,
  122. ItemULongX,
  123. ItemLongLong,
  124. ItemULongLong,
  125. ItemString,
  126. ItemWString,
  127. ItemRString,
  128. ItemRWString,
  129. ItemPString,
  130. ItemPWString,
  131. ItemDSString,
  132. ItemDSWString,
  133. ItemSid,
  134. ItemChar4,
  135. ItemIPAddr,
  136. ItemPort,
  137. ItemMLString,
  138. ItemNWString, // Non-null terminated Wide Char String
  139. ItemPtr,
  140. ItemListLong, // Sort of Enumerated List, field is a long
  141. ItemListShort, // Sort of Enumerated List, field is a Short
  142. ItemListByte, // Sort of Enumerated List, field is a Byte
  143. ItemNTerror, // Convert an NT error number to the usual error string
  144. ItemMerror, // Convert an error number to a module message
  145. ItemTimestamp, // Convert a LongLong to a timestamp string
  146. ItemGuid, // convert a GUID to the usual string
  147. ItemNTSTATUS,
  148. ItemWINERROR,
  149. ItemNETEVENT,
  150. ItemWaitTime,
  151. ItemTimeDelta,
  152. ItemSetLong,
  153. ItemSetShort,
  154. ItemSetByte,
  155. ItemDouble,
  156. ItemHRESULT,
  157. ItemCharHidden, //Just a block of chars ( name from ETW)
  158. ItemUnknown
  159. } ITEM_TYPE;
  160. typedef struct _ITEM_DESC *PITEM_DESC;
  161. typedef struct _ITEM_DESC
  162. {
  163. LIST_ENTRY Entry;
  164. LPTSTR strDescription;
  165. ULONG DataSize;
  166. LPTSTR ItemList;
  167. ITEM_TYPE ItemType;
  168. } ITEM_DESC;
  169. //
  170. // Now the routines we export
  171. //
  172. #ifndef TRACE_API
  173. #ifdef TRACE_EXPORTS
  174. #define TRACE_API __declspec(dllexport)
  175. #else
  176. #define TRACE_API __declspec(dllimport)
  177. #endif
  178. #endif
  179. TRACE_API void
  180. MapGuidToName(
  181. OUT PLIST_ENTRY * HeadEventList,
  182. IN LPGUID pGuid,
  183. IN ULONG nType,
  184. OUT LPTSTR wstr
  185. );
  186. TRACE_API ULONG
  187. UserDefinedGuid(
  188. OUT PLIST_ENTRY HeadEventList,
  189. IN LPGUID Guid,
  190. OUT LPTSTR wstr
  191. );
  192. TRACE_API VOID
  193. AddMofInfo(
  194. PLIST_ENTRY HeadEventList,
  195. const GUID * Guid,
  196. LPTSTR strType,
  197. ULONG typeIndex,
  198. LPTSTR strDesc,
  199. ITEM_TYPE ItemType,
  200. TCHAR * ItemList,
  201. ULONG TypeOfType,
  202. LPTSTR strFormat
  203. );
  204. // the following segment is used to impose our own formatting via a copy of RtlTraceFormat,
  205. // but which fixes up selected formats that we cannot handle correctly.
  206. #define STRINGFIXUP 1 // This conditional is used to identify the differences
  207. NTSTATUS
  208. TraceFormatMessage(
  209. IN PWSTR MessageFormat,
  210. IN ULONG MaximumWidth OPTIONAL,
  211. IN BOOLEAN IgnoreInserts,
  212. IN BOOLEAN ArgumentsAreAnsi,
  213. IN BOOLEAN ArgumentsAreAnArray,
  214. IN va_list *Arguments,
  215. OUT PWSTR Buffer,
  216. IN ULONG Length,
  217. OUT PULONG ReturnLength OPTIONAL
  218. );
  219. #endif // #ifndef _TRACEINT_
  220. #ifdef __cplusplus
  221. }
  222. #endif