Thema: Delphi Ioctl_ata_pass_through

Einzelnen Beitrag anzeigen

hathor
(Gast)

n/a Beiträge
 
#7

AW: Ioctl_ata_pass_through

  Alt 14. Apr 2014, 17:13
Bei meiner Seagate-HDD bekomme ich die Temperatur mit

Delphi-Quellcode:
type
  TSmartData = array[0..527] of Byte;

procedure GetSmartData(var Data: TSmartData);
var
  hdrive: Cardinal;
  dwBytesReturned: DWORD;
  ipar: array[0..31] of Byte;
  opar: TSmartData;
begin
  ipar[0] := 0;
  ipar[1] := $02;
  ipar[2] := 0;
  ipar[3] := 0;
  ipar[4] := $d0;
  ipar[5] := $01;
  ipar[6] := $01;
  ipar[7] := $4f;
  ipar[8] := $c2;
  ipar[9] := $a0;
  ipar[10] := $b0;
  ipar[11] := 0;
  ipar[12] := 0;
  ipar[13] := 0;
  ipar[14] := 0;
  ipar[15] := 0;
  ipar[16] := $8c;
  ipar[17] := $fd;
  ipar[18] := $14;
  ipar[19] := 0;
  ipar[20] := 0;
  ipar[21] := $02;
  ipar[22] := 0;
  ipar[23] := 0;
  ipar[24] := $03;
  ipar[25] := 0;
  ipar[26] := 0;
  ipar[27] := 0;
  ipar[28] := $03;
  ipar[29] := 0;
  ipar[30] := 0;
  ipar[31] := 0;

  // Get first harddrive
  hdrive := CreateFile(PChar('\\.\PhysicalDrive0'), 3221225472, 3, nil, 3, 0, 0);
  DeviceIoControl(hdrive, $0007C088, @ipar, 32, @opar, 528, dwBytesReturned, nil);
  CloseHandle(hdrive);
  Data := opar;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var sdata: TSmartData;
begin
getsmartdata(sdata);
Caption := INTTOSTR(sdata[168]*256+sdata[167]);
end;

Geändert von hathor (14. Apr 2014 um 18:27 Uhr)
  Mit Zitat antworten Zitat