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.

2167 lines
52 KiB

  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name:
  4. ipxext.c
  5. Abstract:
  6. This file contains kernel debugger extensions for examining the
  7. IPX structures.
  8. Author:
  9. Heath Hunnicutt (T-HeathH) 3-Aug-1995
  10. Environment:
  11. User Mode
  12. --*/
  13. #include "precomp.h"
  14. #pragma hdrstop
  15. #include "config.h"
  16. #include "mac.h"
  17. #include "ipxtypes.h"
  18. #define LIMIT_BINDINGS 25
  19. //
  20. // Local function prototypes
  21. //
  22. VOID DumpDeviceObject
  23. (
  24. ULONG DevObjToDump,
  25. VERBOSITY Verbosity
  26. );
  27. VOID
  28. DumpIpxDevice
  29. (
  30. ULONG DeviceToDump,
  31. VERBOSITY Verbosity
  32. );
  33. VOID
  34. DumpIpxSend
  35. (
  36. ULONG IpxSendToDump,
  37. VERBOSITY Verbosity
  38. );
  39. VOID
  40. DumpIpxReceive
  41. (
  42. ULONG IpxReceiveToDump,
  43. VERBOSITY Verbosity
  44. );
  45. VOID
  46. DumpIpxAddress
  47. (
  48. ULONG AddressToDump,
  49. VERBOSITY Verbosity
  50. );
  51. VOID
  52. DumpIpxAddressFile
  53. (
  54. ULONG AddressFileToDump,
  55. VERBOSITY Verbosity
  56. );
  57. VOID
  58. DumpIpxBinding
  59. (
  60. ULONG BindingToDump,
  61. VERBOSITY Verbosity
  62. );
  63. VOID
  64. DumpIpxRouterSegment
  65. (
  66. ULONG SegmentToDump,
  67. VERBOSITY Verbosity
  68. );
  69. VOID
  70. DumpIpxRequest
  71. (
  72. ULONG RequestToDump,
  73. VERBOSITY Verbosity
  74. );
  75. VOID
  76. DumpIpxAdapter
  77. (
  78. ULONG AdapterToDump,
  79. VERBOSITY Verbosity
  80. );
  81. VOID
  82. DumpIpxIrpStack
  83. (
  84. PREQUEST pRequest,
  85. VERBOSITY Verbosity
  86. );
  87. ENUM_INFO EnumIrpMajorFunction[] =
  88. {
  89. EnumString( IRP_MJ_CREATE ),
  90. EnumString( IRP_MJ_CREATE_NAMED_PIPE ),
  91. EnumString( IRP_MJ_CLOSE ),
  92. EnumString( IRP_MJ_READ ),
  93. EnumString( IRP_MJ_WRITE ),
  94. EnumString( IRP_MJ_QUERY_INFORMATION ),
  95. EnumString( IRP_MJ_SET_INFORMATION ),
  96. EnumString( IRP_MJ_QUERY_EA ),
  97. EnumString( IRP_MJ_SET_EA ),
  98. EnumString( IRP_MJ_FLUSH_BUFFERS ),
  99. EnumString( IRP_MJ_QUERY_VOLUME_INFORMATION ),
  100. EnumString( IRP_MJ_SET_VOLUME_INFORMATION ),
  101. EnumString( IRP_MJ_DIRECTORY_CONTROL ),
  102. EnumString( IRP_MJ_FILE_SYSTEM_CONTROL ),
  103. EnumString( IRP_MJ_DEVICE_CONTROL ),
  104. EnumString( IRP_MJ_INTERNAL_DEVICE_CONTROL ),
  105. EnumString( IRP_MJ_SHUTDOWN ),
  106. EnumString( IRP_MJ_LOCK_CONTROL ),
  107. EnumString( IRP_MJ_CLEANUP ),
  108. EnumString( IRP_MJ_CREATE_MAILSLOT ),
  109. EnumString( IRP_MJ_QUERY_SECURITY ),
  110. EnumString( IRP_MJ_SET_SECURITY ),
  111. EnumString( IRP_MJ_POWER ),
  112. // EnumString( IRP_MJ_SYSTEM_CONTROL ),
  113. EnumString( IRP_MJ_DEVICE_CHANGE ),
  114. EnumString( IRP_MJ_QUERY_QUOTA ),
  115. EnumString( IRP_MJ_SET_QUOTA ),
  116. { 0, NULL }
  117. };
  118. ENUM_INFO EnumIrpMinorFunction[ IRP_MJ_MAXIMUM_FUNCTION + 1 ][ 18 ] =
  119. {
  120. {{ 0, NULL}}, // IRP_MJ_CREATE
  121. {{ 0, NULL}}, // IRP_MJ_CREATE_NAMED_PIPE
  122. {{ 0, NULL}}, // IRP_MJ_CLOSE
  123. {{ 0, NULL}}, // IRP_MJ_READ
  124. {{ 0, NULL}}, // IRP_MJ_WRITE
  125. {{ 0, NULL}}, // IRP_MJ_QUERY_INFORMATION
  126. {{ 0, NULL}}, // IRP_MJ_SET_INFORMATION
  127. {{ 0, NULL}}, // IRP_MJ_QUERY_EA
  128. {{ 0, NULL}}, // IRP_MJ_SET_EA
  129. {{ 0, NULL}}, // IRP_MJ_FLUSH_BUFFERS
  130. {{ 0, NULL}}, // IRP_MJ_QUERY_VOLUME_INFORMATION
  131. {{ 0, NULL}}, // IRP_MJ_SET_VOLUME_INFORMATION
  132. {{ 0, NULL}}, // IRP_MJ_DIRECTORY_CONTROL
  133. {{ 0, NULL}}, // IRP_MJ_FILE_SYSTEM_CONTROL
  134. {{ 0, NULL}}, // IRP_MJ_DEVICE_CONTROL
  135. { // IRP_MJ_INTERNAL_DEVICE_CONTROL
  136. EnumString( TDI_ASSOCIATE_ADDRESS ),
  137. EnumString( TDI_DISASSOCIATE_ADDRESS ),
  138. EnumString( TDI_CONNECT ),
  139. EnumString( TDI_LISTEN ),
  140. EnumString( TDI_ACCEPT ),
  141. EnumString( TDI_DISCONNECT ),
  142. EnumString( TDI_SEND ),
  143. EnumString( TDI_RECEIVE ),
  144. EnumString( TDI_SEND_DATAGRAM ),
  145. EnumString( TDI_RECEIVE_DATAGRAM ),
  146. EnumString( TDI_SET_EVENT_HANDLER ),
  147. EnumString( TDI_QUERY_INFORMATION ),
  148. EnumString( TDI_SET_INFORMATION ),
  149. EnumString( TDI_ACTION ),
  150. EnumString( TDI_DIRECT_SEND ),
  151. EnumString( TDI_DIRECT_SEND_DATAGRAM ),
  152. { 0, NULL }
  153. },
  154. {{ 0, NULL}}, // IRP_MJ_SHUTDOWN
  155. {{ 0, NULL}}, // IRP_MJ_LOCK_CONTROL
  156. {{ 0, NULL}}, // IRP_MJ_CLEANUP
  157. {{ 0, NULL}}, // IRP_MJ_CREATE_MAILSLOT
  158. {{ 0, NULL}}, // IRP_MJ_QUERY_SECURITY
  159. {{ 0, NULL}}, // IRP_MJ_SET_SECURITY
  160. {{ 0, NULL}}, // IRP_MJ_QUERY_POWER
  161. {{ 0, NULL}}, // IRP_MJ_SET_POWER
  162. {{ 0, NULL}}, // IRP_MJ_DEVICE_CHANGE
  163. {{ 0, NULL}}, // IRP_MJ_QUERY_QUOTA
  164. {{ 0, NULL}}, // IRP_MJ_SET_QUOTA
  165. };
  166. ENUM_INFO EnumAddressFileState[] =
  167. {
  168. EnumString( ADDRESSFILE_STATE_OPENING ),
  169. EnumString( ADDRESSFILE_STATE_OPEN ),
  170. EnumString( ADDRESSFILE_STATE_CLOSING ),
  171. { 0, NULL }
  172. };
  173. ENUM_INFO EnumBindingFrameType[] =
  174. {
  175. EnumString( ISN_FRAME_TYPE_802_2 ),
  176. EnumString( ISN_FRAME_TYPE_802_3 ),
  177. EnumString( ISN_FRAME_TYPE_ETHERNET_II ),
  178. EnumString( ISN_FRAME_TYPE_SNAP ),
  179. { 0, NULL }
  180. };
  181. ENUM_INFO EnumSendReservedIdentifier[] =
  182. {
  183. EnumString( IDENTIFIER_NB ),
  184. EnumString( IDENTIFIER_SPX ),
  185. EnumString( IDENTIFIER_RIP ),
  186. EnumString( IDENTIFIER_IPX ),
  187. EnumString( IDENTIFIER_RIP_INTERNAL ),
  188. EnumString( IDENTIFIER_RIP_RESPONSE ),
  189. { 0, NULL }
  190. };
  191. ENUM_INFO EnumSendReservedDestinationType[] =
  192. {
  193. EnumString( DESTINATION_DEF ),
  194. EnumString( DESTINATION_BCAST ),
  195. EnumString( DESTINATION_MCAST ),
  196. { 0, NULL }
  197. };
  198. FLAG_INFO FlagsRouteEntry[] =
  199. {
  200. {IPX_ROUTER_PERMANENT_ENTRY,"Permanent"},
  201. {IPX_ROUTER_LOCAL_NET,"Local Net"},
  202. {IPX_ROUTER_SCHEDULE_ROUTE, "Call Schedule Route"},
  203. {IPX_ROUTER_GLOBAL_WAN_NET,"Global Wan Net"},
  204. {0, NULL}
  205. };
  206. MEMBER_TABLE IpxDeviceMembers[] =
  207. {
  208. { "GlobalSendPacketList",
  209. FIELD_OFFSET( DEVICE, GlobalSendPacketList ),
  210. DumpIpxSend,
  211. NextListEntry,
  212. PrevListEntry,
  213. FIELD_OFFSET( NDIS_PACKET, ProtocolReserved ) + FIELD_OFFSET( IPX_SEND_RESERVED, GlobalLinkage )
  214. },
  215. { "GlobalReceivePacketList",
  216. FIELD_OFFSET( DEVICE, GlobalReceivePacketList ),
  217. DumpIpxReceive,
  218. NextListEntry,
  219. PrevListEntry,
  220. FIELD_OFFSET( NDIS_PACKET, ProtocolReserved ) + FIELD_OFFSET( IPX_RECEIVE_RESERVED, GlobalLinkage )
  221. },
  222. { NULL }
  223. };
  224. ///////////////////////////////////////////////////////////////////////
  225. // DEVICE
  226. //////////////////////////////////////////////////////////////////////
  227. //
  228. // Exported functions
  229. //
  230. VOID ipxdev_usage( VOID )
  231. {
  232. dprintf( "Use me!\n" );
  233. }
  234. DECLARE_API( ipxdev )
  235. /*++
  236. Routine Description:
  237. Dumps the most important fields of the specified DEVICE_CONTEXT object
  238. Arguments:
  239. args - Address
  240. Return Value:
  241. None
  242. --*/
  243. {
  244. ULONG deviceToDump = 0;
  245. ULONG pDevice = 0;
  246. ULONG result;
  247. char VarName[ MAX_LIST_VARIABLE_NAME_LENGTH + 1 ];
  248. MEMBER_VARIABLE_INFO MemberInfo;
  249. BOOL bFocusOnMemberVariable = FALSE;
  250. if ( *args )
  251. {
  252. bFocusOnMemberVariable = ReadArgsForTraverse( args, VarName );
  253. }
  254. if ( *args && *args!='-' )
  255. {
  256. if (!sscanf(args, "%lx", &deviceToDump))
  257. {
  258. return;
  259. }
  260. }
  261. if ( deviceToDump == 0 ) {
  262. pDevice = GetExpression( "nwlnkipx!IpxDevice" );
  263. if ( !pDevice ) {
  264. dprintf("Could not get nwlnkipx!IpxDevice, Try !reload\n");
  265. return;
  266. } else {
  267. if (!ReadMemory(pDevice,
  268. &deviceToDump,
  269. sizeof(deviceToDump),
  270. &result
  271. )
  272. )
  273. {
  274. dprintf("%08lx: Could not read device address\n", pDevice);
  275. return;
  276. }
  277. }
  278. }
  279. if ( bFocusOnMemberVariable )
  280. {
  281. if ( !LocateMemberVariable( "IpxDevice", VarName, ( PVOID )deviceToDump, &MemberInfo ))
  282. {
  283. return;
  284. }
  285. WriteMemberInfo( &MemberInfo );
  286. next( hCurrentProcess, hCurrentThread, dwCurrentPc, dwProcessor, "" );
  287. return;
  288. }
  289. DumpIpxDevice(deviceToDump, VERBOSITY_NORMAL );
  290. return;
  291. }
  292. #ifdef _obj
  293. # undef _obj
  294. # undef _objAddr
  295. # undef _objType
  296. #endif
  297. #define _obj Device
  298. #define _objAddr DeviceToDump
  299. #define _objType DEVICE
  300. //
  301. // Local functions
  302. //
  303. VOID
  304. DumpIpxDevice
  305. (
  306. ULONG DeviceToDump,
  307. VERBOSITY Verbosity
  308. )
  309. /*++
  310. Routine Description:
  311. Dumps the fields of the specified DEVICE_CONTEXT structure
  312. Arguments:
  313. DeviceToDump - The device context object to display
  314. Full - Display a partial listing if 0, full listing otherwise.
  315. Return Value:
  316. None
  317. --*/
  318. {
  319. DEVICE Device;
  320. ULONG result;
  321. unsigned int index;
  322. BIND_ARRAY_ELEM Bindings[ LIMIT_BINDINGS ];
  323. WCHAR Buffer[ 1000 ];
  324. PWCHAR pDeviceName = NULL;
  325. if (!ReadMemory(
  326. DeviceToDump,
  327. &Device,
  328. sizeof(Device),
  329. &result
  330. )
  331. )
  332. {
  333. dprintf("%08lx: Could not read device context\n", DeviceToDump);
  334. return;
  335. }
  336. if (Device.Type != IPX_DEVICE_SIGNATURE)
  337. {
  338. dprintf( "Signature does not match, probably not a device object %lx\n", DeviceToDump);
  339. dprintf( "Device.Type == %04X, and I think it should be %04X\n", Device.Type, IPX_DEVICE_SIGNATURE );
  340. dprintf( "DeviceToDump = %08X\n", DeviceToDump );
  341. dprintf( "Offset to Device.Type = %d\n", FIELD_OFFSET( DEVICE, Type ) );
  342. return;
  343. }
  344. if ( !ReadMemory( ( ULONG )Device.DeviceName,
  345. Buffer,
  346. sizeof( WCHAR ) * Device.DeviceNameLength,
  347. &result ))
  348. {
  349. dprintf("%08lx: Could not read device name buffer\n", Device.DeviceName );
  350. }
  351. else
  352. {
  353. pDeviceName = Buffer;
  354. }
  355. if ( Verbosity == VERBOSITY_ONE_LINER )
  356. {
  357. dprintf( "\"%S\"", pDeviceName );
  358. return;
  359. }
  360. dprintf("Device General Info ");
  361. PrintStartStruct();
  362. #if DBG
  363. # if DREF_TOTAL != 13
  364. # error The DREF_TOTAL constant has changed, and so must ipxext.c
  365. # endif
  366. PrintULong( RefTypes[ DREF_CREATE ] );
  367. PrintULong( RefTypes[ DREF_LOADED ] );
  368. PrintULong( RefTypes[ DREF_ADAPTER ] );
  369. PrintULong( RefTypes[ DREF_ADDRESS ] );
  370. PrintULong( RefTypes[ DREF_SR_TIMER ] );
  371. PrintULong( RefTypes[ DREF_RIP_TIMER ] );
  372. PrintULong( RefTypes[ DREF_LONG_TIMER ] );
  373. PrintULong( RefTypes[ DREF_RIP_PACKET ] );
  374. PrintULong( RefTypes[ DREF_ADDRESS_NOTIFY ] );
  375. PrintULong( RefTypes[ DREF_LINE_CHANGE ] );
  376. PrintULong( RefTypes[ DREF_NIC_NOTIFY ] );
  377. PrintULong( RefTypes[ DREF_BINDING ] );
  378. PrintULong( RefTypes[ DREF_PNP ] );
  379. #endif
  380. PrintEnum( Type, EnumStructureType );
  381. PrintUShort( Size );
  382. #if DBG
  383. PrintNChar( Signature1, sizeof( Device.Signature1 ));
  384. #endif
  385. PrintLock( Interlock );
  386. PrintULong( TempDatagramBytesSent );
  387. PrintULong( TempDatagramsSent );
  388. PrintULong( TempDatagramBytesReceived );
  389. PrintULong( TempDatagramsReceived );
  390. PrintBool( EthernetPadToEven );
  391. PrintBool( SingleNetworkActive );
  392. PrintBool( DisableDialoutSap );
  393. PrintBool( MultiCardZeroVirtual );
  394. PrintLock( Lock );
  395. PrintULong( ReferenceCount );
  396. PrintStartStruct();
  397. dprintf( " ( We are assumed not to be at init time )\n" );
  398. PrintUShort( MaxBindings );
  399. if ( Device.MaxBindings > LIMIT_BINDINGS )
  400. {
  401. dprintf(" isnext can only display the first %d bindings, because malloc() always crashed under the kernel debugger.\n", LIMIT_BINDINGS );
  402. dprintf(" This device struct has more bindings than that, but you're only going to see some of them.\n" );
  403. dprintf(" You could always change LIMIT_BINDINGS in ipxext.c and recompile isnext\n" );
  404. Device.MaxBindings = LIMIT_BINDINGS;
  405. }
  406. if ( !ReadMemory( ( ULONG )Device.Bindings,
  407. Bindings,
  408. ((sizeof( PBIND_ARRAY_ELEM )) * Device.MaxBindings),
  409. &result ) )
  410. {
  411. dprintf( "Could not read Bindings array.\n" );
  412. }
  413. else
  414. {
  415. for( index = LOOPBACK_NIC_ID; index <= Device.MaxBindings; index ++ )
  416. {
  417. if ( Bindings[ index ].Binding != NULL )
  418. {
  419. dprintf( " Bindings[ %d ] = %-10X", index, Bindings[ index ].Binding );
  420. DumpIpxBinding( ( ULONG )Bindings[ index ].Binding, VERBOSITY_ONE_LINER );
  421. dprintf( "\n" );
  422. }
  423. }
  424. }
  425. PrintEndStruct();
  426. PrintUShort( ValidBindings );
  427. PrintUShort( HighestExternalNicId );
  428. PrintUShort( SapNicCount );
  429. PrintUShort( HighestType20NicId );
  430. PrintUShort( HighestLanNicId);
  431. PrintLL( GlobalSendPacketList );
  432. PrintLL( GlobalReceivePacketList );
  433. PrintLL( GlobalReceiveBufferList );
  434. PrintLL( AddressNotifyQueue );
  435. PrintLL( LineChangeQueue );
  436. PrintLL( SendPoolList );
  437. PrintLL( ReceivePoolList );
  438. PrintL( SendPacketList );
  439. PrintL( ReceivePacketList );
  440. PrintUChar( State );
  441. PrintUChar( FrameTypeDefault );
  442. PrintBool( ActiveNetworkWan );
  443. PrintBool( VirtualNetwork );
  444. PrintUShort( FirstLanNicId );
  445. PrintUShort( FirstWanNicId );
  446. PrintULong( MemoryUsage );
  447. PrintULong( MemoryLimit );
  448. PrintULong( AllocatedDatagrams );
  449. PrintULong( AllocatedReceivePackets );
  450. PrintULong( AllocatedPaddingBuffers );
  451. PrintULong( InitDatagrams );
  452. PrintULong( MaxDatagrams );
  453. PrintULong( RipAgeTime );
  454. PrintULong( RipCount );
  455. PrintULong( RipTimeout );
  456. PrintULong( RipUsageTime );
  457. PrintULong( SourceRouteUsageTime );
  458. PrintUShort( SocketStart );
  459. PrintUShort( SocketEnd );
  460. PrintULong( SocketUniqueness );
  461. PrintULong( VirtualNetworkNumber );
  462. PrintULong( EthernetExtraPadding );
  463. PrintBool( DedicatedRouter );
  464. PrintBool( VirtualNetworkOptional );
  465. PrintUChar( DisableDialinNetbios );
  466. PrintULong( InitReceivePackets );
  467. PrintULong( InitReceiveBuffers );
  468. PrintULong( MaxReceivePackets );
  469. PrintULong( MaxReceiveBuffers );
  470. PrintUShort( ControlChannelIdentifier );
  471. PrintUShort( CurrentSocket );
  472. PrintULong( SegmentCount );
  473. // MORE - dump actual locks
  474. PrintPtr( SegmentLocks );
  475. PrintPtr(Segments);
  476. for( index = 0; index < Device.SegmentCount; index++ ) {
  477. DumpIpxRouterSegment((ULONG)&Device.Segments[index], VERBOSITY_NORMAL);
  478. }
  479. PrintLL( WaitingRipPackets );
  480. PrintULong( RipPacketCount );
  481. PrintBool( RipShortTimerActive );
  482. PrintUShort( RipSendTime );
  483. PrintCTETimer( RipShortTimer );
  484. PrintCTETimer( RipLongTimer );
  485. PrintBool( SourceRoutingUsed ); // TRUE if any 802.5 bindings exist.
  486. PrintUChar( SourceRoutingTime ); // incremented each time timer fires.
  487. PrintCTETimer( SourceRoutingTimer );
  488. PrintULong( LinkSpeed );
  489. PrintULong( MacOptions );
  490. PrintULong( IncludedHeaderOffset );
  491. PrintTDIAddress( SourceAddress );
  492. #if IPX_ADDRESS_HASH_COUNT != 16
  493. # error An assumption is made here concerning the value of IPX_ADDRESS_HASH_COUNT
  494. #endif
  495. PrintLL( AddressDatabases[ 0 ] );
  496. PrintLL( AddressDatabases[ 1 ] );
  497. PrintLL( AddressDatabases[ 2 ] );
  498. PrintLL( AddressDatabases[ 3 ] );
  499. PrintLL( AddressDatabases[ 4 ] );
  500. PrintLL( AddressDatabases[ 5 ] );
  501. PrintLL( AddressDatabases[ 6 ] );
  502. PrintLL( AddressDatabases[ 7 ] );
  503. PrintLL( AddressDatabases[ 8 ] );
  504. PrintLL( AddressDatabases[ 9 ] );
  505. PrintLL( AddressDatabases[ 10 ] );
  506. PrintLL( AddressDatabases[ 11 ] );
  507. PrintLL( AddressDatabases[ 12 ] );
  508. PrintLL( AddressDatabases[ 13 ] );
  509. PrintLL( AddressDatabases[ 14 ] );
  510. PrintLL( AddressDatabases[ 15 ] );
  511. PrintPtr( LastAddress );
  512. PrintPtr( NdisBufferPoolHandle );
  513. PrintAddr( Information );
  514. PrintULong( RealMaxDatagramSize );
  515. #if DBG
  516. PrintNChar( Signature2, sizeof( Device.Signature2 ));
  517. #endif
  518. PrintFlushLeft();
  519. PrintBool( AnyUpperDriverBound );
  520. PrintBool( ForwarderBound );
  521. if ( Device.AnyUpperDriverBound )
  522. {
  523. for ( index = 0; index < UPPER_DRIVER_COUNT; index ++ )
  524. {
  525. PrintFlushLeft();
  526. dprintf( "UpperDriver...[ %d ] = ", index );
  527. PrintStartStruct();
  528. PrintFieldName( "UpperDriverBound" );
  529. PrintRawBool( UpperDriverBound[ index ] );
  530. if ( !Device.UpperDriverBound[ index ] )
  531. {
  532. PrintEndStruct();
  533. continue;
  534. }
  535. PrintFieldName( "ReceiveCompletePending" );
  536. PrintRawBool( ReceiveCompletePending[ index ] );
  537. PrintPtr( UpperDriverControlChannel[ index ] );
  538. PrintSymbolPtr( UpperDrivers[ index ].ReceiveHandler );
  539. PrintEndStruct();
  540. }
  541. }
  542. PrintFlushLeft();
  543. PrintULong( EnableBroadcastCount );
  544. PrintBool( EnableBroadcastPending );
  545. PrintBool( DisableBroadcastPending );
  546. PrintBool( ReverseBroadcastOperation );
  547. PrintBool( WanGlobalNetworkNumber );
  548. PrintULong( GlobalWanNetwork );
  549. PrintBool( GlobalNetworkIndicated );
  550. PrintBool( RipResponder );
  551. PrintBool( SapWarningLogged );
  552. PrintWorkQueueItem( BroadcastOperationQueueItem );
  553. PrintAddr( UnloadEvent );
  554. PrintBool( UnloadWaiting );
  555. PrintAddr( Statistics );
  556. PrintBool( AutoDetect );
  557. PrintBool( DefaultAutoDetected );
  558. PrintUChar( AutoDetectState );
  559. PrintAddr( AutoDetectEvent );
  560. PrintAddr( IpxStartTime );
  561. PrintAddr( AddressResource );
  562. PrintPtr( DeviceObject );
  563. PrintJoin();
  564. PrintPtr( DeviceName );
  565. dprintf( "\"%S\"\n", pDeviceName );
  566. PrintULong( DeviceNameLength );
  567. PrintEndStruct();
  568. PrintEnd
  569. return;
  570. }
  571. #ifdef _obj
  572. # undef _obj
  573. # undef _objAddr
  574. # undef _objType
  575. #endif
  576. #define _obj Reserved
  577. #define _objAddr pReserved
  578. #define _objType IPX_SEND_RESERVED
  579. VOID
  580. DumpIpxSend
  581. (
  582. ULONG IpxSendToDump,
  583. VERBOSITY Verbosity
  584. )
  585. {
  586. PIPX_SEND_RESERVED pReserved;
  587. IPX_SEND_RESERVED Reserved;
  588. ULONG result;
  589. pReserved = SEND_RESERVED(( PIPX_SEND_PACKET )IpxSendToDump );
  590. if ( !ReadMemory( ( ULONG )pReserved,
  591. &Reserved,
  592. sizeof( Reserved ),
  593. &result ))
  594. {
  595. dprintf("%08lx: Could not read IPX_SEND_RESERVED structure\n", pReserved );
  596. return;
  597. }
  598. dprintf( "NDIS_PACKET @(0x%08X) ", IpxSendToDump );
  599. if ( Verbosity == VERBOSITY_ONE_LINER )
  600. {
  601. dprintf( "{ " );
  602. if ( Reserved.Address != NULL )
  603. {
  604. DumpIpxAddress( ( ULONG )( Reserved.Address ), VERBOSITY_ONE_LINER );
  605. }
  606. else
  607. {
  608. dprintf( "(NULL Address)" );
  609. }
  610. dprintf( " (" );
  611. dprint_enum_name( (ULONG) _obj.Identifier, EnumSendReservedIdentifier );
  612. dprintf( ") }" );
  613. return;
  614. }
  615. PrintStart;
  616. PrintStartStruct();
  617. PrintEnum( Identifier, EnumSendReservedIdentifier );
  618. PrintBool( SendInProgress );
  619. PrintBool( OwnedByAddress );
  620. PrintEnum( DestinationType, EnumSendReservedDestinationType );
  621. PrintPtr( PaddingBuffer );
  622. PrintPtr( PreviousTail );
  623. PrintL( PoolLinkage );
  624. PrintLL( GlobalLinkage );
  625. PrintLL( WaitLinkage );
  626. #ifdef IPX_TRACK_POOL
  627. PrintPtr( Pool );
  628. #endif
  629. PrintJoin();
  630. PrintPtr( Address );
  631. if ( Reserved.Address != NULL )
  632. {
  633. DumpIpxAddress( ( ULONG )( Reserved.Address ), VERBOSITY_ONE_LINER );
  634. }
  635. dprintf( "\n" );
  636. PrintFlushLeft();
  637. switch ( Reserved.Identifier )
  638. {
  639. case IDENTIFIER_NB:
  640. case IDENTIFIER_IPX:
  641. case IDENTIFIER_SPX:
  642. dprintf( " --- SR_DG part of union ---------------------------\n");
  643. PrintPtr( u.SR_DG.Request );
  644. PrintJoin();
  645. PrintPtr( u.SR_DG.AddressFile );
  646. if ( Reserved.u.SR_DG.AddressFile != NULL )
  647. {
  648. DumpIpxAddressFile( ( ULONG )( Reserved.u.SR_DG.AddressFile ), VERBOSITY_ONE_LINER );
  649. }
  650. dprintf( "\n" );
  651. PrintUShort( u.SR_DG.CurrentNicId );
  652. PrintBool( u.SR_DG.Net0SendSucceeded );
  653. PrintBool( u.SR_DG.OutgoingSap );
  654. break;
  655. case IDENTIFIER_RIP:
  656. case IDENTIFIER_RIP_INTERNAL:
  657. case IDENTIFIER_RIP_RESPONSE:
  658. PrintStartStruct();
  659. dprintf( " --- SR_RIP part of union ---------------------------\n");
  660. PrintULong( u.SR_RIP.Network );
  661. PrintUShort( u.SR_RIP.CurrentNicId );
  662. PrintUChar( u.SR_RIP.RetryCount );
  663. PrintBool( u.SR_RIP.RouteFound );
  664. PrintUShort( u.SR_RIP.SendTime );
  665. PrintBool( u.SR_RIP.NoIdAdvance );
  666. break;
  667. default:
  668. dprintf( "*** Couldn't determine which part of union to display.\n" );
  669. }
  670. PrintFlushLeft();
  671. PrintPtr( Header );
  672. PrintJoin();
  673. PrintPtr( HeaderBuffer );
  674. DumpMdlChain( ( ULONG )_obj.HeaderBuffer, VERBOSITY_ONE_LINER );
  675. dprintf( "\n" );
  676. PrintEndStruct();
  677. PrintEnd;
  678. }
  679. #ifdef _obj
  680. # undef _obj
  681. # undef _objAddr
  682. # undef _objType
  683. #endif
  684. #define _obj Reserved
  685. #define _objAddr pReserved
  686. #define _objType IPX_RECEIVE_RESERVED
  687. VOID
  688. DumpIpxReceive
  689. (
  690. ULONG IpxReceiveToDump,
  691. VERBOSITY Verbosity
  692. )
  693. {
  694. _objType *_objAddr;
  695. _objType _obj;
  696. ULONG result;
  697. dprintf( "NDIS_PACKET at 0x%08X\n", IpxReceiveToDump );
  698. pReserved = RECEIVE_RESERVED(( PIPX_SEND_PACKET )IpxReceiveToDump );
  699. if ( !ReadMemory( IpxReceiveToDump,
  700. &_obj,
  701. sizeof( _obj ),
  702. &result ))
  703. {
  704. dprintf("%08lx: Could not read IPX_SEND_RESERVED structure\n", _objAddr );
  705. return;
  706. }
  707. PrintStartStruct();
  708. PrintEnum( Identifier, EnumSendReservedIdentifier );
  709. PrintBool( TransferInProgress );
  710. PrintBool( OwnedByAddress );
  711. #ifdef IPX_TRACK_POOL
  712. PrintPtr( Pool );
  713. #endif
  714. PrintJoin();
  715. PrintPtr( Address );
  716. if ( Reserved.Address != NULL )
  717. {
  718. DumpIpxAddress( ( ULONG )( Reserved.Address ), VERBOSITY_ONE_LINER );
  719. }
  720. dprintf( "\n" );
  721. PrintPtr( SingleRequest );
  722. PrintPtr( ReceiveBuffer );
  723. PrintL( PoolLinkage );
  724. PrintLL( GlobalLinkage );
  725. PrintLL( Requests );
  726. PrintEndStruct();
  727. }
  728. DECLARE_API( ipxaddrfile )
  729. {
  730. ULONG AddressFileToDump = 0;
  731. ULONG result;
  732. char VarName[ MAX_LIST_VARIABLE_NAME_LENGTH + 1 ];
  733. MEMBER_VARIABLE_INFO MemberInfo;
  734. BOOL bFocusOnMemberVariable = FALSE;
  735. if ( *args )
  736. {
  737. bFocusOnMemberVariable = ReadArgsForTraverse( args, VarName );
  738. }
  739. if ( *args && *args!='-' )
  740. {
  741. if (!sscanf(args, "%lx", &AddressFileToDump))
  742. {
  743. return;
  744. }
  745. }
  746. if ( AddressFileToDump == 0 )
  747. {
  748. dprintf( "Please specify an address.\n" );
  749. }
  750. if ( bFocusOnMemberVariable )
  751. {
  752. if ( !LocateMemberVariable( "IpxAddressFile", VarName, ( PVOID )AddressFileToDump, &MemberInfo ))
  753. {
  754. return;
  755. }
  756. WriteMemberInfo( &MemberInfo );
  757. next( hCurrentProcess, hCurrentThread, dwCurrentPc, dwProcessor, "" );
  758. return;
  759. }
  760. DumpIpxAddressFile( AddressFileToDump, VERBOSITY_FULL );
  761. return;
  762. }
  763. #ifdef _obj
  764. # undef _obj
  765. # undef _objAddr
  766. # undef _objType
  767. #endif
  768. #define _obj AddressFile
  769. #define _objAddr prAddressFile
  770. #define _objType ADDRESS_FILE
  771. VOID
  772. DumpIpxAddressFile
  773. (
  774. ULONG AddressFileToDump,
  775. VERBOSITY Verbosity
  776. )
  777. {
  778. _objType _obj;
  779. _objType *_objAddr;
  780. ULONG result;
  781. _objAddr = ( _objType * )AddressFileToDump;
  782. if ( !ReadMemory( AddressFileToDump,
  783. &_obj,
  784. sizeof( _obj ),
  785. &result ))
  786. {
  787. dprintf( "%08lx: Could not read %s structure\n",
  788. AddressFileToDump,
  789. "ADDRESS_FILE" );
  790. return;
  791. }
  792. if ( Verbosity == VERBOSITY_ONE_LINER )
  793. {
  794. switch ( _obj.State )
  795. {
  796. case ADDRESSFILE_STATE_OPENING:
  797. dprintf( "OPENING " );
  798. break;
  799. case ADDRESSFILE_STATE_OPEN:
  800. dprintf( "OPEN " );
  801. break;
  802. case ADDRESSFILE_STATE_CLOSING:
  803. dprintf( "CLOSING " );
  804. break;
  805. default:
  806. dprintf( "Bogus state " );
  807. break;
  808. }
  809. DumpIpxAddress( ( ULONG )( AddressFile.Address ), VERBOSITY_ONE_LINER );
  810. return;
  811. }
  812. PrintStartStruct();
  813. #if DBG
  814. # if AFREF_TOTAL != 8
  815. # error AFREF_TOTAL was assumed to equal 8
  816. # endif
  817. PrintULong( RefTypes[ AFREF_CREATE ] );
  818. PrintULong( RefTypes[ AFREF_RCV_DGRAM ] );
  819. PrintULong( RefTypes[ AFREF_SEND_DGRAM ] );
  820. PrintULong( RefTypes[ AFREF_VERIFY ] );
  821. PrintULong( RefTypes[ AFREF_INDICATION ] );
  822. PrintULong( RefTypes[ 5 ] );
  823. PrintULong( RefTypes[ 6 ] );
  824. PrintULong( RefTypes[ 7 ] );
  825. #endif
  826. PrintEnum( Type, EnumStructureType );
  827. PrintUShort( Size );
  828. PrintLL( Linkage );
  829. PrintULong( ReferenceCount );
  830. PrintEnum( State, EnumAddressFileState );
  831. PrintPtr( AddressLock );
  832. PrintPtr( Request );
  833. PrintJoin();
  834. PrintPtr( Address );
  835. if ( AddressFile.Address != NULL )
  836. {
  837. dprintf( "(" );
  838. DumpIpxAddress( ( ULONG )( AddressFile.Address ), VERBOSITY_ONE_LINER );
  839. dprintf( ")" );
  840. }
  841. dprintf( "\n" );
  842. #ifdef ISN_NT
  843. PrintPtr( FileObject );
  844. #endif
  845. PrintJoin();
  846. PrintPtr( Device );
  847. if ( AddressFile.Device != NULL )
  848. {
  849. DumpIpxDevice( ( ULONG )( AddressFile.Device ), VERBOSITY_ONE_LINER );
  850. }
  851. dprintf( "\n" );
  852. PrintBool( SpecialReceiveProcessing );
  853. PrintBool( ExtendedAddressing );
  854. PrintBool( ReceiveFlagsAddressing );
  855. PrintBool( ReceiveIpxHeader );
  856. PrintUChar( DefaultPacketType );
  857. PrintBool( FilterOnPacketType );
  858. PrintUChar( FilteredType );
  859. PrintBool( EnableBroadcast );
  860. PrintBool( IsSapSocket );
  861. PrintLL( ReceiveDatagramQueue );
  862. PrintPtr( CloseRequest );
  863. PrintBool( RegisteredReceiveDatagramHandler );
  864. PrintBool( RegisteredErrorHandler );
  865. PrintSymbolPtr( ReceiveDatagramHandler );
  866. PrintXULong( ReceiveDatagramHandlerContext );
  867. PrintSymbolPtr( ErrorHandler );
  868. PrintXULong( ErrorHandlerContext );
  869. PrintEndStruct();
  870. }
  871. DECLARE_API( ipxaddr )
  872. {
  873. ULONG AddressToDump = 0;
  874. ULONG result;
  875. char VarName[ MAX_LIST_VARIABLE_NAME_LENGTH + 1 ];
  876. MEMBER_VARIABLE_INFO MemberInfo;
  877. BOOL bFocusOnMemberVariable = FALSE;
  878. if ( *args )
  879. {
  880. bFocusOnMemberVariable = ReadArgsForTraverse( args, VarName );
  881. }
  882. if ( *args && *args!='-' )
  883. {
  884. if (!sscanf(args, "%lx", &AddressToDump))
  885. {
  886. return;
  887. }
  888. }
  889. if ( AddressToDump == 0 )
  890. {
  891. dprintf( "Please specify an address.\n" );
  892. }
  893. if ( bFocusOnMemberVariable )
  894. {
  895. if ( !LocateMemberVariable( "IpxBinding", VarName, ( PVOID )AddressToDump, &MemberInfo ))
  896. {
  897. return;
  898. }
  899. WriteMemberInfo( &MemberInfo );
  900. next( hCurrentProcess, hCurrentThread, dwCurrentPc, dwProcessor, "" );
  901. return;
  902. }
  903. DumpIpxAddress( AddressToDump, VERBOSITY_FULL );
  904. return;
  905. }
  906. #ifdef _obj
  907. # undef _obj
  908. # undef _objAddr
  909. # undef _objType
  910. #endif
  911. #define _obj Address
  912. #define _objAddr prAddress
  913. #define _objType ADDRESS
  914. VOID
  915. DumpIpxAddress
  916. (
  917. ULONG AddressToDump,
  918. VERBOSITY Verbosity
  919. )
  920. {
  921. _objType _obj;
  922. _objType *_objAddr;
  923. ULONG result;
  924. _objAddr = ( _objType * )AddressToDump;
  925. if ( !ReadMemory( AddressToDump,
  926. &_obj,
  927. sizeof( _obj ),
  928. &result ))
  929. {
  930. dprintf( "%08lx: Could not read %s structure\n",
  931. AddressToDump,
  932. "ADDRESS" );
  933. return;
  934. }
  935. if ( Verbosity == VERBOSITY_ONE_LINER )
  936. {
  937. dprint_hardware_address( _obj.LocalAddress.NodeAddress );
  938. dprintf( ".%d", Address.LocalAddress.Socket );
  939. return;
  940. }
  941. PrintStartStruct();
  942. #if DBG
  943. # if AREF_TOTAL != 4
  944. # error AREF_TOTAL was assumed to equal 4
  945. # endif
  946. PrintULong( RefTypes[ AREF_ADDRESS_FILE ] );
  947. PrintULong( RefTypes[ AREF_LOOKUP ] );
  948. PrintULong( RefTypes[ AREF_RECEIVE ] );
  949. PrintULong( RefTypes[ 3 ] );
  950. #endif
  951. PrintEnum( Type, EnumStructureType );
  952. PrintUShort( Size );
  953. PrintLL( Linkage );
  954. PrintULong( ReferenceCount );
  955. PrintLock( Lock );
  956. PrintPtr( Request );
  957. PrintUShort( Socket );
  958. PrintUShort( SendSourceSocket );
  959. PrintBool( Stopping );
  960. PrintULong( Flags );
  961. PrintJoin();
  962. PrintPtr( Device );
  963. if ( Address.Device != NULL )
  964. {
  965. DumpIpxDevice( ( ULONG )( Address.Device ), VERBOSITY_ONE_LINER );
  966. }
  967. dprintf( "\n" );
  968. PrintPtr( DeviceLock );
  969. PrintLL( AddressFileDatabase );
  970. PrintTDIAddress( LocalAddress );
  971. PrintAddr( SendPacket );
  972. PrintAddr( ReceivePacket );
  973. PrintAddr( SendPacketHeader );
  974. #ifdef ISN_NT
  975. PrintStartStruct();
  976. if ( Address.ReferenceCount )
  977. {
  978. PrintULong( u.ShareAccess.OpenCount );
  979. PrintULong( u.ShareAccess.Readers );
  980. PrintULong( u.ShareAccess.Writers );
  981. PrintULong( u.ShareAccess.Deleters );
  982. PrintULong( u.ShareAccess.SharedRead );
  983. PrintULong( u.ShareAccess.SharedWrite );
  984. PrintULong( u.ShareAccess.SharedDelete );
  985. }
  986. else
  987. {
  988. PrintWorkQueueItem( u.DestroyAddressQueueItem );
  989. }
  990. PrintEndStruct();
  991. PrintPtr( SecurityDescriptor );
  992. #endif
  993. PrintEndStruct();
  994. }
  995. DECLARE_API( ipxadapter )
  996. {
  997. ULONG AdapterToDump = 0;
  998. ULONG result;
  999. char VarName[ MAX_LIST_VARIABLE_NAME_LENGTH + 1 ];
  1000. MEMBER_VARIABLE_INFO MemberInfo;
  1001. BOOL bFocusOnMemberVariable = FALSE;
  1002. if ( *args )
  1003. {
  1004. bFocusOnMemberVariable = ReadArgsForTraverse( args, VarName );
  1005. }
  1006. if ( *args && *args!='-' )
  1007. {
  1008. if (!sscanf(args, "%lx", &AdapterToDump ))
  1009. {
  1010. return;
  1011. }
  1012. }
  1013. if ( AdapterToDump == 0 )
  1014. {
  1015. dprintf( "Please specify an address.\n" );
  1016. }
  1017. if ( bFocusOnMemberVariable )
  1018. {
  1019. if ( !LocateMemberVariable( "IpxAdapter", VarName, ( PVOID )AdapterToDump, &MemberInfo ))
  1020. {
  1021. return;
  1022. }
  1023. WriteMemberInfo( &MemberInfo );
  1024. next( hCurrentProcess, hCurrentThread, dwCurrentPc, dwProcessor, "" );
  1025. return;
  1026. }
  1027. DumpIpxAdapter( AdapterToDump, VERBOSITY_FULL );
  1028. return;
  1029. }
  1030. #ifdef _obj
  1031. # undef _obj
  1032. # undef _objAddr
  1033. # undef _objType
  1034. #endif
  1035. #define _obj Adapter
  1036. #define _objAddr prAdapter
  1037. #define _objType ADAPTER
  1038. VOID
  1039. DumpIpxAdapter
  1040. (
  1041. ULONG AdapterToDump,
  1042. VERBOSITY Verbosity
  1043. )
  1044. {
  1045. _objType _obj;
  1046. _objType *_objAddr;
  1047. ULONG result;
  1048. WCHAR Buffer[ 1000 ];
  1049. PWCHAR pAdapterName = NULL;
  1050. _objAddr = ( _objType * )AdapterToDump;
  1051. if ( !ReadMemory( AdapterToDump,
  1052. &_obj,
  1053. sizeof( _obj ),
  1054. &result ))
  1055. {
  1056. dprintf( "%08lx: Could not read %s structure\n",
  1057. AdapterToDump,
  1058. "ADAPTER" );
  1059. return;
  1060. }
  1061. if ( !ReadMemory( ( ULONG )Adapter.AdapterName,
  1062. Buffer,
  1063. sizeof( WCHAR ) * Adapter.AdapterNameLength,
  1064. &result ))
  1065. {
  1066. dprintf("%08lx: Could not read adapter name structure\n", Adapter.AdapterName );
  1067. }
  1068. else
  1069. {
  1070. pAdapterName = Buffer;
  1071. }
  1072. if ( Verbosity == VERBOSITY_ONE_LINER )
  1073. {
  1074. dprintf( "\"%S\"", pAdapterName );
  1075. return;
  1076. }
  1077. dprintf( "Adapter at 0x%08X\n", AdapterToDump );
  1078. PrintStart;
  1079. PrintEnum( Type, EnumStructureType );
  1080. PrintUShort( Size );
  1081. #if DBG
  1082. PrintNChar( Signature1, sizeof( Adapter.Signature1 ));
  1083. #endif
  1084. PrintULong( BindingCount );
  1085. PrintPtr( NdisBindingHandle );
  1086. PrintLL( RequestCompletionQueue );
  1087. #if ISN_FRAME_TYPE_MAX !=4
  1088. # error ISN_FRAME_TYPE_MAX is no longer 4.
  1089. #endif
  1090. PrintULong( DefHeaderSizes[ ISN_FRAME_TYPE_ETHERNET_II ] );
  1091. PrintULong( BcMcHeaderSizes[ ISN_FRAME_TYPE_ETHERNET_II ] );
  1092. PrintPtr( Bindings[ ISN_FRAME_TYPE_ETHERNET_II ] );
  1093. PrintULong( DefHeaderSizes[ ISN_FRAME_TYPE_802_3 ] );
  1094. PrintULong( BcMcHeaderSizes[ ISN_FRAME_TYPE_802_3 ] );
  1095. PrintPtr( Bindings[ ISN_FRAME_TYPE_802_3 ] );
  1096. PrintULong( DefHeaderSizes[ ISN_FRAME_TYPE_802_2 ] );
  1097. PrintULong( BcMcHeaderSizes[ ISN_FRAME_TYPE_802_2 ] );
  1098. PrintPtr( Bindings[ ISN_FRAME_TYPE_802_2 ] );
  1099. PrintULong( DefHeaderSizes[ ISN_FRAME_TYPE_SNAP ] );
  1100. PrintULong( BcMcHeaderSizes[ ISN_FRAME_TYPE_SNAP ] );
  1101. PrintPtr( Bindings[ ISN_FRAME_TYPE_SNAP ] );
  1102. PrintULong( AllocatedReceiveBuffers );
  1103. PrintLL( ReceiveBufferPoolList );
  1104. PrintL( ReceiveBufferList );
  1105. PrintULong( AllocatedPaddingBuffers );
  1106. PrintL( PaddingBufferList );
  1107. PrintBool( BroadcastEnabled );
  1108. PrintPtr( AutoDetectFoundOnBinding );
  1109. PrintBool( AutoDetectResponse );
  1110. PrintBool( DefaultAutoDetected );
  1111. PrintUShort( FirstWanNicId );
  1112. PrintUShort( LastWanNicId );
  1113. PrintULong( WanNicIdCount );
  1114. PrintUShort( BindSap );
  1115. PrintUShort( BindSapNetworkOrder );
  1116. PrintBool( SourceRouting );
  1117. PrintBool( EnableFunctionalAddress );
  1118. PrintBool( EnableWanRouter );
  1119. PrintULong( ConfigMaxPacketSize );
  1120. PrintJoin();
  1121. PrintPtr( AdapterName );
  1122. if ( pAdapterName != NULL )
  1123. {
  1124. dprintf( "\"%S\"", pAdapterName );
  1125. }
  1126. dprintf( "\n" );
  1127. PrintULong( AdapterNameLength );
  1128. PrintJoin();
  1129. PrintPtr( Device );
  1130. if ( Adapter.Device != NULL )
  1131. {
  1132. DumpIpxDevice( ( ULONG )( Adapter.Device ), VERBOSITY_ONE_LINER );
  1133. }
  1134. dprintf( "\n" );
  1135. PrintLock( Lock );
  1136. PrintPtr( DeviceLock );
  1137. PrintHardwareAddress( LocalMacAddress );
  1138. PrintUChar( LastSourceRoutingTime );
  1139. PrintAddr( NdisRequestEvent );
  1140. PrintXULong( NdisRequestStatus );
  1141. PrintXULong( OpenErrorStatus );
  1142. PrintStartStruct();
  1143. PrintULong( MacInfo.MediumType );
  1144. PrintULong( MacInfo.RealMediumType );
  1145. PrintBool( MacInfo.SourceRouting );
  1146. PrintBool( MacInfo.MediumAsync );
  1147. PrintUChar( MacInfo.BroadcastMask );
  1148. PrintULong( MacInfo.CopyLookahead );
  1149. PrintULong( MacInfo.MacOptions );
  1150. PrintULong( MacInfo.MinHeaderLength );
  1151. PrintULong( MacInfo.MaxHeaderLength );
  1152. PrintEndStruct();
  1153. PrintULong( MaxReceivePacketSize );
  1154. PrintULong( MaxSendPacketSize );
  1155. PrintULong( ReceiveBufferSpace );
  1156. PrintULong( MediumSpeed );
  1157. #if IDENTIFIER_TOTAL != 4
  1158. # error IDENTIFIER_TOTAL is assumed to equal 4
  1159. #endif
  1160. PrintBool( SourceRoutingEmpty[IDENTIFIER_NB] );
  1161. PrintPtr( SourceRoutingHeads[IDENTIFIER_NB] );
  1162. PrintBool( SourceRoutingEmpty[IDENTIFIER_IPX] );
  1163. PrintPtr( SourceRoutingHeads[IDENTIFIER_IPX] );
  1164. PrintBool( SourceRoutingEmpty[IDENTIFIER_SPX] );
  1165. PrintPtr( SourceRoutingHeads[IDENTIFIER_SPX] );
  1166. PrintBool( SourceRoutingEmpty[IDENTIFIER_RIP] );
  1167. PrintPtr( SourceRoutingHeads[IDENTIFIER_RIP] );
  1168. PrintEnd;
  1169. }
  1170. DECLARE_API( ipxbinding )
  1171. {
  1172. ULONG BindingToDump = 0;
  1173. ULONG result;
  1174. char VarName[ MAX_LIST_VARIABLE_NAME_LENGTH + 1 ];
  1175. MEMBER_VARIABLE_INFO MemberInfo;
  1176. BOOL bFocusOnMemberVariable = FALSE;
  1177. if ( *args )
  1178. {
  1179. bFocusOnMemberVariable = ReadArgsForTraverse( args, VarName );
  1180. }
  1181. if ( *args && *args!='-' )
  1182. {
  1183. if (!sscanf(args, "%lx", &BindingToDump))
  1184. {
  1185. return;
  1186. }
  1187. }
  1188. if ( BindingToDump == 0 )
  1189. {
  1190. dprintf( "Please specify an address.\n" );
  1191. }
  1192. if ( bFocusOnMemberVariable )
  1193. {
  1194. if ( !LocateMemberVariable( "IpxBinding", VarName, ( PVOID )BindingToDump, &MemberInfo ))
  1195. {
  1196. return;
  1197. }
  1198. WriteMemberInfo( &MemberInfo );
  1199. next( hCurrentProcess, hCurrentThread, dwCurrentPc, dwProcessor, "" );
  1200. return;
  1201. }
  1202. DumpIpxBinding( BindingToDump, VERBOSITY_FULL );
  1203. return;
  1204. }
  1205. #ifdef _obj
  1206. # undef _obj
  1207. # undef _objAddr
  1208. # undef _objType
  1209. #endif
  1210. #define _obj Binding
  1211. #define _objAddr pBinding
  1212. #define _objType BINDING
  1213. VOID
  1214. DumpIpxBinding
  1215. (
  1216. ULONG BindingToDump,
  1217. VERBOSITY Verbosity
  1218. )
  1219. {
  1220. BINDING Binding;
  1221. PBINDING pBinding;
  1222. ULONG result;
  1223. pBinding = ( PBINDING )BindingToDump;
  1224. if ( !ReadMemory( BindingToDump,
  1225. &Binding,
  1226. sizeof( Binding ),
  1227. &result ))
  1228. {
  1229. dprintf("%08lx: Could not read BINDING structure\n", BindingToDump );
  1230. return;
  1231. }
  1232. if ( Verbosity == VERBOSITY_ONE_LINER )
  1233. {
  1234. if ( Binding.Adapter != NULL )
  1235. {
  1236. DumpIpxAdapter( ( ULONG )( Binding.Adapter ), VERBOSITY_ONE_LINER );
  1237. }
  1238. dprintf( " %s\n", Binding.LineUp ? "UP" : "DOWN" );
  1239. return;
  1240. }
  1241. dprintf( "Binding at 0x%08X\n", BindingToDump );
  1242. PrintStart;
  1243. PrintStartStruct();
  1244. #if DBG
  1245. # if BREF_TOTAL != 5
  1246. # error The BREF_TOTAL constant has changed, and so must ipxext.c
  1247. # endif
  1248. PrintULong( RefTypes[ 0 ] );
  1249. PrintULong( RefTypes[ BREF_BOUND ] );
  1250. PrintULong( RefTypes[ 2 ] );
  1251. PrintULong( RefTypes[ 3 ] );
  1252. PrintULong( RefTypes[ 4 ] );
  1253. #endif
  1254. PrintEnum( Type, EnumStructureType );
  1255. PrintUShort( Size );
  1256. #if DBG
  1257. PrintNChar( Signature1, sizeof( Binding.Signature1 ));
  1258. #endif
  1259. PrintULong( ReferenceCount );
  1260. PrintJoin();
  1261. PrintPtr( Adapter );
  1262. if ( Binding.Adapter != NULL )
  1263. {
  1264. DumpIpxAdapter( ( ULONG )( Binding.Adapter ), VERBOSITY_ONE_LINER );
  1265. }
  1266. dprintf( "\n" );
  1267. PrintUShort( NicId );
  1268. PrintULong( MaxSendPacketSize );
  1269. PrintJoin();
  1270. PrintULong( MediumSpeed ); // in units of 100 bytes/sec
  1271. dprintf( "(In units of 100 bytes/sec)\n" );
  1272. PrintHardwareAddress( LocalMacAddress );
  1273. PrintHardwareAddress( RemoteMacAddress );
  1274. PrintFieldName( "WanRemoteNode" );
  1275. dprint_hardware_address( Binding.WanRemoteNode );
  1276. dprintf( "\n" );
  1277. PrintBool( AutoDetect );
  1278. PrintBool( DefaultAutoDetect );
  1279. PrintUShort( MatchingResponses );
  1280. PrintUShort( NonMatchingResponses );
  1281. PrintXULong( TentativeNetworkAddress );
  1282. PrintBool( BindingSetMember );
  1283. PrintBool( ReceiveBroadcast );
  1284. PrintBool( LineUp );
  1285. PrintBool( DialOutAsync );
  1286. if ( Binding.BindingSetMember )
  1287. {
  1288. PrintPtr( NextBinding );
  1289. PrintPtr( CurrentSendBinding );
  1290. PrintPtr( MasterBinding );
  1291. }
  1292. PrintULong( WanInactivityCounter );
  1293. PrintTDIAddress( LocalAddress );
  1294. PrintSymbolPtr( SendFrameHandler );
  1295. PrintPtr( Device );
  1296. PrintJoin();
  1297. PrintPtr( DeviceLock );
  1298. if ( Binding.DeviceLock != NULL )
  1299. {
  1300. DumpCTELock( ( ULONG )Binding.DeviceLock, VERBOSITY_ONE_LINER );
  1301. }
  1302. dprintf( "\n" );
  1303. PrintULong( DefHeaderSize );
  1304. PrintULong( BcMcHeaderSize );
  1305. PrintULong( AnnouncedMaxDatagramSize );
  1306. PrintULong( RealMaxDatagramSize );
  1307. PrintULong( MaxLookaheadData );
  1308. PrintULong( FwdAdapterContext );
  1309. PrintULong( InterfaceIndex );
  1310. PrintULong( ConnectionId );
  1311. PrintULong( IpxwanConfigRequired );
  1312. {
  1313. ULONG i;
  1314. for (i=0; i<UPPER_DRIVER_COUNT; i++) {
  1315. PrintBool( IsnInformed[i] );
  1316. }
  1317. }
  1318. PrintEnum( FrameType, EnumBindingFrameType );
  1319. PrintWorkQueueItem( WanDelayedQueueItem );
  1320. PrintEndStruct();
  1321. PrintEnd;
  1322. }
  1323. #ifdef _obj
  1324. # undef _obj
  1325. # undef _objAddr
  1326. # undef _objType
  1327. #endif
  1328. #define _obj RouteEntry
  1329. #define _objAddr pRouteEntry
  1330. #define _objType IPX_ROUTE_ENTRY
  1331. VOID
  1332. DumpIpxRouteEntry
  1333. (
  1334. ULONG EntryToDump,
  1335. VERBOSITY Verbosity
  1336. ) {
  1337. PIPX_ROUTE_ENTRY pRouteEntry;
  1338. IPX_ROUTE_ENTRY RouteEntry;
  1339. ULONG result;
  1340. pRouteEntry = ( PIPX_ROUTE_ENTRY )EntryToDump;
  1341. if ( !ReadMemory( EntryToDump,
  1342. &RouteEntry,
  1343. sizeof( IPX_ROUTE_ENTRY ),
  1344. &result ))
  1345. {
  1346. dprintf("%08lx: Could not read IPX_ROUTE_ENTRY structure\n", EntryToDump );
  1347. return;
  1348. }
  1349. PrintStart;
  1350. PrintStartStruct();
  1351. dprintf( "\tRoute Entry at 0x%08X\n", EntryToDump );
  1352. PrintNetworkAddress(Network);
  1353. PrintUShort(NicId);
  1354. PrintMacAddress(NextRouter);
  1355. PrintPtr(NdisBindingContext);
  1356. PrintFlags(Flags,FlagsRouteEntry);
  1357. PrintUShort(Timer);
  1358. PrintUShort(TickCount);
  1359. PrintUShort(HopCount);
  1360. PrintEndStruct();
  1361. PrintEnd;
  1362. }
  1363. #ifdef _obj
  1364. # undef _obj
  1365. # undef _objAddr
  1366. # undef _objType
  1367. #endif
  1368. #define _obj RouterSegment
  1369. #define _objAddr pRouterSegment
  1370. #define _objType ROUTER_SEGMENT
  1371. VOID
  1372. DumpIpxRouterSegment
  1373. (
  1374. ULONG SegmentToDump,
  1375. VERBOSITY Verbosity
  1376. ) {
  1377. PROUTER_SEGMENT pRouterSegment;
  1378. ROUTER_SEGMENT RouterSegment;
  1379. ULONG result;
  1380. PLIST_ENTRY p;
  1381. LIST_ENTRY temp;
  1382. PIPX_ROUTE_ENTRY pRouteEntry;
  1383. pRouterSegment = ( PROUTER_SEGMENT )SegmentToDump;
  1384. if ( !ReadMemory( SegmentToDump,
  1385. &RouterSegment,
  1386. sizeof( ROUTER_SEGMENT ),
  1387. &result ))
  1388. {
  1389. dprintf("%08lx: Could not read ROUTER_SEGMENT structure\n", SegmentToDump );
  1390. return;
  1391. }
  1392. if ( Verbosity == VERBOSITY_ONE_LINER )
  1393. {
  1394. PrintLL(Entries);
  1395. return;
  1396. }
  1397. PrintStart;
  1398. PrintStartStruct();
  1399. dprintf( "\tSegment Entry at 0x%08X\n", SegmentToDump );
  1400. PrintLL(WaitingForRoute);
  1401. PrintLL(FindWaitingForRoute);
  1402. PrintLL(WaitingLocalTarget);
  1403. PrintLL(WaitingReripNetnum);
  1404. PrintLL(Entries);
  1405. PrintPtr(EnumerateLocation);
  1406. for (p = RouterSegment.Entries.Flink;
  1407. p != &(pRouterSegment->Entries);) {
  1408. pRouteEntry = CONTAINING_RECORD(p,
  1409. IPX_ROUTE_ENTRY,
  1410. PRIVATE.Linkage);
  1411. DumpIpxRouteEntry((ULONG)pRouteEntry,VERBOSITY_ONE_LINER);
  1412. if ( !ReadMemory( (ULONG) p,
  1413. &temp,
  1414. sizeof( LIST_ENTRY ),
  1415. &result ))
  1416. {
  1417. dprintf("%08lx: Could not read LIST_ENTRY structure\n", p);
  1418. break;
  1419. } else {
  1420. p = temp.Flink;
  1421. }
  1422. }
  1423. PrintEnd;
  1424. PrintEndStruct();
  1425. return;
  1426. }
  1427. DECLARE_API( ipxrequest )
  1428. {
  1429. ULONG RequestToDump = 0;
  1430. ULONG result;
  1431. char VarName[ MAX_LIST_VARIABLE_NAME_LENGTH + 1 ];
  1432. MEMBER_VARIABLE_INFO MemberInfo;
  1433. BOOL bFocusOnMemberVariable = FALSE;
  1434. if ( *args )
  1435. {
  1436. bFocusOnMemberVariable = ReadArgsForTraverse( args, VarName );
  1437. }
  1438. if ( *args && *args!='-' )
  1439. {
  1440. if (!sscanf(args, "%lx", &RequestToDump))
  1441. {
  1442. return;
  1443. }
  1444. }
  1445. if ( RequestToDump == 0 )
  1446. {
  1447. dprintf( "Please specify an address.\n" );
  1448. }
  1449. if ( bFocusOnMemberVariable )
  1450. {
  1451. if ( !LocateMemberVariable( "IpxRequest", VarName, ( PVOID )RequestToDump, &MemberInfo ))
  1452. {
  1453. return;
  1454. }
  1455. WriteMemberInfo( &MemberInfo );
  1456. next( hCurrentProcess, hCurrentThread, dwCurrentPc, dwProcessor, "" );
  1457. return;
  1458. }
  1459. DumpIpxRequest( RequestToDump, VERBOSITY_FULL );
  1460. return;
  1461. }
  1462. #ifdef _obj
  1463. # undef _obj
  1464. # undef _objAddr
  1465. # undef _objType
  1466. #endif
  1467. #define _obj Request
  1468. #define _objAddr prRequest
  1469. #define _objType REQUEST
  1470. VOID
  1471. DumpIpxRequest
  1472. (
  1473. ULONG RequestToDump,
  1474. VERBOSITY Verbosity
  1475. )
  1476. {
  1477. _objType _obj;
  1478. _objType *_objAddr;
  1479. ULONG result;
  1480. _objAddr = ( _objType * )RequestToDump;
  1481. if ( !ReadMemory( RequestToDump,
  1482. &_obj,
  1483. sizeof( _obj ),
  1484. &result ))
  1485. {
  1486. dprintf( "%08lx: Could not read %s structure\n",
  1487. RequestToDump,
  1488. "REQUEST" );
  1489. return;
  1490. }
  1491. PrintStartStruct();
  1492. DumpIpxIrpStack( &Request, VERBOSITY_FULL );
  1493. PrintEndStruct();
  1494. }
  1495. PDEVICE_OBJECT GetIpxDeviceObject( VOID )
  1496. {
  1497. ULONG deviceToDump = 0;
  1498. ULONG prDevice = 0;
  1499. ULONG result;
  1500. DEVICE Device;
  1501. prDevice = GetExpression( "nwlnkipx!IpxDevice" );
  1502. if ( !prDevice )
  1503. {
  1504. dprintf("Could not get nwlnkipx!IpxDevice, Try !reload\n");
  1505. return( NULL );
  1506. }
  1507. if (!ReadMemory( prDevice,
  1508. &deviceToDump,
  1509. sizeof(deviceToDump),
  1510. &result ))
  1511. {
  1512. dprintf("%08lx: Could not read device address\n", prDevice);
  1513. return( NULL );
  1514. }
  1515. if ( !ReadMemory( deviceToDump,
  1516. &Device,
  1517. sizeof(Device),
  1518. &result ))
  1519. {
  1520. dprintf("%08lx: Could not read device context\n", deviceToDump);
  1521. return( NULL );
  1522. }
  1523. return( Device.DeviceObject );
  1524. }
  1525. #ifdef _obj
  1526. # undef _obj
  1527. # undef _objAddr
  1528. # undef _objType
  1529. #endif
  1530. #define _obj ConnInfo
  1531. #define _objAddr prConnInfo
  1532. #define _objType TDI_CONNECTION_INFORMATION
  1533. VOID
  1534. DumpTdiConnectionInformation
  1535. (
  1536. ULONG InformationToDump,
  1537. VERBOSITY Verbosity
  1538. )
  1539. {
  1540. _objType _obj;
  1541. _objType *_objAddr;
  1542. ULONG result;
  1543. _objAddr = ( _objType * )InformationToDump;
  1544. if ( !ReadMemory( InformationToDump,
  1545. &_obj,
  1546. sizeof( _obj ),
  1547. &result ))
  1548. {
  1549. dprintf( "%08lx: Could not read %s structure\n",
  1550. InformationToDump,
  1551. "TDI_CONNECTION_INFORMATION" );
  1552. return;
  1553. }
  1554. PrintStartStruct();
  1555. PrintULong( UserDataLength ); // length of user data buffer
  1556. PrintPtr( UserData ); // pointer to user data buffer
  1557. PrintULong( OptionsLength ); // length of follwoing buffer
  1558. PrintPtr( Options ); // pointer to buffer containing options
  1559. PrintULong( RemoteAddressLength ); // length of following buffer
  1560. PrintPtr( RemoteAddress ); // buffer containing the remote address
  1561. PrintEndStruct();
  1562. }
  1563. #ifdef _obj
  1564. # undef _obj
  1565. # undef _objAddr
  1566. # undef _objType
  1567. #endif
  1568. #define _obj Parameters
  1569. #define _objAddr prParameters
  1570. #define _objType TDI_REQUEST_KERNEL_SENDDG
  1571. VOID
  1572. DumpTdiSendParameters
  1573. (
  1574. ULONG ParametersToDump,
  1575. VERBOSITY Verbosity
  1576. )
  1577. {
  1578. _objType _obj;
  1579. _objType *_objAddr;
  1580. ULONG result;
  1581. _objAddr = ( _objType * )ParametersToDump;
  1582. if ( !ReadMemory( ParametersToDump,
  1583. &_obj,
  1584. sizeof( _obj ),
  1585. &result ))
  1586. {
  1587. dprintf( "%08lx: Could not read %s structure\n",
  1588. ParametersToDump,
  1589. "TDI_REQUEST_KERNEL_SENDDG" );
  1590. return;
  1591. }
  1592. PrintStartStruct();
  1593. PrintULong( SendLength );
  1594. PrintPtr( SendDatagramInformation );
  1595. DumpTdiConnectionInformation(( ULONG )_obj.SendDatagramInformation, Verbosity );
  1596. PrintEndStruct();
  1597. }
  1598. #ifdef _obj
  1599. # undef _obj
  1600. # undef _objAddr
  1601. # undef _objType
  1602. #endif
  1603. #define _obj Stack
  1604. #define _objAddr prStack
  1605. #define _objType IO_STACK_LOCATION
  1606. VOID
  1607. DumpIpxIrpStack
  1608. (
  1609. PREQUEST pRequest,
  1610. VERBOSITY Verbosity
  1611. )
  1612. /*++
  1613. Routine Description:
  1614. Given an IRP of interest to the debugger, this routine will search that IRP's
  1615. stacks for the stack location that involves IPX. This stack location will be
  1616. dumped, and the file object contained in it will be followed. The file object
  1617. will then be used to ....
  1618. Matching the IRP stack locations to IPX requires finding the IPX device object
  1619. pointer from the ipxdev structure, and looking in the devobjects referred to
  1620. by the IRP to see if they refer to ipx.
  1621. --*/
  1622. {
  1623. _objType _obj;
  1624. _objType *_objAddr;
  1625. ULONG result;
  1626. PIO_STACK_LOCATION pStack;
  1627. ULONG StackToDump;
  1628. PDEVICE_OBJECT IpxDeviceObject;
  1629. CHAR idxStack;
  1630. IpxDeviceObject = GetIpxDeviceObject();
  1631. if ( IpxDeviceObject == NULL )
  1632. {
  1633. return;
  1634. }
  1635. prStack = pRequest->Tail.Overlay.CurrentStackLocation;
  1636. for ( idxStack = 0; idxStack < pRequest->StackCount; idxStack ++ )
  1637. {
  1638. StackToDump = ( ULONG )prStack;
  1639. if ( !ReadMemory( StackToDump,
  1640. &Stack,
  1641. sizeof( Stack ),
  1642. &result ))
  1643. {
  1644. dprintf( "%08lx: Could not read %s structure\n",
  1645. StackToDump,
  1646. "STACK" );
  1647. return;
  1648. }
  1649. if ( Stack.DeviceObject == IpxDeviceObject )
  1650. {
  1651. break;
  1652. }
  1653. prStack --;
  1654. }
  1655. if ( Stack.DeviceObject != IpxDeviceObject )
  1656. {
  1657. dprintf( "None of the device objects in this IRP's stacks seem to match the IPX device object.\n ");
  1658. return;
  1659. }
  1660. PrintStartStruct();
  1661. PrintXEnum( MajorFunction, EnumIrpMajorFunction );
  1662. PrintXEnum( MinorFunction, EnumIrpMinorFunction[ _obj.MajorFunction ] );
  1663. // Send? Dump Parameters
  1664. PrintAddr( Parameters );
  1665. DumpTdiSendParameters( AddressOf( Parameters ), VERBOSITY_FULL );
  1666. PrintXULong( Flags );
  1667. PrintXULong( Control );
  1668. PrintJoin();
  1669. PrintPtr( DeviceObject );
  1670. DumpDeviceObject(( ULONG ) Stack.DeviceObject, VERBOSITY_ONE_LINER );
  1671. PrintJoin();
  1672. PrintPtr( FileObject );
  1673. if ( Stack.FileObject != NULL )
  1674. {
  1675. FILE_OBJECT FileObject;
  1676. if ( !ReadMemory( ( ULONG )Stack.FileObject,
  1677. &FileObject,
  1678. sizeof( FileObject ),
  1679. &result ))
  1680. {
  1681. dprintf( "%08lx: Could not read FileObject", Stack.FileObject );
  1682. }
  1683. else
  1684. {
  1685. dprintf( "Addressfile at %8X: ", ( ULONG )FileObject.FsContext );
  1686. DumpIpxAddressFile( ( ULONG )FileObject.FsContext, VERBOSITY_ONE_LINER );
  1687. }
  1688. }
  1689. dprintf( "\n" );
  1690. PrintSymbolPtr( CompletionRoutine );
  1691. PrintXULong( Context );
  1692. PrintEndStruct();
  1693. }
  1694. #ifdef _obj
  1695. # undef _obj
  1696. # undef _objAddr
  1697. # undef _objType
  1698. #endif
  1699. #define _obj DevObj
  1700. #define _objAddr prDevObj
  1701. #define _objType DEVICE_OBJECT
  1702. VOID DumpDeviceObject
  1703. (
  1704. ULONG DevObjToDump,
  1705. VERBOSITY Verbosity
  1706. )
  1707. {
  1708. _objType _obj;
  1709. _objType *_objAddr;
  1710. ULONG result;
  1711. PIO_STACK_LOCATION pStack;
  1712. _objAddr = ( _objType * )DevObjToDump;
  1713. if ( !ReadMemory( DevObjToDump,
  1714. &_obj,
  1715. sizeof( _obj ),
  1716. &result ))
  1717. {
  1718. dprintf( "%08lx: Could not read %s structure\n",
  1719. DevObjToDump,
  1720. "DEVICE_OBJECT" );
  1721. return;
  1722. }
  1723. if ( Verbosity != VERBOSITY_ONE_LINER )
  1724. {
  1725. dprintf( "DumpDeviceObject only support VERBOSITY_ONE_LINER.\n" );
  1726. }
  1727. dprintf( "Ref = %d, Driver = %08X, CurrentIrp = %08X\n",
  1728. _obj.ReferenceCount,
  1729. _obj.DriverObject,
  1730. _obj.CurrentIrp );
  1731. }