⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qssi.c

📁 ReactOS是一些高手根据Windows XP的内核编写出的类XP。内核实现机理和API函数调用几乎相同。甚至可以兼容XP的程序。喜欢研究系统内核的人可以看一看。
💻 C
📖 第 1 页 / 共 4 页
字号:
	lstrcpynW (
		Name,
		Tzi.DaylightName, /* WCHAR [32] */
		32
		);
	wprintf (
		L"\tName: \"%s\"\n",
		Name
		);

	PrintUtcDateTime (
		"\tDate: %s\n",
		(PTIME) & Tzi.DaylightDate /* SYSTEMTIME */
		);

	printf (
		"\tBias: %ld'\n",
		Tzi.DaylightBias /* LONG */
		);

	return EXIT_SUCCESS;
}


/**********************************************************************
 *
 * DESCRIPTION
 *
 * NOTE
 * 	Class 45.
 */
CMD_DEF(45)
CMD_NOT_IMPLEMENTED


/**********************************************************************
 *
 * DESCRIPTION
 *
 * NOTE
 * 	Class 46.
 */
CMD_DEF(46)
CMD_NOT_IMPLEMENTED


/**********************************************************************
 *
 * DESCRIPTION
 *
 * NOTE
 * 	Class 47.
 */
CMD_DEF(47)
CMD_NOT_IMPLEMENTED


/**********************************************************************
 *
 * DESCRIPTION
 *
 * NOTE
 * 	Class 48.
 */
CMD_DEF(48)
CMD_NOT_IMPLEMENTED


/**********************************************************************
 *
 * DESCRIPTION
 *
 * NOTE
 * 	Class 49.
 */
CMD_DEF(49)
CMD_NOT_IMPLEMENTED


/**********************************************************************
 *
 * DESCRIPTION
 *
 * NOTE
 * 	Class 50.
 */
CMD_DEF(50)
CMD_NOT_IMPLEMENTED


/**********************************************************************
 *
 * DESCRIPTION
 *
 * NOTE
 * 	Class 51.
 */
CMD_DEF(51)
CMD_NOT_IMPLEMENTED


/**********************************************************************
 *
 * DESCRIPTION
 *
 * NOTE
 * 	Class 52.
 */
CMD_DEF(52)
CMD_NOT_IMPLEMENTED


/**********************************************************************
 *
 * DESCRIPTION
 *
 * NOTE
 * 	Class 53.
 */
CMD_DEF(53)
CMD_NOT_IMPLEMENTED


/**********************************************************************
 *	Miscellanea Commands
 **********************************************************************/

CMD_DEF(ver)
{
	INT	Total = 0;

	Total =
	printf (
	"ReactOS Operating System - http://www.reactos.com/\n"
	"QSI - Query System Information (compiled on %s, %s)\n"
	"Copyright (c) 1999-2001 Emanuele Aliberti et alii\n\n"
	"Run the command in verbose mode, for full license information.\n\n",
	__DATE__, __TIME__
	);

	if (Application.Flag.Verbose)
	{
	Total +=
	printf (
	"This program is free software; you can redistribute it and/or modify\n"
	"it under the terms of the GNU General Public License as published by\n"
	"the Free Software Foundation; either version 2 of the License, or\n"
	"(at your option) any later version.\n\n"

	"This program is distributed in the hope that it will be useful,\n"
	"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
	"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
	"GNU General Public License for more details.\n\n"

	"You should have received a copy of the GNU General Public License\n"
	"along with this program; if not, write to the Free Software\n"
	"Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n"
	"(See also http://www.fsf.org/).\n"
	);
	}
	return (Total);
}


CMD_DEF(exit)
{
	Application.Active = FALSE;
	return EXIT_SUCCESS;
}


extern COMMAND_DESCRIPTOR Commands [];

CMD_DEF(help)
{
	int i;

	if (Application.Flag.Verbose)
	{
		printf ("Commands:\n");
	}
	for (	i = 0;
		(NULL != Commands[i].Name);
		i ++
		)
	{
		printf (
			(strlen (Commands[i].Name) > 7)
				? "%s\t: %s\n"
				: "%s\t\t: %s\n",
			Commands[i].Name,
			Commands[i].Description
			);
	}
	return EXIT_SUCCESS;
}


CMD_DEF(credits)
{
	return
	printf (
		"\nReactOS (http://www.reactos.com/):\n"
		"\tEmanuele Aliberti\n"
		"\tEric Kohl\n\n"

		"HandleEx:\n"
		"\tMark Russinovich (http://www.sysinternals.com/)\n\n"

		"NtDriverList:\n"
		"\tYariv Kaplan (http://www.internals.com/)\n\n"

		"Undocumented SYSTEM_POOL_INFORMATION:\n"
		"\tKlaus P. Gerlicher\n\n"

		"Undocumented Windows NT:\n"
		"\tPrasad Dabak, Sandeep Phadke, and Milind Borate\n\n"

		"Windows NT/2000 Native API Reference:\n"
		"\tGary Nebbett\n\n"

		"comp.os.ms-windows.programmer.nt.kernel-mode\n"
		"\t(many postings with sample code)\n"
		);
}


