// // ¨ú±oºÏºÐ§Ç¸¹ // function GetVolumeSerial(Drive: char): string; var OldErrorMode: Integer; VolNameBuf: array[0..MAX_PATH] of char; VolSerialNum: DWORD; MaxFileNameLen: DWORD; FileSysFlags: DWORD; FileSystemNameBuf: array[0..255] of char; begin Result := ''; OldErrorMode := SetErrorMode(SEM_FAILCRITICALERRORS); try VolNameBuf[0] := #$00; if GetVolumeInformation(PChar(Drive + ':\'), VolNameBuf, sizeof(VolNameBuf), @VolSerialNum, MaxFileNameLen, FileSysFlags, FileSystemNameBuf, 256) then begin Result := IntToHex(HIWORD(VolSerialNum),4) + '-' + IntToHex(LOWORD(VolSerialNum),4); Result := UpperCase(Result); end; finally SetErrorMode(OldErrorMode); end; end;