重新讨论此问题:获取硬盘的工业序列号,CPU序列号,主板序列号(300分)

  • 主题发起人 主题发起人 zhshf
  • 开始时间 开始时间
Z

zhshf

Unregistered / Unconfirmed
GUEST, unregistred user!
以前讨论过这些问题,但结果并不理想,我想要具体能够真正实现的<font color=#FF0000>程序代码</font>,
而不是理论,请各位高手赐教:

1.硬盘的<font color=#FF0000>工业序列号</font>,而不是卷标序列号,
以前的讨论中没有实现取得工业序列号的程序;

2.CPU序列号的取得在以前的讨论中有,但那种方法只能取得奔腾的序列号,
那么其它CPU呢,比如;Cyrix,Celeron,K5,K6等等,希望有一种方法,
能对任何类型(起码是常见的几种类型)的CPU都适用;

3.如何取得主板的序列号在以前的讨论中没有解决,难道真的不行吗?
 
怎麽没有一位大虾,回答此问题。难道都不知道?
 
难道是分不够多吗?我可以再加分!
 
工业序列号是什么东东?在哪里看?不要告诉我是在硬盘壳子上找哦!
 
cpu的序列号可以获得:
unit Main;

/////////////////////////////////////////////////////////////////////////////
// (c) NPS, 1997 - Idea, realisation, adoptation IsCPUID_Available) //
// kvk@estpak.ee //
// (c) Alex Abreu, 1997 - IsCPUID_Available source and idea //
// simonet@bhnet.com.br //
/////////////////////////////////////////////////////////////////////////////

interface

uses
Windows,
Messages,
SysUtils,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
ExtCtrls,
StdCtrls,
Buttons;

type
TDemoForm = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
GetButton: TBitBtn;
CloseButton: TBitBtn;
Bevel1: TBevel;
Label5: TLabel;
FLabel: TLabel;
MLabel: TLabel;
PLabel: TLabel;
SLabel: TLabel;
PValue: TLabel;
FValue: TLabel;
MValue: TLabel;
SValue: TLabel;
procedure GetButtonClick(Sender: TObject);
end;

var
DemoForm: TDemoForm;

implementation

{$R *.DFM}

const
ID_BIT = $200000; // EFLAGS ID bit
type
TCPUID = array[1..4] of Longint;
TVendor = array [0..11] of char;

function IsCPUID_Available : Boolean; register;
asm
PUSHFD {direct access to flags no possible, only via stack}
POP EAX {flags to EAX}
MOV EDX,EAX {save current flags}
XOR EAX,ID_BIT {not ID bit}
PUSH EAX {onto stack}
POPFD {from stack to flags, with not ID bit}
PUSHFD {back to stack}
POP EAX {get back to EAX}
XOR EAX,EDX {check if ID bit affected}
JZ @exit {no, CPUID not availavle}
MOV AL,True {Result=True}
@exit:
end;

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.GetButtonClick(Sender: TObject);
var
CPUID : TCPUID;
I : Integer;
S : TVendor;
begin
for I := Low(CPUID) to High(CPUID) do CPUID := -1;
if IsCPUID_Available then begin
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);
PValue.Caption := IntToStr(CPUID[1] shr 12 and 3);
FValue.Caption := IntToStr(CPUID[1] shr 8 and $f);
MValue.Caption := IntToStr(CPUID[1] shr 4 and $f);
SValue.Caption := IntToStr(CPUID[1] and $f);
S := GetCPUVendor;
Label5.Caption := 'Vendor: ' + S; end
else begin
Label5.Caption := 'CPUID not available';
end;
end;

end.
 
各位大虾,你们取CPU id的方法我都试过了,取到的id 号不同频率的cpu id不同,同一频率的id号相同!!!这可怎么办??
另外,AMD的CPU怎么办??
双CPU机器的cpu id是那一个CPU的??????
 
