Q
qdlover
Unregistered / Unconfirmed
GUEST, unregistred user!
本来想做个机器码注册模块
网卡不能用,因为有的机器没有网卡
硬盘id不能用,因为有的硬盘没有id
GetVolumeInformation不能用,因为重新分区就变了
bios id不能用,因为笔记本电脑的取不出来
试到最后就剩下cpuid了
结果不幸的是,在p4 超线程的cpu(就是那种任务管理器里面能看到两颗cpu的)cpuid竟然是变化的2个值,更倒霉的是,不一定每次取出来的是哪一个
晕倒了,除了用加密狗,还有什么好办法能确定机器的唯一标识码啊??
有p4超线程cpu的可以测试以下程序,取100次,2个id不定什么时候取出来哪个
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TCPUID = array[1..4] of Longint;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
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;
procedure TForm1.Button1Click(Sender: TObject);
var
i,k:integer;
r:TCPUID;
str:string;
begin
memo1.Clear;
for k:=0 to 100 do
begin
r:=getcpuid;
str:='';
for i:=1 to 4 do
begin
str:=str+'-'+inttostr(abs(r));
end;
memo1.lines.add(str);
end;
end;
end.
网卡不能用,因为有的机器没有网卡
硬盘id不能用,因为有的硬盘没有id
GetVolumeInformation不能用,因为重新分区就变了
bios id不能用,因为笔记本电脑的取不出来
试到最后就剩下cpuid了
结果不幸的是,在p4 超线程的cpu(就是那种任务管理器里面能看到两颗cpu的)cpuid竟然是变化的2个值,更倒霉的是,不一定每次取出来的是哪一个
晕倒了,除了用加密狗,还有什么好办法能确定机器的唯一标识码啊??
有p4超线程cpu的可以测试以下程序,取100次,2个id不定什么时候取出来哪个
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TCPUID = array[1..4] of Longint;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
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;
procedure TForm1.Button1Click(Sender: TObject);
var
i,k:integer;
r:TCPUID;
str:string;
begin
memo1.Clear;
for k:=0 to 100 do
begin
r:=getcpuid;
str:='';
for i:=1 to 4 do
begin
str:=str+'-'+inttostr(abs(r));
end;
memo1.lines.add(str);
end;
end;
end.