#include "precomp.h" #pragma hdrstop #include #include #include #include #define ROUTE_TABLE_SIZE 32 FLAG_INFO FlagsNTE[] = { { NTE_VALID, "NTE_Valid" }, { NTE_COPY, "NTE_Copy" }, { NTE_PRIMARY, "NTE_Primary" }, { NTE_ACTIVE, "NTE_Active" }, { NTE_DYNAMIC, "NTE_Dynamic" }, { NTE_DHCP, "NTE_DHCP" }, { NTE_DISCONNECTED, "NTE_Disconnected" }, { NTE_TIMER_STARTED, "NTE_TimerStarted" }, { NTE_IF_DELETING, "NTE_IF_Deleting" }, { 0, NULL } }; FLAG_INFO FlagsIF[] = { { IF_FLAGS_P2P, "IF_Point_to_Point" }, { IF_FLAGS_DELETING, "IF_Deleting" }, { IF_FLAGS_NOIPADDR, "IF_NoIPAddr" }, { IF_FLAGS_P2MP, "IF_P2MP" }, { IF_FLAGS_REMOVING_POWER, "IF_REMOVING_POWER" }, { IF_FLAGS_POWER_DOWN, "IF_POWER_DOWN" }, { IF_FLAGS_REMOVING_DEVICE, "IF_REMOVING_DEVICE" }, { IF_FLAGS_NOLINKBCST, "IF_FLAGS_NOLINKBCST" }, { 0, NULL } }; FLAG_INFO FlagsRCE[] = { { RCE_VALID, "RCE_Valid" }, { RCE_CONNECTED, "RCE_Connected" }, { RCE_REFERENCED, "RCE_Referenced" }, { RCE_DEADGW, "RCE_Deadgw" }, { 0, NULL } }; FLAG_INFO FlagsRTE[] = { { RTE_VALID, "RTE_Valid" }, { RTE_INCREASE, "RTE_Increase" }, { RTE_IF_VALID, "RTE_If_Valid" }, { RTE_DEADGW, "RTE_DeadGW" }, { RTE_NEW, "RTE_New" }, { 0, NULL } }; VOID DumpLog ( ); DECLARE_API( dumplog ) { DumpLog(); return; } VOID DumpIPH( ULONG IPH ); DECLARE_API( IPH ) { ULONG addressToDump = 0; if ( *args ) { sscanf(args, "%lx", &addressToDump); } DumpIPH( addressToDump ); return; } ULONG_PTR DumpNTE( ULONG NTEAddr, VERBOSITY Verbosity ); DECLARE_API( nte ) { ULONG addressToDump = 0; ULONG result; if ( *args ) { sscanf(args, "%lx", &addressToDump); } DumpNTE( addressToDump, VERBOSITY_NORMAL ); return; } ULONG_PTR DumpInterface( ULONG InterfaceAddr, VERBOSITY Verbosity ); DECLARE_API( interface ) { ULONG addressToDump = 0; ULONG result; if ( *args ) { sscanf(args, "%lx", &addressToDump); } DumpInterface( addressToDump, VERBOSITY_NORMAL ); return; } VOID DumpIFList ( VERBOSITY Verbosity ); DECLARE_API( iflist ) { char buf[128]; buf[0] = '\0'; if ( *args ) { sscanf(args, "%s", buf); } if (buf[0] == '\0') { dprintf( "VERBOSITY_NORMAL\n" ); DumpIFList( VERBOSITY_NORMAL ); } else { dprintf( "VERBOSITY_FULL\n" ); DumpIFList( VERBOSITY_FULL ); } return; } VOID DumpNTEList ( VERBOSITY Verbosity ); DECLARE_API( ntelist ) { char buf[128]; buf[0] = '\0'; if ( *args ) { sscanf(args, "%s", buf); } if (buf[0] == '\0') { dprintf( "VERBOSITY_NORMAL\n" ); DumpNTEList( VERBOSITY_NORMAL ); } else { dprintf( "VERBOSITY_FULL\n" ); DumpNTEList( VERBOSITY_FULL ); } return; } ULONG DumpRCE( ULONG RCEAddr, VERBOSITY Verbosity ); DECLARE_API( rce ) { ULONG addressToDump = 0; ULONG result; if ( *args ) { sscanf(args, "%lx", &addressToDump); } DumpRCE( addressToDump, VERBOSITY_NORMAL ); return; } ULONG DumpRTE( ULONG RTEAddr, VERBOSITY Verbosity ); DECLARE_API( rte ) { ULONG addressToDump = 0; ULONG result; if ( *args ) { sscanf(args, "%lx", &addressToDump); } DumpRTE( addressToDump, VERBOSITY_NORMAL ); return; } ULONG DumpATE( ULONG ATEAddr, VERBOSITY Verbosity ); DECLARE_API( ate ) { ULONG addressToDump = 0; ULONG result; if ( *args ) { sscanf(args, "%lx", &addressToDump); } DumpATE( addressToDump, VERBOSITY_NORMAL ); return; } ULONG DumpAI( ULONG AIAddr, VERBOSITY Verbosity ); DECLARE_API( ai ) { ULONG addressToDump = 0; ULONG result; if ( *args ) { sscanf(args, "%lx", &addressToDump); } DumpAI( addressToDump, VERBOSITY_NORMAL ); return; } VOID DumpARPTable ( ULONG ARPTableAddr, VERBOSITY Verbosity ); DECLARE_API( arptable ) { ULONG addressToDump = 0; ULONG result; if ( *args ) { sscanf(args, "%lx", &addressToDump); } DumpARPTable( addressToDump, VERBOSITY_NORMAL ); return; } #ifdef _obj # undef _obj # undef _objAddr # undef _objType # undef _objTypeName #endif #define _obj NTE #define _objAddr NTEToDump #define _objType NetTableEntry #define _objTypeName "NetTableEntry" ULONG_PTR DumpNTE ( ULONG _objAddr, VERBOSITY Verbosity ) /*++ Routine Description: Dumps the fields of the specified DEVICE_CONTEXT structure Arguments: DeviceToDump - The device context object to display Full - Display a partial listing if 0, full listing otherwise. Return Value: None --*/ { _objType _obj; ULONG result; unsigned int index; BOOL bActive; if ( !ReadMemory( _objAddr, &_obj, sizeof( _obj ), &result )) { dprintf("%08lx: Could not read %s structure.\n", _objAddr, _objTypeName ); return(0); } if ( Verbosity == VERBOSITY_ONE_LINER ) { dprintf( "NOT IMPLEMENTED" ); return(0); } dprintf( "%s @ %08lx\n", _objTypeName, _objAddr ); PrintStartStruct(); PrintFieldName( "nte_next" ); dprint_addr_list( ( ULONG_PTR )_obj.nte_next, FIELD_OFFSET( _objType, nte_next )); PrintIPAddress( nte_addr ); PrintIPAddress( nte_mask ); PrintPtr( nte_if ); PrintFieldName( "nte_ifnext" ); dprint_addr_list( ( ULONG_PTR )_obj.nte_ifnext, FIELD_OFFSET( _objType, nte_ifnext )); PrintFlags( nte_flags, FlagsNTE ); PrintUShort( nte_context ); PrintULong( nte_instance ); PrintPtr( nte_pnpcontext ); PrintLock( nte_lock ); PrintPtr( nte_ralist ); PrintPtr( nte_echolist ); PrintCTETimer( nte_timer ); PrintAddr( nte_timerblock ); PrintUShort( nte_mss ); PrintULong( nte_icmpseq ); PrintPtr( nte_igmplist ); PrintPtr( nte_addrhandle ); PrintIPAddress( nte_rtrdiscaddr ); PrintUChar( nte_rtrdiscstate ); PrintUChar( nte_rtrdisccount ); PrintUChar( nte_rtrdiscovery ); PrintUChar( nte_deleting ); PrintPtr( nte_rtrlist ); PrintULong( nte_igmpcount ); PrintEndStruct(); return( (ULONG_PTR)_obj.nte_next ); } VOID DumpNTEList ( VERBOSITY Verbosity ) { ULONG Listlen=0; ULONG NteAddr; ULONG result; NetTableEntry **NteList, **PreservedPtr; ULONG_PTR CurrentNTE; ULONG index; ULONG NET_TABLE_SIZE; NteAddr = GetUlongValue( "tcpip!NewNetTableList" ); NET_TABLE_SIZE = GetUlongValue( "tcpip!NET_TABLE_SIZE" ); NteList = malloc(sizeof( NetTableEntry * ) * NET_TABLE_SIZE); if (NteList == NULL) { dprintf("malloc failed\n"); return; } PreservedPtr = NteList; // Listlen = GetUlongValue( "tcpip!NumNTE" ); if ( !ReadMemory( NteAddr, &NteList[0], 4 * NET_TABLE_SIZE, &result )) { dprintf("%08lx: Could not read the list.\n", NteAddr); return; } for (index=0; index