//硬盘的序列号
Unit HardDisk;
INTERFACE
FUNCTION GetHardDiskNaam : STRING;
FUNCTION GetHardDiskSerieNummer : STRING;
FUNCTION GetHardDiskControlleNummer : STRING;
PROCEDURE GetHardDiskGegevens;
CONST
CodeerTabel : ARRAY[0..24] OF BYTE =
(3,1,2,1,4,1,3,2,6,4,6,5,1,2,6,4,2,6,3,4,6,2,4,1,2);
TYPE
CharArray = ARRAY[0..24] OF CHAR;
VAR
HardDiskGegevens : ARRAY[1..256] OF INTEGER;
HardDiskNaam : CharArray;
SerieNummer : CharArray;
ControlleNummer : CharArray;
C_HardDiskNaam: STRING;
C_HardDiskSerieNummer : STRING;
C_HardDiskControlleNummer : STRING;
C_LicentieNaam: STRING;
IMPLEMENTATION
FUNCTION GetHardDiskNaam : STRING;
VAR
Teller : INTEGER;
Lus : INTEGER;
BEGIN
GetHardDiskNaam := '';
Teller := 1;
FOR Lus := 1 TO 18 DO
BEGIN
HardDiskNaam[Teller] := CHR( ( HardDiskGegevens[27+Lus] DIV 256 ));
Inc(Teller);
HardDiskNaam[Teller] := CHR( ( HardDiskGegevens[27+Lus] MOD 256 ));
Inc(Teller);
END;
GetHardDiskNaam := HardDiskNaam;
END;
FUNCTION GetHardDiskSerieNummer : STRING;
VAR
Teller : INTEGER;
Lus : INTEGER;
BEGIN
GetHardDiskSerieNummer := '';
Teller := 1;
FOR Lus := 1 TO 8 DO
BEGIN
SerieNummer[Teller] := CHR( ( HardDiskGegevens[10+Lus] DIV 256 ));
Inc(Teller);
SerieNummer[Teller] := CHR( ( HardDiskGegevens[10+Lus] MOD 256 ));
Inc(Teller);
END;
GetHardDiskSerieNummer := SerieNummer;
END;
FUNCTION GetHardDiskControlleNummer : STRING;
VAR
Teller : INTEGER;
Lus : INTEGER;
BEGIN
GetHardDiskControlleNummer := '';
Teller := 1;
FOR Lus := 1 TO 3 DO
BEGIN
ControlleNummer[Teller] := CHR( ( HardDiskGegevens[23+Lus] DIV 256 ));
Inc(Teller);
ControlleNummer[Teller] := CHR( ( HardDiskGegevens[23+Lus] MOD 256 ));
Inc(Teller);
END;
GetHardDiskControlleNummer := ControlleNummer;
END;
PROCEDURE GetHardDiskGegevens;
VAR
Lus : INTEGER;
BEGIN
WHILE ( Port[$1f7] <> $50) DO
Port[$1F6] := $A0
Port[$1F7] := $EC
WHILE ( Port[$1f7] <> $58 ) DO
FOR Lus := 1 TO 256 DO
BEGIN
HardDiskGegevens[Lus] := Portw[$1F0]
END;
END;
END.
A:
unit Chiunit4;
interface
function Chk...(ParamIn ... ,=20
ParamDatabaseNamePchar: pchar ): longint; export;
implementation
uses SysUtils, DBTables, ExtCtrls
const
ide_drive_C =3D $00A0;
ide_Data =3D $1F0;
ide_Error =3D $1F1;
ide_DriveAndHead =3D $1F6;
ide_Command =3D $1F7;
ide_command_readpar =3D $EC;
ide_Status=3D $1F7;
ide_status_busy =3D $80;
ide_status_ready =3D $40;
ide_status_error =3D $01;
ide_Fixed =3D $3F6;
ide_Fixed_Irq =3D $02;
IntervalleMinimum =3D 0.0000232;
{ 0.000011574 =3D 1 seconde (.0001 (hh.mmss) (-DEG=3D.0002777) / 24) }
{ .0000174 =3D 1 1/2 sec } { .0000232 =3D 2 sec }
type
tIdeRec =3D Record
rec : array[0..255] of word;
end;
var
ExitSave : Pointer;
IdeRec : tIdeRec;
function ConvertToString : string;
var
i,j : integer;
begin
FillChar( Result, 20, ' ' ); Result[0] :=3D #20;
for i :=3D 1 to 20 do
begin
j :=3D Trunc( (i-1) /2 ) +10
if Lo(IdeRec.Rec[j]) =3D (0)
then Result:=3D ' '
else
Result:=3D Chr ( Lo( IdeRec.Rec[j] ) )
i :=3D i +1;
if Hi(IdeRec.Rec[j]) =3D (0)
then Result:=3D ' '
else
Result:=3D Chr ( Hi( IdeRec.Rec[j] ) )
end;
end;
function DoIt(Numero: string) : longint;
var
portchar :byte;
boo :Boolean;
i :integer;
S,S1 :String;
begin
Result:=3D 19 { fail per default }
FillChar( IdeRec.Rec, 512, ' ' )
{ en premier lieu v=E9rifier l'=E9tat }
boo :=3D true;
{ poll DRQ wait }
i :=3D 5000
repeat
i :=3D i -1;
portchar :=3D Lo(port[ide_status]) { get status }
until
( i <>('+Copy(S1,1,20)+')' }
end;
finally
{ re-enable disk interrupts }
port[ide_Fixed] :=3D ide_Fixed_Irq
end;
END;
procedure MyExit; far;
{ reset disk parameters so other disk operations won't be desturbed in ca=
se
of program abort }
begin
ExitProc :=3D ExitSave; { restore previous exitproc }
{ Port[ide_Command]:=3D$10; { send command: reset current drive }
end;
function GetParam(ParamAlias: string): String;
var
i : integer
t : TTable
S : String
begin
Result :=3D '';
try
t :=3D nil;
t :=3D TTable.Create(nil);
t.DatabaseName :=3D ParamAlias;
t.TableName :=3D ...;
t.TableType :=3D ttPARADOX;
t.open;
...
finally
if Assigned(t) then t.free
end;
end;
function FixParam(ParamAlias: string): boolean;
var
i : integer
t : TTable
S : String
begin
Result :=3D False;
try
t :=3D nil;
t :=3D TTable.Create(nil);
t.DatabaseName :=3D ParamAlias;
t.TableName :=3D ;
t.TableType :=3D ttPARADOX;
t.open;
if=20
begin
... t.Edit;
t.setFields([nil, S]);
t.post;
end;
t.close;
Result :=3D True;
finally
if Assigned(t) then t.free
end;
end;
{----------------------------------------------------}
function Chk...(ParamIn:
ParamDatabaseNamePchar: pchar ): longInt
var
ParamString : String; =20
Temps : Real;
Ok : boolean;
i: integer;
S :string[20];
S6 : string[6];
r :longInt;
Label
Jump;
BEGIN
Result:=3D 0 { par d=E9faut }
if Ok then
i :=3D 0;
repeat
begin
i :=3D i +1
r :=3D DoIt(Copy(ParamString,54,20))
if r =3D 10 then begin
Ok :=3D True
break
end
else begin
Ok :=3D False
Result:=3D r;
Continue;
end;
end;
until i =3D 3
If Ok
then begin
Ok :=3D FixParam(ParamDatabaseName)
If Ok then else { Result :=3D 'FixParam fail'; }
Result :=3D 2
end;
If Ok then Result :=3D 1
END;
Begin
ExitSave:=3D ExitProc;
ExitProc:=3D @MyExit;
end.
 
取得任意CPU ID和任意主板的ID不可能,因为这取决与硬件厂商的公布的资料多少,
现在没有一个统一的标准,因此无法做一个统一的程序,甚至同一公司的新产品如果用以前的程序都有可能会失败!这在将来恐怕也无法实现,因为新技术总会出现,一
旦出现他们的存储信息的标准也可能改变,所以现在只能针对某一种成熟的产品开发
特定的程序。如果谁可以作到的话,谁将是业界标准制定的第一人!
 
PC平台不是工作站平台,可怕把所有的唯一序列号都搞到
是不可能的。别的不说,我买过的某种廉价网卡(20块钱一块)
居然MAC地址都是一模一样的,真是搞笑!所以至少在网卡这个
配件上,我还是选择大牌厂家的产品。
再说,写这样的程序要经过非常仔细的硬件测试才可以确认,
不能光在几种设备上试一试就完了。
如果是为了加密和软件保护,还是选择软件狗算了。
 
如果我的程序读出的硬盘序列号不对,请给我写信:blackhost@163.net
 
only you:
你的程序编译通不过
 
to Kill Night:
请您解释一下下面这些代表的含义:
CPUID[1],CPUID[2],CPUID[3],CPUID[4],PValue,FValue,MValue,SValue
 
好,我试试。
 
怎么取cpu id??
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
I
回复
0
查看
856
import
I
后退
顶部