|
|
# # Default types for WPP #
# our basic arithmetic types
DEFINE_SIMPLE_TYPE( SBYTE, signed char, ItemChar, "d", c, 1); DEFINE_SIMPLE_TYPE( SSHORT, signed short, ItemShort, "hd", h, 2); DEFINE_SIMPLE_TYPE( SINT, signed int, ItemLong, "d", d, 4); DEFINE_SIMPLE_TYPE( SLONG, signed long, ItemLong, "ld", l, 4); DEFINE_SIMPLE_TYPE( SINT64, signed __int64, ItemLongLong, "I64d", i, 8);
DEFINE_SIMPLE_TYPE( UBYTE, unsigned char, ItemChar, "u", C, 1); DEFINE_SIMPLE_TYPE( USHORT, unsigned short, ItemShort, "hu", H, 2); DEFINE_SIMPLE_TYPE( UINT, unsigned int, ItemLong, "u", D, 4); DEFINE_SIMPLE_TYPE( ULONG, unsigned long, ItemLong, "lu", L, 4); DEFINE_SIMPLE_TYPE( UINT64, unsigned __int64, ItemLongLong, "I64u", I, 8);
DEFINE_SIMPLE_TYPE( DOUBLE, double, ItemDouble, "s", g, 8);
# arch dependent types
DEFINE_SIMPLE_TYPE( SLONGPTR, LONG_PTR, ItemPtr, "Id", p, 6); DEFINE_SIMPLE_TYPE( ULONGPTR, ULONG_PTR, ItemPtr, "Iu", P, 6); DEFINE_SIMPLE_TYPE( PTR, const void*, ItemPtr, "p", q, 6); DEFINE_SIMPLE_TYPE( HANDLE, const void*, ItemPtr, "p", Q, 6);
# predefined constants
DEFINE_SIMPLE_TYPE( COMPNAME,,, "__COMPNAME__",,); DEFINE_SIMPLE_TYPE( FILE,,, "__FILE__",,); DEFINE_SIMPLE_TYPE( LINE,,, "__LINE__",,); DEFINE_SIMPLE_TYPE( FUNC,,, "%!FUNC!",,); // traceprt now understands %!FUNC! DEFINE_SIMPLE_TYPE( LEVEL,,, "%!LEVEL!",,); // and %!LEVEL%
DEFINE_SIMPLE_TYPE( STDPREFIX,,, "%0",,); DEFINE_SIMPLE_TYPE( MOD,,, "%1!s!",,); DEFINE_SIMPLE_TYPE( TYP,,, "%2!s!",,); DEFINE_SIMPLE_TYPE( TID,,, "%3!x!",,); DEFINE_SIMPLE_TYPE( NOW,,, "%4!s!",,); DEFINE_SIMPLE_TYPE( SEQ,,, "%7!x!",,); DEFINE_SIMPLE_TYPE( PID,,, "%8!x!",,); DEFINE_SIMPLE_TYPE( CPU,,, "%9!x!",,); DEFINE_SIMPLE_TYPE( SPACE,,, " ",,);
DEFINE_SIMPLE_TYPE_PTR(GUID, LPCGUID, ItemGuid, "s", _guid_, 0); // simple type, passed by addr
DEFINE_FLAVOR( UCHAR, SBYTE, ItemUChar, "c" ); DEFINE_FLAVOR( SCHAR, SBYTE, ItemChar, "c" ); DEFINE_FLAVOR( BOOLEAN, SBYTE, ItemListByte(FALSE,TRUE), "s");
# all strings require custom processing
DEFINE_CPLX_TYPE(ASTR, WPP_LOGASTR, const char*, ItemString, "s", s, 0); DEFINE_CPLX_TYPE(ARSTR, WPP_LOGASTR, LPCSTR, ItemRString, "s", t, 0); DEFINE_CPLX_TYPE(ARWSTR, WPP_LOGWSTR, LPCWSTR, ItemRWString, "s", S, 0); DEFINE_CPLX_TYPE(WSTR, WPP_LOGWSTR, LPCWSTR, ItemWString, "s", S, 0); DEFINE_CPLX_TYPE(CSTR, WPP_LOGPCSTR, PCSTRING, ItemPString, "s", z, 0, 2); DEFINE_CPLX_TYPE(USTR, WPP_LOGPUSTR, PCUNICODE_STRING,ItemPWString,"s", Z, 0, 2);
DEFINE_CPLX_TYPE(sid, WPP_LOGPSID, PSID, ItemSid,"s", _sid_, 0); DEFINE_CPLX_TYPE(str, WPP_LOGSTDSTR, const std::string&, ItemString,"s", _str_, 0);
#kludge for printf like statements
DEFINE_FLAVOR(e, DOUBLE,,); DEFINE_FLAVOR(E, DOUBLE,,); DEFINE_FLAVOR(f, DOUBLE,,); DEFINE_FLAVOR(g, DOUBLE,,); DEFINE_FLAVOR(G, DOUBLE,,);
DEFINE_FLAVOR(c, SBYTE,,); DEFINE_FLAVOR(hc, SBYTE,,); DEFINE_FLAVOR(lc, SSHORT,,); DEFINE_FLAVOR(wc, SSHORT,,); DEFINE_FLAVOR(C, SSHORT,,);
DEFINE_FLAVOR(s, ASTR,,); DEFINE_FLAVOR(hs, ASTR,,); DEFINE_FLAVOR(S, WSTR,,); DEFINE_FLAVOR(ws, WSTR,,); DEFINE_FLAVOR(ls, WSTR,,);
DEFINE_FLAVOR(hi, SSHORT,,); DEFINE_FLAVOR(hd, SSHORT,,); DEFINE_FLAVOR(hu, USHORT,,"u"); DEFINE_FLAVOR(hx, USHORT,,"x"); DEFINE_FLAVOR(hX, USHORT,,"X"); DEFINE_FLAVOR(ho, USHORT,,"o");
DEFINE_FLAVOR(Id, ULONGPTR,,"Id"); DEFINE_FLAVOR(Iu, ULONGPTR,,"Iu"); DEFINE_FLAVOR(Ix, ULONGPTR,,"Ix"); DEFINE_FLAVOR(IX, ULONGPTR,,"IX"); DEFINE_FLAVOR(Io, ULONGPTR,,"Io");
DEFINE_FLAVOR(i, SINT,,); DEFINE_FLAVOR(d, SINT,,); DEFINE_FLAVOR(u, UINT,,"u"); DEFINE_FLAVOR(x, UINT,,"x"); DEFINE_FLAVOR(X, UINT,,"X"); DEFINE_FLAVOR(o, UINT,,"o"); DEFINE_FLAVOR(cccc, SINT, ItemChar4, "s");
DEFINE_FLAVOR(li, SLONG,,); DEFINE_FLAVOR(ld, SLONG,,); DEFINE_FLAVOR(lu, ULONG,,"u"); DEFINE_FLAVOR(lx, ULONG,,"x"); DEFINE_FLAVOR(lX, ULONG,,"X"); DEFINE_FLAVOR(lo, ULONG,,"o");
DEFINE_FLAVOR(I64d, SINT64,,); DEFINE_FLAVOR(I64u, UINT64,,); DEFINE_FLAVOR(I64x, UINT64,,"I64x"); DEFINE_FLAVOR(I64X, UINT64,,"I64X"); DEFINE_FLAVOR(I64o, UINT64,,"I64o");
DEFINE_FLAVOR(p, PTR,,);
DEFINE_FLAVOR(Z, USTR,,); DEFINE_FLAVOR(wZ, USTR,,); DEFINE_FLAVOR(z, CSTR,,); DEFINE_FLAVOR(hZ, CSTR,,);
# default formats for those who don't care to provide their own strings
DEFINE_FLAVOR(XBYTE, SBYTE,, "02x"); DEFINE_FLAVOR(OBYTE, SBYTE,, "o");
DEFINE_FLAVOR(XSHORT, SSHORT,, "04hX"); DEFINE_FLAVOR(OSHORT, SSHORT,, "ho");
DEFINE_FLAVOR(XINT, SINT,, "08x"); DEFINE_FLAVOR(OINT, SINT,, "o");
DEFINE_FLAVOR(XLONG, SLONG,, "08lX"); DEFINE_FLAVOR(OLONG, SLONG,, "lo");
DEFINE_FLAVOR(XINT64, SINT64,, "08i64X"); DEFINE_FLAVOR(OINT64, SINT64,, "i64o");
DEFINE_FLAVOR(XLONGPTR, SLONGPTR,,"Ix"); DEFINE_FLAVOR(OLONGPTR, SLONGPTR,,"Ox");
# special formats
DEFINE_FLAVOR(IPADDR, UINT, ItemIPAddr, "s"); DEFINE_FLAVOR(PORT, USHORT, ItemPort, "s"); DEFINE_FLAVOR(STATUS, UINT, ItemNTSTATUS, "s"); DEFINE_FLAVOR(WINERROR, UINT, ItemWINERROR, "s"); DEFINE_FLAVOR(HRESULT, SINT, ItemHRESULT, "s");
DEFINE_FLAVOR(ipaddr,IPADDR,,); DEFINE_FLAVOR(port,PORT,,); DEFINE_FLAVOR(status,STATUS,,); DEFINE_FLAVOR(hresult,HRESULT,,); DEFINE_FLAVOR(winerr,WINERROR,,); DEFINE_FLAVOR(guid,GUID,,);
# time related stuff
DEFINE_FLAVOR(TIMESTAMP, SINT64, ItemTimestamp, "s"); DEFINE_FLAVOR(TIME, SINT64, ItemTimestamp, "s"); DEFINE_FLAVOR(DATE, SINT64, ItemTimestamp, "s"); DEFINE_FLAVOR(WAITTIME, SINT64, ItemTimestamp, "s");
DEFINE_FLAVOR(due, SINT64, ItemWaitTime, "s"); DEFINE_FLAVOR(delta, SINT64, ItemTimeDelta, "s"); DEFINE_FLAVOR(datetime, SINT64, ItemTimestamp, "s");
# enumeration types
DEFINE_FLAVOR(ItemListByte, SBYTE, ItemListByte, "s"); DEFINE_FLAVOR(ItemListShort, SSHORT, ItemListShort,"s"); DEFINE_FLAVOR(ItemListLong, SLONG, ItemListLong, "s");
DEFINE_FLAVOR(ItemSetByte, UBYTE, ItemSetByte, "s"); DEFINE_FLAVOR(ItemSetShort, USHORT, ItemSetShort,"s"); DEFINE_FLAVOR(ItemSetLong, ULONG, ItemSetLong, "s");
CUSTOM_TYPE(b1, ItemSetByte(1,2,3,4,5,6,7,8) ); CUSTOM_TYPE(b2, ItemSetShort(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) ); 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) );
CUSTOM_TYPE(bool, ItemListLong(false,true) ); CUSTOM_TYPE(bool16, ItemListShort(false,true) ); CUSTOM_TYPE(bool8, ItemListByte(false,true) );
CUSTOM_TYPE(irql, ItemListByte(Low,APC,DPC) );
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) ); 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) );
# default tracing macro
FUNC DoTraceMessage(LEVEL,MSG,...);
# default prefix (use traceprt default)
USEPREFIX(*,"%!STDPREFIX!"); // traceprt will add standard prefix
WPP_FLAGS(-lookfor:WPP_INIT_TRACING); // the same flags that can be passed on the command line to tracewpp
|