的CTL_CODE宏定義爲
#define CTL_CODE(DeviceType, Function, Method, Access) (
((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method)
)
所以德爾福相當於IOCTL_ATA_PASS_THROUGH
常量的是這樣的
uses
Windows;
const
//#define IOCTL_ATA_PASS_THROUGH CTL_CODE(IOCTL_SCSI_BASE, 0x040B, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
IOCTL_SCSI_BASE = FILE_DEVICE_CONTROLLER;
IOCTL_ATA_PASS_THROUGH= (IOCTL_SCSI_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or ($040B shl 2) or (METHOD_BUFFERED);
注:Unfortunally德爾福不支持宏,但您可以創建功能
function CTL_CODE(DeviceType, _Function, Method, Access: Cardinal): Cardinal;
begin
Result := (DeviceType shl 16) or (Access Shl 14) or (_Function shl 2) or (Method);
end;
並獲得RU值正時這樣
Flag:=CTL_CODE(IOCTL_SCSI_BASE, $040B , METHOD_BUFFERED, (FILE_READ_ACCESS or FILE_WRITE_ACCESS));
但是,你甚至可以在Delphi中使用這個東西嗎?這不是特定的驅動程序嗎? (+1) – TLama 2012-01-18 16:40:55
是的,你可以在delphi中使用它,例如重新引用S.M.A.R.T. hdd的數據。 – RRUZ 2012-01-18 16:43:39