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
10 KiB

  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name:
  4. isnext.h
  5. Abstract:
  6. This file is a common header file for isnext.dll
  7. Author:
  8. Munil Shah (munils) 18-May-1995
  9. Environment:
  10. User Mode
  11. --*/
  12. #define ITEMSIZE 25
  13. typedef struct
  14. {
  15. ULONG Value;
  16. PCHAR pszDescription;
  17. } ENUM_INFO, *PENUM_INFO, FLAG_INFO, *PFLAG_INFO;
  18. #define EnumString( Value ) { Value, #Value }
  19. extern ENUM_INFO EnumStructureType[];
  20. //#define EOL ( (Item++ & 1) ? "\n":"" )
  21. typedef enum
  22. {
  23. VERBOSITY_ONE_LINER = 0,
  24. VERBOSITY_NORMAL,
  25. VERBOSITY_FULL
  26. } VERBOSITY;
  27. #define PrintStart Item = 0;
  28. extern int _Indent;
  29. extern char IndentBuf[ 80 ];
  30. #define IndentChange( cch ) { IndentBuf[_Indent]=' '; _Indent += ( cch ); IndentBuf[_Indent]='\0';}
  31. #define Indent( cch ) IndentChange( cch )
  32. #define Outdent( cch ) IndentChange( -( cch ) )
  33. #define PrintStartStruct() { PrintStart; dprintf( "%s{\n", IndentBuf ); Indent( 2 ); }
  34. #define PrintStartNamedStruct( _name ) { PrintStart; dprintf( "%s%s {\n", IndentBuf, _name ); Indent( 2 ); }
  35. static PCHAR pchEol = "\n";
  36. static PCHAR pchBlank = "";
  37. static PCHAR * ppchCurrentEol = &pchEol;
  38. static PCHAR * ppchTempEol = &pchEol;
  39. #define PrintJoin() { ppchCurrentEol = &pchBlank; }
  40. #define EOL (( ppchTempEol = ppchCurrentEol ), ( ppchCurrentEol = &pchEol ), ( *ppchTempEol ))
  41. VOID
  42. dprintSymbolPtr
  43. (
  44. PVOID Pointer,
  45. PCHAR EndOfLine
  46. );
  47. VOID
  48. dprint_nchar
  49. (
  50. PCHAR pch,
  51. int cch
  52. );
  53. VOID
  54. dprint_hardware_address
  55. (
  56. PUCHAR Address
  57. );
  58. VOID
  59. dprint_network_address
  60. (
  61. PUCHAR Address
  62. );
  63. BOOL
  64. dprint_enum_name
  65. (
  66. ULONG Value,
  67. PENUM_INFO pEnumInfo
  68. );
  69. BOOL
  70. dprint_flag_names
  71. (
  72. ULONG Value,
  73. PFLAG_INFO pFlagInfo
  74. );
  75. BOOL
  76. dprint_masked_value
  77. (
  78. ULONG Value,
  79. ULONG Mask
  80. );
  81. /*
  82. #define PrintEnd \
  83. dprintf( "%s", EOL ); \
  84. Item = 0;
  85. */
  86. #define PrintEnd \
  87. Item = 0;
  88. #define PrintEndStruct() { Outdent( 2 ); PrintEnd; dprintf( "%s}\n", IndentBuf ); }
  89. #define PrintFlushLeft() PrintEnd
  90. #define PRINTBOOL(var) ( (var) ? "True" : "False")
  91. #define PrintFieldName(_fieldName) \
  92. if ( strlen(_fieldName) > 35 ) { \
  93. dprintf("%s%-.25s..%s = ",IndentBuf,_fieldName, &(_fieldName[strlen(_fieldName)-8])); \
  94. }else { \
  95. dprintf("%s%-35.35s = ",IndentBuf,_fieldName ); \
  96. }
  97. #define PrintFieldNameAt(_fieldName) \
  98. if ( strlen(_fieldName) > 35 ) { \
  99. dprintf("%s%-.25s..%s @ ",IndentBuf,_fieldName, &(_fieldName[strlen(_fieldName)-8])); \
  100. }else { \
  101. dprintf("%s%-35.35s @ ",IndentBuf,_fieldName ); \
  102. }
  103. #define PrintListFieldName(_fieldName) \
  104. if ( strlen(_fieldName) > 40 ) { \
  105. dprintf("%s%-.30s...%s Flink = ",IndentBuf,_fieldName, &(_fieldName[strlen(_fieldName)-7])); \
  106. }else { \
  107. dprintf("%s%-40.40s Flink = ",IndentBuf,_fieldName ); \
  108. }
  109. #define PrintIndent() dprintf( "%s", IndentBuf );
  110. /* #define PrintFieldName(_fieldName) \
  111. dprintf(" %-25.25s = ",_fieldName );*/
  112. #define PrintRawBool( _bValue ) \
  113. dprintf("%-10s%s", (_obj._bValue) ? "True" : "False", EOL)
  114. #define PrintBool(_field) \
  115. PrintFieldName(#_field) \
  116. dprintf("%-10s%s", (_obj._field) ? "True" : "False", EOL)
  117. #define PrintULong(_field) \
  118. PrintFieldName(#_field) \
  119. dprintf("%-10lu%s", _obj._field, EOL)
  120. #define PrintXULong(_field) \
  121. PrintFieldName(#_field) \
  122. dprintf("0x%08lx%s", _obj._field, EOL)
  123. #define PrintUShort(_field) \
  124. PrintFieldName(#_field) \
  125. dprintf("%-10hu%s", _obj._field, EOL)
  126. #define PrintXUShort(_field) \
  127. PrintFieldName(#_field) \
  128. dprintf("0x%04hx%s", _obj._field, EOL)
  129. #define PrintNChar( _field, count ) \
  130. PrintFieldName(#_field) \
  131. dprint_nchar( ( PCHAR )_obj._field, count ); \
  132. dprintf("%s", EOL)
  133. #define PrintUChar(_field) \
  134. PrintFieldName(#_field) \
  135. dprintf("%-10lu%s", (ULONG) _obj._field, EOL)
  136. #define PrintXUChar(_field) \
  137. PrintFieldName(#_field) \
  138. dprintf("0x%-8lx%s", (ULONG) _obj._field, EOL)
  139. #define PrintPtr(_field) \
  140. PrintFieldName(#_field) \
  141. dprintf("%-10lx%s", _obj._field, EOL)
  142. #define PrintSymbolPtr( _field ) \
  143. PrintFieldName(#_field) \
  144. dprintSymbolPtr( (( PVOID )_obj._field), EOL );
  145. #define AddressOf( _field ) ((( ULONG )_objAddr) + FIELD_OFFSET( _objType, _field ))
  146. #define PrintAddr(_field) \
  147. PrintFieldNameAt(#_field) \
  148. dprintf("%-10lx%s", AddressOf( _field ), EOL)
  149. #define PrintL(_field) \
  150. PrintFieldName(#_field##".Next") \
  151. dprintf("%-10lx%s", _obj._field.Next, EOL )
  152. #define PrintLL(_field) \
  153. PrintEnd; \
  154. PrintListFieldName(#_field ); \
  155. dprintf("%-10lx", _obj._field.Flink ); \
  156. dprintf("Blink = %-10lx", _obj._field.Blink ); \
  157. dprintf("%s\n", ( _obj._field.Flink == _obj._field.Blink ) ? " (Empty)" : "" );
  158. #define PrintIrpQ(_field) \
  159. PrintEnd; \
  160. PrintFieldName(#_field##".Head"); \
  161. dprintf("%-10lx", _obj._field.Head ); \
  162. PrintFieldName(#_field##".Tail"); \
  163. dprintf("%-10lx\n", _obj._field.Tail );
  164. #define PrintFlags( _field, _pFlagStruct ) \
  165. PrintEnd; \
  166. PrintFieldName(#_field); \
  167. dprintf("0x%08lx (", (ULONG) _obj._field ); \
  168. dprint_flag_names( (ULONG) _obj._field, _pFlagStruct ); \
  169. dprintf( ")\n" );
  170. #define PrintFlagsMask( _field, _pFlagStruct, _Mask ) \
  171. PrintEnd; \
  172. PrintFieldName(" & " ## #_Mask ); \
  173. dprintf("0x"); \
  174. dprint_masked_value((ULONG) _obj._field, _Mask ); \
  175. dprintf("("); \
  176. dprint_flag_names( (ULONG) _obj._field, _pFlagStruct ); \
  177. dprintf( ")\n" );
  178. #define PrintEnum( _field, _pEnumStruct ) \
  179. PrintEnd; \
  180. PrintFieldName(#_field); \
  181. dprintf("%lu (", (ULONG) _obj._field ); \
  182. dprint_enum_name( (ULONG) _obj._field, _pEnumStruct ); \
  183. dprintf( ")\n" );
  184. #define PrintXEnum( _field, _pEnumStruct ) \
  185. PrintEnd; \
  186. PrintFieldName(#_field); \
  187. dprintf("0x%08lx (", (ULONG) _obj._field ); \
  188. dprint_enum_name( (ULONG) _obj._field, _pEnumStruct ); \
  189. dprintf( ")\n" );
  190. #define PrintXEnumMask( _field, _pEnumStruct, _Mask ) \
  191. PrintEnd; \
  192. PrintFieldName(" & " ## #_Mask ); \
  193. dprintf("0x"); \
  194. dprint_masked_value((ULONG) _obj._field, _Mask ); \
  195. dprintf("("); \
  196. dprint_enum_name((ULONG) _obj._field & _Mask, _pEnumStruct ); \
  197. dprintf( ")\n" );
  198. #define PrintNetworkAddress( _field ) PrintFieldName(#_field); dprint_network_address( _obj._field); dprintf( "%s", EOL );
  199. #define PrintMacAddress( _field ) PrintFieldName(#_field); dprint_hardware_address( _obj._field); dprintf( "%s", EOL );
  200. #define PrintHardwareAddress( _field ) \
  201. PrintFieldName(#_field); \
  202. dprint_hardware_address( _obj._field.Address ); \
  203. dprintf( "%s", EOL );
  204. #define PrintIpxLocalTarget( _field ) \
  205. PrintStartNamedStruct( #_field ); \
  206. PrintFieldName( "NicId" ); \
  207. dprintf("%-10u%s", _obj._field.NicId, EOL); \
  208. PrintFieldName( "MacAddress" ); \
  209. dprint_hardware_address( _obj._field.MacAddress ); \
  210. dprintf( "%s", EOL ); \
  211. PrintEndStruct();
  212. #define PrintLock( _field ) \
  213. PrintULong( _field )
  214. #define PrintTDIAddress( _field ) \
  215. PrintFieldName( #_field ); \
  216. dprintf( "{ NetworkAddress = %X, NodeAddress = ", _obj._field.NetworkAddress );\
  217. dprint_hardware_address( _obj._field.NodeAddress );\
  218. dprintf( ", Socket = %d }%s", _obj._field.Socket, EOL );
  219. #define PrintCTETimer( _field ) \
  220. dprintf( "%s", #_field ); \
  221. PrintStartStruct(); \
  222. DumpCTETimer ( ((ULONG)_objAddr) +FIELD_OFFSET( _objType, _field ), VERBOSITY_NORMAL );\
  223. PrintEndStruct();
  224. #define PrintWorkQueueItem( _field ) \
  225. dprintf( "%s", #_field ); \
  226. PrintStartStruct(); \
  227. DumpWorkQueueItem ( ((ULONG)_objAddr) +FIELD_OFFSET( _objType, _field ), VERBOSITY_NORMAL );\
  228. PrintEndStruct();
  229. extern BOOLEAN ChkTarget;
  230. extern INT Item;
  231. #define CHECK_SIGNATURE( _field, _signature ) \
  232. if ( _obj._field != _signature ) \
  233. { \
  234. dprintf( "Object at %08X doesn't have signature %s at %08X\n", \
  235. _objAddr, \
  236. #_signature, \
  237. (( ULONG )_objAddr) + FIELD_OFFSET( _objType, _field ));\
  238. }