The CTL_CODE macro is defined as
#define CTL_CODE(DeviceType, Function, Method, Access) ( ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) )
So the equivalent of delphi IOCTL_ATA_PASS_THROUGH const is something like this
uses Windows; const //
Note. Unfortunately, delphi does not support macros, but you can create a function
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;
and thus get the value at runtime
Flag:=CTL_CODE(IOCTL_SCSI_BASE, $040B , METHOD_BUFFERED, (FILE_READ_ACCESS or FILE_WRITE_ACCESS));
source share