2005-05-07 21:24:31 +00:00
|
|
|
/* $Id$
|
2000-04-25 23:22:57 +00:00
|
|
|
*
|
|
|
|
* PROJECT : ReactOS Operating System (see http://www.reactos.com/)
|
|
|
|
* DESCRIPTION: Tool to query system information
|
|
|
|
* FILE : rosapps/sysutils/qsi.c
|
|
|
|
* AUTHOR : Emanuele Aliberti
|
|
|
|
* LICENSE : GNU GPL (see http://www.gnu.org/)
|
|
|
|
* DATE : 1999-07-28
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* BUILD INSTRUCTIONS
|
|
|
|
* If you got this code directly from the CVS repository on
|
|
|
|
* mok.lcvm.com, it should be ok to run "make sqi.exe" from the
|
|
|
|
* current directory. Otherwise, be sure the directories
|
|
|
|
* "rosapps" and "reactos" are siblings (see the FILE file
|
|
|
|
* in the header).
|
|
|
|
*
|
|
|
|
* REVISIONS
|
|
|
|
* 2000-02-12 (ea)
|
|
|
|
* Partially rewritten to run as a tool to query
|
|
|
|
* every system information class data.
|
|
|
|
* 2000-04-23 (ea)
|
|
|
|
* Added almost all structures for getting system
|
|
|
|
* information (from UNDOCNT.H by Dabak et alii).
|
2001-01-13 18:17:17 +00:00
|
|
|
* 2001-01-13 (ea)
|
2001-01-14 19:59:43 +00:00
|
|
|
* New QSI class names used by E.Kohl.
|
2000-04-25 23:22:57 +00:00
|
|
|
*/
|
|
|
|
#include <windows.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <wchar.h>
|
|
|
|
|
|
|
|
#define NTOS_MODE_USER
|
|
|
|
#include <ntos.h>
|
|
|
|
|
|
|
|
typedef
|
|
|
|
struct _FLAGS
|
|
|
|
{
|
|
|
|
DWORD Verbose:1; /* print unknown, unused, service fields */
|
|
|
|
DWORD Dump:1; /* raw dump output buffer */
|
|
|
|
DWORD Batch:1; /* no shell (for future use) */
|
|
|
|
} FLAGS;
|
|
|
|
|
|
|
|
static
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
FLAGS Flag;
|
|
|
|
BOOL Active;
|
|
|
|
HANDLE Heap;
|
|
|
|
INT ExitCode;
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
} Application =
|
|
|
|
{
|
|
|
|
{0, 0},
|
|
|
|
FALSE
|
|
|
|
};
|
|
|
|
|
|
|
|
#define ONOFF(b) ((b)?"on":"off")
|
|
|
|
|
|
|
|
#define ARGV_SIZE 64
|
|
|
|
|
|
|
|
#define BUFFER_SIZE_DEFAULT 65536
|
|
|
|
|
|
|
|
#define TF(b) ((b)?"true":"false")
|
|
|
|
|
|
|
|
typedef
|
|
|
|
INT (* COMMAND_CALL) (INT ArgC,LPCSTR ArgV []);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VOID STDCALL PrintStatus (NTSTATUS Status);
|
|
|
|
|
|
|
|
#define CMD_REF(n) CMD_##n
|
|
|
|
#define CMD_DEF(n) INT CMD_REF(n) (INT argc, LPCSTR argv [])
|
|
|
|
#define CMD_NOT_IMPLEMENTED {printf("%s not implemented\n", argv[0]);return(0);}
|
|
|
|
|
|
|
|
typedef
|
|
|
|
struct _COMMAND_DESCRIPTOR
|
|
|
|
{
|
|
|
|
LPCSTR Name;
|
|
|
|
COMMAND_CALL EntryPoint;
|
|
|
|
LPCSTR Description;
|
|
|
|
|
|
|
|
} COMMAND_DESCRIPTOR, * PCOMMAND_DESCRIPTOR;
|
|
|
|
|
|
|
|
|
2000-04-27 23:39:49 +00:00
|
|
|
/* Fast BYTE to binary representation */
|
|
|
|
|
|
|
|
#define BIT(n,m) (((n)&(m))?'1':'0')
|
|
|
|
LPSTR
|
|
|
|
STDCALL
|
|
|
|
ByteToBinaryString (
|
|
|
|
BYTE Byte,
|
|
|
|
CHAR Binary [8]
|
|
|
|
)
|
|
|
|
{
|
|
|
|
Binary [7] = BIT(Byte,0x01);
|
|
|
|
Binary [6] = BIT(Byte,0x02);
|
|
|
|
Binary [5] = BIT(Byte,0x04);
|
|
|
|
Binary [4] = BIT(Byte,0x08);
|
|
|
|
Binary [3] = BIT(Byte,0x10);
|
|
|
|
Binary [2] = BIT(Byte,0x20);
|
|
|
|
Binary [1] = BIT(Byte,0x40);
|
|
|
|
Binary [0] = BIT(Byte,0x80);
|
|
|
|
return (LPSTR) Binary;
|
|
|
|
}
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
/* --- */
|
|
|
|
VOID
|
|
|
|
STDCALL
|
|
|
|
DumpData (int Size, PVOID pData )
|
|
|
|
{
|
|
|
|
PBYTE Buffer = (PBYTE) pData;
|
|
|
|
PBYTE Base = Buffer;
|
|
|
|
int i;
|
|
|
|
const int Width = 16;
|
|
|
|
|
|
|
|
if (! Application.Flag.Dump)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2005-05-07 21:24:31 +00:00
|
|
|
while (Size > 0)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
printf ("%04x: ", (Buffer - Base));
|
|
|
|
for ( i = 0;
|
|
|
|
(i < Width);
|
|
|
|
++i
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if (Size - i > 0)
|
|
|
|
{
|
|
|
|
printf (
|
|
|
|
"%02x%c",
|
|
|
|
Buffer[i],
|
|
|
|
(i % 4 == 3) ? '|' : ' '
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf (" ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
printf (" ");
|
|
|
|
for ( i = 0;
|
|
|
|
(i < Width);
|
|
|
|
++i
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if (Size - i > 0)
|
|
|
|
{
|
|
|
|
printf (
|
|
|
|
"%c",
|
|
|
|
( (Buffer[i] > ' ')
|
|
|
|
&& (Buffer[i] < 127)
|
|
|
|
)
|
|
|
|
? Buffer[i]
|
|
|
|
: ' '
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
printf ("\n");
|
|
|
|
Buffer += Width;
|
|
|
|
Size -= Width;
|
|
|
|
}
|
|
|
|
printf ("\n");
|
|
|
|
}
|
|
|
|
|
2000-05-28 17:44:53 +00:00
|
|
|
/* --- */
|
|
|
|
|
|
|
|
static
|
|
|
|
LPTSTR
|
|
|
|
KernelObjectName [] =
|
|
|
|
{
|
|
|
|
_T("0"), /* FIXME */
|
|
|
|
_T("1"), /* FIXME */
|
|
|
|
_T("Directory"),
|
|
|
|
_T("SymbolicLink"),
|
|
|
|
_T("Token"),
|
|
|
|
_T("Process"),
|
|
|
|
_T("Thread"),
|
|
|
|
_T("Event"),
|
|
|
|
_T("8"), /* FIXME */
|
|
|
|
_T("Mutant"),
|
|
|
|
_T("Semaphore"),
|
|
|
|
_T("Timer"),
|
|
|
|
_T("12"), /* FIXME */
|
|
|
|
_T("WindowStation"),
|
|
|
|
_T("Desktop"),
|
|
|
|
_T("Section"),
|
|
|
|
_T("Key"),
|
|
|
|
_T("Port"),
|
|
|
|
_T("18"), /* FIXME */
|
|
|
|
_T("19"), /* FIXME */
|
|
|
|
_T("20"), /* FIXME */
|
|
|
|
_T("21"), /* FIXME */
|
|
|
|
_T("IoCompletion"),
|
|
|
|
_T("File"),
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
LPTSTR
|
|
|
|
STDCALL
|
|
|
|
HandleTypeToObjectName (
|
|
|
|
DWORD HandleType
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if (HandleType > 23) /* FIXME: use a symbol not a literal */
|
|
|
|
{
|
|
|
|
return _T("Unknown");
|
|
|
|
}
|
|
|
|
return KernelObjectName [HandleType];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* --- */
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
STDCALL
|
|
|
|
FindRequiredBufferSize (int i, int step)
|
|
|
|
{
|
|
|
|
NTSTATUS Status = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
BYTE Buffer [BUFFER_SIZE_DEFAULT];
|
|
|
|
INT Size;
|
|
|
|
LONG Length = 0;
|
|
|
|
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
Size = step = (step > 0 ? step : 1);
|
|
|
|
while ( (Size < sizeof Buffer)
|
|
|
|
&& (Status == STATUS_INFO_LENGTH_MISMATCH)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if (Application.Flag.Verbose)
|
|
|
|
{
|
|
|
|
printf ("\tTry %d", Size);
|
|
|
|
}
|
|
|
|
RtlZeroMemory (Buffer, sizeof Buffer);
|
|
|
|
Length = 0;
|
|
|
|
Status = NtQuerySystemInformation (
|
|
|
|
i,
|
|
|
|
& Buffer,
|
|
|
|
Size,
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS == Status)
|
|
|
|
{
|
|
|
|
printf ("Length = %d\n", Size);
|
|
|
|
return Size;
|
|
|
|
}
|
|
|
|
if (Length > 0)
|
|
|
|
{
|
|
|
|
Size = Length;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* FIXME: slow linear search! */
|
|
|
|
Size += step;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
printf ("No valid buffer length found!\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
|
|
|
STDCALL
|
|
|
|
PrintStatus (NTSTATUS Status)
|
|
|
|
{
|
|
|
|
LPCSTR StatusName = NULL;
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
switch (Status)
|
|
|
|
{
|
|
|
|
case STATUS_INVALID_INFO_CLASS:
|
|
|
|
StatusName = "STATUS_INVALID_INFO_CLASS";
|
|
|
|
break;
|
|
|
|
case STATUS_INFO_LENGTH_MISMATCH:
|
|
|
|
StatusName = "STATUS_INFO_LENGTH_MISMATCH";
|
|
|
|
break;
|
|
|
|
case STATUS_ACCESS_VIOLATION:
|
|
|
|
StatusName = "STATUS_ACCESS_VIOLATION";
|
|
|
|
break;
|
|
|
|
case STATUS_NOT_IMPLEMENTED:
|
|
|
|
StatusName = "STATUS_NOT_IMPLEMENTED";
|
|
|
|
break;
|
|
|
|
case STATUS_BREAKPOINT:
|
|
|
|
StatusName = "STATUS_BREAKPOINT";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (NULL != StatusName)
|
|
|
|
{
|
|
|
|
printf ("\tStatus = %s\n", StatusName);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
printf ("\tStatus = 0x%08lX\n", Status );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Auxiliary functions */
|
|
|
|
|
|
|
|
PCHAR
|
|
|
|
DaysOfWeek [] =
|
|
|
|
{
|
|
|
|
"Sunday",
|
|
|
|
"Monday",
|
|
|
|
"Tuesday",
|
|
|
|
"Wednesday",
|
|
|
|
"Thursday",
|
|
|
|
"Friday",
|
|
|
|
"Saturday",
|
|
|
|
"Sunday"
|
|
|
|
};
|
|
|
|
|
|
|
|
VOID
|
|
|
|
STDCALL
|
|
|
|
PrintUtcDateTime (LPCSTR Template, PTIME UtcTime)
|
|
|
|
{
|
|
|
|
CHAR UtcTimeString [64];
|
|
|
|
TIME_FIELDS UtcTimeFields;
|
|
|
|
|
|
|
|
RtlTimeToTimeFields (
|
|
|
|
(PLARGE_INTEGER) UtcTime,
|
|
|
|
& UtcTimeFields
|
|
|
|
);
|
|
|
|
sprintf (
|
|
|
|
UtcTimeString,
|
|
|
|
"%s %d-%02d-%02d %02d:%02d:%02d.%03d UTC",
|
|
|
|
DaysOfWeek[UtcTimeFields.Weekday],
|
|
|
|
UtcTimeFields.Year,
|
|
|
|
UtcTimeFields.Month,
|
|
|
|
UtcTimeFields.Day,
|
|
|
|
UtcTimeFields.Hour,
|
|
|
|
UtcTimeFields.Minute,
|
|
|
|
UtcTimeFields.Second,
|
|
|
|
UtcTimeFields.Milliseconds
|
2005-05-07 21:24:31 +00:00
|
|
|
);
|
2000-04-25 23:22:57 +00:00
|
|
|
printf (
|
|
|
|
Template,
|
|
|
|
UtcTimeString
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* Dumpers
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
* Dump whatever we get by calling NtQuerySystemInformation with
|
|
|
|
* a user provided system information class id.
|
|
|
|
* NOTE
|
|
|
|
* NtQuerySystemInformation called with user class id.
|
|
|
|
*/
|
|
|
|
CMD_DEF(unknown)
|
|
|
|
{
|
|
|
|
int _id = atoi ((char*)(argv[0] + 1)); /* "#24" */
|
|
|
|
/* ^ */
|
|
|
|
int Size = -1;
|
|
|
|
PBYTE Buffer = NULL;
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
printf ("SystemInformation %d:\n", _id);
|
|
|
|
/* Find buffer size */
|
|
|
|
Size = FindRequiredBufferSize (_id, 1);
|
|
|
|
if (-1 == Size)
|
|
|
|
{
|
|
|
|
printf("\t(no data)\n");
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
/* Allocate the buffer */
|
|
|
|
Buffer = GlobalAlloc (GMEM_ZEROINIT, Size);
|
|
|
|
if (NULL == Buffer)
|
|
|
|
{
|
|
|
|
printf ("#%d: could not allocate %d bytes\n", _id, Size);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
/* Query the executive */
|
|
|
|
Status = NtQuerySystemInformation (
|
|
|
|
_id,
|
|
|
|
Buffer,
|
|
|
|
Size,
|
|
|
|
NULL
|
|
|
|
);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
FindRequiredBufferSize (_id, 1);
|
|
|
|
GlobalFree (Buffer);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
/* Print the data */
|
|
|
|
DumpData (Size, Buffer);
|
|
|
|
/* --- */
|
|
|
|
GlobalFree (Buffer);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 0.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(0)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
SYSTEM_BASIC_INFORMATION Info;
|
|
|
|
|
|
|
|
RtlZeroMemory (
|
|
|
|
(PVOID) & Info,
|
|
|
|
sizeof Info
|
|
|
|
);
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
0,
|
2000-04-25 23:22:57 +00:00
|
|
|
& Info,
|
|
|
|
sizeof Info,
|
|
|
|
NULL
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2001-07-12 11:58:57 +00:00
|
|
|
printf (" Reserved 0x%08lx\n", Info.Reserved);
|
|
|
|
printf (" TimerResolution %ld\n", Info.TimerResolution);
|
|
|
|
printf (" PageSize %ld\n", Info.PageSize);
|
|
|
|
printf (" NumberOfPhysicalPages %ld\n", Info.NumberOfPhysicalPages);
|
|
|
|
printf (" LowestPhysicalPageNumber %ld\n", Info.LowestPhysicalPageNumber);
|
|
|
|
printf (" HighestPhysicalPageNumber %ld\n", Info.HighestPhysicalPageNumber);
|
|
|
|
printf (" AllocationGranularity %ld\n", Info.AllocationGranularity);
|
|
|
|
printf (" MinimumUserModeAddress 0x%08lx (%ld)\n", Info.MinimumUserModeAddress, Info.MinimumUserModeAddress);
|
|
|
|
printf (" MaximumUserModeAddress 0x%08lx (%ld)\n", Info.MaximumUserModeAddress, Info.MaximumUserModeAddress);
|
|
|
|
printf (" ActiveProcessorsAffinityMask 0x%08lx\n", Info.ActiveProcessorsAffinityMask);
|
2001-01-13 18:17:17 +00:00
|
|
|
printf (" NumberOfProcessors %d\n", (int) Info.NumberOfProcessors);
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 1.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(1)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
SYSTEM_PROCESSOR_INFORMATION Info;
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
RtlZeroMemory (
|
|
|
|
(PVOID) & Info,
|
|
|
|
sizeof Info
|
|
|
|
);
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
1,
|
2000-04-25 23:22:57 +00:00
|
|
|
& Info,
|
|
|
|
sizeof Info,
|
|
|
|
NULL
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2001-01-13 18:17:17 +00:00
|
|
|
printf (" ProcessorArchitecture %d\n", Info.ProcessorArchitecture);
|
|
|
|
printf (" ProcessorLevel %d\n", Info.ProcessorLevel);
|
|
|
|
printf (" ProcessorRevision %d\n", Info.ProcessorRevision);
|
|
|
|
printf (" Reserved 0x%08x\n", Info.Reserved);
|
2001-07-12 11:58:57 +00:00
|
|
|
printf (" FeatureBits %08lx\n", Info.ProcessorFeatureBits);
|
2001-01-13 18:17:17 +00:00
|
|
|
/* FIXME: decode feature bits */
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
* System performance information.
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* NOTE
|
|
|
|
* Class 2.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(2)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
PSYSTEM_PERFORMANCE_INFO Info;
|
|
|
|
LONG Length = 0;
|
|
|
|
|
|
|
|
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
2,
|
2000-04-25 23:22:57 +00:00
|
|
|
& Info,
|
|
|
|
sizeof Info,
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
printf ("Not implemented.\n");
|
|
|
|
#if 0
|
|
|
|
LARGE_INTEGER TotalProcessorTime;
|
|
|
|
LARGE_INTEGER IoReadTransferCount;
|
|
|
|
LARGE_INTEGER IoWriteTransferCount;
|
|
|
|
LARGE_INTEGER IoOtherTransferCount;
|
|
|
|
ULONG IoReadOperationCount;
|
|
|
|
ULONG IoWriteOperationCount;
|
|
|
|
ULONG IoOtherOperationCount;
|
|
|
|
ULONG MmAvailablePages;
|
|
|
|
ULONG MmTotalCommitedPages;
|
|
|
|
ULONG MmTotalCommitLimit;
|
|
|
|
ULONG MmPeakLimit;
|
|
|
|
ULONG PageFaults;
|
|
|
|
ULONG WriteCopies;
|
|
|
|
ULONG TransitionFaults;
|
|
|
|
ULONG Unknown1;
|
|
|
|
ULONG DemandZeroFaults;
|
|
|
|
ULONG PagesInput;
|
|
|
|
ULONG PagesRead;
|
|
|
|
ULONG Unknown2;
|
|
|
|
ULONG Unknown3;
|
|
|
|
ULONG PagesOutput;
|
|
|
|
ULONG PageWrites;
|
|
|
|
ULONG Unknown4;
|
|
|
|
ULONG Unknown5;
|
|
|
|
ULONG PoolPagedBytes;
|
|
|
|
ULONG PoolNonPagedBytes;
|
|
|
|
ULONG Unknown6;
|
|
|
|
ULONG Unknown7;
|
|
|
|
ULONG Unknown8;
|
|
|
|
ULONG Unknown9;
|
|
|
|
ULONG MmTotalSystemFreePtes;
|
|
|
|
ULONG MmSystemCodepage;
|
|
|
|
ULONG MmTotalSystemDriverPages;
|
|
|
|
ULONG MmTotalSystemCodePages;
|
|
|
|
ULONG Unknown10;
|
|
|
|
ULONG Unknown11;
|
|
|
|
ULONG Unknown12;
|
|
|
|
ULONG MmSystemCachePage;
|
|
|
|
ULONG MmPagedPoolPage;
|
|
|
|
ULONG MmSystemDriverPage;
|
|
|
|
ULONG CcFastReadNoWait;
|
|
|
|
ULONG CcFastReadWait;
|
|
|
|
ULONG CcFastReadResourceMiss;
|
|
|
|
ULONG CcFastReadNotPossible;
|
|
|
|
ULONG CcFastMdlReadNoWait;
|
|
|
|
ULONG CcFastMdlReadWait;
|
|
|
|
ULONG CcFastMdlReadResourceMiss;
|
|
|
|
ULONG CcFastMdlReadNotPossible;
|
|
|
|
ULONG CcMapDataNoWait;
|
|
|
|
ULONG CcMapDataWait;
|
|
|
|
ULONG CcMapDataNoWaitMiss;
|
|
|
|
ULONG CcMapDataWaitMiss;
|
|
|
|
ULONG CcPinMappedDataCount;
|
|
|
|
ULONG CcPinReadNoWait;
|
|
|
|
ULONG CcPinReadWait;
|
|
|
|
ULONG CcPinReadNoWaitMiss;
|
|
|
|
ULONG CcPinReadWaitMiss;
|
|
|
|
ULONG CcCopyReadNoWait;
|
|
|
|
ULONG CcCopyReadWait;
|
|
|
|
ULONG CcCopyReadNoWaitMiss;
|
|
|
|
ULONG CcCopyReadWaitMiss;
|
|
|
|
ULONG CcMdlReadNoWait;
|
|
|
|
ULONG CcMdlReadWait;
|
|
|
|
ULONG CcMdlReadNoWaitMiss;
|
|
|
|
ULONG CcMdlReadWaitMiss;
|
|
|
|
ULONG CcReadaheadIos;
|
|
|
|
ULONG CcLazyWriteIos;
|
|
|
|
ULONG CcLazyWritePages;
|
|
|
|
ULONG CcDataFlushes;
|
|
|
|
ULONG CcDataPages;
|
|
|
|
ULONG ContextSwitches;
|
|
|
|
ULONG Unknown13;
|
|
|
|
ULONG Unknown14;
|
|
|
|
ULONG SystemCalls;
|
|
|
|
#endif
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 3.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(3)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
2001-01-13 18:17:17 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
SYSTEM_TIMEOFDAY_INFORMATION Info;
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
3,
|
2000-04-25 23:22:57 +00:00
|
|
|
& Info,
|
|
|
|
sizeof Info,
|
|
|
|
NULL
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2001-01-13 18:17:17 +00:00
|
|
|
PrintUtcDateTime (" BootTime %s\n", (PTIME) & Info.BootTime);
|
|
|
|
PrintUtcDateTime (" CurrentTime %s\n", (PTIME) & Info.CurrentTime);
|
|
|
|
PrintUtcDateTime (" TimeZoneBias %s\n", (PTIME) & Info.TimeZoneBias); /* FIXME */
|
|
|
|
printf (" TimeZoneId %ld\n", Info.TimeZoneId);
|
2001-07-12 11:58:57 +00:00
|
|
|
printf (" Reserved %08lx\n", Info.Reserved);
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 4.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(4)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
SYSTEM_PATH_INFORMATION Info;
|
|
|
|
CHAR _Info [_MAX_PATH];
|
|
|
|
ULONG Length = 0;
|
|
|
|
|
|
|
|
RtlZeroMemory (& Info, _MAX_PATH);
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
4,
|
2000-04-25 23:22:57 +00:00
|
|
|
& _Info,
|
|
|
|
_MAX_PATH,
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
DumpData (_MAX_PATH, & _Info);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
DumpData (_MAX_PATH, & _Info);
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
* A snapshot of the process+thread tables.
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 5.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(5)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
PSYSTEM_PROCESS_INFORMATION pInfo = NULL;
|
|
|
|
LONG Length = 0;
|
|
|
|
ULONG ThreadIndex;
|
|
|
|
|
|
|
|
pInfo = GlobalAlloc (GMEM_ZEROINIT, BUFFER_SIZE_DEFAULT);
|
|
|
|
/* FIXME: check NULL==pInfo */
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
/*
|
|
|
|
* Obtain required buffer size
|
|
|
|
*/
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
5,
|
2000-04-25 23:22:57 +00:00
|
|
|
pInfo,
|
|
|
|
BUFFER_SIZE_DEFAULT,
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
if (STATUS_INFO_LENGTH_MISMATCH == Status)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Allocate buffer
|
|
|
|
*/
|
|
|
|
pInfo = GlobalReAlloc (pInfo, Length, GMEM_ZEROINIT);
|
|
|
|
if (NULL == pInfo)
|
|
|
|
{
|
|
|
|
printf ("\tCould not allocate memory.\n");
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
GlobalFree (pInfo);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Get process+thread list from ntoskrnl.exe
|
|
|
|
*/
|
|
|
|
Status = NtQuerySystemInformation (
|
|
|
|
SystemProcessInformation,
|
|
|
|
pInfo,
|
|
|
|
Length,
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
GlobalFree (pInfo);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
wprintf (L"%s:\n", (pInfo->Name.Length ? pInfo->Name.Buffer : L"*idle*") );
|
|
|
|
if (Application.Flag.Verbose)
|
|
|
|
{
|
|
|
|
wprintf (L"\tRelativeOffset = 0x%08x\n", pInfo->RelativeOffset);
|
|
|
|
}
|
|
|
|
wprintf (L"\tThreads = %ld\n", pInfo->ThreadCount);
|
|
|
|
wprintf (L"\tHandles = %ld\n", pInfo->HandleCount);
|
|
|
|
wprintf (L"\tBasePriority = %ld\n", pInfo->BasePriority);
|
|
|
|
wprintf (L"\tPID = %ld\n", pInfo->ProcessId);
|
|
|
|
wprintf (L"\tPPID = %ld\n", pInfo->ParentProcessId);
|
|
|
|
wprintf (L"\tVirtualSize:\t\tWorkingSetSize:\n");
|
|
|
|
wprintf (L"\t\tPeak : %ld\t\t\tPeak : %ld\n",
|
|
|
|
pInfo->PeakVirtualSizeBytes,
|
|
|
|
pInfo->PeakWorkingSetSizeBytes
|
|
|
|
);
|
|
|
|
wprintf (L"\t\tTotal: %ld\t\t\tTotal: %ld\n",
|
|
|
|
pInfo->TotalVirtualSizeBytes,
|
|
|
|
pInfo->TotalWorkingSetSizeBytes
|
|
|
|
);
|
|
|
|
wprintf (L"\tPagedPoolUsage:\t\tNonPagedPoolUsage:\n");
|
|
|
|
wprintf (L"\t\tPeak : %ld\t\t\tPeak : %ld\n",
|
|
|
|
pInfo->PeakPagedPoolUsagePages,
|
|
|
|
pInfo->TotalPagedPoolUsagePages
|
|
|
|
);
|
|
|
|
wprintf (L"\t\tTotal: %ld\t\t\tTotal: %ld\n",
|
|
|
|
pInfo->PeakNonPagedPoolUsagePages,
|
|
|
|
pInfo->TotalNonPagedPoolUsagePages
|
|
|
|
);
|
|
|
|
wprintf (L"\tPageFileUsage:\n");
|
|
|
|
wprintf (L"\t\tPeak : %ld\n", pInfo->PeakPageFileUsageBytes);
|
|
|
|
wprintf (L"\t\tTotal: %ld\n", pInfo->TotalPageFileUsageBytes);
|
|
|
|
|
|
|
|
wprintf (L"\tPageFaultCount = %ld\n", pInfo->PageFaultCount);
|
|
|
|
wprintf (L"\tTotalPrivateBytes = %ld\n", pInfo->TotalPrivateBytes);
|
|
|
|
/* Threads */
|
|
|
|
for ( ThreadIndex = 0;
|
|
|
|
(ThreadIndex < pInfo->ThreadCount);
|
|
|
|
ThreadIndex ++
|
|
|
|
)
|
|
|
|
{
|
|
|
|
wprintf (L"\t%x in %x:\n",
|
|
|
|
pInfo->ThreadSysInfo[ThreadIndex].ClientId.UniqueThread,
|
|
|
|
pInfo->ThreadSysInfo[ThreadIndex].ClientId.UniqueProcess
|
|
|
|
);
|
|
|
|
PrintUtcDateTime (
|
|
|
|
"\t\tKernelTime = %s\n",
|
|
|
|
& (pInfo->ThreadSysInfo[ThreadIndex].KernelTime)
|
|
|
|
);
|
|
|
|
PrintUtcDateTime (
|
|
|
|
"\t\tUserTime = %s\n",
|
|
|
|
& (pInfo->ThreadSysInfo[ThreadIndex].UserTime)
|
|
|
|
);
|
|
|
|
PrintUtcDateTime (
|
|
|
|
"\t\tCreateTime = %s\n",
|
|
|
|
& (pInfo->ThreadSysInfo[ThreadIndex].CreateTime)
|
|
|
|
);
|
|
|
|
wprintf (L"\t\tTickCount = %ld\n",
|
|
|
|
pInfo->ThreadSysInfo[ThreadIndex].TickCount
|
|
|
|
);
|
|
|
|
wprintf (L"\t\tStartEIP = 0x%08x\n",
|
|
|
|
pInfo->ThreadSysInfo[ThreadIndex].StartEIP
|
|
|
|
);
|
|
|
|
/* CLIENT_ID ClientId; */
|
|
|
|
wprintf (L"\t\tDynamicPriority = %d\n",
|
|
|
|
pInfo->ThreadSysInfo[ThreadIndex].DynamicPriority
|
|
|
|
);
|
|
|
|
wprintf (L"\t\tBasePriority = %d\n",
|
|
|
|
pInfo->ThreadSysInfo[ThreadIndex].BasePriority
|
|
|
|
);
|
|
|
|
wprintf (L"\t\tnSwitches = %ld\n",
|
|
|
|
pInfo->ThreadSysInfo[ThreadIndex].nSwitches
|
|
|
|
);
|
|
|
|
wprintf (L"\t\tState = 0x%08x\n",
|
|
|
|
pInfo->ThreadSysInfo[ThreadIndex].State
|
|
|
|
);
|
|
|
|
wprintf (L"\t\tWaitReason = %ld\n",
|
|
|
|
pInfo->ThreadSysInfo[ThreadIndex].WaitReason
|
|
|
|
);
|
|
|
|
}
|
|
|
|
/* Next */
|
|
|
|
if (0 == pInfo->RelativeOffset)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
(ULONG) pInfo += pInfo->RelativeOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
DumpData (Length, pInfo);
|
|
|
|
|
|
|
|
GlobalFree (pInfo);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 6.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(6)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
SYSTEM_SDT_INFORMATION Info;
|
|
|
|
ULONG Length = 0;
|
|
|
|
|
|
|
|
/* FIXME */
|
|
|
|
RtlZeroMemory (& Info, sizeof Info);
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
6,
|
2000-04-25 23:22:57 +00:00
|
|
|
& Info,
|
|
|
|
sizeof Info,
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
DumpData (Length, & Info);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2001-01-13 18:17:17 +00:00
|
|
|
printf (" BufferLength = %ld\n", Info.BufferLength);
|
|
|
|
printf (" NumberOfSystemServiceTables = %ld\n", Info.NumberOfSystemServiceTables);
|
|
|
|
printf (" NumberOfServices = %ld\n", Info.NumberOfServices [0]);
|
|
|
|
printf (" ServiceCounters = %ld\n", Info.ServiceCounters [0]);
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
DumpData (Length, & Info);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 7.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(7)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
2001-01-13 18:17:17 +00:00
|
|
|
SYSTEM_DEVICE_INFORMATION Info;
|
2000-04-25 23:22:57 +00:00
|
|
|
ULONG Length = 0;
|
|
|
|
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
7,
|
2000-04-25 23:22:57 +00:00
|
|
|
& Info,
|
|
|
|
sizeof Info,
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2001-01-13 18:17:17 +00:00
|
|
|
printf (" Number Of Disks %ld\n", Info.NumberOfDisks);
|
|
|
|
printf (" Number Of Floppies %ld\n", Info.NumberOfFloppies);
|
|
|
|
printf (" Number Of CD-ROMs %ld\n", Info.NumberOfCdRoms);
|
|
|
|
printf (" Number Of Tapes %ld\n", Info.NumberOfTapes);
|
|
|
|
printf (" Number Of Serial Ports %ld\n", Info.NumberOfSerialPorts);
|
|
|
|
printf (" Number Of Parallel Ports %ld\n", Info.NumberOfParallelPorts);
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
DumpData (Length, & Info);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 8.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(8)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
SYSTEM_PROCESSORTIME_INFO Info;
|
|
|
|
ULONG Length = 0;
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
8,
|
2000-04-25 23:22:57 +00:00
|
|
|
& Info,
|
|
|
|
sizeof Info,
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2001-01-13 18:17:17 +00:00
|
|
|
PrintUtcDateTime (" TotalProcessorRunTime : %s\n", & Info.TotalProcessorRunTime);
|
|
|
|
PrintUtcDateTime (" TotalProcessorTime : %s\n", & Info.TotalProcessorTime);
|
|
|
|
PrintUtcDateTime (" TotalProcessorUserTime: %s\n", & Info.TotalProcessorUserTime);
|
|
|
|
PrintUtcDateTime (" TotalDPCTime : %s\n", & Info.TotalDPCTime);
|
|
|
|
PrintUtcDateTime (" TotalInterruptTime : %s\n", & Info.TotalInterruptTime);
|
|
|
|
printf (" TotalInterrupts : %ld\n", Info.TotalInterrupts);
|
2001-07-12 11:58:57 +00:00
|
|
|
printf (" Unused : %08lx\n", Info.Unused);
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 9.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(9)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
2001-01-13 18:17:17 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
SYSTEM_FLAGS_INFORMATION Info;
|
|
|
|
ULONG Length = 0;
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
9,
|
2000-04-25 23:22:57 +00:00
|
|
|
& Info,
|
|
|
|
sizeof Info,
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2001-07-12 11:58:57 +00:00
|
|
|
printf (" NtGlobalFlag: %08lx\n", Info.Flags);
|
2001-01-14 19:59:43 +00:00
|
|
|
if (FLG_STOP_ON_EXCEPTION & Info.Flags) printf ("\tSTOP_ON_EXCEPTION\n");
|
|
|
|
if (FLG_STOP_ON_HANG_GUI & Info.Flags) printf ("\tSTOP_ON_HANG_GUI\n");
|
|
|
|
if (FLG_SHOW_LDR_SNAPS & Info.Flags) printf ("\tSHOW_LDR_SNAPS\n");
|
|
|
|
if (FLG_DEBUG_INITIAL_COMMAND & Info.Flags) printf ("\tDEBUG_INITIAL_COMMAND\n");
|
|
|
|
if (FLG_HEAP_ENABLE_TAIL_CHECK & Info.Flags) printf ("\tHEAP_ENABLE_TAIL_CHECK\n");
|
|
|
|
if (FLG_HEAP_ENABLE_FREE_CHECK & Info.Flags) printf ("\tHEAP_ENABLE_FREE_CHECK\n");
|
|
|
|
if (FLG_HEAP_ENABLE_TAGGING & Info.Flags) printf ("\tHEAP_ENABLE_TAGGING\n");
|
|
|
|
if (FLG_HEAP_ENABLE_TAG_BY_DLL & Info.Flags) printf ("\tHEAP_ENABLE_TAG_BY_DLL\n");
|
|
|
|
if (FLG_HEAP_ENABLE_CALL_TRACING & Info.Flags) printf ("\tHEAP_ENABLE_CALL_TRACING\n");
|
|
|
|
if (FLG_HEAP_DISABLE_COALESCING & Info.Flags) printf ("\tHEAP_DISABLE_COALESCING\n");
|
|
|
|
if (FLG_HEAP_VALIDATE_PARAMETERS & Info.Flags) printf ("\tHEAP_VALIDATE_PARAMETERS\n");
|
|
|
|
if (FLG_HEAP_VALIDATE_ALL & Info.Flags) printf ("\tHEAP_VALIDATE_ALL\n");
|
|
|
|
if (FLG_POOL_ENABLE_TAIL_CHECK & Info.Flags) printf ("\tPOOL_ENABLE_TAIL_CHECK\n");
|
|
|
|
if (FLG_POOL_ENABLE_FREE_CHECK & Info.Flags) printf ("\tPOOL_ENABLE_FREE_CHECK\n");
|
|
|
|
if (FLG_POOL_ENABLE_TAGGING & Info.Flags) printf ("\tPOOL_ENABLE_TAGGING\n");
|
|
|
|
if (FLG_USER_STACK_TRACE_DB & Info.Flags) printf ("\tUSER_STACK_TRACE_DB\n");
|
|
|
|
if (FLG_KERNEL_STACK_TRACE_DB & Info.Flags) printf ("\tKERNEL_STACK_TRACE_DB\n");
|
|
|
|
if (FLG_MAINTAIN_OBJECT_TYPELIST & Info.Flags) printf ("\tMAINTAIN_OBJECT_TYPELIST\n");
|
|
|
|
if (FLG_IGNORE_DEBUG_PRIV & Info.Flags) printf ("\tIGNORE_DEBUG_PRIV\n");
|
|
|
|
if (FLG_ENABLE_CSRDEBUG & Info.Flags) printf ("\tENABLE_CSRDEBUG\n");
|
|
|
|
if (FLG_ENABLE_KDEBUG_SYMBOL_LOAD & Info.Flags) printf ("\tENABLE_KDEBUG_SYMBOL_LOAD\n");
|
|
|
|
if (FLG_DISABLE_PAGE_KERNEL_STACKS & Info.Flags) printf ("\tDISABLE_PAGE_KERNEL_STACKS\n");
|
|
|
|
if (FLG_ENABLE_CLOSE_EXCEPTION & Info.Flags) printf ("\tENABLE_CLOSE_EXCEPTION\n");
|
|
|
|
if (FLG_ENABLE_EXCEPTION_LOGGING & Info.Flags) printf ("\tENABLE_EXCEPTION_LOGGING\n");
|
|
|
|
if (FLG_ENABLE_DBGPRINT_BUFFERING & Info.Flags) printf ("\tENABLE_DBGPRINT_BUFFERING\n");
|
|
|
|
if (FLG_UNKNOWN_01000000 & Info.Flags) printf ("\tUNKNOWN_01000000\n");
|
|
|
|
if (FLG_UNKNOWN_02000000 & Info.Flags) printf ("\tUNKNOWN_02000000\n");
|
|
|
|
if (FLG_UNKNOWN_04000000 & Info.Flags) printf ("\tUNKNOWN_04000000\n");
|
|
|
|
if (FLG_UNKNOWN_10000000 & Info.Flags) printf ("\tUNKNOWN_10000000\n");
|
|
|
|
if (FLG_UNKNOWN_20000000 & Info.Flags) printf ("\tUNKNOWN_20000000\n");
|
|
|
|
if (FLG_UNKNOWN_40000000 & Info.Flags) printf ("\tUNKNOWN_40000000\n");
|
|
|
|
if (FLG_UNKNOWN_80000000 & Info.Flags) printf ("\tUNKNOWN_80000000\n");
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 10.
|
|
|
|
*/
|
|
|
|
CMD_DEF(10)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 11.
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Code originally in Yariv Kaplan's NtDriverList,
|
|
|
|
* at http://www.internals.com/, adapted to ReactOS
|
|
|
|
* structures layout.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(11)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
PSYSTEM_MODULE_INFORMATION pInfo = NULL;
|
|
|
|
LONG Length = 0;
|
|
|
|
INT Index;
|
|
|
|
const PCHAR hr =
|
|
|
|
"-------- -------- -------- ---------------------------------------\n";
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Obtain required buffer size
|
|
|
|
*/
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
11,
|
2000-04-25 23:22:57 +00:00
|
|
|
& pInfo,
|
|
|
|
0, /* query size */
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (STATUS_INFO_LENGTH_MISMATCH == Status)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Allocate buffer
|
|
|
|
*/
|
2005-05-07 21:24:31 +00:00
|
|
|
pInfo = GlobalAlloc (GMEM_ZEROINIT, Length);
|
2000-04-25 23:22:57 +00:00
|
|
|
if (NULL == pInfo)
|
|
|
|
{
|
|
|
|
printf ("Could not allocate memory.\n");
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Get module list from ntoskrnl.exe
|
|
|
|
*/
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
11,
|
2000-04-25 23:22:57 +00:00
|
|
|
pInfo,
|
|
|
|
Length,
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
printf ("Index Address Size Name\n");
|
|
|
|
printf (hr);
|
|
|
|
|
|
|
|
for ( Index = 0;
|
|
|
|
(Index < (int) pInfo->Count);
|
|
|
|
Index ++
|
|
|
|
)
|
|
|
|
{
|
|
|
|
printf (
|
2001-07-12 11:58:57 +00:00
|
|
|
"%8lx %8p %8lx %s\n",
|
|
|
|
pInfo->Module[Index].EntryIndex,
|
|
|
|
pInfo->Module[Index].BaseAddress,
|
|
|
|
pInfo->Module[Index].Size,
|
|
|
|
pInfo->Module[Index].Name
|
2000-04-25 23:22:57 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
printf (hr);
|
|
|
|
|
|
|
|
GlobalFree (pInfo);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 12.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(12)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
PSYSTEM_RESOURCE_LOCK_INFO pInfo = NULL;
|
|
|
|
LONG Length = 0;
|
|
|
|
INT Index;
|
|
|
|
const PCHAR hr =
|
|
|
|
"-------- -------- -------- -------- -------- -------- ------------\n";
|
|
|
|
|
|
|
|
pInfo = GlobalAlloc (GMEM_ZEROINIT, BUFFER_SIZE_DEFAULT);
|
|
|
|
/* FIXME: check NULL==pInfo */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Obtain required buffer size
|
|
|
|
*/
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
12,
|
2000-04-25 23:22:57 +00:00
|
|
|
pInfo,
|
|
|
|
BUFFER_SIZE_DEFAULT, /* query size */
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
if (STATUS_INFO_LENGTH_MISMATCH == Status)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Allocate buffer
|
|
|
|
*/
|
2005-05-07 21:24:31 +00:00
|
|
|
pInfo = GlobalReAlloc (pInfo, Length, GMEM_ZEROINIT);
|
2000-04-25 23:22:57 +00:00
|
|
|
if (NULL == pInfo)
|
|
|
|
{
|
|
|
|
printf ("Could not allocate memory.\n");
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
GlobalFree (pInfo);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Get locked resource list from ntoskrnl.exe
|
|
|
|
*/
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
12,
|
2000-04-25 23:22:57 +00:00
|
|
|
pInfo,
|
|
|
|
Length,
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
GlobalFree (pInfo);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
printf ("Address Active # Content# Sh/Wait Exc/Wait\n");
|
|
|
|
printf (hr);
|
|
|
|
|
|
|
|
for ( Index = 0;
|
|
|
|
(Index < (int) pInfo->Count);
|
|
|
|
Index ++
|
|
|
|
)
|
|
|
|
{
|
|
|
|
printf (
|
2001-07-12 11:58:57 +00:00
|
|
|
"%08lx %8ld %8ld %8ld %8ld %08lx\n",
|
2000-04-25 23:22:57 +00:00
|
|
|
pInfo->Lock[Index].ResourceAddress,
|
|
|
|
pInfo->Lock[Index].ActiveCount,
|
|
|
|
pInfo->Lock[Index].ContentionCount,
|
|
|
|
pInfo->Lock[Index].NumberOfSharedWaiters,
|
|
|
|
pInfo->Lock[Index].NumberOfExclusiveWaiters,
|
|
|
|
pInfo->Lock[Index].Unknown
|
|
|
|
);
|
|
|
|
}
|
|
|
|
printf (hr);
|
|
|
|
|
|
|
|
GlobalFree (pInfo);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 13.
|
|
|
|
*/
|
|
|
|
CMD_DEF(13)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 14.
|
|
|
|
*/
|
|
|
|
CMD_DEF(14)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 15.
|
|
|
|
*/
|
|
|
|
CMD_DEF(15)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 16. You can not pass 0 as the initial output buffer's
|
|
|
|
* size to get back the needed buffer size.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(16)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
PSYSTEM_HANDLE_INFORMATION pInfo = NULL;
|
|
|
|
LONG Length = 0;
|
|
|
|
INT Index;
|
|
|
|
const PCHAR hr =
|
2000-05-28 17:44:53 +00:00
|
|
|
"-------- -------- -------- -------- -------- ----------\n";
|
2000-04-27 23:39:49 +00:00
|
|
|
CHAR FlagsString [9] = {0};
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
pInfo = GlobalAlloc (GMEM_ZEROINIT, BUFFER_SIZE_DEFAULT);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Obtain required buffer size
|
|
|
|
*/
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
16,
|
2000-04-25 23:22:57 +00:00
|
|
|
pInfo,
|
|
|
|
BUFFER_SIZE_DEFAULT,
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
if (STATUS_INFO_LENGTH_MISMATCH == Status)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Allocate buffer
|
|
|
|
*/
|
2005-05-07 21:24:31 +00:00
|
|
|
pInfo = GlobalReAlloc (pInfo, Length, GMEM_ZEROINIT);
|
2000-04-25 23:22:57 +00:00
|
|
|
if (NULL == pInfo)
|
|
|
|
{
|
|
|
|
printf ("\tCould not allocate memory.\n");
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
GlobalFree (pInfo);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Get handle table from ntoskrnl.exe
|
|
|
|
*/
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
16,
|
2000-04-25 23:22:57 +00:00
|
|
|
pInfo,
|
|
|
|
Length,
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
GlobalFree (pInfo);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2000-05-28 17:44:53 +00:00
|
|
|
printf ("Handle OwnerPID ObjPtr Access Flags Type\n");
|
2000-04-25 23:22:57 +00:00
|
|
|
printf (hr);
|
|
|
|
|
|
|
|
for ( Index = 0;
|
|
|
|
(Index < (int) pInfo->Count);
|
|
|
|
Index ++
|
|
|
|
)
|
|
|
|
{
|
|
|
|
printf (
|
2001-07-12 11:58:57 +00:00
|
|
|
"%8x %8lx %8p %8lx %s %s\n",
|
2000-04-25 23:22:57 +00:00
|
|
|
pInfo->Handle[Index].HandleValue,
|
|
|
|
pInfo->Handle[Index].OwnerPid,
|
|
|
|
pInfo->Handle[Index].ObjectPointer,
|
2000-04-27 23:39:49 +00:00
|
|
|
pInfo->Handle[Index].AccessMask,
|
|
|
|
ByteToBinaryString (
|
|
|
|
pInfo->Handle[Index].HandleFlags,
|
|
|
|
FlagsString
|
2000-05-28 17:44:53 +00:00
|
|
|
),
|
|
|
|
HandleTypeToObjectName (pInfo->Handle[Index].ObjectType)
|
2000-04-25 23:22:57 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
printf (hr);
|
|
|
|
|
|
|
|
DumpData (Length, pInfo);
|
|
|
|
|
|
|
|
GlobalFree (pInfo);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 17.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(17)
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 18.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(18)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
PSYSTEM_PAGEFILE_INFORMATION pInfo = NULL;
|
|
|
|
LONG Length = 0;
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
pInfo = GlobalAlloc (GMEM_ZEROINIT, BUFFER_SIZE_DEFAULT);
|
|
|
|
/* FIXME: check pInfo */
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
Status = NtQuerySystemInformation(
|
2001-01-13 18:17:17 +00:00
|
|
|
18,
|
2000-04-25 23:22:57 +00:00
|
|
|
pInfo,
|
|
|
|
BUFFER_SIZE_DEFAULT,
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
if (STATUS_INFO_LENGTH_MISMATCH == Status)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Allocate buffer
|
|
|
|
*/
|
2005-05-07 21:24:31 +00:00
|
|
|
pInfo = GlobalReAlloc (pInfo, Length, GMEM_ZEROINIT);
|
2000-04-25 23:22:57 +00:00
|
|
|
if (NULL == pInfo)
|
|
|
|
{
|
|
|
|
printf ("Could not allocate memory.\n");
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
GlobalFree (pInfo);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
18,
|
2000-04-25 23:22:57 +00:00
|
|
|
pInfo,
|
|
|
|
Length,
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
GlobalFree (pInfo);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
2001-01-13 18:17:17 +00:00
|
|
|
wprintf (L" \"%s\":\n", pInfo->PagefileFileName.Buffer);
|
|
|
|
wprintf (L"\tRelativeOffset %08x\n", pInfo->RelativeOffset);
|
|
|
|
wprintf (L"\tCurrentSizePages %ld\n", pInfo->CurrentSizePages);
|
|
|
|
wprintf (L"\tTotalUsedPages %ld\n", pInfo->TotalUsedPages);
|
|
|
|
wprintf (L"\tPeakUsedPages %ld\n", pInfo->PeakUsedPages);
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
if (0 == pInfo->RelativeOffset)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
printf ("\n");
|
|
|
|
(ULONG) pInfo += pInfo->RelativeOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
DumpData (Length, pInfo);
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
GlobalFree (pInfo);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 19.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(19)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
SYSTEM_VDM_INFORMATION Info;
|
|
|
|
|
|
|
|
RtlZeroMemory (& Info, sizeof Info);
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
19,
|
2000-04-25 23:22:57 +00:00
|
|
|
& Info,
|
|
|
|
sizeof Info,
|
|
|
|
NULL
|
|
|
|
);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2001-01-13 18:17:17 +00:00
|
|
|
printf (" VdmSegmentNotPresentCount = %ld\n", Info.VdmSegmentNotPresentCount);
|
|
|
|
printf (" VdmINSWCount = %ld\n", Info.VdmINSWCount);
|
|
|
|
printf (" VdmESPREFIXCount = %ld\n", Info.VdmESPREFIXCount);
|
|
|
|
printf (" VdmCSPREFIXCount = %ld\n", Info.VdmCSPREFIXCount);
|
|
|
|
printf (" VdmSSPREFIXCount = %ld\n", Info.VdmSSPREFIXCount);
|
|
|
|
printf (" VdmDSPREFIXCount = %ld\n", Info.VdmDSPREFIXCount);
|
|
|
|
printf (" VdmFSPREFIXCount = %ld\n", Info.VdmFSPREFIXCount);
|
|
|
|
printf (" VdmGSPREFIXCount = %ld\n", Info.VdmGSPREFIXCount);
|
|
|
|
printf (" VdmOPER32PREFIXCount = %ld\n", Info.VdmOPER32PREFIXCount);
|
|
|
|
printf (" VdmADDR32PREFIXCount = %ld\n", Info.VdmADDR32PREFIXCount);
|
|
|
|
printf (" VdmINSBCount = %ld\n", Info.VdmINSBCount);
|
|
|
|
printf (" VdmINSWV86Count = %ld\n", Info.VdmINSWV86Count);
|
|
|
|
printf (" VdmOUTSBCount = %ld\n", Info.VdmOUTSBCount);
|
|
|
|
printf (" VdmOUTSWCount = %ld\n", Info.VdmOUTSWCount);
|
|
|
|
printf (" VdmPUSHFCount = %ld\n", Info.VdmPUSHFCount);
|
|
|
|
printf (" VdmPOPFCount = %ld\n", Info.VdmPOPFCount);
|
|
|
|
printf (" VdmINTNNCount = %ld\n", Info.VdmINTNNCount);
|
|
|
|
printf (" VdmINTOCount = %ld\n", Info.VdmINTOCount);
|
|
|
|
printf (" VdmIRETCount = %ld\n", Info.VdmIRETCount);
|
|
|
|
printf (" VdmINBIMMCount = %ld\n", Info.VdmINBIMMCount);
|
|
|
|
printf (" VdmINWIMMCount = %ld\n", Info.VdmINWIMMCount);
|
|
|
|
printf (" VdmOUTBIMMCount = %ld\n", Info.VdmOUTBIMMCount);
|
|
|
|
printf (" VdmOUTWIMMCount = %ld\n", Info.VdmOUTWIMMCount);
|
|
|
|
printf (" VdmINBCount = %ld\n", Info.VdmINBCount);
|
|
|
|
printf (" VdmINWCount = %ld\n", Info.VdmINWCount);
|
|
|
|
printf (" VdmOUTBCount = %ld\n", Info.VdmOUTBCount);
|
|
|
|
printf (" VdmOUTWCount = %ld\n", Info.VdmOUTWCount);
|
|
|
|
printf (" VdmLOCKPREFIXCount = %ld\n", Info.VdmLOCKPREFIXCount);
|
|
|
|
printf (" VdmREPNEPREFIXCount = %ld\n", Info.VdmREPNEPREFIXCount);
|
|
|
|
printf (" VdmREPPREFIXCount = %ld\n", Info.VdmREPPREFIXCount);
|
|
|
|
printf (" VdmHLTCount = %ld\n", Info.VdmHLTCount);
|
|
|
|
printf (" VdmCLICount = %ld\n", Info.VdmCLICount);
|
|
|
|
printf (" VdmSTICount = %ld\n", Info.VdmSTICount);
|
|
|
|
printf (" VdmBopCount = %ld\n", Info.VdmBopCount);
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 20.
|
|
|
|
*/
|
|
|
|
CMD_DEF(20)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 21.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(21)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
SYSTEM_CACHE_INFORMATION Si;
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
RtlZeroMemory (
|
|
|
|
(PVOID) & Si,
|
|
|
|
sizeof Si
|
|
|
|
);
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
21,
|
2000-04-25 23:22:57 +00:00
|
|
|
& Si,
|
|
|
|
sizeof Si,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
printf ("\tSize:\n");
|
|
|
|
printf ("\t\tCurrent = %ld\n", Si.CurrentSize);
|
|
|
|
printf ("\t\tPeak = %ld\n\n", Si.PeakSize);
|
|
|
|
printf ("\tPageFaults:\n\t\tCount = %ld\n\n", Si.PageFaultCount);
|
|
|
|
printf ("\tWorking Set:\n");
|
|
|
|
printf ("\t\tMinimum = %ld\n", Si.MinimumWorkingSet );
|
|
|
|
printf ("\t\tMaximum = %ld\n", Si.MaximumWorkingSet );
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
* Get statistic data about tagged pools. Not implemented in the
|
|
|
|
* free build.
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 22.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(22)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
PSYSTEM_POOL_TAG_INFO pInfo = NULL;
|
|
|
|
ULONG Length;
|
|
|
|
ULONG PoolIndex;
|
|
|
|
|
|
|
|
pInfo = GlobalAlloc (GMEM_ZEROINIT, BUFFER_SIZE_DEFAULT);
|
|
|
|
/* FIXME: check pInfo */
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
Status = NtQuerySystemInformation(
|
2001-01-13 18:17:17 +00:00
|
|
|
22,
|
2000-04-25 23:22:57 +00:00
|
|
|
pInfo,
|
|
|
|
BUFFER_SIZE_DEFAULT,
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
if (STATUS_INFO_LENGTH_MISMATCH == Status)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Allocate buffer
|
|
|
|
*/
|
2005-05-07 21:24:31 +00:00
|
|
|
pInfo = GlobalReAlloc (pInfo, Length, GMEM_ZEROINIT);
|
2000-04-25 23:22:57 +00:00
|
|
|
if (NULL == pInfo)
|
|
|
|
{
|
|
|
|
printf ("Could not allocate memory.\n");
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
GlobalFree (pInfo);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
22,
|
2000-04-25 23:22:57 +00:00
|
|
|
pInfo,
|
|
|
|
Length,
|
|
|
|
& Length
|
|
|
|
);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
GlobalFree (pInfo);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( PoolIndex = 0;
|
|
|
|
(PoolIndex < pInfo->Count);
|
|
|
|
PoolIndex ++
|
|
|
|
)
|
|
|
|
{
|
|
|
|
wprintf (L"\t%08x:\n", pInfo->PoolEntry[PoolIndex].Tag);
|
|
|
|
wprintf (L"\t\tPaged:\t\tNon Paged:\n");
|
|
|
|
wprintf (
|
|
|
|
L"\t\tAllocationCount = %ld\tAllocationCount = %ld\n",
|
|
|
|
pInfo->PoolEntry[PoolIndex].Paged.AllocationCount,
|
|
|
|
pInfo->PoolEntry[PoolIndex].NonPaged.AllocationCount
|
|
|
|
);
|
|
|
|
wprintf (
|
|
|
|
L"\t\tFreeCount = %ld\tFreeCount = %ld\n",
|
|
|
|
pInfo->PoolEntry[PoolIndex].Paged.FreeCount,
|
|
|
|
pInfo->PoolEntry[PoolIndex].NonPaged.FreeCount
|
|
|
|
);
|
|
|
|
wprintf (
|
|
|
|
L"\t\tSizeBytes = %ld\tSizeBytes = %ld\n",
|
|
|
|
pInfo->PoolEntry[PoolIndex].Paged.SizeBytes,
|
|
|
|
pInfo->PoolEntry[PoolIndex].NonPaged.SizeBytes
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
DumpData (Length, pInfo);
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
GlobalFree (pInfo);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 23.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(23)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
SYSTEM_PROCESSOR_SCHEDULE_INFO Info;
|
|
|
|
|
|
|
|
RtlZeroMemory (
|
|
|
|
& Info,
|
|
|
|
sizeof Info
|
|
|
|
);
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
23,
|
2000-04-25 23:22:57 +00:00
|
|
|
& Info,
|
|
|
|
sizeof Info,
|
|
|
|
NULL
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
printf ("\tnContextSwitches = %ld\n", Info.nContextSwitches);
|
|
|
|
printf ("\tnDPCQueued = %ld\n", Info.nDPCQueued);
|
|
|
|
printf ("\tnDPCRate = %ld\n", Info.nDPCRate);
|
|
|
|
printf ("\tTimerResolution = %ld\n", Info.TimerResolution);
|
|
|
|
printf ("\tnDPCBypasses = %ld\n", Info.nDPCBypasses);
|
|
|
|
printf ("\tnAPCBypasses = %ld\n", Info.nAPCBypasses);
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
DumpData (sizeof Info, & Info);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 24.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(24)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
SYSTEM_DPC_INFORMATION Info;
|
|
|
|
|
|
|
|
RtlZeroMemory (
|
|
|
|
& Info,
|
|
|
|
sizeof Info
|
|
|
|
);
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
24,
|
2000-04-25 23:22:57 +00:00
|
|
|
& Info,
|
|
|
|
sizeof Info,
|
|
|
|
NULL
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Application.Flag.Verbose)
|
|
|
|
{
|
|
|
|
printf ("\tUnused = %ld\n", Info.Unused);
|
|
|
|
}
|
|
|
|
printf ("\tKiMaximumDpcQueueDepth = %ld\n", Info.KiMaximumDpcQueueDepth);
|
|
|
|
printf ("\tKiMinimumDpcRate = %ld\n", Info.KiMinimumDpcRate);
|
|
|
|
printf ("\tKiAdjustDpcThreshold = %ld\n", Info.KiAdjustDpcThreshold);
|
|
|
|
printf ("\tKiIdealDpcRate = %ld\n", Info.KiIdealDpcRate);
|
|
|
|
|
|
|
|
DumpData (sizeof Info, & Info);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 25.
|
|
|
|
*/
|
|
|
|
CMD_DEF(25)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 26.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(26)
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 27.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(27)
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 28.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(28)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
2001-07-12 11:58:57 +00:00
|
|
|
SYSTEM_QUERY_TIME_ADJUSTMENT Info;
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
RtlZeroMemory (& Info, sizeof Info);
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
28,
|
2000-04-25 23:22:57 +00:00
|
|
|
& Info,
|
|
|
|
sizeof Info,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2001-07-12 11:58:57 +00:00
|
|
|
printf ("\tKeTimeAdjustment = %ld\n", Info.TimeAdjustment);
|
|
|
|
printf ("\tKeMaximumIncrement = %ld\n", Info.MaximumIncrement);
|
|
|
|
printf ("\tKeTimeSynchronization = %s\n", TF(Info.TimeSynchronization));
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 29.
|
|
|
|
*/
|
|
|
|
CMD_DEF(29)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 30.
|
|
|
|
*/
|
|
|
|
CMD_DEF(30)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 31.
|
|
|
|
*/
|
|
|
|
CMD_DEF(31)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 32.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(32)
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 33.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(33)
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 34.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(34)
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 35.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(35)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
SYSTEM_DEBUGGER_INFO Info;
|
|
|
|
|
|
|
|
RtlZeroMemory (& Info, sizeof Info);
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
35,
|
2000-04-25 23:22:57 +00:00
|
|
|
& Info,
|
|
|
|
sizeof Info,
|
|
|
|
NULL
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
printf ("\tKdDebuggerEnabled = %s\n", TF(Info.KdDebuggerEnabled));
|
|
|
|
printf ("\tKdDebuggerPresent = %s\n", TF(Info.KdDebuggerPresent));
|
|
|
|
|
|
|
|
DumpData (sizeof Info, & Info);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 36.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(36)
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 37.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(37)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
SYSTEM_QUOTA_INFORMATION Info;
|
|
|
|
|
|
|
|
RtlZeroMemory (& Info, sizeof Info);
|
|
|
|
Status = NtQuerySystemInformation (
|
2001-01-13 18:17:17 +00:00
|
|
|
37,
|
2000-04-25 23:22:57 +00:00
|
|
|
& Info,
|
|
|
|
sizeof Info,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
printf ("\tCmpGlobalQuota = %ld\n", Info.CmpGlobalQuota);
|
|
|
|
printf ("\tCmpGlobalQuotaUsed = %ld\n", Info.CmpGlobalQuotaUsed);
|
|
|
|
printf ("\tMmSizeofPagedPoolInBytes = %ld\n", Info.MmSizeofPagedPoolInBytes);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 38.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(38)
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 39.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(39)
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 40.
|
|
|
|
*/
|
|
|
|
CMD_DEF(40)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 41.
|
|
|
|
*/
|
|
|
|
CMD_DEF(41)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 42.
|
|
|
|
*/
|
|
|
|
CMD_DEF(42)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 43.
|
|
|
|
*/
|
|
|
|
CMD_DEF(43)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
* Dump the system TIME_ZONE_INFORMATION object.
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 44.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(44)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
2001-01-14 20:16:37 +00:00
|
|
|
SYSTEM_TIME_ZONE_INFORMATION Tzi;
|
2000-04-25 23:22:57 +00:00
|
|
|
WCHAR Name [33];
|
|
|
|
|
|
|
|
RtlZeroMemory (& Tzi, sizeof Tzi);
|
|
|
|
Status = NtQuerySystemInformation(
|
2001-01-14 20:16:37 +00:00
|
|
|
44,
|
2000-04-25 23:22:57 +00:00
|
|
|
& Tzi,
|
|
|
|
sizeof Tzi,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
PrintStatus (Status);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
printf (
|
2001-07-12 11:58:57 +00:00
|
|
|
" Bias........: %ld'\n",
|
2000-04-25 23:22:57 +00:00
|
|
|
Tzi.Bias /* LONG */
|
|
|
|
);
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2001-01-14 20:16:37 +00:00
|
|
|
printf (" Standard\n");
|
2000-04-25 23:22:57 +00:00
|
|
|
RtlZeroMemory (
|
|
|
|
(PVOID) Name,
|
|
|
|
sizeof Name
|
|
|
|
);
|
|
|
|
lstrcpynW (
|
|
|
|
Name,
|
|
|
|
Tzi.StandardName, /* WCHAR [32] */
|
|
|
|
32
|
|
|
|
);
|
|
|
|
wprintf (
|
|
|
|
L"\tName: \"%s\"\n",
|
|
|
|
Name
|
|
|
|
);
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
PrintUtcDateTime (
|
|
|
|
"\tDate: %s\n",
|
2001-01-14 20:16:37 +00:00
|
|
|
(PTIME) & Tzi.StandardDate /* SYSTEMTIME */
|
2000-04-25 23:22:57 +00:00
|
|
|
);
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2001-07-12 11:58:57 +00:00
|
|
|
printf ("\tBias: %ld'\n",
|
2000-04-25 23:22:57 +00:00
|
|
|
Tzi.StandardBias /* LONG */
|
|
|
|
);
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2001-01-14 20:16:37 +00:00
|
|
|
printf (" Daylight\n");
|
2000-04-25 23:22:57 +00:00
|
|
|
RtlZeroMemory (
|
|
|
|
(PVOID) Name,
|
|
|
|
sizeof Name
|
|
|
|
);
|
|
|
|
lstrcpynW (
|
|
|
|
Name,
|
2005-05-07 21:24:31 +00:00
|
|
|
Tzi.DaylightName, /* WCHAR [32] */
|
2000-04-25 23:22:57 +00:00
|
|
|
32
|
|
|
|
);
|
|
|
|
wprintf (
|
|
|
|
L"\tName: \"%s\"\n",
|
|
|
|
Name
|
|
|
|
);
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
PrintUtcDateTime (
|
|
|
|
"\tDate: %s\n",
|
2005-05-07 21:24:31 +00:00
|
|
|
(PTIME) & Tzi.DaylightDate /* SYSTEMTIME */
|
2000-04-25 23:22:57 +00:00
|
|
|
);
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
printf (
|
2001-07-12 11:58:57 +00:00
|
|
|
"\tBias: %ld'\n",
|
2005-05-07 21:24:31 +00:00
|
|
|
Tzi.DaylightBias /* LONG */
|
2000-04-25 23:22:57 +00:00
|
|
|
);
|
2001-01-14 20:16:37 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2000-04-25 23:22:57 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 45.
|
|
|
|
*/
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_DEF(45)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2001-01-13 18:17:17 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 46.
|
|
|
|
*/
|
|
|
|
CMD_DEF(46)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2001-01-13 18:17:17 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 47.
|
|
|
|
*/
|
|
|
|
CMD_DEF(47)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2001-01-13 18:17:17 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 48.
|
|
|
|
*/
|
|
|
|
CMD_DEF(48)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2001-01-13 18:17:17 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 49.
|
|
|
|
*/
|
|
|
|
CMD_DEF(49)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2001-01-13 18:17:17 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 50.
|
|
|
|
*/
|
|
|
|
CMD_DEF(50)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2001-01-13 18:17:17 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 51.
|
|
|
|
*/
|
|
|
|
CMD_DEF(51)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2001-01-13 18:17:17 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 52.
|
|
|
|
*/
|
|
|
|
CMD_DEF(52)
|
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2005-05-07 21:24:31 +00:00
|
|
|
*
|
2001-01-13 18:17:17 +00:00
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Class 53.
|
|
|
|
*/
|
|
|
|
CMD_DEF(53)
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_NOT_IMPLEMENTED
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* Miscellanea Commands
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
CMD_DEF(ver)
|
|
|
|
{
|
|
|
|
INT Total = 0;
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
Total =
|
|
|
|
printf (
|
|
|
|
"ReactOS Operating System - http://www.reactos.com/\n"
|
|
|
|
"QSI - Query System Information (compiled on %s, %s)\n"
|
2001-01-13 18:17:17 +00:00
|
|
|
"Copyright (c) 1999-2001 Emanuele Aliberti et alii\n\n"
|
|
|
|
"Run the command in verbose mode, for full license information.\n\n",
|
2000-04-25 23:22:57 +00:00
|
|
|
__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;
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
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"
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
"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"
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
"Undocumented Windows NT:\n"
|
|
|
|
"\tPrasad Dabak, Sandeep Phadke, and Milind Borate\n\n"
|
|
|
|
|
|
|
|
"Windows NT/2000 Native API Reference:\n"
|
2000-04-27 23:39:49 +00:00
|
|
|
"\tGary Nebbett\n\n"
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
"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 */
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
{ /* 0 Q */
|
|
|
|
"basic",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(0),
|
2000-04-25 23:22:57 +00:00
|
|
|
"Basic system information"
|
|
|
|
},
|
|
|
|
{ /* 1 Q */
|
2005-05-07 21:24:31 +00:00
|
|
|
"processor",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(1),
|
2000-04-25 23:22:57 +00:00
|
|
|
"Processor characteristics"
|
|
|
|
},
|
|
|
|
{ /* 2 Q */
|
2005-05-07 21:24:31 +00:00
|
|
|
"perf",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(2),
|
2000-04-25 23:22:57 +00:00
|
|
|
"System performance data"
|
|
|
|
},
|
|
|
|
{ /* 3 Q */
|
|
|
|
"time",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(3),
|
2000-04-25 23:22:57 +00:00
|
|
|
"System times"
|
|
|
|
},
|
2001-01-13 18:17:17 +00:00
|
|
|
{ /* 4 Q (checked build only) */
|
2000-04-25 23:22:57 +00:00
|
|
|
"path",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(4),
|
|
|
|
"Path (checked build only)"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 5 Q */
|
|
|
|
"process",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(5),
|
2000-04-25 23:22:57 +00:00
|
|
|
"Process & thread tables"
|
|
|
|
},
|
|
|
|
{ /* 6 Q */
|
2001-01-13 18:17:17 +00:00
|
|
|
"callcount",
|
|
|
|
CMD_REF(6),
|
|
|
|
"Call count information"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 7 Q */
|
2001-01-13 18:17:17 +00:00
|
|
|
"device",
|
|
|
|
CMD_REF(7),
|
2000-04-25 23:22:57 +00:00
|
|
|
"I/O devices in the system, by class"
|
|
|
|
},
|
|
|
|
{ /* 8 Q */
|
2001-01-13 18:17:17 +00:00
|
|
|
"performance",
|
|
|
|
CMD_REF(8),
|
|
|
|
"Processor performance"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 9 QS */
|
2001-01-13 18:17:17 +00:00
|
|
|
"flags",
|
|
|
|
CMD_REF(9),
|
|
|
|
"System wide flags"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 10 */
|
2001-01-13 18:17:17 +00:00
|
|
|
"call",
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_REF(10),
|
2001-01-13 18:17:17 +00:00
|
|
|
"Call time"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 11 Q */
|
|
|
|
"module",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(11),
|
2000-04-25 23:22:57 +00:00
|
|
|
"Table of kernel modules"
|
|
|
|
},
|
|
|
|
{ /* 12 Q */
|
2001-01-13 18:17:17 +00:00
|
|
|
"locks",
|
|
|
|
CMD_REF(12),
|
2000-04-25 23:22:57 +00:00
|
|
|
"Table of locks on resources"
|
|
|
|
},
|
|
|
|
{ /* 13 */
|
2001-01-13 18:17:17 +00:00
|
|
|
"stack",
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_REF(13),
|
2001-01-13 18:17:17 +00:00
|
|
|
"Stack trace"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 14 */
|
2001-01-13 18:17:17 +00:00
|
|
|
"ppool",
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_REF(14),
|
2001-01-13 18:17:17 +00:00
|
|
|
"Paged pool"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 15 */
|
2001-01-13 18:17:17 +00:00
|
|
|
"nppool",
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_REF(15),
|
2001-01-13 18:17:17 +00:00
|
|
|
"Non paged pool"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 16 Q */
|
|
|
|
"handle",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(16),
|
|
|
|
"Table of handles"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 17 Q */
|
|
|
|
"object",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(17),
|
|
|
|
"Table of executive objects"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 18 Q */
|
|
|
|
"pagefile",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(18),
|
|
|
|
"Virtual memory paging files"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 19 Q */
|
2001-01-13 18:17:17 +00:00
|
|
|
"vdmie",
|
|
|
|
CMD_REF(19),
|
2000-04-25 23:22:57 +00:00
|
|
|
"Virtual DOS Machine instruction emulation (VDM)"
|
|
|
|
},
|
|
|
|
{ /* 20 */
|
2001-01-13 18:17:17 +00:00
|
|
|
"vdmbop",
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_REF(20),
|
2001-01-13 18:17:17 +00:00
|
|
|
"Bop (VDM)"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 21 QS */
|
2005-05-07 21:24:31 +00:00
|
|
|
"cache",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(21),
|
|
|
|
"File cache"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 22 Q */
|
|
|
|
"pooltag",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(22),
|
2000-04-25 23:22:57 +00:00
|
|
|
"Tagged pools statistics (checked build only)"
|
|
|
|
},
|
|
|
|
{ /* 23 Q */
|
2001-01-13 18:17:17 +00:00
|
|
|
"int",
|
|
|
|
CMD_REF(23),
|
|
|
|
"Processor schedule information (interrupt)"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 24 QS */
|
|
|
|
"dpc",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(24),
|
|
|
|
"Deferred procedure call behaviour (DPC)"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 25 */
|
2001-01-13 18:17:17 +00:00
|
|
|
"fullmem",
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_REF(25),
|
2001-01-13 18:17:17 +00:00
|
|
|
"Full memory"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 26 S (callable) */
|
|
|
|
"loadpe",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(26),
|
|
|
|
"Load a kernel mode DLL (module in PE format)"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 27 S (callable) */
|
|
|
|
"unloadpe",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(27),
|
|
|
|
"Unload a kernel mode DLL (module in Pe format)"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 28 QS */
|
|
|
|
"timeadj",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(28),
|
2000-04-25 23:22:57 +00:00
|
|
|
"Time adjustment"
|
|
|
|
},
|
|
|
|
{ /* 29 */
|
2001-01-13 18:17:17 +00:00
|
|
|
"smem",
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_REF(29),
|
2001-01-13 18:17:17 +00:00
|
|
|
"Summary memory"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 30 */
|
2001-01-13 18:17:17 +00:00
|
|
|
"event",
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_REF(30),
|
2001-01-13 18:17:17 +00:00
|
|
|
"Next event ID"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 31 */
|
2001-01-13 18:17:17 +00:00
|
|
|
"events",
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_REF(31),
|
2001-01-13 18:17:17 +00:00
|
|
|
"Event IDs"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 32 Q */
|
2001-01-13 18:17:17 +00:00
|
|
|
"crash",
|
|
|
|
CMD_REF(32),
|
2000-04-25 23:22:57 +00:00
|
|
|
"Crash Dump Section"
|
|
|
|
},
|
|
|
|
{ /* 33 Q */
|
2001-01-13 18:17:17 +00:00
|
|
|
"exceptions",
|
|
|
|
CMD_REF(33),
|
|
|
|
"Exceptions"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 34 Q */
|
|
|
|
"crashstate",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(34),
|
2000-04-25 23:22:57 +00:00
|
|
|
"Crash Dump State"
|
|
|
|
},
|
|
|
|
{ /* 35 Q */
|
|
|
|
"debugger",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(35),
|
|
|
|
"Kernel debugger"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 36 Q */
|
2001-01-13 18:17:17 +00:00
|
|
|
"cswitch",
|
|
|
|
CMD_REF(36),
|
|
|
|
"Thread context switch counters"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 37 QS */
|
2001-01-13 18:17:17 +00:00
|
|
|
"regquota",
|
|
|
|
CMD_REF(37),
|
|
|
|
"Registry quota values"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 38 S */
|
2001-01-13 18:17:17 +00:00
|
|
|
"est",
|
|
|
|
CMD_REF(38),
|
|
|
|
"Extended service table"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 39 S */
|
|
|
|
"prisep",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(39),
|
2000-04-25 23:22:57 +00:00
|
|
|
"Priority Separation"
|
|
|
|
},
|
|
|
|
{ /* 40 */
|
2001-01-13 18:17:17 +00:00
|
|
|
"ppbus",
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_REF(40),
|
2001-01-13 18:17:17 +00:00
|
|
|
"Plug & play bus"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 41 */
|
2001-01-13 18:17:17 +00:00
|
|
|
"dock",
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_REF(41),
|
2001-01-13 18:17:17 +00:00
|
|
|
"Dock"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 42 */
|
2001-01-13 18:17:17 +00:00
|
|
|
"power",
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_REF(42),
|
2001-01-13 18:17:17 +00:00
|
|
|
"Power"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 43 */
|
2001-01-13 18:17:17 +00:00
|
|
|
"procspeed",
|
2000-04-25 23:22:57 +00:00
|
|
|
CMD_REF(43),
|
2001-01-13 18:17:17 +00:00
|
|
|
"Processor speed"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 44 QS */
|
|
|
|
"tz",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(44),
|
|
|
|
"Current time zone (TZ)"
|
2000-04-25 23:22:57 +00:00
|
|
|
},
|
|
|
|
{ /* 45 Q */
|
|
|
|
"lookaside",
|
2001-01-13 18:17:17 +00:00
|
|
|
CMD_REF(45),
|
2000-04-25 23:22:57 +00:00
|
|
|
"Lookaside"
|
|
|
|
},
|
2001-01-13 18:17:17 +00:00
|
|
|
/* 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)"
|
|
|
|
},
|
2000-04-25 23:22:57 +00:00
|
|
|
/* 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"
|
|
|
|
},
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
{ 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");
|
|
|
|
}
|
|
|
|
}
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
}
|
|
|
|
if (! Application.Flag.Batch)
|
|
|
|
{
|
|
|
|
printf ("Bye\n");
|
|
|
|
}
|
|
|
|
return (EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|