Delphi get disk serial number

From , 5 Years ago, written in Delphi (Object Pascal), viewed 99 times.
URL https://pastebin.vip/view/27934a1f
  1. function HardDiskSerial(const Drive: string): Windows.DWORD;
  2. var
  3.   Unused: Windows.DWORD;        // unused parameters
  4.   PrevErrorMode: Windows.UINT;  // stores Windows error mode
  5. begin
  6.   // Inhibit system dialog appearing on error
  7.   PrevErrorMode := Windows.SetErrorMode(
  8.     Windows.SEM_FAILCRITICALERRORS
  9.   );
  10.   try
  11.     Result := 0;
  12.     Windows.GetVolumeInformation(
  13.       PChar(Drive), nil, 0, @Result, Unused, Unused, nil, 0
  14.     );
  15.   finally
  16.     // Restore old error mode
  17.     Windows.SetErrorMode(PrevErrorMode);
  18.   end;
  19. end;
  20. //delphi/2201

Reply to "Delphi get disk serial number"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website