delphi xe-xe3下最简单的获取硬盘序列号

2018-10-31

delphi xe-xe3下最简单的获取硬盘序列号  

function GetVolumeID: string;
var
 vVolumeNameBuffer: array[0..255]of Char;
 vVolumeSerialNumber: DWORD;
 vMaximumComponentLength: DWORD;
 vFileSystemFlags: DWORD;
 vFileSystemNameBuffer: array[0..255]of Char;
begin
 if GetVolumeInformation('C:\', vVolumeNameBuffer, SizeOf(vVolumeNameBuffer),
 @vVolumeSerialNumber, vMaximumComponentLength, vFileSystemFlags,
 vFileSystemNameBuffer, SizeOf(vFileSystemNameBuffer))  then
 begin
 Result := IntToHex(vVolumeSerialNumber, 8);
 end;
end;
阅读17