Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Ioctl_ata_pass_through (https://www.delphipraxis.net/179954-ioctl_ata_pass_through.html)

Mattze 14. Apr 2014 07:55

Ioctl_ata_pass_through
 
Hallo,

ich habe für IOCTL_ATA_PASS_THROUGH einen Typ
Delphi-Quellcode:
    TATAIdentifyDeviceQuery = packed record
      header: ATA_PASS_THROUGH_EX;
      data: array [0..255] of Word;
    end;
gefunden.
(Damit kriegt man z. Bsp. raus, ob das eine SSD ist: data[217]=1)

Mich würden nun aber noch die anderen data interessieren.
Bisher habe ich dazu nichts gefunden. Kennt jemand ein paar?

Gruß
Mattze

Union 14. Apr 2014 08:03

AW: Ioctl_ata_pass_through
 
Das ist aber etwas sehr allgmein. Die tatsächliche Struktur ist hier dokumentiert.

hathor 14. Apr 2014 09:27

AW: Ioctl_ata_pass_through
 
http://en.wikipedia.org/wiki/S.M.A.R....T._attributes

Mattze 14. Apr 2014 09:44

°C
 
Hallo,

vielen Dank, aber...

@Union: Es geht hier nicht um die Struktur von ATA_PASS_THROUGH_EX, sondern um die Struktur des OutputPuffers.

@Hathor: Das dachte ich zuerst auch. Allerdings müsste dann data[194] die aktuelle Temperatur der Platte sein sein. Ist es aber nicht! Der Wert ist 0, richtig (anders per SMART direkt ausgelesen) ist sie 29°C.
(Ich dachte auch, das das die gleichen Werte wie bei WMI unter Vendorspezifisch1 angegeben sind. Aber??? Den Klassennamen habe ich jetzt vergessen!)

Gruß Mattze

hathor 14. Apr 2014 09:53

AW: Ioctl_ata_pass_through
 
Manche Einträge sind herstellerspezifisch -> Stichwort: arrVendorSpecific.
Z.B. Temperatur:
Manche speichern auch den niedrigsten, aktuellen und höchsten Wert, der je aufgetreten ist.

Nicht alle SSD haben einen Temperatursensor!

Mattze 14. Apr 2014 10:16

AW: Ioctl_ata_pass_through
 
Hallo,

das herstellerspezifisch" stimmt natürlich - und ist ziemlich lästig.
Aber:
1. Es geht nicht um die Temperatur einer SDD, sondern einer ganz normalen S.M.A.R.T.-HDD.
2. Im Datenpuffer data[194] steht 0. Dieser SMART-Wert direkt ausgelesen gibt 29. Fremdprogramme ergeben auch 29! Laut Deines Vorschlages gibt SMART bei 194 tatsächlich die Temperatur an und dort ist auch kein Hinweis auf "herstellerspezifisch" zu finden. Das scheint wirklich zu den allgemein gültigen Adressen zu gehören!

Gruß
Mattze

hathor 14. Apr 2014 16:13

AW: Ioctl_ata_pass_through
 
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;

hathor 15. Apr 2014 10:22

AW: Ioctl_ata_pass_through
 
Nachtrag: constant arrVendorSpecific

FUJITSU, HITACHI, MAXTOR: arrVendorSpecific(151)
WESTERN DIGITAL, IBM: arrVendorSpecific(139)
SAMSUNG: arrVendorSpecific(135)
SEAGATE: arrVendorSpecific(127)


Alle Zeitangaben in WEZ +1. Es ist jetzt 14:03 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz