1 /* $Id: qsi.c,v 1.5 2001/01/14 19:59:43 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).
25 * New QSI class names used by E.Kohl.
33 #define NTOS_MODE_USER
39 DWORD Verbose
:1; /* print unknown, unused, service fields */
40 DWORD Dump
:1; /* raw dump output buffer */
41 DWORD Batch
:1; /* no shell (for future use) */
58 #define ONOFF(b) ((b)?"on":"off")
62 #define BUFFER_SIZE_DEFAULT 65536
64 #define TF(b) ((b)?"true":"false")
67 INT (* COMMAND_CALL
) (INT ArgC
,LPCSTR ArgV
[]);
71 VOID STDCALL
PrintStatus (NTSTATUS Status
);
73 #define CMD_REF(n) CMD_##n
74 #define CMD_DEF(n) INT CMD_REF(n) (INT argc, LPCSTR argv [])
75 #define CMD_NOT_IMPLEMENTED {printf("%s not implemented\n", argv[0]);return(0);}
78 struct _COMMAND_DESCRIPTOR
81 COMMAND_CALL EntryPoint
;
84 } COMMAND_DESCRIPTOR
, * PCOMMAND_DESCRIPTOR
;
87 /* Fast BYTE to binary representation */
89 #define BIT(n,m) (((n)&(m))?'1':'0')
97 Binary
[7] = BIT(Byte
,0x01);
98 Binary
[6] = BIT(Byte
,0x02);
99 Binary
[5] = BIT(Byte
,0x04);
100 Binary
[4] = BIT(Byte
,0x08);
101 Binary
[3] = BIT(Byte
,0x10);
102 Binary
[2] = BIT(Byte
,0x20);
103 Binary
[1] = BIT(Byte
,0x40);
104 Binary
[0] = BIT(Byte
,0x80);
105 return (LPSTR
) Binary
;
111 DumpData (int Size
, PVOID pData
)
113 PBYTE Buffer
= (PBYTE
) pData
;
116 const int Width
= 16;
118 if (! Application
.Flag
.Dump
)
124 printf ("%04x: ", (Buffer
- Base
));
135 (i
% 4 == 3) ? '|' : ' '
172 KernelObjectName
[] =
186 _T("12"), /* FIXME */
192 _T("18"), /* FIXME */
193 _T("19"), /* FIXME */
194 _T("20"), /* FIXME */
195 _T("21"), /* FIXME */
204 HandleTypeToObjectName (
208 if (HandleType
> 23) /* FIXME: use a symbol not a literal */
210 return _T("Unknown");
212 return KernelObjectName
[HandleType
];
220 FindRequiredBufferSize (int i
, int step
)
222 NTSTATUS Status
= STATUS_INFO_LENGTH_MISMATCH
;
223 BYTE Buffer
[BUFFER_SIZE_DEFAULT
];
228 Size
= step
= (step
> 0 ? step
: 1);
229 while ( (Size
< sizeof Buffer
)
230 && (Status
== STATUS_INFO_LENGTH_MISMATCH
)
233 if (Application
.Flag
.Verbose
)
235 printf ("\tTry %d", Size
);
237 RtlZeroMemory (Buffer
, sizeof Buffer
);
239 Status
= NtQuerySystemInformation (
245 if (STATUS_SUCCESS
== Status
)
247 printf ("Length = %d\n", Size
);
256 /* FIXME: slow linear search! */
260 printf ("No valid buffer length found!\n");
267 PrintStatus (NTSTATUS Status
)
269 LPCSTR StatusName
= NULL
;
273 case STATUS_INVALID_INFO_CLASS
:
274 StatusName
= "STATUS_INVALID_INFO_CLASS";
276 case STATUS_INFO_LENGTH_MISMATCH
:
277 StatusName
= "STATUS_INFO_LENGTH_MISMATCH";
279 case STATUS_ACCESS_VIOLATION
:
280 StatusName
= "STATUS_ACCESS_VIOLATION";
282 case STATUS_NOT_IMPLEMENTED
:
283 StatusName
= "STATUS_NOT_IMPLEMENTED";
285 case STATUS_BREAKPOINT
:
286 StatusName
= "STATUS_BREAKPOINT";
289 if (NULL
!= StatusName
)
291 printf ("\tStatus = %s\n", StatusName
);
294 printf ("\tStatus = 0x%08lX\n", Status
);
297 /* Auxiliary functions */
314 PrintUtcDateTime (LPCSTR Template
, PTIME UtcTime
)
316 CHAR UtcTimeString
[64];
317 TIME_FIELDS UtcTimeFields
;
319 RtlTimeToTimeFields (
320 (PLARGE_INTEGER
) UtcTime
,
325 "%s %d-%02d-%02d %02d:%02d:%02d.%03d UTC",
326 DaysOfWeek
[UtcTimeFields
.Weekday
],
331 UtcTimeFields
.Minute
,
332 UtcTimeFields
.Second
,
333 UtcTimeFields
.Milliseconds
342 /**********************************************************************
344 **********************************************************************/
347 /**********************************************************************
350 * Dump whatever we get by calling NtQuerySystemInformation with
351 * a user provided system information class id.
353 * NtQuerySystemInformation called with user class id.
357 int _id
= atoi ((char*)(argv
[0] + 1)); /* "#24" */
364 printf ("SystemInformation %d:\n", _id
);
365 /* Find buffer size */
366 Size
= FindRequiredBufferSize (_id
, 1);
369 printf("\t(no data)\n");
372 /* Allocate the buffer */
373 Buffer
= GlobalAlloc (GMEM_ZEROINIT
, Size
);
376 printf ("#%d: could not allocate %d bytes\n", _id
, Size
);
379 /* Query the executive */
380 Status
= NtQuerySystemInformation (
386 if (!NT_SUCCESS(Status
))
388 PrintStatus (Status
);
389 FindRequiredBufferSize (_id
, 1);
394 DumpData (Size
, Buffer
);
402 /**********************************************************************
412 SYSTEM_BASIC_INFORMATION Info
;
418 Status
= NtQuerySystemInformation (
424 if (STATUS_SUCCESS
!= Status
)
426 PrintStatus (Status
);
429 printf (" Reserved 0x%08x\n", Info
.Reserved
);
430 printf (" TimerResolution %d\n", Info
.TimerResolution
);
431 printf (" PageSize %d\n", Info
.PageSize
);
432 printf (" NumberOfPhysicalPages %d\n", Info
.NumberOfPhysicalPages
);
433 printf (" LowestPhysicalPageNumber %d\n", Info
.LowestPhysicalPageNumber
);
434 printf (" HighestPhysicalPageNumber %d\n", Info
.HighestPhysicalPageNumber
);
435 printf (" AllocationGranularity %d\n", Info
.AllocationGranularity
);
436 printf (" MinimumUserModeAddress 0x%08x (%d)\n", Info
.MinimumUserModeAddress
, Info
.MinimumUserModeAddress
);
437 printf (" MaximumUserModeAddress 0x%08x (%d)\n", Info
.MaximumUserModeAddress
, Info
.MaximumUserModeAddress
);
438 printf (" ActiveProcessorsAffinityMask 0x%08x\n", Info
.ActiveProcessorsAffinityMask
);
439 printf (" NumberOfProcessors %d\n", (int) Info
.NumberOfProcessors
);
445 /**********************************************************************
455 SYSTEM_PROCESSOR_INFORMATION Info
;
461 Status
= NtQuerySystemInformation (
467 if (STATUS_SUCCESS
!= Status
)
469 PrintStatus (Status
);
472 printf (" ProcessorArchitecture %d\n", Info
.ProcessorArchitecture
);
473 printf (" ProcessorLevel %d\n", Info
.ProcessorLevel
);
474 printf (" ProcessorRevision %d\n", Info
.ProcessorRevision
);
475 printf (" Reserved 0x%08x\n", Info
.Reserved
);
476 printf (" FeatureBits %08x\n", Info
.ProcessorFeatureBits
);
477 /* FIXME: decode feature bits */
483 /**********************************************************************
486 * System performance information.
493 NTSTATUS Status
= STATUS_SUCCESS
;
494 PSYSTEM_PERFORMANCE_INFO Info
;
498 Status
= NtQuerySystemInformation (
504 if (STATUS_SUCCESS
!= Status
)
506 PrintStatus (Status
);
509 printf ("Not implemented.\n");
511 LARGE_INTEGER TotalProcessorTime
;
512 LARGE_INTEGER IoReadTransferCount
;
513 LARGE_INTEGER IoWriteTransferCount
;
514 LARGE_INTEGER IoOtherTransferCount
;
515 ULONG IoReadOperationCount
;
516 ULONG IoWriteOperationCount
;
517 ULONG IoOtherOperationCount
;
518 ULONG MmAvailablePages
;
519 ULONG MmTotalCommitedPages
;
520 ULONG MmTotalCommitLimit
;
524 ULONG TransitionFaults
;
526 ULONG DemandZeroFaults
;
535 ULONG PoolPagedBytes
;
536 ULONG PoolNonPagedBytes
;
541 ULONG MmTotalSystemFreePtes
;
542 ULONG MmSystemCodepage
;
543 ULONG MmTotalSystemDriverPages
;
544 ULONG MmTotalSystemCodePages
;
548 ULONG MmSystemCachePage
;
549 ULONG MmPagedPoolPage
;
550 ULONG MmSystemDriverPage
;
551 ULONG CcFastReadNoWait
;
552 ULONG CcFastReadWait
;
553 ULONG CcFastReadResourceMiss
;
554 ULONG CcFastReadNotPossible
;
555 ULONG CcFastMdlReadNoWait
;
556 ULONG CcFastMdlReadWait
;
557 ULONG CcFastMdlReadResourceMiss
;
558 ULONG CcFastMdlReadNotPossible
;
559 ULONG CcMapDataNoWait
;
561 ULONG CcMapDataNoWaitMiss
;
562 ULONG CcMapDataWaitMiss
;
563 ULONG CcPinMappedDataCount
;
564 ULONG CcPinReadNoWait
;
566 ULONG CcPinReadNoWaitMiss
;
567 ULONG CcPinReadWaitMiss
;
568 ULONG CcCopyReadNoWait
;
569 ULONG CcCopyReadWait
;
570 ULONG CcCopyReadNoWaitMiss
;
571 ULONG CcCopyReadWaitMiss
;
572 ULONG CcMdlReadNoWait
;
574 ULONG CcMdlReadNoWaitMiss
;
575 ULONG CcMdlReadWaitMiss
;
576 ULONG CcReadaheadIos
;
577 ULONG CcLazyWriteIos
;
578 ULONG CcLazyWritePages
;
581 ULONG ContextSwitches
;
590 /**********************************************************************
600 SYSTEM_TIMEOFDAY_INFORMATION Info
;
602 Status
= NtQuerySystemInformation (
608 if (STATUS_SUCCESS
!= Status
)
610 PrintStatus (Status
);
613 PrintUtcDateTime (" BootTime %s\n", (PTIME
) & Info
.BootTime
);
614 PrintUtcDateTime (" CurrentTime %s\n", (PTIME
) & Info
.CurrentTime
);
615 PrintUtcDateTime (" TimeZoneBias %s\n", (PTIME
) & Info
.TimeZoneBias
); /* FIXME */
616 printf (" TimeZoneId %ld\n", Info
.TimeZoneId
);
617 printf (" Reserved %08x\n", Info
.Reserved
);
623 /**********************************************************************
633 SYSTEM_PATH_INFORMATION Info
;
634 CHAR _Info
[_MAX_PATH
];
637 RtlZeroMemory (& Info
, _MAX_PATH
);
638 Status
= NtQuerySystemInformation (
644 if (STATUS_SUCCESS
!= Status
)
646 PrintStatus (Status
);
647 DumpData (_MAX_PATH
, & _Info
);
650 DumpData (_MAX_PATH
, & _Info
);
655 /**********************************************************************
658 * A snapshot of the process+thread tables.
665 NTSTATUS Status
= STATUS_SUCCESS
;
666 PSYSTEM_PROCESS_INFORMATION pInfo
= NULL
;
670 pInfo
= GlobalAlloc (GMEM_ZEROINIT
, BUFFER_SIZE_DEFAULT
);
671 /* FIXME: check NULL==pInfo */
674 * Obtain required buffer size
676 Status
= NtQuerySystemInformation (
682 if (STATUS_SUCCESS
!= Status
)
684 if (STATUS_INFO_LENGTH_MISMATCH
== Status
)
689 pInfo
= GlobalReAlloc (pInfo
, Length
, GMEM_ZEROINIT
);
692 printf ("\tCould not allocate memory.\n");
698 PrintStatus (Status
);
704 * Get process+thread list from ntoskrnl.exe
706 Status
= NtQuerySystemInformation (
707 SystemProcessInformation
,
712 if (!NT_SUCCESS(Status
))
714 PrintStatus (Status
);
721 wprintf (L
"%s:\n", (pInfo
->Name
.Length
? pInfo
->Name
.Buffer
: L
"*idle*") );
722 if (Application
.Flag
.Verbose
)
724 wprintf (L
"\tRelativeOffset = 0x%08x\n", pInfo
->RelativeOffset
);
726 wprintf (L
"\tThreads = %ld\n", pInfo
->ThreadCount
);
727 wprintf (L
"\tHandles = %ld\n", pInfo
->HandleCount
);
728 wprintf (L
"\tBasePriority = %ld\n", pInfo
->BasePriority
);
729 wprintf (L
"\tPID = %ld\n", pInfo
->ProcessId
);
730 wprintf (L
"\tPPID = %ld\n", pInfo
->ParentProcessId
);
731 wprintf (L
"\tVirtualSize:\t\tWorkingSetSize:\n");
732 wprintf (L
"\t\tPeak : %ld\t\t\tPeak : %ld\n",
733 pInfo
->PeakVirtualSizeBytes
,
734 pInfo
->PeakWorkingSetSizeBytes
736 wprintf (L
"\t\tTotal: %ld\t\t\tTotal: %ld\n",
737 pInfo
->TotalVirtualSizeBytes
,
738 pInfo
->TotalWorkingSetSizeBytes
740 wprintf (L
"\tPagedPoolUsage:\t\tNonPagedPoolUsage:\n");
741 wprintf (L
"\t\tPeak : %ld\t\t\tPeak : %ld\n",
742 pInfo
->PeakPagedPoolUsagePages
,
743 pInfo
->TotalPagedPoolUsagePages
745 wprintf (L
"\t\tTotal: %ld\t\t\tTotal: %ld\n",
746 pInfo
->PeakNonPagedPoolUsagePages
,
747 pInfo
->TotalNonPagedPoolUsagePages
749 wprintf (L
"\tPageFileUsage:\n");
750 wprintf (L
"\t\tPeak : %ld\n", pInfo
->PeakPageFileUsageBytes
);
751 wprintf (L
"\t\tTotal: %ld\n", pInfo
->TotalPageFileUsageBytes
);
753 wprintf (L
"\tPageFaultCount = %ld\n", pInfo
->PageFaultCount
);
754 wprintf (L
"\tTotalPrivateBytes = %ld\n", pInfo
->TotalPrivateBytes
);
756 for ( ThreadIndex
= 0;
757 (ThreadIndex
< pInfo
->ThreadCount
);
761 wprintf (L
"\t%x in %x:\n",
762 pInfo
->ThreadSysInfo
[ThreadIndex
].ClientId
.UniqueThread
,
763 pInfo
->ThreadSysInfo
[ThreadIndex
].ClientId
.UniqueProcess
766 "\t\tKernelTime = %s\n",
767 & (pInfo
->ThreadSysInfo
[ThreadIndex
].KernelTime
)
770 "\t\tUserTime = %s\n",
771 & (pInfo
->ThreadSysInfo
[ThreadIndex
].UserTime
)
774 "\t\tCreateTime = %s\n",
775 & (pInfo
->ThreadSysInfo
[ThreadIndex
].CreateTime
)
777 wprintf (L
"\t\tTickCount = %ld\n",
778 pInfo
->ThreadSysInfo
[ThreadIndex
].TickCount
780 wprintf (L
"\t\tStartEIP = 0x%08x\n",
781 pInfo
->ThreadSysInfo
[ThreadIndex
].StartEIP
783 /* CLIENT_ID ClientId; */
784 wprintf (L
"\t\tDynamicPriority = %d\n",
785 pInfo
->ThreadSysInfo
[ThreadIndex
].DynamicPriority
787 wprintf (L
"\t\tBasePriority = %d\n",
788 pInfo
->ThreadSysInfo
[ThreadIndex
].BasePriority
790 wprintf (L
"\t\tnSwitches = %ld\n",
791 pInfo
->ThreadSysInfo
[ThreadIndex
].nSwitches
793 wprintf (L
"\t\tState = 0x%08x\n",
794 pInfo
->ThreadSysInfo
[ThreadIndex
].State
796 wprintf (L
"\t\tWaitReason = %ld\n",
797 pInfo
->ThreadSysInfo
[ThreadIndex
].WaitReason
801 if (0 == pInfo
->RelativeOffset
)
805 (ULONG
) pInfo
+= pInfo
->RelativeOffset
;
808 DumpData (Length
, pInfo
);
816 /**********************************************************************
826 SYSTEM_SDT_INFORMATION Info
;
830 RtlZeroMemory (& Info
, sizeof Info
);
831 Status
= NtQuerySystemInformation (
837 if (STATUS_SUCCESS
!= Status
)
839 PrintStatus (Status
);
840 DumpData (Length
, & Info
);
843 printf (" BufferLength = %ld\n", Info
.BufferLength
);
844 printf (" NumberOfSystemServiceTables = %ld\n", Info
.NumberOfSystemServiceTables
);
845 printf (" NumberOfServices = %ld\n", Info
.NumberOfServices
[0]);
846 printf (" ServiceCounters = %ld\n", Info
.ServiceCounters
[0]);
848 DumpData (Length
, & Info
);
854 /**********************************************************************
863 NTSTATUS Status
= STATUS_SUCCESS
;
864 SYSTEM_DEVICE_INFORMATION Info
;
867 Status
= NtQuerySystemInformation (
873 if (STATUS_SUCCESS
!= Status
)
875 PrintStatus (Status
);
878 printf (" Number Of Disks %ld\n", Info
.NumberOfDisks
);
879 printf (" Number Of Floppies %ld\n", Info
.NumberOfFloppies
);
880 printf (" Number Of CD-ROMs %ld\n", Info
.NumberOfCdRoms
);
881 printf (" Number Of Tapes %ld\n", Info
.NumberOfTapes
);
882 printf (" Number Of Serial Ports %ld\n", Info
.NumberOfSerialPorts
);
883 printf (" Number Of Parallel Ports %ld\n", Info
.NumberOfParallelPorts
);
885 DumpData (Length
, & Info
);
891 /**********************************************************************
901 SYSTEM_PROCESSORTIME_INFO Info
;
904 Status
= NtQuerySystemInformation (
910 if (STATUS_SUCCESS
!= Status
)
912 PrintStatus (Status
);
915 PrintUtcDateTime (" TotalProcessorRunTime : %s\n", & Info
.TotalProcessorRunTime
);
916 PrintUtcDateTime (" TotalProcessorTime : %s\n", & Info
.TotalProcessorTime
);
917 PrintUtcDateTime (" TotalProcessorUserTime: %s\n", & Info
.TotalProcessorUserTime
);
918 PrintUtcDateTime (" TotalDPCTime : %s\n", & Info
.TotalDPCTime
);
919 PrintUtcDateTime (" TotalInterruptTime : %s\n", & Info
.TotalInterruptTime
);
920 printf (" TotalInterrupts : %ld\n", Info
.TotalInterrupts
);
921 printf (" Unused : %08x\n", Info
.Unused
);
927 /**********************************************************************
937 SYSTEM_FLAGS_INFORMATION Info
;
940 Status
= NtQuerySystemInformation (
946 if (STATUS_SUCCESS
!= Status
)
948 PrintStatus (Status
);
951 printf (" NtGlobalFlag: %08x\n", Info
.Flags
);
952 if (FLG_STOP_ON_EXCEPTION
& Info
.Flags
) printf ("\tSTOP_ON_EXCEPTION\n");
953 if (FLG_STOP_ON_HANG_GUI
& Info
.Flags
) printf ("\tSTOP_ON_HANG_GUI\n");
954 if (FLG_SHOW_LDR_SNAPS
& Info
.Flags
) printf ("\tSHOW_LDR_SNAPS\n");
955 if (FLG_DEBUG_INITIAL_COMMAND
& Info
.Flags
) printf ("\tDEBUG_INITIAL_COMMAND\n");
956 if (FLG_HEAP_ENABLE_TAIL_CHECK
& Info
.Flags
) printf ("\tHEAP_ENABLE_TAIL_CHECK\n");
957 if (FLG_HEAP_ENABLE_FREE_CHECK
& Info
.Flags
) printf ("\tHEAP_ENABLE_FREE_CHECK\n");
958 if (FLG_HEAP_ENABLE_TAGGING
& Info
.Flags
) printf ("\tHEAP_ENABLE_TAGGING\n");
959 if (FLG_HEAP_ENABLE_TAG_BY_DLL
& Info
.Flags
) printf ("\tHEAP_ENABLE_TAG_BY_DLL\n");
960 if (FLG_HEAP_ENABLE_CALL_TRACING
& Info
.Flags
) printf ("\tHEAP_ENABLE_CALL_TRACING\n");
961 if (FLG_HEAP_DISABLE_COALESCING
& Info
.Flags
) printf ("\tHEAP_DISABLE_COALESCING\n");
962 if (FLG_HEAP_VALIDATE_PARAMETERS
& Info
.Flags
) printf ("\tHEAP_VALIDATE_PARAMETERS\n");
963 if (FLG_HEAP_VALIDATE_ALL
& Info
.Flags
) printf ("\tHEAP_VALIDATE_ALL\n");
964 if (FLG_POOL_ENABLE_TAIL_CHECK
& Info
.Flags
) printf ("\tPOOL_ENABLE_TAIL_CHECK\n");
965 if (FLG_POOL_ENABLE_FREE_CHECK
& Info
.Flags
) printf ("\tPOOL_ENABLE_FREE_CHECK\n");
966 if (FLG_POOL_ENABLE_TAGGING
& Info
.Flags
) printf ("\tPOOL_ENABLE_TAGGING\n");
967 if (FLG_USER_STACK_TRACE_DB
& Info
.Flags
) printf ("\tUSER_STACK_TRACE_DB\n");
968 if (FLG_KERNEL_STACK_TRACE_DB
& Info
.Flags
) printf ("\tKERNEL_STACK_TRACE_DB\n");
969 if (FLG_MAINTAIN_OBJECT_TYPELIST
& Info
.Flags
) printf ("\tMAINTAIN_OBJECT_TYPELIST\n");
970 if (FLG_IGNORE_DEBUG_PRIV
& Info
.Flags
) printf ("\tIGNORE_DEBUG_PRIV\n");
971 if (FLG_ENABLE_CSRDEBUG
& Info
.Flags
) printf ("\tENABLE_CSRDEBUG\n");
972 if (FLG_ENABLE_KDEBUG_SYMBOL_LOAD
& Info
.Flags
) printf ("\tENABLE_KDEBUG_SYMBOL_LOAD\n");
973 if (FLG_DISABLE_PAGE_KERNEL_STACKS
& Info
.Flags
) printf ("\tDISABLE_PAGE_KERNEL_STACKS\n");
974 if (FLG_ENABLE_CLOSE_EXCEPTION
& Info
.Flags
) printf ("\tENABLE_CLOSE_EXCEPTION\n");
975 if (FLG_ENABLE_EXCEPTION_LOGGING
& Info
.Flags
) printf ("\tENABLE_EXCEPTION_LOGGING\n");
976 if (FLG_ENABLE_DBGPRINT_BUFFERING
& Info
.Flags
) printf ("\tENABLE_DBGPRINT_BUFFERING\n");
977 if (FLG_UNKNOWN_01000000
& Info
.Flags
) printf ("\tUNKNOWN_01000000\n");
978 if (FLG_UNKNOWN_02000000
& Info
.Flags
) printf ("\tUNKNOWN_02000000\n");
979 if (FLG_UNKNOWN_04000000
& Info
.Flags
) printf ("\tUNKNOWN_04000000\n");
980 if (FLG_UNKNOWN_10000000
& Info
.Flags
) printf ("\tUNKNOWN_10000000\n");
981 if (FLG_UNKNOWN_20000000
& Info
.Flags
) printf ("\tUNKNOWN_20000000\n");
982 if (FLG_UNKNOWN_40000000
& Info
.Flags
) printf ("\tUNKNOWN_40000000\n");
983 if (FLG_UNKNOWN_80000000
& Info
.Flags
) printf ("\tUNKNOWN_80000000\n");
989 /**********************************************************************
1000 /**********************************************************************
1008 * Code originally in Yariv Kaplan's NtDriverList,
1009 * at http://www.internals.com/, adapted to ReactOS
1010 * structures layout.
1014 NTSTATUS Status
= STATUS_SUCCESS
;
1015 PSYSTEM_MODULE_INFORMATION pInfo
= NULL
;
1019 "-------- -------- -------- ---------------------------------------\n";
1023 * Obtain required buffer size
1025 Status
= NtQuerySystemInformation (
1031 if (STATUS_INFO_LENGTH_MISMATCH
== Status
)
1036 pInfo
= GlobalAlloc (GMEM_ZEROINIT
, Length
);
1039 printf ("Could not allocate memory.\n");
1040 return EXIT_FAILURE
;
1045 PrintStatus (Status
);
1046 return EXIT_FAILURE
;
1049 * Get module list from ntoskrnl.exe
1051 Status
= NtQuerySystemInformation (
1057 if (!NT_SUCCESS(Status
))
1059 PrintStatus (Status
);
1060 return EXIT_FAILURE
;
1062 printf ("Index Address Size Name\n");
1066 (Index
< (int) pInfo
->Count
);
1071 "%8x %08x %8x %s\n",
1072 pInfo
->Module
[Index
].ModuleEntryIndex
,
1073 pInfo
->Module
[Index
].ModuleBaseAddress
,
1074 pInfo
->Module
[Index
].ModuleSize
,
1075 pInfo
->Module
[Index
].ModuleName
1082 return EXIT_SUCCESS
;
1086 /**********************************************************************
1095 NTSTATUS Status
= STATUS_SUCCESS
;
1096 PSYSTEM_RESOURCE_LOCK_INFO pInfo
= NULL
;
1100 "-------- -------- -------- -------- -------- -------- ------------\n";
1102 pInfo
= GlobalAlloc (GMEM_ZEROINIT
, BUFFER_SIZE_DEFAULT
);
1103 /* FIXME: check NULL==pInfo */
1106 * Obtain required buffer size
1108 Status
= NtQuerySystemInformation (
1111 BUFFER_SIZE_DEFAULT
, /* query size */
1114 if (STATUS_SUCCESS
!= Status
)
1116 if (STATUS_INFO_LENGTH_MISMATCH
== Status
)
1121 pInfo
= GlobalReAlloc (pInfo
, Length
, GMEM_ZEROINIT
);
1124 printf ("Could not allocate memory.\n");
1125 return EXIT_FAILURE
;
1130 PrintStatus (Status
);
1132 return EXIT_FAILURE
;
1136 * Get locked resource list from ntoskrnl.exe
1138 Status
= NtQuerySystemInformation (
1144 if (!NT_SUCCESS(Status
))
1146 PrintStatus (Status
);
1148 return EXIT_FAILURE
;
1150 printf ("Address Active # Content# Sh/Wait Exc/Wait\n");
1154 (Index
< (int) pInfo
->Count
);
1159 "%08x %8ld %8ld %8ld %8ld %08x\n",
1160 pInfo
->Lock
[Index
].ResourceAddress
,
1161 pInfo
->Lock
[Index
].ActiveCount
,
1162 pInfo
->Lock
[Index
].ContentionCount
,
1163 pInfo
->Lock
[Index
].NumberOfSharedWaiters
,
1164 pInfo
->Lock
[Index
].NumberOfExclusiveWaiters
,
1165 pInfo
->Lock
[Index
].Unknown
1172 return EXIT_SUCCESS
;
1176 /**********************************************************************
1187 /**********************************************************************
1198 /**********************************************************************
1209 /**********************************************************************
1214 * Class 16. You can not pass 0 as the initial output buffer's
1215 * size to get back the needed buffer size.
1219 NTSTATUS Status
= STATUS_SUCCESS
;
1220 PSYSTEM_HANDLE_INFORMATION pInfo
= NULL
;
1224 "-------- -------- -------- -------- -------- ----------\n";
1225 CHAR FlagsString
[9] = {0};
1227 pInfo
= GlobalAlloc (GMEM_ZEROINIT
, BUFFER_SIZE_DEFAULT
);
1230 * Obtain required buffer size
1232 Status
= NtQuerySystemInformation (
1235 BUFFER_SIZE_DEFAULT
,
1238 if (STATUS_SUCCESS
!= Status
)
1240 if (STATUS_INFO_LENGTH_MISMATCH
== Status
)
1245 pInfo
= GlobalReAlloc (pInfo
, Length
, GMEM_ZEROINIT
);
1248 printf ("\tCould not allocate memory.\n");
1249 return EXIT_FAILURE
;
1254 PrintStatus (Status
);
1256 return EXIT_FAILURE
;
1260 * Get handle table from ntoskrnl.exe
1262 Status
= NtQuerySystemInformation (
1268 if (!NT_SUCCESS(Status
))
1270 PrintStatus (Status
);
1272 return EXIT_FAILURE
;
1274 printf ("Handle OwnerPID ObjPtr Access Flags Type\n");
1278 (Index
< (int) pInfo
->Count
);
1283 "%8x %8x %8x %8x %s %s\n",
1284 pInfo
->Handle
[Index
].HandleValue
,
1285 pInfo
->Handle
[Index
].OwnerPid
,
1286 pInfo
->Handle
[Index
].ObjectPointer
,
1287 pInfo
->Handle
[Index
].AccessMask
,
1288 ByteToBinaryString (
1289 pInfo
->Handle
[Index
].HandleFlags
,
1292 HandleTypeToObjectName (pInfo
->Handle
[Index
].ObjectType
)
1297 DumpData (Length
, pInfo
);
1301 return EXIT_SUCCESS
;
1305 /**********************************************************************
1316 /**********************************************************************
1326 PSYSTEM_PAGEFILE_INFORMATION pInfo
= NULL
;
1329 pInfo
= GlobalAlloc (GMEM_ZEROINIT
, BUFFER_SIZE_DEFAULT
);
1330 /* FIXME: check pInfo */
1332 Status
= NtQuerySystemInformation(
1335 BUFFER_SIZE_DEFAULT
,
1338 if (STATUS_SUCCESS
!= Status
)
1340 if (STATUS_INFO_LENGTH_MISMATCH
== Status
)
1345 pInfo
= GlobalReAlloc (pInfo
, Length
, GMEM_ZEROINIT
);
1348 printf ("Could not allocate memory.\n");
1349 return EXIT_FAILURE
;
1354 PrintStatus (Status
);
1356 return EXIT_FAILURE
;
1359 Status
= NtQuerySystemInformation (
1365 if (!NT_SUCCESS(Status
))
1367 PrintStatus (Status
);
1369 return EXIT_FAILURE
;
1374 wprintf (L
" \"%s\":\n", pInfo
->PagefileFileName
.Buffer
);
1375 wprintf (L
"\tRelativeOffset %08x\n", pInfo
->RelativeOffset
);
1376 wprintf (L
"\tCurrentSizePages %ld\n", pInfo
->CurrentSizePages
);
1377 wprintf (L
"\tTotalUsedPages %ld\n", pInfo
->TotalUsedPages
);
1378 wprintf (L
"\tPeakUsedPages %ld\n", pInfo
->PeakUsedPages
);
1380 if (0 == pInfo
->RelativeOffset
)
1385 (ULONG
) pInfo
+= pInfo
->RelativeOffset
;
1388 DumpData (Length
, pInfo
);
1392 return EXIT_SUCCESS
;
1396 /**********************************************************************
1406 SYSTEM_VDM_INFORMATION Info
;
1408 RtlZeroMemory (& Info
, sizeof Info
);
1409 Status
= NtQuerySystemInformation (
1415 if (!NT_SUCCESS(Status
))
1417 PrintStatus (Status
);
1418 return EXIT_FAILURE
;
1420 printf (" VdmSegmentNotPresentCount = %ld\n", Info
.VdmSegmentNotPresentCount
);
1421 printf (" VdmINSWCount = %ld\n", Info
.VdmINSWCount
);
1422 printf (" VdmESPREFIXCount = %ld\n", Info
.VdmESPREFIXCount
);
1423 printf (" VdmCSPREFIXCount = %ld\n", Info
.VdmCSPREFIXCount
);
1424 printf (" VdmSSPREFIXCount = %ld\n", Info
.VdmSSPREFIXCount
);
1425 printf (" VdmDSPREFIXCount = %ld\n", Info
.VdmDSPREFIXCount
);
1426 printf (" VdmFSPREFIXCount = %ld\n", Info
.VdmFSPREFIXCount
);
1427 printf (" VdmGSPREFIXCount = %ld\n", Info
.VdmGSPREFIXCount
);
1428 printf (" VdmOPER32PREFIXCount = %ld\n", Info
.VdmOPER32PREFIXCount
);
1429 printf (" VdmADDR32PREFIXCount = %ld\n", Info
.VdmADDR32PREFIXCount
);
1430 printf (" VdmINSBCount = %ld\n", Info
.VdmINSBCount
);
1431 printf (" VdmINSWV86Count = %ld\n", Info
.VdmINSWV86Count
);
1432 printf (" VdmOUTSBCount = %ld\n", Info
.VdmOUTSBCount
);
1433 printf (" VdmOUTSWCount = %ld\n", Info
.VdmOUTSWCount
);
1434 printf (" VdmPUSHFCount = %ld\n", Info
.VdmPUSHFCount
);
1435 printf (" VdmPOPFCount = %ld\n", Info
.VdmPOPFCount
);
1436 printf (" VdmINTNNCount = %ld\n", Info
.VdmINTNNCount
);
1437 printf (" VdmINTOCount = %ld\n", Info
.VdmINTOCount
);
1438 printf (" VdmIRETCount = %ld\n", Info
.VdmIRETCount
);
1439 printf (" VdmINBIMMCount = %ld\n", Info
.VdmINBIMMCount
);
1440 printf (" VdmINWIMMCount = %ld\n", Info
.VdmINWIMMCount
);
1441 printf (" VdmOUTBIMMCount = %ld\n", Info
.VdmOUTBIMMCount
);
1442 printf (" VdmOUTWIMMCount = %ld\n", Info
.VdmOUTWIMMCount
);
1443 printf (" VdmINBCount = %ld\n", Info
.VdmINBCount
);
1444 printf (" VdmINWCount = %ld\n", Info
.VdmINWCount
);
1445 printf (" VdmOUTBCount = %ld\n", Info
.VdmOUTBCount
);
1446 printf (" VdmOUTWCount = %ld\n", Info
.VdmOUTWCount
);
1447 printf (" VdmLOCKPREFIXCount = %ld\n", Info
.VdmLOCKPREFIXCount
);
1448 printf (" VdmREPNEPREFIXCount = %ld\n", Info
.VdmREPNEPREFIXCount
);
1449 printf (" VdmREPPREFIXCount = %ld\n", Info
.VdmREPPREFIXCount
);
1450 printf (" VdmHLTCount = %ld\n", Info
.VdmHLTCount
);
1451 printf (" VdmCLICount = %ld\n", Info
.VdmCLICount
);
1452 printf (" VdmSTICount = %ld\n", Info
.VdmSTICount
);
1453 printf (" VdmBopCount = %ld\n", Info
.VdmBopCount
);
1455 return EXIT_SUCCESS
;
1459 /**********************************************************************
1470 /**********************************************************************
1480 SYSTEM_CACHE_INFORMATION Si
;
1486 Status
= NtQuerySystemInformation (
1492 if (!NT_SUCCESS(Status
))
1494 PrintStatus (Status
);
1495 return EXIT_FAILURE
;
1497 printf ("\tSize:\n");
1498 printf ("\t\tCurrent = %ld\n", Si
.CurrentSize
);
1499 printf ("\t\tPeak = %ld\n\n", Si
.PeakSize
);
1500 printf ("\tPageFaults:\n\t\tCount = %ld\n\n", Si
.PageFaultCount
);
1501 printf ("\tWorking Set:\n");
1502 printf ("\t\tMinimum = %ld\n", Si
.MinimumWorkingSet
);
1503 printf ("\t\tMaximum = %ld\n", Si
.MaximumWorkingSet
);
1505 return EXIT_SUCCESS
;
1509 /**********************************************************************
1512 * Get statistic data about tagged pools. Not implemented in the
1521 PSYSTEM_POOL_TAG_INFO pInfo
= NULL
;
1525 pInfo
= GlobalAlloc (GMEM_ZEROINIT
, BUFFER_SIZE_DEFAULT
);
1526 /* FIXME: check pInfo */
1528 Status
= NtQuerySystemInformation(
1531 BUFFER_SIZE_DEFAULT
,
1534 if (STATUS_SUCCESS
!= Status
)
1536 if (STATUS_INFO_LENGTH_MISMATCH
== Status
)
1541 pInfo
= GlobalReAlloc (pInfo
, Length
, GMEM_ZEROINIT
);
1544 printf ("Could not allocate memory.\n");
1545 return EXIT_FAILURE
;
1550 PrintStatus (Status
);
1552 return EXIT_FAILURE
;
1555 Status
= NtQuerySystemInformation (
1561 if (!NT_SUCCESS(Status
))
1563 PrintStatus (Status
);
1565 return EXIT_FAILURE
;
1568 for ( PoolIndex
= 0;
1569 (PoolIndex
< pInfo
->Count
);
1573 wprintf (L
"\t%08x:\n", pInfo
->PoolEntry
[PoolIndex
].Tag
);
1574 wprintf (L
"\t\tPaged:\t\tNon Paged:\n");
1576 L
"\t\tAllocationCount = %ld\tAllocationCount = %ld\n",
1577 pInfo
->PoolEntry
[PoolIndex
].Paged
.AllocationCount
,
1578 pInfo
->PoolEntry
[PoolIndex
].NonPaged
.AllocationCount
1581 L
"\t\tFreeCount = %ld\tFreeCount = %ld\n",
1582 pInfo
->PoolEntry
[PoolIndex
].Paged
.FreeCount
,
1583 pInfo
->PoolEntry
[PoolIndex
].NonPaged
.FreeCount
1586 L
"\t\tSizeBytes = %ld\tSizeBytes = %ld\n",
1587 pInfo
->PoolEntry
[PoolIndex
].Paged
.SizeBytes
,
1588 pInfo
->PoolEntry
[PoolIndex
].NonPaged
.SizeBytes
1592 DumpData (Length
, pInfo
);
1596 return EXIT_SUCCESS
;
1600 /**********************************************************************
1610 SYSTEM_PROCESSOR_SCHEDULE_INFO Info
;
1616 Status
= NtQuerySystemInformation (
1622 if (STATUS_SUCCESS
!= Status
)
1624 PrintStatus (Status
);
1625 return EXIT_FAILURE
;
1628 printf ("\tnContextSwitches = %ld\n", Info
.nContextSwitches
);
1629 printf ("\tnDPCQueued = %ld\n", Info
.nDPCQueued
);
1630 printf ("\tnDPCRate = %ld\n", Info
.nDPCRate
);
1631 printf ("\tTimerResolution = %ld\n", Info
.TimerResolution
);
1632 printf ("\tnDPCBypasses = %ld\n", Info
.nDPCBypasses
);
1633 printf ("\tnAPCBypasses = %ld\n", Info
.nAPCBypasses
);
1635 DumpData (sizeof Info
, & Info
);
1637 return EXIT_SUCCESS
;
1642 /**********************************************************************
1652 SYSTEM_DPC_INFORMATION Info
;
1658 Status
= NtQuerySystemInformation (
1664 if (STATUS_SUCCESS
!= Status
)
1666 PrintStatus (Status
);
1667 return EXIT_FAILURE
;
1670 if (Application
.Flag
.Verbose
)
1672 printf ("\tUnused = %ld\n", Info
.Unused
);
1674 printf ("\tKiMaximumDpcQueueDepth = %ld\n", Info
.KiMaximumDpcQueueDepth
);
1675 printf ("\tKiMinimumDpcRate = %ld\n", Info
.KiMinimumDpcRate
);
1676 printf ("\tKiAdjustDpcThreshold = %ld\n", Info
.KiAdjustDpcThreshold
);
1677 printf ("\tKiIdealDpcRate = %ld\n", Info
.KiIdealDpcRate
);
1679 DumpData (sizeof Info
, & Info
);
1681 return EXIT_SUCCESS
;
1685 /**********************************************************************
1696 /**********************************************************************
1706 /**********************************************************************
1717 /**********************************************************************
1726 NTSTATUS Status
= STATUS_SUCCESS
;
1727 SYSTEM_TIME_ADJUSTMENT_INFO Info
;
1729 RtlZeroMemory (& Info
, sizeof Info
);
1730 Status
= NtQuerySystemInformation (
1736 if (!NT_SUCCESS(Status
))
1738 PrintStatus (Status
);
1739 return EXIT_FAILURE
;
1741 printf ("\tKeTimeAdjustment = %ld\n", Info
.KeTimeAdjustment
);
1742 printf ("\tKeMaximumIncrement = %ld\n", Info
.KeMaximumIncrement
);
1743 printf ("\tKeTimeSynchronization = %s\n", TF(Info
.KeTimeSynchronization
));
1745 return EXIT_SUCCESS
;
1749 /**********************************************************************
1760 /**********************************************************************
1771 /**********************************************************************
1782 /**********************************************************************
1793 /**********************************************************************
1804 /**********************************************************************
1815 /**********************************************************************
1825 SYSTEM_DEBUGGER_INFO Info
;
1827 RtlZeroMemory (& Info
, sizeof Info
);
1828 Status
= NtQuerySystemInformation (
1834 if (STATUS_SUCCESS
!= Status
)
1836 PrintStatus (Status
);
1837 return EXIT_FAILURE
;
1839 printf ("\tKdDebuggerEnabled = %s\n", TF(Info
.KdDebuggerEnabled
));
1840 printf ("\tKdDebuggerPresent = %s\n", TF(Info
.KdDebuggerPresent
));
1842 DumpData (sizeof Info
, & Info
);
1844 return EXIT_SUCCESS
;
1848 /**********************************************************************
1859 /**********************************************************************
1868 NTSTATUS Status
= STATUS_SUCCESS
;
1869 SYSTEM_QUOTA_INFORMATION Info
;
1871 RtlZeroMemory (& Info
, sizeof Info
);
1872 Status
= NtQuerySystemInformation (
1878 if (!NT_SUCCESS(Status
))
1880 PrintStatus (Status
);
1881 return EXIT_FAILURE
;
1883 printf ("\tCmpGlobalQuota = %ld\n", Info
.CmpGlobalQuota
);
1884 printf ("\tCmpGlobalQuotaUsed = %ld\n", Info
.CmpGlobalQuotaUsed
);
1885 printf ("\tMmSizeofPagedPoolInBytes = %ld\n", Info
.MmSizeofPagedPoolInBytes
);
1887 return EXIT_SUCCESS
;
1891 /**********************************************************************
1902 /**********************************************************************
1913 /**********************************************************************
1924 /**********************************************************************
1935 /**********************************************************************
1946 /**********************************************************************
1957 /**********************************************************************
1960 * Dump the system TIME_ZONE_INFORMATION object.
1969 TIME_ZONE_INFORMATION Tzi
;
1972 RtlZeroMemory (& Tzi
, sizeof Tzi
);
1973 Status
= NtQuerySystemInformation(
1974 SystemTimeZoneInformation
,
1979 if (!NT_SUCCESS(Status
))
1981 PrintStatus (Status
);
1982 return EXIT_FAILURE
;
1985 "12h/24h.....: %dh\n",
1989 "Bias........: %d'\n",
1993 printf ("Standard\n");
2000 Tzi
.StandardName
, /* WCHAR [32] */
2004 L
"\tName: \"%s\"\n",
2010 & Tzi
.StandardDate
/* SYSTEMTIME */
2013 printf ("\tBias: %d'\n",
2014 Tzi
.StandardBias
/* LONG */
2017 printf ("Daylight\n");
2024 Tzi
.DaylightName
, /* WCHAR [32] */
2028 L
"\tName: \"%s\"\n",
2034 & Tzi
.DaylightDate
/* SYSTEMTIME */
2039 Tzi
.DaylightBias
/* LONG */
2042 return EXIT_SUCCESS
;
2046 /**********************************************************************
2057 /**********************************************************************
2068 /**********************************************************************
2079 /**********************************************************************
2090 /**********************************************************************
2101 /**********************************************************************
2112 /**********************************************************************
2123 /**********************************************************************
2134 /**********************************************************************
2145 /**********************************************************************
2146 * Miscellanea Commands
2147 **********************************************************************/
2155 "ReactOS Operating System - http://www.reactos.com/\n"
2156 "QSI - Query System Information (compiled on %s, %s)\n"
2157 "Copyright (c) 1999-2001 Emanuele Aliberti et alii\n\n"
2158 "Run the command in verbose mode, for full license information.\n\n",
2162 if (Application
.Flag
.Verbose
)
2166 "This program is free software; you can redistribute it and/or modify\n"
2167 "it under the terms of the GNU General Public License as published by\n"
2168 "the Free Software Foundation; either version 2 of the License, or\n"
2169 "(at your option) any later version.\n\n"
2171 "This program is distributed in the hope that it will be useful,\n"
2172 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
2173 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
2174 "GNU General Public License for more details.\n\n"
2176 "You should have received a copy of the GNU General Public License\n"
2177 "along with this program; if not, write to the Free Software\n"
2178 "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n"
2179 "(See also http://www.fsf.org/).\n"
2188 Application
.Active
= FALSE
;
2189 return EXIT_SUCCESS
;
2193 extern COMMAND_DESCRIPTOR Commands
[];
2199 if (Application
.Flag
.Verbose
)
2201 printf ("Commands:\n");
2204 (NULL
!= Commands
[i
].Name
);
2209 (strlen (Commands
[i
].Name
) > 7)
2213 Commands
[i
].Description
2216 return EXIT_SUCCESS
;
2224 "\nReactOS (http://www.reactos.com/):\n"
2225 "\tEmanuele Aliberti\n"
2229 "\tMark Russinovich (http://www.sysinternals.com/)\n\n"
2232 "\tYariv Kaplan (http://www.internals.com/)\n\n"
2234 "Undocumented SYSTEM_POOL_INFORMATION:\n"
2235 "\tKlaus P. Gerlicher\n\n"
2237 "Undocumented Windows NT:\n"
2238 "\tPrasad Dabak, Sandeep Phadke, and Milind Borate\n\n"
2240 "Windows NT/2000 Native API Reference:\n"
2241 "\tGary Nebbett\n\n"
2243 "comp.os.ms-windows.programmer.nt.kernel-mode\n"
2244 "\t(many postings with sample code)\n"
2251 Application
.Flag
.Verbose
= ~Application
.Flag
.Verbose
;
2253 "Verbose mode is %s.\n",
2254 ONOFF(Application
.Flag
.Verbose
)
2261 Application
.Flag
.Dump
= ~Application
.Flag
.Dump
;
2263 "Dump mode is %s.\n",
2264 ONOFF(Application
.Flag
.Dump
)
2269 /**********************************************************************
2271 **********************************************************************/
2276 /* System information classes */
2281 "Basic system information"
2286 "Processor characteristics"
2291 "System performance data"
2298 { /* 4 Q (checked build only) */
2301 "Path (checked build only)"
2306 "Process & thread tables"
2311 "Call count information"
2316 "I/O devices in the system, by class"
2321 "Processor performance"
2336 "Table of kernel modules"
2341 "Table of locks on resources"
2366 "Table of executive objects"
2371 "Virtual memory paging files"
2376 "Virtual DOS Machine instruction emulation (VDM)"
2391 "Tagged pools statistics (checked build only)"
2396 "Processor schedule information (interrupt)"
2401 "Deferred procedure call behaviour (DPC)"
2408 { /* 26 S (callable) */
2411 "Load a kernel mode DLL (module in PE format)"
2413 { /* 27 S (callable) */
2416 "Unload a kernel mode DLL (module in Pe format)"
2441 "Crash Dump Section"
2461 "Thread context switch counters"
2466 "Registry quota values"
2471 "Extended service table"
2476 "Priority Separation"
2501 "Current time zone (TZ)"
2512 "Set time slip (5.0)"
2517 "Create session (5.0)"
2522 "Delete session (5.0)"
2542 "Add verifier (5.0)"
2547 "Session processes (5.0)"
2558 "Print this command directory"
2563 "Print the list of people and sources that made QSI possible"
2568 "Print version number and license information"
2573 "Exit to operating system"
2578 "Enable/disable dumping raw data returned by system"
2583 "Enable/disable printing unused, unknown, and service fields"
2591 /* user input --> command decoder */
2595 DecodeCommand (LPCSTR Command
)
2601 && stricmp (Commands
[i
].Name
,Command
)
2605 return Commands
[i
].EntryPoint
;
2611 LPCSTR CommandArgv
[]
2615 LPCSTR Separators
= " \t";
2617 for ( CommandArgv
[ArgC
] = strtok ((char*)CommandLine
, (char*)Separators
);
2619 CommandArgv
[ArgC
] = (LPCSTR
) strtok (NULL
, (char*)Separators
)
2622 if (NULL
== CommandArgv
[ArgC
++])
2632 main (int argc
, char * argv
[])
2634 CHAR CommandLine
[_MAX_PATH
];
2637 LPCSTR CommandArgv
[ARGV_SIZE
];
2640 * Initialize rt data.
2642 Application
.Heap
= GetProcessHeap ();
2643 Application
.Active
= TRUE
;
2647 while (Application
.Active
)
2649 /* Print the prompt string. */
2650 if (! Application
.Flag
.Batch
)
2652 printf ("\r\nsystem> ");
2654 /* Read user command. */
2656 /* Parse the user command */
2657 CommandArgc
= ParseCommandLine (
2661 if (0 != CommandArgc
)
2663 COMMAND_CALL CommandCall
= NULL
;
2666 if ((CommandCall
= DecodeCommand (CommandArgv
[0])))
2669 Application
.ExitCode
=
2677 printf ("Unknown command (type help for a list of valid commands).\n");
2682 if (! Application
.Flag
.Batch
)
2686 return (EXIT_SUCCESS
);