You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

370 lines
12 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_sys_computer;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, BusinessSkinForm, bsSkinCtrls,
Mask, bsSkinBoxCtrls;
type
Tfrm_sys_computer = class(TForm)
Timer1: TTimer;
Memo1: TMemo;
bsBusinessSkinForm1: TbsBusinessSkinForm;
Panel1: TPanel;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinButton6: TbsSkinButton;
bsSkinButton7: TbsSkinButton;
bsSkinButton8: TbsSkinButton;
StatusBar1: TbsSkinEdit;
procedure Timer1Timer(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
TCpuFeature = (cpuNoCPUID,cpuNonIntel,cpuOnChipFPU,
cpuVirtualModeExtensions,cpuDebuggingExtensions,
cpuPageSizeExtensions,cpuTimeStampCounter,
cpuModelSpecificRegisters,cpuPhysicalAddressExtensions,
cpuMachineCheckExtensions,cpuCMPXCHG8B,cpuOnChipAPIC,
cpuFastSystemCall,cpuMemoryRangeRegisters,cpuPageGlobalEnable,
cpuMachineCheckArchitecture,cpuConditionalMoveInstruction,
cpuPageAttributeTable,cpu32bitPageSzExtension,
cpuProcessorSerialNum,cpuMMXTechnology,cpuFastFloatingPoint,
cpuSIMDExtensions);
TCpuFeatures = set of TCpuFeature;
function GetCpuFeatures(FeatureList : TStrings = nil) : TCpuFeatures;
var
frm_sys_computer: Tfrm_sys_computer;
implementation
uses u_sys_cupspeed,u_sys_sysinfo,u_sys_bios, u_main;
{$R *.dfm}
procedure Tfrm_sys_computer.Timer1Timer(Sender: TObject);
var i: Integer;
begin
CollectCPUData;
StatusBar1.Text:=Format('CPUʹ<55><CAB9><EFBFBD><EFBFBD> %5.2f%%',[GetCPUUsage(0)*100]);
end;
function GetCpuFeatures(FeatureList : TStrings = nil) : TCpuFeatures;
const
FPU_FLAG = $0001;
VME_FLAG = $0002;
DE_FLAG = $0004;
PSE_FLAG = $0008;
TSC_FLAG = $0010;
MSR_FLAG = $0020;
PAE_FLAG = $0040;
MCE_FLAG = $0080;
CX8_FLAG = $0100;
APIC_FLAG = $0200;
SEP_FLAG = $0800;
MTRR_FLAG = $1000;
PGE_FLAG = $2000;
MCA_FLAG = $4000;
CMOV_FLAG = $8000;
PAT_FLAG = $10000;
PSE36_FLAG = $20000;
PSNUM_FLAG = $40000;
MMX_FLAG = $800000;
FXSR_FLAG = $1000000;
SIMD_FLAG = $2000000;
var IsIntel : boolean;
VendorID : array [0..12] of char;
IntelID : array [0..12] of char;
FeaturesFlag,CpuSignature : DWord;
Temp : DWord;
RetVar : TCpuFeatures;
CpuType : byte;
procedure CheckFeature(FeatureFlag : DWord;
const Item : string;
cpuFeatureType : TCpuFeature);
begin
if FeaturesFlag and FeatureFlag = FeatureFlag then begin
if FeatureList <> nil then FeatureList.Add(Item);
include(RetVar,cpuFeatureType);
end;
end;
begin
RetVar := [];
if FeatureList <> nil then FeatureList.Clear;
IsIntel := false;
IntelId := 'GenuineIntel'#0;
VendorID := '------------'#0;
try
asm
//ȷ<><C8B7><EFBFBD>Ƿ<EFBFBD>֧<EFBFBD><D6A7>Intel CPUID<49><44><EFBFBD><EFBFBD>
push ebx
push esi
push edi
mov eax,0 // Set up for CPUID instruction
db 00fh // CPUID - Get Vendor and check INTEL
db 0a2h
mov dword ptr VendorId,ebx
mov dword ptr VendorId[+4],edx
mov dword ptr VendorId[+8],ecx
cmp dword ptr IntelId,ebx //<2F><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>Intel CPU
jne @@EndCPUID
cmp dword ptr IntelId[+4],edx
jne @@EndCPUID
cmp dword ptr IntelId[+8],ecx
jne @@EndCPUID // <20><>Intel CPU
mov byte ptr IsIntel,1 // Set IsIntel to true
cmp eax,1 // Ensure 1 is valid input for CPUID
jl @@EndCPUID // Else jump to end
mov eax,1
db 00fh // CPUID - Get features,family etc.
db 0a2h
mov CpuSignature,eax
mov FeaturesFlag,edx
shr eax,8 // Isolate family
and eax,0fh
mov byte ptr CpuType,al // Set cputype with family
@@EndCPUID :
pop edi // <20>ָ<EFBFBD><D6B8>Ĵ<EFBFBD><C4B4><EFBFBD>
pop esi
pop ebx
end;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if IsIntel then begin
if FeatureList <> nil then begin
FeatureList.Add('CPU Family ' + IntToStr(CpuType));
Temp := (CpuSignature shr 4) and $0f;
FeatureList.Add('CPU Model ' + IntToStr(Temp));
Temp := CpuSignature and $0f;
FeatureList.Add('CPU Stepping ' + IntToStr(Temp));
end;
CheckFeature(FPU_FLAG,'On-Chip FPU',cpuOnChipFPU);
CheckFeature(VME_FLAG,
'VirtualMode Extensions',cpuVirtualModeExtensions);
CheckFeature(DE_FLAG,'Debugging Extensions',cpuDebuggingExtensions);
CheckFeature(PSE_FLAG,'Page Size Extensions',cpuPageSizeExtensions);
CheckFeature(TSC_FLAG,'Time Stamp Counter',cpuTimeStampCounter);
CheckFeature(MSR_FLAG,
'Model Specific Registers',cpuModelSpecificRegisters);
CheckFeature(PAE_FLAG,
'Physical Address Extensions',
cpuPhysicalAddressExtensions);
CheckFeature(MCE_FLAG,
'Machine Check Extensions',cpuMachineCheckExtensions);
CheckFeature(CX8_FLAG,'CMPXCHG8B Instruction',cpuCMPXCHG8B);
CheckFeature(APIC_FLAG,'On Chip APIC',cpuOnChipAPIC);
CheckFeature(SEP_FLAG,'Fast System Call',cpuFastSystemCall);
CheckFeature(MTRR_FLAG,
'Memory Type Range Registers',cpuMemoryRangeRegisters);
CheckFeature(PGE_FLAG,'Page Global Enable',cpuPageGlobalEnable);
CheckFeature(MCA_FLAG,
'Machine Check Architecture',cpuMachineCheckArchitecture);
CheckFeature(CMOV_FLAG,
'Conditional Move Instruction',
cpuConditionalMoveInstruction);
CheckFeature(PAT_FLAG,'Page Attribute Table',cpuPageAttributeTable);
CheckFeature(PSE36_FLAG,
'32 Bit Page Size Extension',cpu32BitPageSzExtension);
CheckFeature(PSNUM_FLAG,
'Processor Serial Number',cpuProcessorSerialNum);
CheckFeature(MMX_FLAG,'Intel MMX Technology',cpuMMXTechnology);
CheckFeature(FXSR_FLAG,
'Fast Floating Point Save and Restore',
cpuFastFloatingPoint);
CheckFeature(SIMD_FLAG,'Streaming SIMD Extensions',cpuSIMDExtensions);
end
else begin
if FeatureList <> nil then
FeatureList.Add('Non-Intel or >486 Chip - Features Unknown');
include(RetVar,cpuNonIntel);
end;
except
if FeatureList <> nil then FeatureList.Add('No CPUID Support');
include(RetVar,cpuNoCPUID);
end;
Result := RetVar;
end;
procedure Tfrm_sys_computer.bsSkinButton1Click(Sender: TObject);
var
cups:TcpuMSG;
begin
Memo1.Clear;
cups:=GetcpuMSG;
Memo1.Lines.Add('ID1:'+cups.ID1);
Memo1.Lines.Add('ID2:'+cups.ID2);
Memo1.Lines.Add('ID3:'+cups.ID3);
Memo1.Lines.Add('ID4:'+cups.ID4);
Memo1.Lines.Add('Vendor:'+cups.Vendor);
Memo1.Lines.Add('CPU<50><55><EFBFBD><EFBFBD>:'+GetProcessorType);
Memo1.Lines.Add('<27><>ʱCPU <20>ٶȣ<D9B6>'+floattostr(GetCPUSpeed)+'MHz');
end;
procedure Tfrm_sys_computer.bsSkinButton2Click(Sender: TObject);
begin
Memo1.Clear;
Memo1.Lines.Add('<27><><EFBFBD>к<EFBFBD>:'+GetmotherboradKey);
Memo1.Lines.Add('BS<42>汾:'+Getmotherboradver);
Memo1.Lines.Add('BS<42><53>Ȩ:'+Getmotherboradverxx);
Memo1.Lines.Add('BS<42><53><EFBFBD><EFBFBD>:'+Getmotherboraddate);
Memo1.Lines.Add('BS<42><53><EFBFBD><EFBFBD>:'+Getmotherboradname);
end;
procedure Tfrm_sys_computer.bsSkinButton3Click(Sender: TObject);
begin
Memo1.Clear;
Memo1.Lines.Add('<27>Կ<EFBFBD><D4BF><EFBFBD><EFBFBD><EFBFBD>:'+GetDisplayDevice);
Memo1.Lines.Add('<27><>ʾ<EFBFBD><CABE>ˢ<EFBFBD><CBA2>Ƶ<EFBFBD><C6B5>:'+ inttostr(GetDisplayFrequency));
end;
procedure Tfrm_sys_computer.bsSkinButton4Click(Sender: TObject);
var
S1, S2, S3: string;
W5: Word;
W4, W3: ULong;
begin
Memo1.Clear;
GetIdeDiskSerialNumber(S1, S2, S3, W3, W4, W5);
Memo1.Lines.Add('<27><><EFBFBD>ţ<EFBFBD>' + S1);
Memo1.Lines.Add('<27>ͺţ<CDBA>' + S2);
Memo1.Lines.Add('<27><EFBFBD><E6B1BE>' + S3);
Memo1.Lines.Add('TotalAddressableSectors<72><73>' + inttostr(W3));
Memo1.Lines.Add('SectorCapacity<74><79>' + inttostr(W4));
Memo1.Lines.Add('SectorsPerTrack<63><6B>' + inttostr(W5));
end;
procedure Tfrm_sys_computer.bsSkinButton5Click(Sender: TObject);
const
b = ' B';
var
ms : TMemoryStatus;
begin
Memo1.Clear;
ms.dwLength:=sizeof(ms);
GlobalMemoryStatus(ms);
Memo1.Lines.Add('<27><><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>:'+Format('%d'+b, [ms.dwTotalPhys]));
Memo1.Lines.Add('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>:'+Format('%d'+b,[ms.dwAvailPhys]));
Memo1.Lines.Add('<27>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+Format('%d'+b,[ms.dwTotalPageFile]));
Memo1.Lines.Add('<27><><EFBFBD>õĶԻ<C4B6><D4BB><EFBFBD>:'+Format('%d'+b, [ms.dwAvailPageFile]));
Memo1.Lines.Add('<27><><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>:'+ Format('%d'+b, [ms.dwTotalVirtual]));
Memo1.Lines.Add('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>:'+ Format('%d'+b,[ms.dwAvailVirtual]));
Memo1.Lines.Add('<27>ڴ<EFBFBD>ʹ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>:'+ Format('%d %%',[ms.dwMemoryLoad]));
end;
procedure Tfrm_sys_computer.bsSkinButton6Click(Sender: TObject);
begin
Memo1.Clear;
Memo1.Lines.Add('ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>:'+GetWindowsVersion)
end;
procedure Tfrm_sys_computer.bsSkinButton7Click(Sender: TObject);
var
systeminfo: SYSTEM_INFO;
memory: MEMORYSTATUS;
sector,byte,cluster,free: DWORD;
freespace,totalspace: longint;
CDtype: UINT;
name: CHAR;
drvname: string;
volname,filesysname: PCHAR;
sno,maxl,fileflag: DWORD;
begin
Memo1.Lines.Clear();
//<2F><><EFBFBD><EFBFBD>CPU<50>ͺ<EFBFBD>
GetSystemInfo(systeminfo);
Memo1.Lines.Add('<27><><EFBFBD><EFBFBD>CPU<50><55><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:' + inttostr(systeminfo.dwProcessorType));
//<2F><><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>״̬
memory.dwLength := sizeof(memory); //<2F><>ʼ<EFBFBD><CABC>
GlobalMemoryStatus(memory);
Memo1.Lines.Add('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>(' + inttostr(integer(memory.dwTotalPhys div 1024 div 1024)) + 'MB)<29><>');
Memo1.Lines.Add('<27><><EFBFBD>п<EFBFBD><D0BF><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>(' + inttostr(integer(memory.dwTotalPhys div 1024)) + 'KB)<29><>');
//<2F><><EFBFBD><EFBFBD>C<EFBFBD>̿<EFBFBD><CCBF>ÿռ<C3BF>
GetDiskFreeSpace('C:', LPDWORD(@sector)^, LPDWORD(@byte)^, LPDWORD(@free)^, LPDWORD(@cluster)^); //<2F><><EFBFBD>÷<EFBFBD><C3B7>ز<EFBFBD><D8B2><EFBFBD>
totalspace := cluster * byte * sector div 1024 div 1024; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
freespace := free * byte * sector div 1024 div 1024; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿռ<C3BF>
Memo1.Lines.Add('C<><43><EFBFBD>ܿռ<DCBF>(' + inttostr(integer(totalspace)) + 'MB)<29><>');
Memo1.Lines.Add('C<>̿<EFBFBD><CCBF>ÿռ<C3BF>(' + inttostr(integer(freespace)) + 'MB)<29><>');
//<2F><><EFBFBD><EFBFBD>CD<43><44>ROM<4F><4D><EFBFBD>Ƿ<EFBFBD><C7B7>й<EFBFBD><D0B9><EFBFBD>
GetMem(volname, 255);
GetMem(filesysname, 100);
for name :='A' to 'Z' do//ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><41>Z
begin
drvname := name + ':';
CDtype := GetDriveType(PCHAR(@drvname[1])); //<2F><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (CDtype = DRIVE_CDROM) then
begin
Memo1.Lines.Add('<27><><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD><EFBFBD>̷<EFBFBD>Ϊ[' + drvname + ']');
volname^ := Chr(0);
filesysname^ := Chr(0);
if ( not (GetVolumeInformation(PCHAR(@drvname[1]), volname, 250, LPDWORD(@sno), LPDWORD(@maxl)^, LPDWORD(@fileflag)^, filesysname,100))) then
Memo1.Lines.Add(drvname + '<27><><EFBFBD><EFBFBD>û<EFBFBD>з<EFBFBD><D0B7>ֹ<EFBFBD><D6B9><EFBFBD>') //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵΪ<D6B5><CEAA>
else //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵΪ<D6B5><CEAA>
begin
Memo1.Lines.Add (drvname + '<27><><EFBFBD>й<EFBFBD><D0B9>̾<EFBFBD><CCBE><EFBFBD>Ϊ: [' + String(volname) + ']');
Memo1.Lines.Add (drvname + '<27><><EFBFBD>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ: [' + inttostr(sno) + ']');
end;
end;
if (CDtype = DRIVE_FIXED) then
begin
Memo1.Lines.Add( drvname );
volname^ := Chr(0);
filesysname^ := Chr(0);
GetVolumeInformation(PCHAR(@drvname[1]), volname, 250, LPDWORD(@sno), LPDWORD(@maxl)^, LPDWORD(@fileflag)^, filesysname,100);
Memo1.Lines.Add (drvname + '<27>̾<EFBFBD><CCBE><EFBFBD>Ϊ: [' + String(volname) + ']');
Memo1.Lines.Add (drvname + '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ: [' + inttostr(sno) + ']');
end;
if (CDtype = DRIVE_REMOVABLE ) then
begin
Memo1.Lines.Add( '<27><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6>̷<EFBFBD>Ϊ[' + drvname + ']' );
volname^ := Chr(0);
filesysname^ := Chr(0);
GetVolumeInformation(PCHAR(@drvname[1]), volname, 250, LPDWORD(@sno), LPDWORD(@maxl)^, LPDWORD(@fileflag)^, filesysname,100);
Memo1.Lines.Add (drvname + '<27>̾<EFBFBD><CCBE><EFBFBD>Ϊ: [' + String(volname) + ']');
Memo1.Lines.Add (drvname + '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ: [' + inttostr(sno) + ']');
end;
end;
FreeMem(volname);
FreeMem(filesysname)
end;
procedure Tfrm_sys_computer.bsSkinButton8Click(Sender: TObject);
begin
close;
end;
end.