CMD_DEF(verbose)
{
	Application.Flag.Verbose = ~Application.Flag.Verbose;
	return printf (
		"Verbose mode is %s.\n",
		ONOFF(Application.Flag.Verbose)
		);
}


CMD_DEF(dump)
{
	Application.Flag.Dump = ~Application.Flag.Dump;
	return printf (
		"Dump mode is %s.\n",
		ONOFF(Application.Flag.Dump)
		);
}


/**********************************************************************
 *	Commands table
 **********************************************************************/

COMMAND_DESCRIPTOR
Commands [] =
{
/* System information classes */

	{						/* 0  Q  */
		"basic",
		CMD_REF(0),
		"Basic system information"
	},
	{						/* 1  Q  */
		"processor",
		CMD_REF(1),
		"Processor characteristics"
	},
	{						/* 2  Q  */
		"perf",
		CMD_REF(2),
		"System performance data"
	},
	{						/* 3  Q  */
		"time",
		CMD_REF(3),
		"System times"
	},
	{						/* 4  Q  (checked build only) */
		"path",
		CMD_REF(4),
		"Path (checked build only)"
	},
	{						/* 5  Q  */
		"process",
		CMD_REF(5),
		"Process & thread tables"
	},
	{						/* 6  Q  */
		"callcount",
		CMD_REF(6),
		"Call count information"
	},
	{						/* 7  Q  */
		"device",
		CMD_REF(7),
		"I/O devices in the system, by class"
	},
	{						/* 8  Q  */
		"performance",
		CMD_REF(8),
		"Processor performance"
	},
	{						/* 9  QS */
		"flags",
		CMD_REF(9),
		"System wide flags"
	},
	{						/* 10    */
		"call",
		CMD_REF(10),
		"Call time"
	},
	{						/* 11 Q  */
		"module",
		CMD_REF(11),
		"Table of kernel modules"
	},
	{						/* 12 Q  */
		"locks",
		CMD_REF(12),
		"Table of locks on resources"
	},
	{						/* 13    */
		"stack",
		CMD_REF(13),
		"Stack trace"
	},
	{						/* 14    */
		"ppool",
		CMD_REF(14),
		"Paged pool"
	},
	{						/* 15    */
		"nppool",
		CMD_REF(15),
		"Non paged pool"
	},
	{						/* 16 Q  */
		"handle",
		CMD_REF(16),
		"Table of handles"
	},
	{						/* 17 Q  */
		"object",
		CMD_REF(17),
		"Table of executive objects"
	},
	{						/* 18 Q  */
		"pagefile",
		CMD_REF(18),
		"Virtual memory paging files"
	},
	{						/* 19 Q  */
		"vdmie",
		CMD_REF(19),
		"Virtual DOS Machine instruction emulation (VDM)"
	},
	{						/* 20    */
		"vdmbop",
		CMD_REF(20),
		"Bop (VDM)"
	},
	{						/* 21 QS */
		"cache",
		CMD_REF(21),
		"File cache"
	},
	{						/* 22 Q  */
		"pooltag",
		CMD_REF(22),
		"Tagged pools statistics (checked build only)"
	},
	{						/* 23 Q  */
		"int",
		CMD_REF(23),
		"Processor schedule information (interrupt)"
	},
	{						/* 24 QS */
		"dpc",
		CMD_REF(24),
		"Deferred procedure call behaviour (DPC)"
	},
	{						/* 25    */
		"fullmem",
		CMD_REF(25),
		"Full memory"
	},
	{						/* 26 S (callable) */
		"loadpe",
		CMD_REF(26),
		"Load a kernel mode DLL (module in PE format)"
	},
	{						/* 27 S (callable) */
		"unloadpe",
		CMD_REF(27),
		"Unload a kernel mode DLL (module in Pe format)"
	},
	{						/* 28 QS */
		"timeadj",
		CMD_REF(28),
		"Time adjustment"
	},
	{						/* 29    */
		"smem",
		CMD_REF(29),
		"Summary memory"
	},
	{						/* 30    */
		"event",
		CMD_REF(30),
		"Next event ID"
	},
	{						/* 31    */
		"events",
		CMD_REF(31),
		"Event IDs"
	},
	{						/* 32 Q  */
		"crash",
		CMD_REF(32),
		"Crash Dump Section"
	},
	{						/* 33 Q  */
		"exceptions",
		CMD_REF(33),
		"Exceptions"
	},
	{						/* 34 Q  */
		"crashstate",
		CMD_REF(34),
		"Crash Dump State"
	},
	{						/* 35 Q  */
		"debugger",
		CMD_REF(35),
		"Kernel debugger"
	},
	{						/* 36 Q  */
		"cswitch",
		CMD_REF(36),
		"Thread context switch counters"
	},
	{						/* 37 QS */
		"regquota",
		CMD_REF(37),
		"Registry quota values"
	},
	{						/* 38 S  */
		"est",
		CMD_REF(38),
		"Extended service table"
	},
	{						/* 39 S  */
		"prisep",
		CMD_REF(39),
		"Priority Separation"
	},
	{						/* 40    */
		"ppbus",
		CMD_REF(40),
		"Plug & play bus"
	},
	{						/* 41    */
		"dock",
		CMD_REF(41),
		"Dock"
	},
	{						/* 42    */
		"power",
		CMD_REF(42),
		"Power"
	},
	{						/* 43    */
		"procspeed",
		CMD_REF(43),
		"Processor speed"
	},
	{						/* 44 QS */
		"tz",
		CMD_REF(44),
		"Current time zone (TZ)"
	},
	{						/* 45 Q  */
		"lookaside",
		CMD_REF(45),
		"Lookaside"
	},
	/* NT5 */
	{						/* 46 Q  */
		"tslip",
		CMD_REF(46),
		"Set time slip (5.0)"
	},
	{						/* 47 Q  */
		"csession",
		CMD_REF(47),
		"Create session (5.0)"
	},
	{						/* 48 Q  */
		"dsession",
		CMD_REF(48),
		"Delete session (5.0)"
	},
	{						/* 49 Q  */
		"#49",
		CMD_REF(49),
		"UNKNOWN (5.0)"
	},
	{						/* 50 Q  */
		"range",
		CMD_REF(50),
		"Range start (5.0)"
	},
	{						/* 51 Q  */
		"verifier",
		CMD_REF(51),
		"Verifier (5.0)"
	},
	{						/* 52 Q  */
		"addverif",
		CMD_REF(52),
		"Add verifier (5.0)"
	},
	{						/* 53 Q  */
		"sesproc",
		CMD_REF(53),
		"Session processes (5.0)"
	},
/* User commands */
	{
		"?",
		CMD_REF(help),
		"Same as 'help'"
	},
	{
		"help",
		CMD_REF(help),
		"Print this command directory"
	},
	{
		"credits",
		CMD_REF(credits),
		"Print the list of people and sources that made QSI possible"
	},
	{
		"ver",
		CMD_REF(ver),
		"Print version number and license information"
	},
	{
		"exit",
		CMD_REF(exit),
		"Exit to operating system"
	},
	{
		"dump",
		CMD_REF(dump),
		"Enable/disable dumping raw data returned by system"
	},
	{
		"verbose",
		CMD_REF(verbose),
		"Enable/disable printing unused, unknown, and service fields"
	},

	{ NULL, NULL }
};



