转贴 读取硬盘序列号
function GetVolume(sdriv:String):String;
var fulldrive :string[3];
tmp_drive :array[0..2] of char;
VolName :array[0..255] of Char; // holds the volume name
dwTemp1,dwTemp2:DWord;
begin
fulldrive:=Sdriv+':\';
strpcopy(tmp_drive,fulldrive);
GetVolumeInformation(tmp_drive, VolName, 255,nil,dwTemp1,dwTemp2,nil,255);
Result:=VolName;
end;function GetDiskVolSerialID(DriveName:string):DWord; //获得磁盘序列号函数
var
dwTemp1,dwTemp2:DWord;
NResult:PDWord; //保存结果
begin
new(NResult); //分配内存
GetVolumeInformation(pChar(DriveName+'\'),
Nil,0,NResult,dwTemp1,dwTemp2,Nil,0);
Result:=NResult^; //返回结果
Dispose(NResult); //释放内存
end;
function GetVolume(sdriv:String):String;
var fulldrive :string[3];
tmp_drive :array[0..2] of char;
VolName :array[0..255] of Char; // holds the volume name
dwTemp1,dwTemp2:DWord;
begin
fulldrive:=Sdriv+':\';
strpcopy(tmp_drive,fulldrive);
GetVolumeInformation(tmp_drive, VolName, 255,nil,dwTemp1,dwTemp2,nil,255);
Result:=VolName;
end;function GetDiskVolSerialID(DriveName:string):DWord; //获得磁盘序列号函数
var
dwTemp1,dwTemp2:DWord;
NResult:PDWord; //保存结果
begin
new(NResult); //分配内存
GetVolumeInformation(pChar(DriveName+'\'),
Nil,0,NResult,dwTemp1,dwTemp2,Nil,0);
Result:=NResult^; //返回结果
Dispose(NResult); //释放内存
end;
* 取这两种东东用来加密是不可靠的(测试发现有些硬盘本身是没有出厂ID的,取卷标号就
不必了;同一型号的CPU的序列号相同,并且不一定所以的CPU都有序列号)。
//建议:找有关取主板“唯一信息”来做序列号的资料。