2008-10-31 21:18:20 +00:00
|
|
|
unit uMachID;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
2023-02-20 17:36:51 +00:00
|
|
|
SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Buttons, StdCtrls, ExtCtrls;
|
2008-10-31 21:18:20 +00:00
|
|
|
|
|
|
|
type
|
|
|
|
|
|
|
|
{ TfrmExMachineID }
|
|
|
|
|
|
|
|
TfrmExMachineID = class(TForm)
|
2023-02-17 16:28:47 +00:00
|
|
|
Bevel1: TBevel;
|
2008-10-31 21:18:20 +00:00
|
|
|
GroupBox1: TGroupBox;
|
|
|
|
chkUser: TCheckBox;
|
|
|
|
chkSystem: TCheckBox;
|
|
|
|
chkNetwork: TCheckBox;
|
|
|
|
chkDrives: TCheckBox;
|
|
|
|
btnGenerate: TButton;
|
|
|
|
edtMachineID: TEdit;
|
|
|
|
procedure btnGenerateClick(Sender: TObject);
|
|
|
|
private
|
|
|
|
{ Private declarations }
|
|
|
|
public
|
|
|
|
{ Public declarations }
|
|
|
|
end;
|
|
|
|
|
|
|
|
var
|
|
|
|
frmExMachineID: TfrmExMachineID;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
2023-02-20 17:36:51 +00:00
|
|
|
{$R *.lfm}
|
|
|
|
|
2008-10-31 21:18:20 +00:00
|
|
|
uses
|
|
|
|
onguard, ogutil;
|
|
|
|
|
|
|
|
procedure TfrmExMachineID.btnGenerateClick(Sender: TObject);
|
|
|
|
var
|
|
|
|
InfoSet : TEsMachineInfoSet;
|
|
|
|
MachineID : Longint;
|
|
|
|
begin
|
|
|
|
{ initialize the machine information set }
|
|
|
|
InfoSet := [];
|
|
|
|
if chkUser.Checked then
|
|
|
|
InfoSet := InfoSet + [midUser];
|
|
|
|
if chkSystem.Checked then
|
|
|
|
InfoSet := InfoSet + [midSystem];
|
|
|
|
if chkNetwork.Checked then
|
|
|
|
InfoSet := InfoSet + [midNetwork];
|
|
|
|
if chkDrives.Checked then
|
|
|
|
InfoSet := InfoSet + [midDrives];
|
|
|
|
|
|
|
|
{ create the machine ID and display in hex }
|
|
|
|
try
|
2023-02-17 16:28:47 +00:00
|
|
|
MachineID := CreateMachineID(InfoSet);
|
|
|
|
edtMachineID.Text := '$' + BufferToHex(MachineID, SizeOf(MachineID));
|
2008-10-31 21:18:20 +00:00
|
|
|
except on E:Exception do
|
2023-02-17 16:28:47 +00:00
|
|
|
ShowMessage(E.Message);
|
2008-10-31 21:18:20 +00:00
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|
|
|
|
|