/* user input --> command decoder */


COMMAND_CALL
DecodeCommand (LPCSTR Command)
{
	int i;

	for (	i = 0;
		(	Commands[i].Name
			&& stricmp (Commands[i].Name,Command)
			);
		++i
		);
	return Commands[i].EntryPoint;
}

INT
ParseCommandLine (
	LPCSTR	CommandLine,
	LPCSTR	CommandArgv []
	)
{
	INT	ArgC = 0;
	LPCSTR	Separators = " \t";

	for (	CommandArgv [ArgC] = strtok ((char*)CommandLine, (char*)Separators);
		(ArgC < ARGV_SIZE);
		CommandArgv [ArgC] = (LPCSTR) strtok (NULL, (char*)Separators)
		)
	{
		if (NULL == CommandArgv [ArgC++])
		{
			break;
		}
	}
	return (ArgC);
}


int
main (int argc, char * argv [])
{
	CHAR	CommandLine [_MAX_PATH];

	INT	CommandArgc;
	LPCSTR	CommandArgv [ARGV_SIZE];

	/*
	 * Initialize rt data.
	 */
	Application.Heap = GetProcessHeap ();
	Application.Active = TRUE;
	/*
	 *  r-e-p loop.
	 */
	while (Application.Active)
	{
		/* Print the prompt string. */
		if (! Application.Flag.Batch)
		{
			printf ("\r\nsystem> ");
		}
		/* Read user command. */
		gets (CommandLine);
		/* Parse the user command */
		CommandArgc = ParseCommandLine (
				CommandLine,
				CommandArgv
				);
		if (0 != CommandArgc)
		{
			COMMAND_CALL	CommandCall = NULL;

			/* decode */
			if ((CommandCall = DecodeCommand (CommandArgv[0])))
			{
				/* execute */
				Application.ExitCode =
					CommandCall (
						CommandArgc,
						CommandArgv
						);
			}
			else
			{
				printf ("Unknown command (type help for a list of valid commands).\n");
			}
		}

	}
	if (! Application.Flag.Batch)
	{
		printf ("Bye\n");
	}
	return (EXIT_SUCCESS);
}

/* EOF */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -