New components to make it easier to use when programming!
SMBIOS as a SuystemInfo component
unit SystemInfo;
[attachment=3762]SMBIOS-SystemInfo.zip[/attachment] [attachment=3762]SMBIOS-SystemInfo.zip[/attachment]
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils, StrUtils, LResources, Forms, Controls, Graphics, Dialogs, uSMBIOS;
type
TSystemInfo = class(TComponent)
private
fVendor : String;
fVersion : String;
fReleaseDate : String;
fBIOSROMSize : String;
fBIOSMajorRel : String;
fBIOSMinorRel : String;
fManufacter : String;
fProductName : String;
fSerialNumber : String;
fUUID : String;
fFamily : String;
fMemorySize : String;
fFormFactory : String;
fSpeed : String;
fMManufacturer : String;
fMSerialNumber : String;
fMAssetTag : String;
fMPartNumber : String;
fMDeviceLocator : String;
fSMBIOSVersion : String;
protected
procedure GetSystemInfoCREATE;
public
constructor Create(TheOwner: TComponent); override;
published
property Vendor : String read fVendor write fVendor;
property Version : String read fVersion write fVersion;
property ReleaseDate : String read fReleaseDate write fReleaseDate;
property BIOSROMSize : String read fBIOSROMSize write fBIOSROMSize;
property BIOSMajorRelease : String read fBIOSMajorRel write fBIOSMajorRel;
property BIOSMinorRelease : String read fBIOSMinorRel write fBIOSMinorRel;
property Manufacter : String read fManufacter write fManufacter;
property ProductName : String read fProductName write fProductName;
property SerialNumber : String read fSerialNumber write fSerialNumber;
property UUID : String read fUUID write fUUID;
property Family : String read fFamily write fFamily;
property MemorySize : String read fMemorySize write fMemorySize;
property FormFactor : String read fFormFactory write fFormFactory;
property DeviceLocator : String read fMDeviceLocator write fMDeviceLocator;
property MemSpeed : String read fSpeed write fSpeed;
property MemManufacturer : String read fMManufacturer write fMManufacturer;
property MemSerialNumber : String read fMSerialNumber write fMSerialNumber;
property MemAssetTag : String read fMAssetTag write fMAssetTag;
property MemPartNumber : String read fMPartNumber write fMPartNumber;
// property SMBIOSVersion : String read fSMBIOSVersion write fSMBIOSVersion;
end;
procedure Register;
implementation
procedure TSystemInfo.GetSystemInfoCREATE;
Var
SMBios : TSMBios;
LBIOS : TBiosInformation;
sUUID : Array[0..31] of AnsiChar;
LMemoryDevice: TMemoryDeviceInformation;
begin
SMBios:=TSMBios.Create;
try
try
LBIOS :=SMBios.BiosInfo;
fVendor := LBIOS.VendorStr;
fVersion := LBIOS.VersionStr;
fReleaseDate := LBIOS.ReleaseDateStr;
fBIOSROMSize := Format('%d k',[64*(LBIOS.RAWBiosInformation^.BiosRomSize+1)]);
//
if LBIOS.RAWBiosInformation^.SystemBIOSMajorRelease<>$ff then
fBIOSMajorRel := Format('%d',[LBIOS.RAWBiosInformation^.SystemBIOSMajorRelease])
else fBIOSMajorRel := '0';
//
if LBIOS.RAWBiosInformation^.SystemBIOSMinorRelease<>$ff then
fBIOSMinorRel := Format('%d',[LBIOS.RAWBiosInformation^.SystemBIOSMinorRelease])
else fBIOSMinorRel := '0';
//
fManufacter := SMBios.SysInfo.ManufacturerStr;
fProductName := SMBios.SysInfo.ProductNameStr;
fSerialNumber := SMBios.SysInfo.SerialNumberStr;
fFamily := SMBios.SysInfo.FamilyStr;;
fSMBIOSVersion := SMBIOS.SysInfo.SKUNumberStr;
//
BinToHex(@SMBios.SysInfo.RAWSystemInformation^.UUID,sUUID,SizeOf(SMBios.SysInfo.RAWSystemInformation^.UUID));
fUUID := sUUID;
//
// fSKUNumber := SMBios.SysInfo.SKUNumberStr;
//
if SMBios.HasMemoryDeviceInfo then begin
for LMemoryDevice in SMBios.MemoryDeviceInfo do begin
fMemorySize := Format('%d Mbytes',[ LMemoryDevice.GetSize ]);
fFormFactory := LMemoryDevice.GetFormFactor;
fMDeviceLocator := LMemoryDevice.GetDeviceLocatorStr;
fSpeed := Format('%d MHz',[LMemoryDevice.RAWMemoryDeviceInfo^.Speed]);
fMManufacturer := LMemoryDevice.ManufacturerStr;
fMSerialNumber := LMemoryDevice.SerialNumberStr;
fMAssetTag := LMemoryDevice.AssetTagStr;
fMPartNumber := LMemoryDevice.PartNumberStr;
end;
//
end;
except
ShowMessage('Erro no TSystemInfo');
end;
finally
SMBios.Free;
end;
end;
constructor TSystemInfo.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
//
GetSystemInfoCREATE;
//
end;
procedure Register;
begin
RegisterComponents('Muga',[TSystemInfo]);
end;
end.