?? getsys.dpr
字號:
program GetSys;
{$APPTYPE CONSOLE}
uses
Windows,
Classes,
SysUtils,
MSI_Console,
MiTeC_Routines,
MiTeC_AccountsNT,
MiTeC_Datetime,
MSI_Network,
MiTeC_StrUtils,
MSI_Storage,
MiTeC_WinIOCTL,
MSI_Processes,
MSI_Devices,
MSI_Common,
MSI_CPU,
MiTeC_USB,
MSI_XML_Reports;
var
hConsole: THandle;
ScreenBuffer: TConsoleScreenBufferInfo;
SavePath: string;
const
FOREGROUND_SILVER = FOREGROUND_RED or FOREGROUND_BLUE or FOREGROUND_GREEN;
FOREGROUND_WHITE = FOREGROUND_RED or FOREGROUND_BLUE or FOREGROUND_GREEN or FOREGROUND_INTENSITY;
FOREGROUND_YELLOW = FOREGROUND_RED or FOREGROUND_GREEN or FOREGROUND_INTENSITY;
FOREGROUND_OLIVE = FOREGROUND_RED or FOREGROUND_GREEN;
FOREGROUND_CYAN = FOREGROUND_BLUE or FOREGROUND_GREEN or FOREGROUND_INTENSITY;
FOREGROUND_TEAL = FOREGROUND_BLUE or FOREGROUND_GREEN;
function Switch(Aparam: string): Boolean;
begin
Result:=FindCmdLineSwitch(AParam,['\','/','-'],True);
end;
procedure WriteLine(AText1: string; AAttr1: Cardinal; AText2: string; AAttr2: Cardinal);
begin
SetConsoleTextAttribute(hConsole,AAttr1);
Write(AText1);
SetConsoleTextAttribute(hConsole,AAttr2);
WriteLn(AText2);
SetConsoleTextAttribute(hConsole, FOREGROUND_SILVER);
end;
procedure Separator;
begin
SetConsoleTextAttribute(hConsole, FOREGROUND_INTENSITY);
Writeln(stringofchar('-',79));
SetConsoleTextAttribute(hConsole, FOREGROUND_SILVER);
end;
procedure SystemOverview;
var
i,j,k,c: integer;
s,d,ad: string;
b: Boolean;
begin
with TMSIC_Console.Create([soMachine,soCPU,soOS,soDisplay,soMonitor,soDisk,soMemory,soUSB,soNetwork,soPrinters,soDevices,soStorage,soMedia]) do begin
try
try
SetConsoleTextAttribute(hConsole, FOREGROUND_WHITE or BACKGROUND_INTENSITY);
Write('SYSTEM OVERVIEW...');
RefreshData;
Write('OK');
GetConsoleScreenBufferInfo(hConsole,ScreenBuffer);
Write(StringOfChar(#32,ScreenBuffer.dwSize.X-ScreenBuffer.dwCursorPosition.X-1));
SetConsoleTextAttribute(hConsole, FOREGROUND_SILVER);
writeln;
WriteLine('Machine: ',FOREGROUND_SILVER,Machine.MachineName,FOREGROUND_YELLOW);
WriteLine('System : ',FOREGROUND_SILVER,Machine.Computer,FOREGROUND_OLIVE);
WriteLine('Model : ',FOREGROUND_SILVER,Trim(Format('%s %s',[Trim(Machine.SMBIOS.SystemManufacturer),
Trim(Machine.SMBIOS.SystemModel)])),FOREGROUND_OLIVE);
WriteLine('UpTime : ',FOREGROUND_SILVER,formatseconds(Machine.SystemUpTime,true,false,False),FOREGROUND_OLIVE);
Separator;
if Trim(CPU.CPUName)='' then
s:=Trim(CPU.MarketingName)
else
s:=Format('%s %s',[cVendorNames[CPU.Vendor].Prefix,CPU.CPUName]);
WriteLine('CPU : ',FOREGROUND_SILVER,Format('%d x %s - %d MHz',[CPU.CPUPhysicalCount,s,CPU.Frequency]),FOREGROUND_YELLOW);
with CPU.Cache do
WriteLine('Cache: ',FOREGROUND_SILVER,Format('%d KB L1 + %d KB L2 + %d KB L3',[Level1.Code.Size+Level1.Data.Size,Level2.Size,Level3.Size]),FOREGROUND_OLIVE);
WriteLine('Number of cores: ',FOREGROUND_SILVER,Format('%d',[CPU.CorePerPackage*CPU.CPUPhysicalCount]),FOREGROUND_OLIVE);
WriteLine('Number of threads: ',FOREGROUND_SILVER,Format('%d',[CPU.LogicalPerPackage*CPU.CPUPhysicalCount]),FOREGROUND_OLIVE);
Separator;
WriteLine('Mainboard: ',FOREGROUND_SILVER,Trim(Format('%s %s',[Trim(Machine.SMBIOS.MainBoardManufacturer),
Trim(Machine.SMBIOS.MainBoardModel)])),FOREGROUND_YELLOW);
WriteLine('Memory : ',FOREGROUND_SILVER,Format('%d MB',[Memory.PhysicalTotal shr 20]),FOREGROUND_OLIVE);
Separator;
WriteLine('Operating system: ',FOREGROUND_SILVER,Format('%s %s [%d.%d.%d]',[OS.OSName,
OS.OSEdition,
OS.MajorVersion,
OS.MinorVersion,
OS.BuildNumber]),FOREGROUND_YELLOW);
if IsNT then
WriteLine('Service pack : ',FOREGROUND_SILVER,Format('%d.%d',[OS.NTSpecific.ServicePackMajorVersion,OS.NTSpecific.ServicePackMinorVersion]),FOREGROUND_OLIVE);
WriteLine('Logged user : ',FOREGROUND_SILVER,Machine.User,FOREGROUND_OLIVE);
Separator;
WriteLine('Display adapter: ',FOREGROUND_SILVER,Display.Adapter,FOREGROUND_YELLOW);
WriteLine('Memory : ',FOREGROUND_SILVER,Format('%d MB',[Display.Memory shr 20]),FOREGROUND_OLIVE);
Separator;
c:=0;
for i:=0 to Monitor.Count-1 do begin
WriteLine('Monitor: ',FOREGROUND_SILVER,Format('%s %s',[Monitor.Monitors[i].Name,Monitor.Monitors[0].ProductNumber]),FOREGROUND_YELLOW);
WriteLine('Dim : ',FOREGROUND_SILVER,Format('(%dx%d)cm',[Monitor.Monitors[i].Width,Monitor.Monitors[0].Height]),FOREGROUND_OLIVE);
Inc(c);
end;
if c>0 then
Separator;
Disk.RefreshData;
ad:=Disk.AvailableDisks;
d:='';
with Storage do
for i:=0 to PhysicalCount-1 do begin
case Physical[i].DeviceType of
FILE_DEVICE_DISK: if Physical[i].Removable then
s:='Removable: '
else
s:='Fixed : ';
FILE_DEVICE_CD_ROM: s:='CD-ROM : ';
FILE_DEVICE_DVD: s:='DVD : ';
FILE_DEVICE_TAPE: s:='Tape : ';
end;
WriteLine(s,FOREGROUND_SILVER,Trim(Format('%s - %d MB (%s)',[Physical[i].Model,Physical[i].Size shr 20,GetStorageBusTypeStr(Physical[i].BusType)])),FOREGROUND_YELLOW);
for j:=0 to LogicalCount-1 do
with Logical[j] do
if PhysicalIndex=i then begin
d:=d+Copy(Drive,1,1);
if not(DeviceType in [FILE_DEVICE_CD_ROM,FILE_DEVICE_DVD, FILE_DEVICE_TAPE,FILE_DEVICE_UNKNOWN]) and (Length(Layout)>0) then
WriteLine(Format(' %s: ',[Drive]),FOREGROUND_SILVER,Format('(%s %s - %d MB)',[
GetPartitionType(Layout[0].Number,Layout[0].Typ),
GetPartitionSystem(Layout[0].Typ),
Layout[0].Length.QuadPart shr 20]),FOREGROUND_OLIVE)
else
WriteLine(Format(' %s: ',[Drive]),FOREGROUND_SILVER,'',FOREGROUND_OLIVE);
end;
end;
b:=False;
with Disk do
for i:=1 to Length(ad) do begin
Drive:=Format('%s:\',[Copy(ad,i,1)]);
if MediaType=dtRemote then begin
if not b then begin
WriteLine('Network drives',FOREGROUND_SILVER,'',FOREGROUND_YELLOW);
b:=True;
end;
d:=d+Copy(Drive,1,1);
WriteLine(Format(' %s ',[Drive]),FOREGROUND_SILVER,Format('(%s)',[UNCPath]),FOREGROUND_OLIVE);
end;
end;
b:=False;
with Disk do
for i:=1 to Length(ad) do begin
Drive:=Format('%s:\',[Copy(ad,i,1)]);
if (Pos(Copy(ad,i,1),d)=0) and (MediaType=dtRemovable) then begin
if not b then begin
WriteLine('Removable drives',FOREGROUND_SILVER,'',FOREGROUND_YELLOW);
b:=True;
end;
d:=d+Copy(Drive,1,1);
if Disk.MediaPresent then
WriteLine(Format(' %s ',[Drive]),FOREGROUND_SILVER,Format('(%s - %d MB)',[Disk.FileSystem,Disk.Capacity shr 20]),FOREGROUND_OLIVE)
else
WriteLine(Format(' %s ',[Drive]),FOREGROUND_SILVER,'',FOREGROUND_OLIVE)
end;
end;
b:=False;
with Disk do
for i:=1 to Length(ad) do begin
Drive:=Format('%s:\',[Copy(ad,i,1)]);
if (Pos(Copy(ad,i,1),d)=0) then begin
if not b then begin
WriteLine('Other drives',FOREGROUND_SILVER,'',FOREGROUND_YELLOW);
b:=True;
end;
d:=d+Copy(Drive,1,1);
if Disk.MediaPresent then
WriteLine(Format(' %s ',[Drive]),FOREGROUND_SILVER,Format('(%s - %d MB)',[Disk.FileSystem,Disk.Capacity shr 20]),FOREGROUND_OLIVE)
else
WriteLine(Format(' %s ',[Drive]),FOREGROUND_SILVER,'',FOREGROUND_OLIVE)
end;
end;
Separator;
c:=0;
with USB do
for i:=0 to USBNodeCount-1 do
if USBNodes[i].USBDevice.ConnectionStatus=1 then
if not(USBNodes[i].USBClass in [usbHostController,usbHub,usbExternalHub]) then begin
WriteLine(Format('USB port %d : ',[USBNodes[i].USBDevice.Port]),FOREGROUND_SILVER,Trim(USBNodes[i].USBDevice.Product),FOREGROUND_YELLOW);
WriteLine('Class : ',FOREGROUND_SILVER,ClassNames[integer(USBNodes[i].USBClass)],FOREGROUND_OLIVE);
WriteLine('Manufacturer: ',FOREGROUND_SILVER,USBNodes[i].USBDevice.Manufacturer,FOREGROUND_OLIVE);
WriteLine('Version : ',FOREGROUND_SILVER,Format('%d.%d',[USBNodes[i].USBDevice.MajorVersion,USBNodes[i].USBDevice.MinorVersion]),FOREGROUND_OLIVE);
Inc(c);
end;
if c>0 then
Separator;
c:=-1;
k:=maxint;
for i:=0 to Devices.DeviceCount-1 do
if (Devices.Devices[i].DeviceClass=dcMedia) and
(Devices.Devices[i].PCINumber>-1) then
if Devices.Devices[i].FunctionNumber<k then begin
k:=Devices.Devices[i].FunctionNumber;
j:=Devices.Devices[i].DeviceNumber;
c:=i;
end;
if c>-1 then begin
WriteLine('Audio adapter: ',FOREGROUND_SILVER,Devices.Devices[c].Name,FOREGROUND_YELLOW);
c:=1;
for i:=0 to Devices.DeviceCount-1 do
if (Devices.Devices[i].DeviceClass=dcMedia) and
(Devices.Devices[i].DeviceNumber=j) and
(Devices.Devices[i].FunctionNumber>k) then
WriteLine('Game adapter : ',FOREGROUND_SILVER,Devices.Devices[i].Name,FOREGROUND_OLIVE);
end;
if (c=-1) and (Media.WAVEOut.Count>0) then begin
WriteLine('Audio adapter: ',FOREGROUND_SILVER,Media.WaveOut[0],FOREGROUND_YELLOW);
c:=1;
end;
if c>0 then
Separator;
c:=0;
with Network.TCPIP do
for i:=0 to AdapterCount-1 do
if (Adapter[i].Address<>'') then begin
s:=Adapter[i].Name;
k:=Pos(' - ',s);
if k>0 then
s:=Copy(s,1,k);
WriteLine('Network adapter: ',FOREGROUND_SILVER,s,FOREGROUND_YELLOW);
WriteLine('MAC address : ',FOREGROUND_SILVER,Adapter[i].Address,FOREGROUND_OLIVE);
WriteLine('IP address : ',FOREGROUND_SILVER,Adapter[i].IPAddress.CommaText,FOREGROUND_OLIVE);
Inc(c);
end;
if c>0 then
Separator;
c:=0;
for i:=0 to Devices.DeviceCount-1 do
if Devices.Devices[i].DeviceClass=dcModem then begin
if Trim(Devices.Devices[i].FriendlyName)='' then
s:=Devices.Devices[i].Description
else
s:=Devices.Devices[i].FriendlyName;
WriteLine('Modem: ',FOREGROUND_SILVER,s,FOREGROUND_YELLOW);
Inc(c);
end;
if c>0 then
Separator;
c:=0;
for i:=0 to Devices.DeviceCount-1 do
if Devices.Devices[i].DeviceClass=dcKeyboard then begin
if Trim(Devices.Devices[i].FriendlyName)='' then
s:=Devices.Devices[i].Description
else
s:=Devices.Devices[i].FriendlyName;
WriteLine('Keyboard: ',FOREGROUND_SILVER,s,FOREGROUND_YELLOW);
Inc(c);
Break;
end;
if c>0 then
Separator;
c:=0;
for i:=0 to Devices.DeviceCount-1 do
if Devices.Devices[i].DeviceClass=dcMouse then begin
if Trim(Devices.Devices[i].FriendlyName)='' then
s:=Devices.Devices[i].Description
else
s:=Devices.Devices[i].FriendlyName;
WriteLine('Mouse: ',FOREGROUND_SILVER,s,FOREGROUND_YELLOW);
Inc(c);
Break;
end;
if c>0 then
Separator;
WriteLine('Default printer: ',FOREGROUND_SILVER,Printers.DefaultPrinter,FOREGROUND_YELLOW);
for i:=0 to Printers.PrinterCount-1 do
if not SameText(Printers.DefaultPrinter,Printers.PrinterName[i]) then
WriteLine('Other printer : ',FOREGROUND_SILVER,Printers.PrinterName[i],FOREGROUND_OLIVE);
Separator;
except
on e: exception do begin
SetConsoleTextAttribute(hConsole, FOREGROUND_RED or FOREGROUND_INTENSITY);
writeln(e.message);
SetConsoleTextAttribute(hConsole, FOREGROUND_SILVER);
end;
end;
finally
Free;
end;
end;
end;
procedure ListTCPIP;
var
i: Integer;
begin
try
try
SetConsoleTextAttribute(hConsole, FOREGROUND_WHITE or BACKGROUND_INTENSITY);
Write('TCP/IP CONFIGURATION...');
with TMiTeC_TCPIP.Create(nil) do begin
RefreshData;
Write('OK');
GetConsoleScreenBufferInfo(hConsole,ScreenBuffer);
Write(StringOfChar(#32,ScreenBuffer.dwSize.X-ScreenBuffer.dwCursorPosition.X-1));
SetConsoleTextAttribute(hConsole, FOREGROUND_SILVER);
writeln;
Writeline('Host name : ',FOREGROUND_SILVER,Hostname,FOREGROUND_YELLOW);
Writeline('Domain name: ',FOREGROUND_SILVER,Domainname,FOREGROUND_OLIVE);
Writeline('Node type : ',FOREGROUND_SILVER,NodeTypes[NodeType],FOREGROUND_OLIVE);
Writeline('WINS proxy : ',FOREGROUND_SILVER,BoolToStr(Boolean(EnableProxy),True),FOREGROUND_OLIVE);
Writeline('IP routing : ',FOREGROUND_SILVER,BoolToStr(Boolean(EnableRouting),True),FOREGROUND_OLIVE);
Writeline('DNS enabled: ',FOREGROUND_SILVER,BoolToStr(Boolean(EnableDNS),True),FOREGROUND_OLIVE);
Writeline('DHCP scope name : ',FOREGROUND_SILVER,DHCPScopeName,FOREGROUND_OLIVE);
Writeline('Primary DNS Suffix: ',FOREGROUND_SILVER,PrimaryDNSSuffix,FOREGROUND_OLIVE);
Writeline('DNS Servers : ',FOREGROUND_SILVER,StringReplace(DNSServers.CommaText,'"','',[rfReplaceAll,rfIgnoreCase]),FOREGROUND_OLIVE);
separator;
for i:=0 to AdapterCount-1 do begin
Writeline('Adapter : ',FOREGROUND_SILVER,Adapter[i].Name,FOREGROUND_YELLOW);
Writeline('MAC address: ',FOREGROUND_SILVER,Adapter[i].Address,FOREGROUND_OLIVE);
Writeline('Type : ',FOREGROUND_SILVER,AdapterTypes[Adapter[i].Typ],FOREGROUND_OLIVE);
Writeline('DHCP : ',FOREGROUND_SILVER,BoolToStr(Boolean(Adapter[i].EnableDHCP),True),FOREGROUND_OLIVE);
Writeline('WINS : ',FOREGROUND_SILVER,BoolToStr(Boolean(Adapter[i].HaveWINS),True),FOREGROUND_OLIVE);
Writeline('IP address : ',FOREGROUND_SILVER,StringReplace(Adapter[i].IPAddress.CommaText,'"','',[rfReplaceAll,rfIgnoreCase]),FOREGROUND_OLIVE);
Writeline('Subnet mask: ',FOREGROUND_SILVER,StringReplace(Adapter[i].IPAddressMask.CommaText,'"','',[rfReplaceAll,rfIgnoreCase]),FOREGROUND_OLIVE);
Writeline('Gateway : ',FOREGROUND_SILVER,StringReplace(Adapter[i].Gateway_IPAddress.CommaText,'"','',[rfReplaceAll,rfIgnoreCase]),FOREGROUND_OLIVE);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -