我简单试了下,移动硬盘也可以获取SN,是否代码有问题
procedure TForm1.Button1Click(Sender: TObject);
var
VolumeSerialNumber : DWORD;
MaximumComponentLength : DWORD;
FileSystemFlags : DWORD;
begin
GetVolumeInformation('k:/',
nil,
0,
@VolumeSerialNumber,
MaximumComponentLength,
FileSystemFlags,
nil,
0);
messagebox(0,pchar(IntToStr(VolumeSerialNumber)),'',mb_ok);
end;