/*++ Copyright (c) 1995-1999 Microsoft Corporation Module Name: help.cxx Abstract: This module contains the help text for all commands supported by this NTSD debugger extension. Author: Keith Moore (keithmo) 12-Nov-1997 Revision History: --*/ #include "inetdbgp.h" // // The following structure defines the text displayed in response // to the "!help" command. This text may also be displayed if invalid // arguments are passed to a command. // typedef struct _HELP_MAP { // // This is the name of the command. // PSTR Command; // // This is a "one-liner" displayed when the user executes "!help". // PSTR OneLiner; // // This is the full help text displayed when the user executes // "!help ". // PSTR FullHelp; } HELP_MAP, *PHELP_MAP; HELP_MAP HelpMaps[] = { { "help", "Dump this list or help for specific command", "help [] - Dump help for command\n" " If no is given, a list of all available commands is displayed\n" }, { "atq", "Dump ATQ structures", "!atq - Dump ATQ_CONTEXT at \n" "!atq -p - Dump ATQ_ENDPOINT at \n" "!atq -g - Dump atq globals\n" "!atq -c[0|1|2|3][0|1] - Dump atq client list at verbosity [n]\n" " Verbosity Levels\n" " 0x - Traverse list, print number on list, confirm signatures\n" " 1x - Active Only\n" " 2x - All Atq contexts\n" " x0 - Print one line summary of Atq Context\n" " x1 - Print full Atq context\n" "!atq -e[0|1|2|3][0|1] - \n" " Dump atq client list at verbosity for given endpoint\n" "!atq -l - Dump atq Endpoint list\n" }, { "asp", "Dump ASP structures", "!asp -g - Dump ASP globals\n" "!asp -tl - Show items in template cache\n" "!asp [-v#] -e - Dump information about script engine\n" "!asp [-v#] -h - Dump CHitObj at \n" "!asp [-v#] -t - Dump CTemplate at \n" "!asp [-v#] -tf - Dump CTemplate::CFileMap at \n" "!asp [-v#] -s - Dump CSession at \n" "!asp [-v#] -a - Dump CAppln at \n" "!asp [-v#] -o - Dump CComponentObject at \n" "!asp -l - VERY BRIEF Display of Object Collection at \n" "\n" "Some options can be prefixed with \"-v\" for more verbosity. Example:\n" " !inetdbg.asp -v -t \n" "\n" "An integer between 0 and 2 may follow the \"-v\" flag.\n" " \"-v0\" is equivalent to no \"-v\" option specified.\n" " \"-v1\" is equivalent to plain \"-v\"\n" " \"-v2\" specifies yet even more verbosity. (provides everything)\n" "\n" "Example:\n" " !inetdbg.asp -v2 -o \n" "\n" "Pointers are displayed in hex. Everything else is decimal unless prefixed with \"0x\".\n" }, { "sched", "Dump scheduler structures", "!sched - Dump Scheduler Item at \n" "!sched -S - Dump CSchedData at \n" "!sched -T - Dump CThreadData at \n" "!sched -s[0|1|2] - Dump global list of schedulers at verbosity [n]\n" "!sched -l[0|1] - Dump Scheduler Item list at verbosity [n]\n" }, { "acache", "Dump allocation cache structures", "!acache - Dump Allocation Cache Handler at \n" "!acache -g - Dump Allocation Cache global information\n" "!acache -l[0|1] - Dump Allocation Cache list at verbosity [v]\n" }, { "ds", "Dump stack with symbols", "!ds [-v] - Dump symbols on stack\n" " -v == print valid symbols only\n" " default addr == current stack pointer\n" }, { "ref", "Dump reference trace log", "!ref [...] - Dump reference trace log at \n" }, { "rref", "Dump reference trace log in reverse order", "!rref [...] - Same as ref, except dumps backwards\n" }, { "resetref", "Reset reference trace log", "!resetref - Reset reference trace log at \n" }, { "st", "Dump string trace log", "!st [-l[0|1]] - Dump string trace log at \n" }, { "rst", "Dump string trace log in reverse order", "!rst [-l[0|1]] - Same as st, except dumps backwards\n" }, { "resetst", "Reset string trace log", "!resetst - Reset string trace log at \n" }, { "wstats", "Dump W3 server statistics", "!wstats [] - Dump w3svc:W3_SERVER_STATISTICS at \n" }, { "cc", "Dump W3 CLIENT_CONN structures", "!cc - Dump w3svc:CLIENT_CONN at \n" "!cc -l[0|1] - Dump w3svc:CLIENT_CONN list at verbosity [v]\n" }, { "hreq", "Dump W3 HTTP_REQUEST structures", "!hreq - Dump w3svc:HTTP_REQUEST object at \n" "!hreq -l[0|1] - Dump HTTP_REQUEST list at verbosity [n]\n" }, { "wreq", "Dump W3 WAM_REQUEST structures", "!wreq - Dump w3svc:WAM_REQUEST object at \n" "!wreq -l[0|1] - Dump WAM_REQUEST list at verbosity [n]\n" }, { "wxin", "Dump WAM_EXEC_INFO structures", "!wxin - Dump wam:WAM_EXEC_INFO object at \n" "!wxin -l[0|1] - Dump WAM's list of WAM_EXEC_INFOs at verbosity [n]\n" }, { "rpcoop", "Find process/thread ID buried in RPC parameters", "!rpcoop - given RPC param finds the process id for OOP\n" " Verbosity Levels [v]\n" " 0 - Print one line summary\n" " 1 - Print level 1 information\n" " 2 - Print level 2 information\n" }, { "fcache", "Dump IIS file cache structures", "!fcache [options] - Dump entire File Cache\n" " -b == dump bin lists\n" " -m == dump mru list\n" " -v == verbose\n" "!fcache - Dump File Cache entry at \n" }, { "lkrhash", "Dump LKRhash table structures", "!lkrhash [options] - Dump LKRhash table at \n" " -l[0-2] == verbosity level\n" " -v == very verbose\n" " -g[0-2] == dump global list of LKRhashes at verbosity level\n" }, { "open", "Dump TS_OPEN_FILE_INFO structures", "!open - Dump TS_OPEN_FILE_INFO @ \n" }, { "uri", "Dump W3_URI_INFO structures", "!uri - Dump W3_URI_INFO @ \n" }, { "phys", "Dump PHYS_OPEN_FILE_INFO structures", "!phys - Dump PHYS_OPEN_FILE_INFO @ \n" }, { "oplock", "Dump OPLOCK_OBJECT structures", "!oplock - Dump OPLOCK_OBJECT @ \n" }, { "blob", "Dump BLOB_HEADER structures", "!blob - Dump BLOB_HEADER @ \n" }, { "mod", "Dump module info", "!mod [] - Dump module info\n" " If is specified, only module containing is dumped\n" }, { "ver", "Dump module version resources", "!ver [] - Dump version resource for specified module\n" " may be either a module base address or name\n" " If no is specified, then all modules are dumped\n" }, { "heapfind", "Find heap block by size or address", "!heapfind -a - Find heap block containing \n" "!heapfind -s - Find all heap blocks of length \n" }, { "heapstat", "Dump heap statistics", "!heapstat - Dump heap statistics\n" " If is present, then only those heap blocks with counts >= \n" " are displayed. Note that *all* heap blocks are included in the totals,\n" " even if those blocks had counts too small to display.\n" " If is not present, all heap blocks are displayed\n" }, { "waminfo", "Dump WAM Dictator info", "!waminfo -g[0|1] - Dump WamDictator info\n" " 0 - Dump WamDictator info only\n" " 1 - Dump WamDictator's Dying List\n" "!waminfo -d - Dump WamInfo (InProc or OutProc)\n" "!waminfo -l - Dump WamInfoOutProc WamRequest OOP List\n" }, { "spud", "Dump SPUD counters", "!spud - Dump SPUD counters\n" }, { "gem", "Get current error mode", "!gem - Get current error mode\n" }, { "exec", "Execute external command", "!exec [] - Execute external command\n" " Default is CMD.EXE\n" }, { "llc", "Counts items on a standard linked-list", "!llc - Counts the LIST_ENTRYs present on the specified list head\n" }, { "dumpoff", "Dump structure/class information base on debug info in PDB", "!dumpoff ![.] [expression]\n" "!dumpoff -s []\n\n" "pdb_file Un-qualified name of PDB file (eg. KERNEL32, NTDLL)\n" "type_name Name of type (struct/class) to dump, OR \n" " == to dump struct/classes of size cbHexSize\n" "member_name (optional) Name of member in type_name to dump\n" "expression (optional) Address of memory to dump as type_name\n" " if not present, offset(s) are dumped\n" "pdb_search_path Set the search path for PDBs\n\n" "Examples: !dumpoff ntdll!_RTL_CRITICAL_SECTION 14d4d0\n" " !dumpoff w3svc!HTTP_REQUEST._dwSignature w3svc!g_GlobalObj\n" " !dumpoff ntdll!_RTL_CRITICAL_SECTION\n" " !dumpoff w3svc!==840\n" " !dumpoff -s \\\\mydrive\\pdbs;c:\\local\\pdbs\n" }, { "vmstat", "Dump virtual memory statistics", "!vmstat - Dump virtual memory statistics" }, { "vmmap", "Dump virtual memory map", "!vmmap - Dump virtual memory map" } #ifndef _NO_TRACING_ ,{ "trace", "Configure WMI Tracing", "!trace -o Toggle tracing active state\n" "!trace -d 0|1 Set OutputDebugString generation state\n" "!trace -s [Module_Name] List module status\n" "!trace -a [Level] [Flags] Set active state of specified module\n" "!trace -f Set control flag for a specific module\n\n" "Notes: -o does not activate any modules, you must use the -a option for that\n" " -a can not notify WMI, this may cause odd results when using \"tracelog\"\n" " The level & flag are hexadecimal\n" } #endif }; #define NUM_HELP_MAPS ( sizeof(HelpMaps) / sizeof(HelpMaps[0]) ) PSTR FindHelpForCommand( IN PSTR CommandName ) { PHELP_MAP helpMap; ULONG i; for( i = NUM_HELP_MAPS, helpMap = HelpMaps ; i > 0 ; i--, helpMap++ ) { if( _stricmp( helpMap->Command, CommandName ) == 0 ) { return helpMap->FullHelp; } } return NULL; } // FindHelpForCommand VOID PrintUsage( IN PSTR CommandName ) { PSTR cmdHelp; PHELP_MAP helpMap; ULONG i; ULONG maxLength; ULONG length; dprintf( "IIS debugging extension for IIS Version 5.0\n" ); if( CommandName == NULL ) { // // We'll display the one-liners for each command. Start by // scanning the commands to find the longest length. This makes the // output much prettier without having to manually tweak the // columns. // maxLength = 0; for( i = NUM_HELP_MAPS, helpMap = HelpMaps ; i > 0 ; i--, helpMap++ ) { length = (ULONG)strlen( helpMap->Command ); if( length > maxLength ) { maxLength = length; } } // // Now actually display the one-liners. // for( i = NUM_HELP_MAPS, helpMap = HelpMaps ; i > 0 ; i--, helpMap++ ) { dprintf( "!%-*s - %s\n", maxLength, helpMap->Command, helpMap->OneLiner ); } } else { // // Find a specific command and display the full help. // cmdHelp = FindHelpForCommand( CommandName ); if( cmdHelp == NULL ) { dprintf( "unrecognized command %s\n", CommandName ); } else { dprintf( "%s", cmdHelp ); } } } // PrintUsage() DECLARE_API( help ) { INIT_API(); // // Skip leading blanks. // while( *lpArgumentString == ' ' || *lpArgumentString == '\t' ) { lpArgumentString++; } if( !strcmp( lpArgumentString, "?" ) ) { lpArgumentString = "help"; } if( *lpArgumentString == '\0' ) { lpArgumentString = NULL; } PrintUsage( lpArgumentString ); } // DECLARE_API( help )