送100分!!!!(100分)

  • 主题发起人 主题发起人 kelf
  • 开始时间 开始时间
K

kelf

Unregistered / Unconfirmed
GUEST, unregistred user!
如何识别计算机的唯一性,或者如何实现使用注册码进行注册。
 
见CUPID一文,配合硬盘ID、、、,你肯定可以做到表示唯一性
 
cpuid+hardiskid+netcard mac
 
那里有CPUID一文??
 
用Delphi如何取得硬盘的硬编码?
 
进来看看!
 
还可以用 BIOS信息.
 
type
TCPUID = array[1..4] of Longint;
TVendor = array [0..11] of char;

function GetCPUID : TCPUID; assembler; register;
asm
PUSH EBX {Save affected register}
PUSH EDI
MOV EDI,EAX {@Resukt}
MOV EAX,1
DW $A20F {CPUID Command}
STOSD {CPUID[1]}
MOV EAX,EBX
STOSD {CPUID[2]}
MOV EAX,ECX
STOSD {CPUID[3]}
MOV EAX,EDX
STOSD {CPUID[4]}
POP EDI {Restore registers}
POP EBX
end;

function GetCPUVendor : TVendor; assembler; register;
asm
PUSH EBX {Save affected register}
PUSH EDI
MOV EDI,EAX {@Result (TVendor)}
MOV EAX,0
DW $A20F {CPUID Command}
MOV EAX,EBX
XCHG EBX,ECX {save ECX result}
MOV ECX,4
@1:
STOSB
SHR EAX,8
LOOP @1
MOV EAX,EDX
MOV ECX,4
@2:
STOSB
SHR EAX,8
LOOP @2
MOV EAX,EBX
MOV ECX,4
@3:
STOSB
SHR EAX,8
LOOP @3
POP EDI {Restore registers}
POP EBX
end;

procedure TDemoForm.BitBtn1Click(Sender: TObject);
var
CPUID : TCPUID;
I : Integer;
S : TVendor;
begin
for I := Low(CPUID) to High(CPUID) do CPUID := -1;
CPUID := GetCPUID;
Label1.Caption := 'CPUID[1] = ' + IntToHex(CPUID[1],8);
Label2.Caption := 'CPUID[2] = ' + IntToHex(CPUID[2],8);
Label3.Caption := 'CPUID[3] = ' + IntToHex(CPUID[3],8);
Label4.Caption := 'CPUID[4] = ' + IntToHex(CPUID[4],8);
S := GetCPUVendor;
Label5.Caption := S;
end;


===========unit DiskInfo;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type string1 = string[1];
type string30 = string[30];

type
TDiskInfo = class(TComponent)
private
FSectorsPerCluster :DWORD; // holds the sectors per cluster
FBytesPerSector :DWORD; // holds the bytes per sector
FFreeClusters :DWORD; // holds the number of free clusters
FClusters :DWORD; // holds the total number of disk clusters
FDiskFreeSpace :DWORD; // holds the total free space
FTotalDiskSpace :DWORD; // holds total disk capacity
FDrive :string1;
FDriveType :string30;
FVolumeName :string;
FSerialNumber :string;
FFileSystemType :string;
function GetDriveTyp :string30;
procedure SetDrive(value:string1);
protected
{ Protected declarations }
public
constructor create(AOwner:TComponent); override;
published
{ Published declarations }
property Drive :string1 read FDrive write setdrive;
property SectorsPerCluster :DWORD read FSectorsPerCluster;
property BytesPerSector :DWORD read FBytesPerSector;
property FreeClusters :DWORD read FFreeClusters;
property Clusters :DWORD read FClusters;
property DiskFreeSpace :DWORD read FDiskFreeSpace;
property TotalDiskSpace :DWORD read FTotalDiskSpace;
property DriveType :string30 read GetDriveTyp;
property VolumeName :string read FVolumeName;
property SerialNumber :string read FSerialNumber;
property FileSystemType :string read FFileSystemType;
end;

procedure Register;

implementation

procedure Register;
begin
RegisterComponents('Smart', [TDiskInfo]);
end;

constructor TDiskInfo.create(AOwner:TComponent);
begin
inherited create(AOwner);
setdrive('C');
end;

procedure TDiskInfo.SetDrive(value:string1);
var fulldrive :string[3];
tmp_drive :array[0..2] of char;
Tmp_SectorsPerCluster, // holds the sectors per cluster
Tmp_BytesPerSector, // holds the bytes per sector
Tmp_FreeClusters, // holds the number of free clusters
Tmp_Clusters :DWORD; // holds the total number of disk clusters
VolName :array[0..255] of Char; // holds the volume name
SerialNumber :DWORD; // holds the serial number
MaxCLength :DWORD; // holds the maximum file component length
FileSysFlag :DWORD; // holds file system flags
FileSysName :array[0..255] of Char; // holds the name of the file system
begin
fdrive:=value;
fulldrive:=value + ':/';
strpcopy(tmp_drive,fulldrive);
if GetDiskFreeSpace(tmp_drive,Tmp_SectorsPerCluster,Tmp_BytesPerSector,
Tmp_FreeClusters,Tmp_Clusters) then
begin
FSectorsPerCluster:=Tmp_SectorsPerCluster;
FBytesPerSector:=Tmp_BytesPerSector;
FFreeClusters:=Tmp_FreeClusters;
FClusters:=Tmp_Clusters;
FDiskFreeSpace:=Tmp_FreeClusters*Tmp_BytesPerSector*Tmp_SectorsPerCluster;
FTotalDiskSpace:=Tmp_Clusters*Tmp_BytesPerSector*Tmp_SectorsPerCluster;
end;

{retrieve the volumn information}
GetVolumeInformation(tmp_drive, VolName, 255, @SerialNumber, MaxCLength,
FileSysFlag, FileSysName, 255);

FVolumeName:=VolName;
FSerialNumber:=IntToHex(SerialNumber,8);
FFileSystemType:=FileSysName;
end;

function TDiskInfo.GetDriveTyp :string30;
var fulldrive :string[3];
tmp_drive :array[0..2] of char;
begin
fulldrive:=fdrive + ':/';
strpcopy(tmp_drive,fulldrive);
{retrieve the drive type}
case GetDriveType(tmp_drive) of
DRIVE_UNKNOWN :result:='No Type Information';
DRIVE_NO_ROOT_DIR :result:='Root Directory does not exist';
DRIVE_REMOVABLE :result:='Removable';
DRIVE_FIXED :result:='Fixed';
DRIVE_REMOTE :result:='Remote';
DRIVE_CDROM :result:='CDROM';
DRIVE_RAMDISK :result:='RamDisk';
end;
end;

end.
 
接受答案了.
 
后退
顶部