Where can I find constant IOCTL values?

I need to know the IOCTL constants for various strings (for example, the value of the IOCTL_ATA_PASS_THROUGH constant). A network search, I found that these constants are defined in the Ntddscsi.h header, but these constants are erroneous. For example, the constant value IOCTL_ATA_PASS_THROUGH should be 4D02C, and in the header file - 40B

Question: where can I find a list with all the correct values?

thanks

EDIT:

I found http://www.ioctls.net/ where all the codes are listed. Anyway, thanks for explaining why the value in Ntddscsi.h is not the "final" value

+4
source share
1 answer

They are located in the ntddscsi.h file found in c: \ Program Files (x86) \ Microsoft SDK \ Windows \ v7.0A \ Include \ (on a 64-bit system). They are ignored as:

#define IOCTL_ATA_PASS_THROUGH CTL_CODE(IOCTL_SCSI_BASE, 0x040b, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 

and IOCTL_SCSI_BASE is

 #define IOCTL_SCSI_BASE FILE_DEVICE_CONTROLLER 

from the same file

and from WinIoCtl.h

 #define METHOD_BUFFERED 0 #define FILE_DEVICE_CONTROLLER 0x00000004 #define FILE_READ_ACCESS ( 0x0001 ) // file & pipe #define FILE_WRITE_ACCESS ( 0x0002 ) // file & pipe 

and CTL_CODE comes from WinIoCtl.h found in c: \ Program Files (x86) \ Microsoft SDK \ Windows \ v7.0A \ Include \

 #define CTL_CODE( DeviceType, Function, Method, Access ) ( \ ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \ 

)

so your final value for IOCTL_ATA_PASS_THROUGH will be:

 (4 << 16 | (1 | 2) << 14 | 0x040b << 2 | 0) = 315436 = 4D02C 

: D

And if you apply these calculations to other IO _.... macros, you will find the values. On the other hand, it is much easier to write a short application to print their values ​​as hex;)

+10
source

All Articles