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.

204 lines
7.7 KiB

  1. #
  2. # Default types for WPP
  3. #
  4. # our basic arithmetic types
  5. DEFINE_SIMPLE_TYPE( SBYTE, signed char, ItemChar, "d", c, 1);
  6. DEFINE_SIMPLE_TYPE( SSHORT, signed short, ItemShort, "hd", h, 2);
  7. DEFINE_SIMPLE_TYPE( SINT, signed int, ItemLong, "d", d, 4);
  8. DEFINE_SIMPLE_TYPE( SLONG, signed long, ItemLong, "ld", l, 4);
  9. DEFINE_SIMPLE_TYPE( SINT64, signed __int64, ItemLongLong, "I64d", i, 8);
  10. DEFINE_SIMPLE_TYPE( UBYTE, unsigned char, ItemChar, "u", C, 1);
  11. DEFINE_SIMPLE_TYPE( USHORT, unsigned short, ItemShort, "hu", H, 2);
  12. DEFINE_SIMPLE_TYPE( UINT, unsigned int, ItemLong, "u", D, 4);
  13. DEFINE_SIMPLE_TYPE( ULONG, unsigned long, ItemLong, "lu", L, 4);
  14. DEFINE_SIMPLE_TYPE( UINT64, unsigned __int64, ItemLongLong, "I64u", I, 8);
  15. DEFINE_SIMPLE_TYPE( DOUBLE, double, ItemDouble, "s", g, 8);
  16. # arch dependent types
  17. DEFINE_SIMPLE_TYPE( SLONGPTR, LONG_PTR, ItemPtr, "Id", p, 6);
  18. DEFINE_SIMPLE_TYPE( ULONGPTR, ULONG_PTR, ItemPtr, "Iu", P, 6);
  19. DEFINE_SIMPLE_TYPE( PTR, const void*, ItemPtr, "p", q, 6);
  20. DEFINE_SIMPLE_TYPE( HANDLE, const void*, ItemPtr, "p", Q, 6);
  21. # predefined constants
  22. DEFINE_SIMPLE_TYPE( COMPNAME,,, "__COMPNAME__",,);
  23. DEFINE_SIMPLE_TYPE( FILE,,, "__FILE__",,);
  24. DEFINE_SIMPLE_TYPE( LINE,,, "__LINE__",,);
  25. DEFINE_SIMPLE_TYPE( FUNC,,, "%!FUNC!",,); // traceprt now understands %!FUNC!
  26. DEFINE_SIMPLE_TYPE( LEVEL,,, "%!LEVEL!",,); // and %!LEVEL%
  27. DEFINE_SIMPLE_TYPE( STDPREFIX,,, "%0",,);
  28. DEFINE_SIMPLE_TYPE( MOD,,, "%1!s!",,);
  29. DEFINE_SIMPLE_TYPE( TYP,,, "%2!s!",,);
  30. DEFINE_SIMPLE_TYPE( TID,,, "%3!x!",,);
  31. DEFINE_SIMPLE_TYPE( NOW,,, "%4!s!",,);
  32. DEFINE_SIMPLE_TYPE( SEQ,,, "%7!x!",,);
  33. DEFINE_SIMPLE_TYPE( PID,,, "%8!x!",,);
  34. DEFINE_SIMPLE_TYPE( CPU,,, "%9!x!",,);
  35. DEFINE_SIMPLE_TYPE( SPACE,,, " ",,);
  36. DEFINE_SIMPLE_TYPE_PTR(GUID, LPCGUID, ItemGuid, "s", _guid_, 0); // simple type, passed by addr
  37. DEFINE_FLAVOR( UCHAR, SBYTE, ItemUChar, "c" );
  38. DEFINE_FLAVOR( SCHAR, SBYTE, ItemChar, "c" );
  39. DEFINE_FLAVOR( BOOLEAN, SBYTE, ItemListByte(FALSE,TRUE), "s");
  40. # all strings require custom processing
  41. DEFINE_CPLX_TYPE(ASTR, WPP_LOGASTR, const char*, ItemString, "s", s, 0);
  42. DEFINE_CPLX_TYPE(ARSTR, WPP_LOGASTR, LPCSTR, ItemRString, "s", t, 0);
  43. DEFINE_CPLX_TYPE(ARWSTR, WPP_LOGWSTR, LPCWSTR, ItemRWString, "s", S, 0);
  44. DEFINE_CPLX_TYPE(WSTR, WPP_LOGWSTR, LPCWSTR, ItemWString, "s", S, 0);
  45. DEFINE_CPLX_TYPE(CSTR, WPP_LOGPCSTR, PCSTRING, ItemPString, "s", z, 0, 2);
  46. DEFINE_CPLX_TYPE(USTR, WPP_LOGPUSTR, PCUNICODE_STRING,ItemPWString,"s", Z, 0, 2);
  47. DEFINE_CPLX_TYPE(sid, WPP_LOGPSID, PSID, ItemSid,"s", _sid_, 0);
  48. DEFINE_CPLX_TYPE(str, WPP_LOGSTDSTR, const std::string&, ItemString,"s", _str_, 0);
  49. #kludge for printf like statements
  50. DEFINE_FLAVOR(e, DOUBLE,,);
  51. DEFINE_FLAVOR(E, DOUBLE,,);
  52. DEFINE_FLAVOR(f, DOUBLE,,);
  53. DEFINE_FLAVOR(g, DOUBLE,,);
  54. DEFINE_FLAVOR(G, DOUBLE,,);
  55. DEFINE_FLAVOR(c, SBYTE,,);
  56. DEFINE_FLAVOR(hc, SBYTE,,);
  57. DEFINE_FLAVOR(lc, SSHORT,,);
  58. DEFINE_FLAVOR(wc, SSHORT,,);
  59. DEFINE_FLAVOR(C, SSHORT,,);
  60. DEFINE_FLAVOR(s, ASTR,,);
  61. DEFINE_FLAVOR(hs, ASTR,,);
  62. DEFINE_FLAVOR(S, WSTR,,);
  63. DEFINE_FLAVOR(ws, WSTR,,);
  64. DEFINE_FLAVOR(ls, WSTR,,);
  65. DEFINE_FLAVOR(hi, SSHORT,,);
  66. DEFINE_FLAVOR(hd, SSHORT,,);
  67. DEFINE_FLAVOR(hu, USHORT,,"u");
  68. DEFINE_FLAVOR(hx, USHORT,,"x");
  69. DEFINE_FLAVOR(hX, USHORT,,"X");
  70. DEFINE_FLAVOR(ho, USHORT,,"o");
  71. DEFINE_FLAVOR(Id, ULONGPTR,,"Id");
  72. DEFINE_FLAVOR(Iu, ULONGPTR,,"Iu");
  73. DEFINE_FLAVOR(Ix, ULONGPTR,,"Ix");
  74. DEFINE_FLAVOR(IX, ULONGPTR,,"IX");
  75. DEFINE_FLAVOR(Io, ULONGPTR,,"Io");
  76. DEFINE_FLAVOR(i, SINT,,);
  77. DEFINE_FLAVOR(d, SINT,,);
  78. DEFINE_FLAVOR(u, UINT,,"u");
  79. DEFINE_FLAVOR(x, UINT,,"x");
  80. DEFINE_FLAVOR(X, UINT,,"X");
  81. DEFINE_FLAVOR(o, UINT,,"o");
  82. DEFINE_FLAVOR(cccc, SINT, ItemChar4, "s");
  83. DEFINE_FLAVOR(li, SLONG,,);
  84. DEFINE_FLAVOR(ld, SLONG,,);
  85. DEFINE_FLAVOR(lu, ULONG,,"u");
  86. DEFINE_FLAVOR(lx, ULONG,,"x");
  87. DEFINE_FLAVOR(lX, ULONG,,"X");
  88. DEFINE_FLAVOR(lo, ULONG,,"o");
  89. DEFINE_FLAVOR(I64d, SINT64,,);
  90. DEFINE_FLAVOR(I64u, UINT64,,);
  91. DEFINE_FLAVOR(I64x, UINT64,,"I64x");
  92. DEFINE_FLAVOR(I64X, UINT64,,"I64X");
  93. DEFINE_FLAVOR(I64o, UINT64,,"I64o");
  94. DEFINE_FLAVOR(p, PTR,,);
  95. DEFINE_FLAVOR(Z, USTR,,);
  96. DEFINE_FLAVOR(wZ, USTR,,);
  97. DEFINE_FLAVOR(z, CSTR,,);
  98. DEFINE_FLAVOR(hZ, CSTR,,);
  99. # default formats for those who don't care to provide their own strings
  100. DEFINE_FLAVOR(XBYTE, SBYTE,, "02x");
  101. DEFINE_FLAVOR(OBYTE, SBYTE,, "o");
  102. DEFINE_FLAVOR(XSHORT, SSHORT,, "04hX");
  103. DEFINE_FLAVOR(OSHORT, SSHORT,, "ho");
  104. DEFINE_FLAVOR(XINT, SINT,, "08x");
  105. DEFINE_FLAVOR(OINT, SINT,, "o");
  106. DEFINE_FLAVOR(XLONG, SLONG,, "08lX");
  107. DEFINE_FLAVOR(OLONG, SLONG,, "lo");
  108. DEFINE_FLAVOR(XINT64, SINT64,, "08i64X");
  109. DEFINE_FLAVOR(OINT64, SINT64,, "i64o");
  110. DEFINE_FLAVOR(XLONGPTR, SLONGPTR,,"Ix");
  111. DEFINE_FLAVOR(OLONGPTR, SLONGPTR,,"Ox");
  112. # special formats
  113. DEFINE_FLAVOR(IPADDR, UINT, ItemIPAddr, "s");
  114. DEFINE_FLAVOR(PORT, USHORT, ItemPort, "s");
  115. DEFINE_FLAVOR(STATUS, UINT, ItemNTSTATUS, "s");
  116. DEFINE_FLAVOR(WINERROR, UINT, ItemWINERROR, "s");
  117. DEFINE_FLAVOR(HRESULT, SINT, ItemHRESULT, "s");
  118. DEFINE_FLAVOR(ipaddr,IPADDR,,);
  119. DEFINE_FLAVOR(port,PORT,,);
  120. DEFINE_FLAVOR(status,STATUS,,);
  121. DEFINE_FLAVOR(hresult,HRESULT,,);
  122. DEFINE_FLAVOR(winerr,WINERROR,,);
  123. DEFINE_FLAVOR(guid,GUID,,);
  124. # time related stuff
  125. DEFINE_FLAVOR(TIMESTAMP, SINT64, ItemTimestamp, "s");
  126. DEFINE_FLAVOR(TIME, SINT64, ItemTimestamp, "s");
  127. DEFINE_FLAVOR(DATE, SINT64, ItemTimestamp, "s");
  128. DEFINE_FLAVOR(WAITTIME, SINT64, ItemTimestamp, "s");
  129. DEFINE_FLAVOR(due, SINT64, ItemWaitTime, "s");
  130. DEFINE_FLAVOR(delta, SINT64, ItemTimeDelta, "s");
  131. DEFINE_FLAVOR(datetime, SINT64, ItemTimestamp, "s");
  132. # enumeration types
  133. DEFINE_FLAVOR(ItemListByte, SBYTE, ItemListByte, "s");
  134. DEFINE_FLAVOR(ItemListShort, SSHORT, ItemListShort,"s");
  135. DEFINE_FLAVOR(ItemListLong, SLONG, ItemListLong, "s");
  136. DEFINE_FLAVOR(ItemSetByte, UBYTE, ItemSetByte, "s");
  137. DEFINE_FLAVOR(ItemSetShort, USHORT, ItemSetShort,"s");
  138. DEFINE_FLAVOR(ItemSetLong, ULONG, ItemSetLong, "s");
  139. CUSTOM_TYPE(b1, ItemSetByte(1,2,3,4,5,6,7,8) );
  140. CUSTOM_TYPE(b2, ItemSetShort(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) );
  141. CUSTOM_TYPE(b4, ItemSetLong(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31) );
  142. CUSTOM_TYPE(bool, ItemListLong(false,true) );
  143. CUSTOM_TYPE(bool16, ItemListShort(false,true) );
  144. CUSTOM_TYPE(bool8, ItemListByte(false,true) );
  145. CUSTOM_TYPE(irql, ItemListByte(Low,APC,DPC) );
  146. CUSTOM_TYPE(pnpmn, ItemListByte(IRP_MN_START_DEVICE,IRP_MN_QUERY_REMOVE_DEVICE,IRP_MN_REMOVE_DEVICE,IRP_MN_CANCEL_REMOVE_DEVICE,IRP_MN_STOP_DEVICE,IRP_MN_QUERY_STOP_DEVICE,IRP_MN_CANCEL_STOP_DEVICE,IRP_MN_QUERY_DEVICE_RELATIONS,IRP_MN_QUERY_INTERFACE,IRP_MN_QUERY_CAPABILITIES,IRP_MN_QUERY_RESOURCES,IRP_MN_QUERY_RESOURCE_REQUIREMENTS,IRP_MN_QUERY_DEVICE_TEXT,IRP_MN_FILTER_RESOURCE_REQUIREMENTS,IRP_MN_PNP_14,IRP_MN_READ_CONFIG,IRP_MN_WRITE_CONFIG,IRP_MN_EJECT,IRP_MN_SET_LOCK,IRP_MN_QUERY_ID,IRP_MN_QUERY_PNP_DEVICE_STATE,IRP_MN_QUERY_BUS_INFORMATION,IRP_MN_DEVICE_USAGE_NOTIFICATION,IRP_MN_SURPRISE_REMOVAL) );
  147. CUSTOM_TYPE(sysctrl, ItemListByte(IRP_MN_QUERY_ALL_DATA,IRP_MN_QUERY_SINGLE_INSTANCE, IRP_MN_CHANGE_SINGLE_INSTANCE, IRP_MN_CHANGE_SINGLE_ITEM, IRP_MN_ENABLE_EVENTS, IRP_MN_DISABLE_EVENTS, IRP_MN_ENABLE_COLLECTION, IRP_MN_DISABLE_COLLECTION, IRP_MN_REGINFO, IRP_MN_EXECUTE_METHOD, IRP_MN_Reserved_0a, IRP_MN_REGINFO_EX) );
  148. # default tracing macro
  149. FUNC DoTraceMessage(LEVEL,MSG,...);
  150. # default prefix (use traceprt default)
  151. USEPREFIX(*,"%!STDPREFIX!"); // traceprt will add standard prefix
  152. WPP_FLAGS(-lookfor:WPP_INIT_TRACING); // the same flags that can be passed on the command line to tracewpp