Advertisement
Guest User

Untitled

a guest
Dec 25th, 2012
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.30 KB | None | 0 0
  1. function ReadKey(Path: String; Value: String): String;
  2. var
  3.   reg: TRegistry;
  4. begin
  5.   reg:=TRegistry.Create;
  6.   try
  7.     reg.RootKey:=HKEY_LOCAL_MACHINE;
  8.     reg.OpenKey(Path, False);
  9.     Result:=reg.ReadString(Value);
  10.     if Result = '' then
  11.       Result:='Unknown';
  12.   except
  13.     Result:='Unknown';
  14.   end;
  15. end;
  16.  
  17. function GetCDriveSN: String;
  18. var
  19.   pdw: pDword;
  20.   mc, fl: Dword;
  21.   dwSerial: Dword;
  22. begin
  23.   New(pdw);
  24.   GetVolumeInformation('C:\', nil, 0, pdw, mc, fl, nil, 0);
  25.   dwSerial:=pdw^;
  26.   Dispose(pdw);
  27.   Result:=IntToStr(tmp);
  28. end;
  29.  
  30. function GetHardwareID: string;
  31. var
  32.   tmp, tmp2: String;
  33.   FileData: THWProfileInfo;
  34. begin
  35.   tmp:=md5(ReadKey('Hardware\Description\System\CentralProcessor\0', 'VendorIdentifier'));
  36.   tmp:=tmp + md5(ReadKey('Hardware\Description\System\CentralProcessor\0', 'ProcessorNameString'));
  37.   tmp:=tmp + md5(ReadKey('Hardware\Description\System', 'SystemBiosDate'));
  38.   tmp:=md5(tmp + GetCDriveSN);
  39.  
  40.   tmp2:=md5(ReadKey('Hardware\Description\System', 'VideoBiosDate'));
  41.   tmp2:=tmp2 + md5(ReadKey('Hardware\Description\System\CentralProcessor\0', 'Identifier'));
  42.   tmp2:=tmp2 + md5(ReadKey('Software\Microsoft\Windows\CurrentVersion', 'ProductID'));
  43.   GetCurrentHwProfile(FileData);
  44.   tmp2:=md5(tmp2 + FileData.szHwProfileGuid);
  45.  
  46.   Result:=md5(tmp + tmp2);
  47. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement