1 /* $Id: qsi.c,v 1.3 2000/05/28 17:44:51 ea Exp $
3 * PROJECT : ReactOS Operating System (see http://www.reactos.com/)
4 * DESCRIPTION: Tool to query system information
5 * FILE : rosapps/sysutils/qsi.c
6 * AUTHOR : Emanuele Aliberti
7 * LICENSE : GNU GPL (see http://www.gnu.org/)
11 * If you got this code directly from the CVS repository on
12 * mok.lcvm.com, it should be ok to run "make sqi.exe" from the
13 * current directory. Otherwise, be sure the directories
14 * "rosapps" and "reactos" are siblings (see the FILE file
19 * Partially rewritten to run as a tool to query
20 * every system information class data.
22 * Added almost all structures for getting system
23 * information (from UNDOCNT.H by Dabak et alii).
31 #define NTOS_MODE_USER
37 DWORD Verbose
:1; /* print unknown, unused, service fields */
38 DWORD Dump
:1; /* raw dump output buffer */
39 DWORD Batch
:1; /* no shell (for future use) */
56 #define ONOFF(b) ((b)?"on":"off")
60 #define BUFFER_SIZE_DEFAULT 65536
62 #define TF(b) ((b)?"true":"false")
65 INT (* COMMAND_CALL
) (INT ArgC
,LPCSTR ArgV
[]);
69 VOID STDCALL
PrintStatus (NTSTATUS Status
);
71 #define CMD_REF(n) CMD_##n
72 #define CMD_DEF(n) INT CMD_REF(n) (INT argc, LPCSTR argv [])
73 #define CMD_NOT_IMPLEMENTED {printf("%s not implemented\n", argv[0]);return(0);}
76 struct _COMMAND_DESCRIPTOR
79 COMMAND_CALL EntryPoint
;
82 } COMMAND_DESCRIPTOR
, * PCOMMAND_DESCRIPTOR
;
85 /* Fast BYTE to binary representation */
87 #define BIT(n,m) (((n)&(m))?'1':'0')
95 Binary
[7] = BIT(Byte
,0x01);
96 Binary
[6] = BIT(Byte
,0x02);
97 Binary
[5] = BIT(Byte
,0x04);
98 Binary
[4] = BIT(Byte
,0x08);
99 Binary
[3] = BIT(Byte
,0x10);
100 Binary
[2] = BIT(Byte
,0x20);
101 Binary
[1] = BIT(Byte
,0x40);
102 Binary
[0] = BIT(Byte
,0x80);
103 return (LPSTR
) Binary
;
109 DumpData (int Size
, PVOID pData
)
111 PBYTE Buffer
= (PBYTE
) pData
;
114 const int Width
= 16;
116 if (! Application
.Flag
.Dump
)
122 printf ("%04x: ", (Buffer
- Base
));
133 (i
% 4 == 3) ? '|' : ' '
170 KernelObjectName
[] =
184 _T("12"), /* FIXME */
190 _T("18"), /* FIXME */
191 _T("19"), /* FIXME */
192 _T("20"), /* FIXME */
193 _T("21"), /* FIXME */
202 HandleTypeToObjectName (
206 if (HandleType
> 23) /* FIXME: use a symbol not a literal */
208 return _T("Unknown");
210 return KernelObjectName
[HandleType
];
218 FindRequiredBufferSize (int i
, int step
)
220 NTSTATUS Status
= STATUS_INFO_LENGTH_MISMATCH
;
221 BYTE Buffer
[BUFFER_SIZE_DEFAULT
];
226 Size
= step
= (step
> 0 ? step
: 1);
227 while ( (Size
< sizeof Buffer
)
228 && (Status
== STATUS_INFO_LENGTH_MISMATCH
)
231 if (Application
.Flag
.Verbose
)
233 printf ("\tTry %d", Size
);
235 RtlZeroMemory (Buffer
, sizeof Buffer
);
237 Status
= NtQuerySystemInformation (
243 if (STATUS_SUCCESS
== Status
)
245 printf ("Length = %d\n", Size
);
254 /* FIXME: slow linear search! */
258 printf ("No valid buffer length found!\n");
265 PrintStatus (NTSTATUS Status
)
267 LPCSTR StatusName
= NULL
;
271 case STATUS_INVALID_INFO_CLASS
:
272 StatusName
= "STATUS_INVALID_INFO_CLASS";
274 case STATUS_INFO_LENGTH_MISMATCH
:
275 StatusName
= "STATUS_INFO_LENGTH_MISMATCH";
277 case STATUS_ACCESS_VIOLATION
:
278 StatusName
= "STATUS_ACCESS_VIOLATION";
280 case STATUS_NOT_IMPLEMENTED
:
281 StatusName
= "STATUS_NOT_IMPLEMENTED";
283 case STATUS_BREAKPOINT
:
284 StatusName
= "STATUS_BREAKPOINT";
287 if (NULL
!= StatusName
)
289 printf ("\tStatus = %s\n", StatusName
);
292 printf ("\tStatus = 0x%08lX\n", Status
);
295 /* Auxiliary functions */
312 PrintUtcDateTime (LPCSTR Template
, PTIME UtcTime
)
314 CHAR UtcTimeString
[64];
315 TIME_FIELDS UtcTimeFields
;
317 RtlTimeToTimeFields (
318 (PLARGE_INTEGER
) UtcTime
,
323 "%s %d-%02d-%02d %02d:%02d:%02d.%03d UTC",
324 DaysOfWeek
[UtcTimeFields
.Weekday
],
329 UtcTimeFields
.Minute
,
330 UtcTimeFields
.Second
,
331 UtcTimeFields
.Milliseconds
340 /**********************************************************************
342 **********************************************************************/
345 /**********************************************************************
348 * Dump whatever we get by calling NtQuerySystemInformation with
349 * a user provided system information class id.
351 * NtQuerySystemInformation called with user class id.
355 int _id
= atoi ((char*)(argv
[0] + 1)); /* "#24" */
362 printf ("SystemInformation %d:\n", _id
);
363 /* Find buffer size */
364 Size
= FindRequiredBufferSize (_id
, 1);
367 printf("\t(no data)\n");
370 /* Allocate the buffer */
371 Buffer
= GlobalAlloc (GMEM_ZEROINIT
, Size
);
374 printf ("#%d: could not allocate %d bytes\n", _id
, Size
);
377 /* Query the executive */
378 Status
= NtQuerySystemInformation (
384 if (!NT_SUCCESS(Status
))
386 PrintStatus (Status
);
387 FindRequiredBufferSize (_id
, 1);
392 DumpData (Size
, Buffer
);
400 /**********************************************************************
410 SYSTEM_BASIC_INFORMATION Info
;
412 if (Application
.Flag
.Verbose
)
414 printf ("SystemBasicInformation:\n");
420 Status
= NtQuerySystemInformation (
421 SystemBasicInformation
,
426 if (STATUS_SUCCESS
!= Status
)
428 PrintStatus (Status
);
431 printf ("\tAlwaysZero = 0x%08x\n", Info
.AlwaysZero
);
432 printf ("\tKeMaximumIncrement = %ld\n", Info
.KeMaximumIncrement
);
433 printf ("\tMmPageSize = %ld\n", Info
.MmPageSize
);
434 printf ("\tMmNumberOfPhysicalPages = %ld\n", Info
.MmNumberOfPhysicalPages
);
435 printf ("\tMmLowestPhysicalPage = %ld\n", Info
.MmLowestPhysicalPage
);
436 printf ("\tMmHighestPhysicalPage = %ld\n", Info
.MmHighestPhysicalPage
);
437 printf ("\tMmLowestUserAddress = 0x%08x\n", Info
.MmLowestUserAddress
);
438 printf ("\tMmLowestUserAddress1 = 0x%08x\n", Info
.MmLowestUserAddress1
);
439 printf ("\tMmHighestUserAddress = 0x%08x\n", Info
.MmHighestUserAddress
);
440 printf ("\tKeActiveProcessors = 0x%08x\n", Info
.KeActiveProcessors
);
441 printf ("\tKeNumberProcessors = %ld\n", Info
.KeNumberProcessors
);
447 /**********************************************************************
457 SYSTEM_PROCESSOR_INFORMATION Info
;
459 if (Application
.Flag
.Verbose
)
461 printf ("SystemProcessorInformation:\n");
467 Status
= NtQuerySystemInformation (
468 SystemProcessorInformation
,
473 if (STATUS_SUCCESS
!= Status
)
475 PrintStatus (Status
);
478 printf ("\tKeProcessorArchitecture = %ld\n", Info
.KeProcessorArchitecture
);
479 printf ("\tKeProcessorLevel = %ld\n", Info
.KeProcessorLevel
);
480 printf ("\tKeProcessorRevision = %ld\n", Info
.KeProcessorRevision
);
481 if (Application
.Flag
.Verbose
)
483 printf ("\tAlwaysZero = 0x%08x\n", Info
.AlwaysZero
);
485 printf ("\tKeFeatureBits = %08x\n", Info
.KeFeatureBits
);
491 /**********************************************************************
494 * System performance information.
501 NTSTATUS Status
= STATUS_SUCCESS
;
502 PSYSTEM_PERFORMANCE_INFO Info
;
506 if (Application
.Flag
.Verbose
)
508 printf ("SystemPerformanceInformation:\n");
510 Status
= NtQuerySystemInformation (
511 SystemPerformanceInformation
,
516 if (STATUS_SUCCESS
!= Status
)
518 PrintStatus (Status
);
521 printf ("Not implemented.\n");
523 LARGE_INTEGER TotalProcessorTime
;
524 LARGE_INTEGER IoReadTransferCount
;
525 LARGE_INTEGER IoWriteTransferCount
;
526 LARGE_INTEGER IoOtherTransferCount
;
527 ULONG IoReadOperationCount
;
528 ULONG IoWriteOperationCount
;
529 ULONG IoOtherOperationCount
;
530 ULONG MmAvailablePages
;
531 ULONG MmTotalCommitedPages
;
532 ULONG MmTotalCommitLimit
;
536 ULONG TransitionFaults
;
538 ULONG DemandZeroFaults
;
547 ULONG PoolPagedBytes
;
548 ULONG PoolNonPagedBytes
;
553 ULONG MmTotalSystemFreePtes
;
554 ULONG MmSystemCodepage
;
555 ULONG MmTotalSystemDriverPages
;
556 ULONG MmTotalSystemCodePages
;
560 ULONG MmSystemCachePage
;
561 ULONG MmPagedPoolPage
;
562 ULONG MmSystemDriverPage
;
563 ULONG CcFastReadNoWait
;
564 ULONG CcFastReadWait
;
565 ULONG CcFastReadResourceMiss
;
566 ULONG CcFastReadNotPossible
;
567 ULONG CcFastMdlReadNoWait
;
568 ULONG CcFastMdlReadWait
;
569 ULONG CcFastMdlReadResourceMiss
;
570 ULONG CcFastMdlReadNotPossible
;
571 ULONG CcMapDataNoWait
;
573 ULONG CcMapDataNoWaitMiss
;
574 ULONG CcMapDataWaitMiss
;
575 ULONG CcPinMappedDataCount
;
576 ULONG CcPinReadNoWait
;
578 ULONG CcPinReadNoWaitMiss
;
579 ULONG CcPinReadWaitMiss
;
580 ULONG CcCopyReadNoWait
;
581 ULONG CcCopyReadWait
;
582 ULONG CcCopyReadNoWaitMiss
;
583 ULONG CcCopyReadWaitMiss
;
584 ULONG CcMdlReadNoWait
;
586 ULONG CcMdlReadNoWaitMiss
;
587 ULONG CcMdlReadWaitMiss
;
588 ULONG CcReadaheadIos
;
589 ULONG CcLazyWriteIos
;
590 ULONG CcLazyWritePages
;
593 ULONG ContextSwitches
;
602 /**********************************************************************
612 SYSTEM_TIME_INFORMATION Info
;
614 if (Application
.Flag
.Verbose
)
616 printf ("SystemTimeInformation:\n");
618 Status
= NtQuerySystemInformation (
619 SystemTimeInformation
,
624 if (STATUS_SUCCESS
!= Status
)
626 PrintStatus (Status
);
629 PrintUtcDateTime ("\tKeBootTime : %s\n", & Info
.KeBootTime
);
630 PrintUtcDateTime ("\tKeSystemTime : %s\n", & Info
.KeSystemTime
);
631 PrintUtcDateTime ("\tExpTimeZoneBias: %s\n", & Info
.ExpTimeZoneBias
); /* FIXME */
632 printf ("\tExpTimeZoneId : %ld\n", Info
.ExpTimeZoneId
);
633 if (Application
.Flag
.Verbose
)
635 printf ("\tUnused : %08x (?)\n", Info
.Unused
);
642 /**********************************************************************
652 SYSTEM_PATH_INFORMATION Info
;
653 CHAR _Info
[_MAX_PATH
];
656 RtlZeroMemory (& Info
, _MAX_PATH
);
657 Status
= NtQuerySystemInformation (
658 SystemPathInformation
,
663 if (STATUS_SUCCESS
!= Status
)
665 PrintStatus (Status
);
666 DumpData (_MAX_PATH
, & _Info
);
669 DumpData (_MAX_PATH
, & _Info
);
674 /**********************************************************************
677 * A snapshot of the process+thread tables.
684 NTSTATUS Status
= STATUS_SUCCESS
;
685 PSYSTEM_PROCESS_INFORMATION pInfo
= NULL
;
689 pInfo
= GlobalAlloc (GMEM_ZEROINIT
, BUFFER_SIZE_DEFAULT
);
690 /* FIXME: check NULL==pInfo */
692 if (Application
.Flag
.Verbose
)
694 printf ("SystemProcessInformation:\n");
697 * Obtain required buffer size
699 Status
= NtQuerySystemInformation (
700 SystemProcessInformation
,
705 if (STATUS_SUCCESS
!= Status
)
707 if (STATUS_INFO_LENGTH_MISMATCH
== Status
)
712 pInfo
= GlobalReAlloc (pInfo
, Length
, GMEM_ZEROINIT
);
715 printf ("\tCould not allocate memory.\n");
721 PrintStatus (Status
);
727 * Get process+thread list from ntoskrnl.exe
729 Status
= NtQuerySystemInformation (
730 SystemProcessInformation
,
735 if (!NT_SUCCESS(Status
))
737 PrintStatus (Status
);
744 wprintf (L
"%s:\n", (pInfo
->Name
.Length
? pInfo
->Name
.Buffer
: L
"*idle*") );
745 if (Application
.Flag
.Verbose
)
747 wprintf (L
"\tRelativeOffset = 0x%08x\n", pInfo
->RelativeOffset
);
749 wprintf (L
"\tThreads = %ld\n", pInfo
->ThreadCount
);
750 wprintf (L
"\tHandles = %ld\n", pInfo
->HandleCount
);
751 wprintf (L
"\tBasePriority = %ld\n", pInfo
->BasePriority
);
752 wprintf (L
"\tPID = %ld\n", pInfo
->ProcessId
);
753 wprintf (L
"\tPPID = %ld\n", pInfo
->ParentProcessId
);
754 wprintf (L
"\tVirtualSize:\t\tWorkingSetSize:\n");
755 wprintf (L
"\t\tPeak : %ld\t\t\tPeak : %ld\n",
756 pInfo
->PeakVirtualSizeBytes
,
757 pInfo
->PeakWorkingSetSizeBytes
759 wprintf (L
"\t\tTotal: %ld\t\t\tTotal: %ld\n",
760 pInfo
->TotalVirtualSizeBytes
,
761 pInfo
->TotalWorkingSetSizeBytes
763 wprintf (L
"\tPagedPoolUsage:\t\tNonPagedPoolUsage:\n");
764 wprintf (L
"\t\tPeak : %ld\t\t\tPeak : %ld\n",
765 pInfo
->PeakPagedPoolUsagePages
,
766 pInfo
->TotalPagedPoolUsagePages
768 wprintf (L
"\t\tTotal: %ld\t\t\tTotal: %ld\n",
769 pInfo
->PeakNonPagedPoolUsagePages
,
770 pInfo
->TotalNonPagedPoolUsagePages
772 wprintf (L
"\tPageFileUsage:\n");
773 wprintf (L
"\t\tPeak : %ld\n", pInfo
->PeakPageFileUsageBytes
);
774 wprintf (L
"\t\tTotal: %ld\n", pInfo
->TotalPageFileUsageBytes
);
776 wprintf (L
"\tPageFaultCount = %ld\n", pInfo
->PageFaultCount
);
777 wprintf (L
"\tTotalPrivateBytes = %ld\n", pInfo
->TotalPrivateBytes
);
779 for ( ThreadIndex
= 0;
780 (ThreadIndex
< pInfo
->ThreadCount
);
784 wprintf (L
"\t%x in %x:\n",
785 pInfo
->ThreadSysInfo
[ThreadIndex
].ClientId
.UniqueThread
,
786 pInfo
->ThreadSysInfo
[ThreadIndex
].ClientId
.UniqueProcess
789 "\t\tKernelTime = %s\n",
790 & (pInfo
->ThreadSysInfo
[ThreadIndex
].KernelTime
)
793 "\t\tUserTime = %s\n",
794 & (pInfo
->ThreadSysInfo
[ThreadIndex
].UserTime
)
797 "\t\tCreateTime = %s\n",
798 & (pInfo
->ThreadSysInfo
[ThreadIndex
].CreateTime
)
800 wprintf (L
"\t\tTickCount = %ld\n",
801 pInfo
->ThreadSysInfo
[ThreadIndex
].TickCount
803 wprintf (L
"\t\tStartEIP = 0x%08x\n",
804 pInfo
->ThreadSysInfo
[ThreadIndex
].StartEIP
806 /* CLIENT_ID ClientId; */
807 wprintf (L
"\t\tDynamicPriority = %d\n",
808 pInfo
->ThreadSysInfo
[ThreadIndex
].DynamicPriority
810 wprintf (L
"\t\tBasePriority = %d\n",
811 pInfo
->ThreadSysInfo
[ThreadIndex
].BasePriority
813 wprintf (L
"\t\tnSwitches = %ld\n",
814 pInfo
->ThreadSysInfo
[ThreadIndex
].nSwitches
816 wprintf (L
"\t\tState = 0x%08x\n",
817 pInfo
->ThreadSysInfo
[ThreadIndex
].State
819 wprintf (L
"\t\tWaitReason = %ld\n",
820 pInfo
->ThreadSysInfo
[ThreadIndex
].WaitReason
824 if (0 == pInfo
->RelativeOffset
)
828 (ULONG
) pInfo
+= pInfo
->RelativeOffset
;
831 DumpData (Length
, pInfo
);
839 /**********************************************************************
846 CMD_DEF(ServiceDescriptorTable
)
849 SYSTEM_SDT_INFORMATION Info
;
853 if (Application
.Flag
.Verbose
)
855 printf ("SystemServiceDescriptorTableInfo:\n");
857 RtlZeroMemory (& Info
, sizeof Info
);
858 Status
= NtQuerySystemInformation (
859 SystemServiceDescriptorTableInfo
,
864 if (STATUS_SUCCESS
!= Status
)
866 PrintStatus (Status
);
867 DumpData (Length
, & Info
);
870 printf ("\tBufferLength = %ld\n", Info
.BufferLength
);
871 printf ("\tNumberOfSystemServiceTables = %ld\n", Info
.NumberOfSystemServiceTables
);
872 printf ("\tNumberOfServices = %ld\n", Info
.NumberOfServices
[0]);
873 printf ("\tServiceCounters = %ld\n", Info
.ServiceCounters
[0]);
875 DumpData (Length
, & Info
);
881 /**********************************************************************
890 NTSTATUS Status
= STATUS_SUCCESS
;
891 SYSTEM_IOCONFIG_INFORMATION Info
;
894 if (Application
.Flag
.Verbose
)
896 printf ("SystemIoConfigInformation:\n");
898 Status
= NtQuerySystemInformation (
899 SystemIoConfigInformation
,
904 if (STATUS_SUCCESS
!= Status
)
906 PrintStatus (Status
);
909 printf ("\tDiskCount : %ld\n", Info
.DiskCount
);
910 printf ("\tFloppyCount : %ld\n", Info
.FloppyCount
);
911 printf ("\tCdRomCount : %ld\n", Info
.CdRomCount
);
912 printf ("\tTapeCount : %ld\n", Info
.TapeCount
);
913 printf ("\tSerialCount : %ld\n", Info
.SerialCount
);
914 printf ("\tParallelCount: %ld\n", Info
.ParallelCount
);
916 DumpData (Length
, & Info
);
922 /**********************************************************************
929 CMD_DEF(ProcessorTime
)
932 SYSTEM_PROCESSORTIME_INFO Info
;
935 if (Application
.Flag
.Verbose
)
937 printf ("SystemProcessorTimeInformation:\n");
939 Status
= NtQuerySystemInformation (
940 SystemProcessorTimeInformation
,
945 if (STATUS_SUCCESS
!= Status
)
947 PrintStatus (Status
);
950 PrintUtcDateTime ("\tTotalProcessorRunTime : %s\n", & Info
.TotalProcessorRunTime
);
951 PrintUtcDateTime ("\tTotalProcessorTime : %s\n", & Info
.TotalProcessorTime
);
952 PrintUtcDateTime ("\tTotalProcessorUserTime: %s\n", & Info
.TotalProcessorUserTime
);
953 PrintUtcDateTime ("\tTotalDPCTime : %s\n", & Info
.TotalDPCTime
);
954 PrintUtcDateTime ("\tTotalInterruptTime : %s\n", & Info
.TotalInterruptTime
);
955 printf ("\tTotalInterrupts : %ld\n", Info
.TotalInterrupts
);
956 if (Application
.Flag
.Verbose
)
958 printf ("\tUnused : %08x\n", Info
.Unused
);
965 /**********************************************************************
972 CMD_DEF(NtGlobalFlag
)
975 SYSTEM_GLOBAL_FLAG_INFO Info
;
978 if (Application
.Flag
.Verbose
)
980 printf ("SystemNtGlobalFlagInformation:\n");
982 Status
= NtQuerySystemInformation (
983 SystemNtGlobalFlagInformation
,
988 if (STATUS_SUCCESS
!= Status
)
990 PrintStatus (Status
);
993 printf ("\tNtGlobalFlag: %08x\n", Info
.NtGlobalFlag
);
994 /* FIXME: decode each flag */
1000 /**********************************************************************
1011 /**********************************************************************
1019 * Code originally in Yariv Kaplan's NtDriverList,
1020 * at http://www.internals.com/, adapted to ReactOS
1021 * structures layout.
1025 NTSTATUS Status
= STATUS_SUCCESS
;
1026 PSYSTEM_MODULE_INFORMATION pInfo
= NULL
;
1030 "-------- -------- -------- ---------------------------------------\n";
1033 if (Application
.Flag
.Verbose
)
1035 printf ("SystemModuleInformation:\n");
1038 * Obtain required buffer size
1040 Status
= NtQuerySystemInformation (
1041 SystemModuleInformation
,
1046 if (STATUS_INFO_LENGTH_MISMATCH
== Status
)
1051 pInfo
= GlobalAlloc (GMEM_ZEROINIT
, Length
);
1054 printf ("Could not allocate memory.\n");
1055 return EXIT_FAILURE
;
1060 PrintStatus (Status
);
1061 return EXIT_FAILURE
;
1064 * Get module list from ntoskrnl.exe
1066 Status
= NtQuerySystemInformation (
1067 SystemModuleInformation
,
1072 if (!NT_SUCCESS(Status
))
1074 PrintStatus (Status
);
1075 return EXIT_FAILURE
;
1077 printf ("Index Address Size Name\n");
1081 (Index
< (int) pInfo
->Count
);
1086 "%8x %08x %8x %s\n",
1087 pInfo
->Module
[Index
].ModuleEntryIndex
,
1088 pInfo
->Module
[Index
].ModuleBaseAddress
,
1089 pInfo
->Module
[Index
].ModuleSize
,
1090 pInfo
->Module
[Index
].ModuleName
1097 return EXIT_SUCCESS
;
1101 /**********************************************************************
1108 CMD_DEF(ResourceLock
)
1110 NTSTATUS Status
= STATUS_SUCCESS
;
1111 PSYSTEM_RESOURCE_LOCK_INFO pInfo
= NULL
;
1115 "-------- -------- -------- -------- -------- -------- ------------\n";
1117 pInfo
= GlobalAlloc (GMEM_ZEROINIT
, BUFFER_SIZE_DEFAULT
);
1118 /* FIXME: check NULL==pInfo */
1120 if (Application
.Flag
.Verbose
)
1122 printf ("SystemResourceLockInformation:\n");
1125 * Obtain required buffer size
1127 Status
= NtQuerySystemInformation (
1128 SystemResourceLockInformation
,
1130 BUFFER_SIZE_DEFAULT
, /* query size */
1133 if (STATUS_SUCCESS
!= Status
)
1135 if (STATUS_INFO_LENGTH_MISMATCH
== Status
)
1140 pInfo
= GlobalReAlloc (pInfo
, Length
, GMEM_ZEROINIT
);
1143 printf ("Could not allocate memory.\n");
1144 return EXIT_FAILURE
;
1149 PrintStatus (Status
);
1151 return EXIT_FAILURE
;
1155 * Get locked resource list from ntoskrnl.exe
1157 Status
= NtQuerySystemInformation (
1158 SystemResourceLockInformation
,
1163 if (!NT_SUCCESS(Status
))
1165 PrintStatus (Status
);
1167 return EXIT_FAILURE
;
1169 printf ("Address Active # Content# Sh/Wait Exc/Wait\n");
1173 (Index
< (int) pInfo
->Count
);
1178 "%08x %8ld %8ld %8ld %8ld %08x\n",
1179 pInfo
->Lock
[Index
].ResourceAddress
,
1180 pInfo
->Lock
[Index
].ActiveCount
,
1181 pInfo
->Lock
[Index
].ContentionCount
,
1182 pInfo
->Lock
[Index
].NumberOfSharedWaiters
,
1183 pInfo
->Lock
[Index
].NumberOfExclusiveWaiters
,
1184 pInfo
->Lock
[Index
].Unknown
1191 return EXIT_SUCCESS
;
1195 /**********************************************************************
1206 /**********************************************************************
1217 /**********************************************************************
1228 /**********************************************************************
1233 * Class 16. You can not pass 0 as the initial output buffer's
1234 * size to get back the needed buffer size.
1238 NTSTATUS Status
= STATUS_SUCCESS
;
1239 PSYSTEM_HANDLE_INFORMATION pInfo
= NULL
;
1243 "-------- -------- -------- -------- -------- ----------\n";
1244 CHAR FlagsString
[9] = {0};
1246 pInfo
= GlobalAlloc (GMEM_ZEROINIT
, BUFFER_SIZE_DEFAULT
);
1248 if (Application
.Flag
.Verbose
)
1250 printf ("SystemHandleInformation:\n");
1253 * Obtain required buffer size
1255 Status
= NtQuerySystemInformation (
1256 SystemHandleInformation
,
1258 BUFFER_SIZE_DEFAULT
,
1261 if (STATUS_SUCCESS
!= Status
)
1263 if (STATUS_INFO_LENGTH_MISMATCH
== Status
)
1268 pInfo
= GlobalReAlloc (pInfo
, Length
, GMEM_ZEROINIT
);
1271 printf ("\tCould not allocate memory.\n");
1272 return EXIT_FAILURE
;
1277 PrintStatus (Status
);
1279 return EXIT_FAILURE
;
1283 * Get handle table from ntoskrnl.exe
1285 Status
= NtQuerySystemInformation (
1286 SystemHandleInformation
,
1291 if (!NT_SUCCESS(Status
))
1293 PrintStatus (Status
);
1295 return EXIT_FAILURE
;
1297 printf ("Handle OwnerPID ObjPtr Access Flags Type\n");
1301 (Index
< (int) pInfo
->Count
);
1306 "%8x %8x %8x %8x %s %s\n",
1307 pInfo
->Handle
[Index
].HandleValue
,
1308 pInfo
->Handle
[Index
].OwnerPid
,
1309 pInfo
->Handle
[Index
].ObjectPointer
,
1310 pInfo
->Handle
[Index
].AccessMask
,
1311 ByteToBinaryString (
1312 pInfo
->Handle
[Index
].HandleFlags
,
1315 HandleTypeToObjectName (pInfo
->Handle
[Index
].ObjectType
)
1320 DumpData (Length
, pInfo
);
1324 return EXIT_SUCCESS
;
1328 /**********************************************************************
1339 /**********************************************************************
1349 PSYSTEM_PAGEFILE_INFORMATION pInfo
= NULL
;
1352 pInfo
= GlobalAlloc (GMEM_ZEROINIT
, BUFFER_SIZE_DEFAULT
);
1353 /* FIXME: check pInfo */
1355 if (Application
.Flag
.Verbose
)
1357 printf ("SystemPageFileInformation:\n");
1359 Status
= NtQuerySystemInformation(
1360 SystemPageFileInformation
,
1362 BUFFER_SIZE_DEFAULT
,
1365 if (STATUS_SUCCESS
!= Status
)
1367 if (STATUS_INFO_LENGTH_MISMATCH
== Status
)
1372 pInfo
= GlobalReAlloc (pInfo
, Length
, GMEM_ZEROINIT
);
1375 printf ("Could not allocate memory.\n");
1376 return EXIT_FAILURE
;
1381 PrintStatus (Status
);
1383 return EXIT_FAILURE
;
1386 Status
= NtQuerySystemInformation (
1387 SystemPageFileInformation
,
1392 if (!NT_SUCCESS(Status
))
1394 PrintStatus (Status
);
1396 return EXIT_FAILURE
;
1401 wprintf (L
"\t\"%s\":\n", pInfo
->PagefileFileName
.Buffer
);
1402 if (Application
.Flag
.Verbose
)
1404 wprintf (L
"\t\tRelativeOffset = %08x\n", pInfo
->RelativeOffset
);
1406 wprintf (L
"\t\tCurrentSizePages = %ld\n", pInfo
->CurrentSizePages
);
1407 wprintf (L
"\t\tTotalUsedPages = %ld\n", pInfo
->TotalUsedPages
);
1408 wprintf (L
"\t\tPeakUsedPages = %ld\n", pInfo
->PeakUsedPages
);
1410 if (0 == pInfo
->RelativeOffset
)
1415 (ULONG
) pInfo
+= pInfo
->RelativeOffset
;
1418 DumpData (Length
, pInfo
);
1422 return EXIT_SUCCESS
;
1426 /**********************************************************************
1433 CMD_DEF(InstructionEmulation
)
1436 SYSTEM_VDM_INFORMATION Info
;
1438 if (Application
.Flag
.Verbose
)
1440 printf ("SystemInstructionEmulationInfo:\n");
1442 RtlZeroMemory (& Info
, sizeof Info
);
1443 Status
= NtQuerySystemInformation (
1444 SystemInstructionEmulationInfo
,
1449 if (!NT_SUCCESS(Status
))
1451 PrintStatus (Status
);
1452 return EXIT_FAILURE
;
1454 printf ("\tVdmSegmentNotPresentCount = %ld\n", Info
.VdmSegmentNotPresentCount
);
1455 printf ("\tVdmINSWCount = %ld\n", Info
.VdmINSWCount
);
1456 printf ("\tVdmESPREFIXCount = %ld\n", Info
.VdmESPREFIXCount
);
1457 printf ("\tVdmCSPREFIXCount = %ld\n", Info
.VdmCSPREFIXCount
);
1458 printf ("\tVdmSSPREFIXCount = %ld\n", Info
.VdmSSPREFIXCount
);
1459 printf ("\tVdmDSPREFIXCount = %ld\n", Info
.VdmDSPREFIXCount
);
1460 printf ("\tVdmFSPREFIXCount = %ld\n", Info
.VdmFSPREFIXCount
);
1461 printf ("\tVdmGSPREFIXCount = %ld\n", Info
.VdmGSPREFIXCount
);
1462 printf ("\tVdmOPER32PREFIXCount = %ld\n", Info
.VdmOPER32PREFIXCount
);
1463 printf ("\tVdmADDR32PREFIXCount = %ld\n", Info
.VdmADDR32PREFIXCount
);
1464 printf ("\tVdmINSBCount = %ld\n", Info
.VdmINSBCount
);
1465 printf ("\tVdmINSWV86Count = %ld\n", Info
.VdmINSWV86Count
);
1466 printf ("\tVdmOUTSBCount = %ld\n", Info
.VdmOUTSBCount
);
1467 printf ("\tVdmOUTSWCount = %ld\n", Info
.VdmOUTSWCount
);
1468 printf ("\tVdmPUSHFCount = %ld\n", Info
.VdmPUSHFCount
);
1469 printf ("\tVdmPOPFCount = %ld\n", Info
.VdmPOPFCount
);
1470 printf ("\tVdmINTNNCount = %ld\n", Info
.VdmINTNNCount
);
1471 printf ("\tVdmINTOCount = %ld\n", Info
.VdmINTOCount
);
1472 printf ("\tVdmIRETCount = %ld\n", Info
.VdmIRETCount
);
1473 printf ("\tVdmINBIMMCount = %ld\n", Info
.VdmINBIMMCount
);
1474 printf ("\tVdmINWIMMCount = %ld\n", Info
.VdmINWIMMCount
);
1475 printf ("\tVdmOUTBIMMCount = %ld\n", Info
.VdmOUTBIMMCount
);
1476 printf ("\tVdmOUTWIMMCount = %ld\n", Info
.VdmOUTWIMMCount
);
1477 printf ("\tVdmINBCount = %ld\n", Info
.VdmINBCount
);
1478 printf ("\tVdmINWCount = %ld\n", Info
.VdmINWCount
);
1479 printf ("\tVdmOUTBCount = %ld\n", Info
.VdmOUTBCount
);
1480 printf ("\tVdmOUTWCount = %ld\n", Info
.VdmOUTWCount
);
1481 printf ("\tVdmLOCKPREFIXCount = %ld\n", Info
.VdmLOCKPREFIXCount
);
1482 printf ("\tVdmREPNEPREFIXCount = %ld\n", Info
.VdmREPNEPREFIXCount
);
1483 printf ("\tVdmREPPREFIXCount = %ld\n", Info
.VdmREPPREFIXCount
);
1484 printf ("\tVdmHLTCount = %ld\n", Info
.VdmHLTCount
);
1485 printf ("\tVdmCLICount = %ld\n", Info
.VdmCLICount
);
1486 printf ("\tVdmSTICount = %ld\n", Info
.VdmSTICount
);
1487 printf ("\tVdmBopCount = %ld\n", Info
.VdmBopCount
);
1489 return EXIT_SUCCESS
;
1493 /**********************************************************************
1504 /**********************************************************************
1514 SYSTEM_CACHE_INFORMATION Si
;
1516 if (Application
.Flag
.Verbose
)
1518 printf ("SystemCacheInformation:\n");
1524 Status
= NtQuerySystemInformation (
1525 SystemCacheInformation
,
1530 if (!NT_SUCCESS(Status
))
1532 PrintStatus (Status
);
1533 return EXIT_FAILURE
;
1535 printf ("\tSize:\n");
1536 printf ("\t\tCurrent = %ld\n", Si
.CurrentSize
);
1537 printf ("\t\tPeak = %ld\n\n", Si
.PeakSize
);
1538 printf ("\tPageFaults:\n\t\tCount = %ld\n\n", Si
.PageFaultCount
);
1539 printf ("\tWorking Set:\n");
1540 printf ("\t\tMinimum = %ld\n", Si
.MinimumWorkingSet
);
1541 printf ("\t\tMaximum = %ld\n", Si
.MaximumWorkingSet
);
1543 return EXIT_SUCCESS
;
1547 /**********************************************************************
1550 * Get statistic data about tagged pools. Not implemented in the
1559 PSYSTEM_POOL_TAG_INFO pInfo
= NULL
;
1563 pInfo
= GlobalAlloc (GMEM_ZEROINIT
, BUFFER_SIZE_DEFAULT
);
1564 /* FIXME: check pInfo */
1566 if (Application
.Flag
.Verbose
)
1568 printf ("SystemPoolTagInformation:\n");
1570 Status
= NtQuerySystemInformation(
1571 SystemPoolTagInformation
,
1573 BUFFER_SIZE_DEFAULT
,
1576 if (STATUS_SUCCESS
!= Status
)
1578 if (STATUS_INFO_LENGTH_MISMATCH
== Status
)
1583 pInfo
= GlobalReAlloc (pInfo
, Length
, GMEM_ZEROINIT
);
1586 printf ("Could not allocate memory.\n");
1587 return EXIT_FAILURE
;
1592 PrintStatus (Status
);
1594 return EXIT_FAILURE
;
1597 Status
= NtQuerySystemInformation (
1598 SystemPoolTagInformation
,
1603 if (!NT_SUCCESS(Status
))
1605 PrintStatus (Status
);
1607 return EXIT_FAILURE
;
1610 for ( PoolIndex
= 0;
1611 (PoolIndex
< pInfo
->Count
);
1615 wprintf (L
"\t%08x:\n", pInfo
->PoolEntry
[PoolIndex
].Tag
);
1616 wprintf (L
"\t\tPaged:\t\tNon Paged:\n");
1618 L
"\t\tAllocationCount = %ld\tAllocationCount = %ld\n",
1619 pInfo
->PoolEntry
[PoolIndex
].Paged
.AllocationCount
,
1620 pInfo
->PoolEntry
[PoolIndex
].NonPaged
.AllocationCount
1623 L
"\t\tFreeCount = %ld\tFreeCount = %ld\n",
1624 pInfo
->PoolEntry
[PoolIndex
].Paged
.FreeCount
,
1625 pInfo
->PoolEntry
[PoolIndex
].NonPaged
.FreeCount
1628 L
"\t\tSizeBytes = %ld\tSizeBytes = %ld\n",
1629 pInfo
->PoolEntry
[PoolIndex
].Paged
.SizeBytes
,
1630 pInfo
->PoolEntry
[PoolIndex
].NonPaged
.SizeBytes
1634 DumpData (Length
, pInfo
);
1638 return EXIT_SUCCESS
;
1642 /**********************************************************************
1649 CMD_DEF(ProcessorSchedule
)
1652 SYSTEM_PROCESSOR_SCHEDULE_INFO Info
;
1654 if (Application
.Flag
.Verbose
)
1656 printf ("SystemProcessorScheduleInfo:\n");
1662 Status
= NtQuerySystemInformation (
1663 SystemProcessorScheduleInfo
,
1668 if (STATUS_SUCCESS
!= Status
)
1670 PrintStatus (Status
);
1671 return EXIT_FAILURE
;
1674 printf ("\tnContextSwitches = %ld\n", Info
.nContextSwitches
);
1675 printf ("\tnDPCQueued = %ld\n", Info
.nDPCQueued
);
1676 printf ("\tnDPCRate = %ld\n", Info
.nDPCRate
);
1677 printf ("\tTimerResolution = %ld\n", Info
.TimerResolution
);
1678 printf ("\tnDPCBypasses = %ld\n", Info
.nDPCBypasses
);
1679 printf ("\tnAPCBypasses = %ld\n", Info
.nAPCBypasses
);
1681 DumpData (sizeof Info
, & Info
);
1683 return EXIT_SUCCESS
;
1688 /**********************************************************************
1698 SYSTEM_DPC_INFORMATION Info
;
1700 if (Application
.Flag
.Verbose
)
1702 printf ("SystemDpcInformation:\n");
1708 Status
= NtQuerySystemInformation (
1709 SystemDpcInformation
,
1714 if (STATUS_SUCCESS
!= Status
)
1716 PrintStatus (Status
);
1717 return EXIT_FAILURE
;
1720 if (Application
.Flag
.Verbose
)
1722 printf ("\tUnused = %ld\n", Info
.Unused
);
1724 printf ("\tKiMaximumDpcQueueDepth = %ld\n", Info
.KiMaximumDpcQueueDepth
);
1725 printf ("\tKiMinimumDpcRate = %ld\n", Info
.KiMinimumDpcRate
);
1726 printf ("\tKiAdjustDpcThreshold = %ld\n", Info
.KiAdjustDpcThreshold
);
1727 printf ("\tKiIdealDpcRate = %ld\n", Info
.KiIdealDpcRate
);
1729 DumpData (sizeof Info
, & Info
);
1731 return EXIT_SUCCESS
;
1735 /**********************************************************************
1746 /**********************************************************************
1753 INT
CMD_LoadImage (INT argc
, LPCSTR argv
[])
1756 /**********************************************************************
1763 CMD_DEF(UnloadImage
)
1767 /**********************************************************************
1774 CMD_DEF(TimeAdjustment
)
1776 NTSTATUS Status
= STATUS_SUCCESS
;
1777 SYSTEM_TIME_ADJUSTMENT_INFO Info
;
1779 if (Application
.Flag
.Verbose
)
1781 printf ("SystemTimeAdjustmentInformation:\n");
1783 RtlZeroMemory (& Info
, sizeof Info
);
1784 Status
= NtQuerySystemInformation (
1785 SystemTimeAdjustmentInformation
,
1790 if (!NT_SUCCESS(Status
))
1792 PrintStatus (Status
);
1793 return EXIT_FAILURE
;
1795 printf ("\tKeTimeAdjustment = %ld\n", Info
.KeTimeAdjustment
);
1796 printf ("\tKeMaximumIncrement = %ld\n", Info
.KeMaximumIncrement
);
1797 printf ("\tKeTimeSynchronization = %s\n", TF(Info
.KeTimeSynchronization
));
1799 return EXIT_SUCCESS
;
1803 /**********************************************************************
1814 /**********************************************************************
1825 /**********************************************************************
1836 /**********************************************************************
1843 CMD_DEF(CrashDumpSection
)
1847 /**********************************************************************
1854 CMD_DEF(ProcessorFaultCount
)
1858 /**********************************************************************
1865 CMD_DEF(CrashDumpState
)
1869 /**********************************************************************
1879 SYSTEM_DEBUGGER_INFO Info
;
1881 RtlZeroMemory (& Info
, sizeof Info
);
1882 Status
= NtQuerySystemInformation (
1883 SystemDebuggerInformation
,
1888 if (STATUS_SUCCESS
!= Status
)
1890 PrintStatus (Status
);
1891 return EXIT_FAILURE
;
1893 printf ("\tKdDebuggerEnabled = %s\n", TF(Info
.KdDebuggerEnabled
));
1894 printf ("\tKdDebuggerPresent = %s\n", TF(Info
.KdDebuggerPresent
));
1896 DumpData (sizeof Info
, & Info
);
1898 return EXIT_SUCCESS
;
1902 /**********************************************************************
1909 CMD_DEF(ThreadSwitchCounters
)
1913 /**********************************************************************
1922 NTSTATUS Status
= STATUS_SUCCESS
;
1923 SYSTEM_QUOTA_INFORMATION Info
;
1925 if (Application
.Flag
.Verbose
)
1927 printf ("SystemQuotaInformation:\n");
1929 RtlZeroMemory (& Info
, sizeof Info
);
1930 Status
= NtQuerySystemInformation (
1931 SystemQuotaInformation
,
1936 if (!NT_SUCCESS(Status
))
1938 PrintStatus (Status
);
1939 return EXIT_FAILURE
;
1941 printf ("\tCmpGlobalQuota = %ld\n", Info
.CmpGlobalQuota
);
1942 printf ("\tCmpGlobalQuotaUsed = %ld\n", Info
.CmpGlobalQuotaUsed
);
1943 printf ("\tMmSizeofPagedPoolInBytes = %ld\n", Info
.MmSizeofPagedPoolInBytes
);
1945 return EXIT_SUCCESS
;
1949 /**********************************************************************
1960 /**********************************************************************
1967 CMD_DEF(PrioritySeparation
)
1971 /**********************************************************************
1982 /**********************************************************************
1993 /**********************************************************************
2004 /**********************************************************************
2015 /**********************************************************************
2018 * Dump the system TIME_ZONE_INFORMATION object.
2027 TIME_ZONE_INFORMATION Tzi
;
2030 if (Application
.Flag
.Verbose
)
2032 printf ("SystemTimeZoneInformation:\n");
2034 RtlZeroMemory (& Tzi
, sizeof Tzi
);
2035 Status
= NtQuerySystemInformation(
2036 SystemTimeZoneInformation
,
2041 if (!NT_SUCCESS(Status
))
2043 PrintStatus (Status
);
2044 return EXIT_FAILURE
;
2047 "12h/24h.....: %dh\n",
2051 "Bias........: %d'\n",
2055 printf ("Standard\n");
2062 Tzi
.StandardName
, /* WCHAR [32] */
2066 L
"\tName: \"%s\"\n",
2072 & Tzi
.StandardDate
/* SYSTEMTIME */
2075 printf ("\tBias: %d'\n",
2076 Tzi
.StandardBias
/* LONG */
2079 printf ("Daylight\n");
2086 Tzi
.DaylightName
, /* WCHAR [32] */
2090 L
"\tName: \"%s\"\n",
2096 & Tzi
.DaylightDate
/* SYSTEMTIME */
2101 Tzi
.DaylightBias
/* LONG */
2105 return EXIT_SUCCESS
;
2109 /**********************************************************************
2120 /**********************************************************************
2121 * Miscellanea Commands
2122 **********************************************************************/
2130 "ReactOS Operating System - http://www.reactos.com/\n"
2131 "QSI - Query System Information (compiled on %s, %s)\n"
2132 "Copyright (c) 1999, 2000 Emanuele Aliberti et alii\n\n",
2136 if (Application
.Flag
.Verbose
)
2140 "This program is free software; you can redistribute it and/or modify\n"
2141 "it under the terms of the GNU General Public License as published by\n"
2142 "the Free Software Foundation; either version 2 of the License, or\n"
2143 "(at your option) any later version.\n\n"
2145 "This program is distributed in the hope that it will be useful,\n"
2146 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
2147 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
2148 "GNU General Public License for more details.\n\n"
2150 "You should have received a copy of the GNU General Public License\n"
2151 "along with this program; if not, write to the Free Software\n"
2152 "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n"
2153 "(See also http://www.fsf.org/).\n"
2162 Application
.Active
= FALSE
;
2163 return EXIT_SUCCESS
;
2167 extern COMMAND_DESCRIPTOR Commands
[];
2173 if (Application
.Flag
.Verbose
)
2175 printf ("Commands:\n");
2178 (NULL
!= Commands
[i
].Name
);
2183 (strlen (Commands
[i
].Name
) > 7)
2187 Commands
[i
].Description
2190 return EXIT_SUCCESS
;
2198 "\nReactOS (http://www.reactos.com/):\n"
2199 "\tEmanuele Aliberti\n"
2203 "\tMark Russinovich (http://www.sysinternals.com/)\n\n"
2206 "\tYariv Kaplan (http://www.internals.com/)\n\n"
2208 "Undocumented SYSTEM_POOL_INFORMATION:\n"
2209 "\tKlaus P. Gerlicher\n\n"
2211 "Undocumented Windows NT:\n"
2212 "\tPrasad Dabak, Sandeep Phadke, and Milind Borate\n\n"
2214 "Windows NT/2000 Native API Reference:\n"
2215 "\tGary Nebbett\n\n"
2217 "comp.os.ms-windows.programmer.nt.kernel-mode\n"
2218 "\t(many postings with sample code)\n"
2225 Application
.Flag
.Verbose
= ~Application
.Flag
.Verbose
;
2227 "Verbose mode is %s.\n",
2228 ONOFF(Application
.Flag
.Verbose
)
2235 Application
.Flag
.Dump
= ~Application
.Flag
.Dump
;
2237 "Dump mode is %s.\n",
2238 ONOFF(Application
.Flag
.Dump
)
2243 /**********************************************************************
2245 **********************************************************************/
2250 /* System information classes */
2255 "Basic system information"
2260 "Processor characteristics"
2264 CMD_REF(Performance
),
2265 "System performance data"
2280 "Process & thread tables"
2284 CMD_REF(ServiceDescriptorTable
),
2285 "Service descriptor table (SDT)"
2290 "I/O devices in the system, by class"
2294 CMD_REF(ProcessorTime
),
2295 "Print processor times"
2299 CMD_REF(NtGlobalFlag
),
2300 "Print the system wide flags"
2310 "Table of kernel modules"
2314 CMD_REF(ResourceLock
),
2315 "Table of locks on resources"
2335 "Table of handles (Ps Manager)"
2340 "Table of objects (Ob Manager)"
2345 "Virtual memory paging files (Cc Subsystem)"
2349 CMD_REF(InstructionEmulation
),
2350 "Virtual DOS Machine instruction emulation (VDM)"
2360 "Cache Manager Status"
2365 "Tagged pools statistics (checked build only)"
2369 CMD_REF(ProcessorSchedule
),
2370 "Processor schedule information"
2375 "Deferred procedure call (DPC)"
2382 { /* 26 S (callable) */
2385 "Load a kernel mode DLL (in PE format)"
2387 { /* 27 S (callable) */
2389 CMD_REF(UnloadImage
),
2390 "Unload a kernel mode DLL (module)"
2394 CMD_REF(TimeAdjustment
),
2414 CMD_REF(CrashDumpSection
),
2415 "Crash Dump Section"
2419 CMD_REF(ProcessorFaultCount
),
2420 "Processor fault count"
2424 CMD_REF(CrashDumpState
),
2434 CMD_REF(ThreadSwitchCounters
),
2435 "Thread switch counters"
2440 "System quota values"
2444 CMD_REF(LoadDriver
),
2445 "Load kernel driver (SYS)"
2449 CMD_REF(PrioritySeparation
),
2450 "Priority Separation"
2475 "Time zone (TZ) information"
2491 "Print this command directory"
2496 "Print the list of people and sources that made QSI possible"
2501 "Print version number and license information"
2506 "Exit to operating system"
2511 "Enable/disable dumping raw data returned by system"
2516 "Enable/disable printing unused, unknown, and service fields"
2524 /* user input --> command decoder */
2528 DecodeCommand (LPCSTR Command
)
2534 && stricmp (Commands
[i
].Name
,Command
)
2538 return Commands
[i
].EntryPoint
;
2544 LPCSTR CommandArgv
[]
2548 LPCSTR Separators
= " \t";
2550 for ( CommandArgv
[ArgC
] = strtok ((char*)CommandLine
, (char*)Separators
);
2552 CommandArgv
[ArgC
] = (LPCSTR
) strtok (NULL
, (char*)Separators
)
2555 if (NULL
== CommandArgv
[ArgC
++])
2565 main (int argc
, char * argv
[])
2567 CHAR CommandLine
[_MAX_PATH
];
2570 LPCSTR CommandArgv
[ARGV_SIZE
];
2573 * Initialize rt data.
2575 Application
.Heap
= GetProcessHeap ();
2576 Application
.Active
= TRUE
;
2580 while (Application
.Active
)
2582 /* Print the prompt string. */
2583 if (! Application
.Flag
.Batch
)
2585 printf ("\r\nsystem> ");
2587 /* Read user command. */
2589 /* Parse the user command */
2590 CommandArgc
= ParseCommandLine (
2594 if (0 != CommandArgc
)
2596 COMMAND_CALL CommandCall
= NULL
;
2599 if ((CommandCall
= DecodeCommand (CommandArgv
[0])))
2602 Application
.ExitCode
=
2610 printf ("Unknown command (type help for a list of valid commands).\n");
2615 if (! Application
.Flag
.Batch
)
2619 return (EXIT_SUCCESS
);