IOCTL
A system macro was defined in wdm.h to parse/deserialize the IO control code:
Macro: Used to generate IOCTL and FSCTL function control code, function code 0-2047 used by Microsoft, 2048-4095 for users
#define Ctl_code (DeviceType, Function, Method, Access) ((DeviceType) << 16) | ((Access) << 14) | (Function) << 2) | (Method))
Macros: Extracting macros for device types
#define Device_type_from_ctl_code (Ctrlcode) ((ULONG) (Ctrlcode & 0xffff0000) >> 16)
Macros: Extracting Cache methods
#define Method_from_ctl_code (Ctrlcode) ((ULONG) (Ctrlcode & 3))
Macros: extracting function codes
#define Iogetfunctioncodefromctlcode (Controlcode) ((Controlcode >> 2) & 0X00000FFF)
Device Type code:
1 //2 //Define The various device type values. Note that the values used by Microsoft3 //Corporation is in the range 0-32767, and 32768-65535 is reserved for use4 //by customers.5 //6 7 #defineDevice_type ULONG8 9 #defineFile_device_beep 0x00000001Ten #defineFile_device_cd_rom 0x00000002 One #defineFile_device_cd_rom_file_system 0x00000003 A #defineFile_device_controller 0x00000004 - #defineFile_device_datalink 0x00000005 - #defineFile_device_dfs 0x00000006 the #defineFile_device_disk 0x00000007 - #defineFile_device_disk_file_system 0x00000008 - #defineFile_device_file_system 0x00000009 - #defineFile_device_inport_port 0x0000000a + #defineFile_device_keyboard 0x0000000b - #defineFile_device_mailslot 0x0000000c + #defineFile_device_midi_in 0x0000000d A #defineFile_device_midi_out 0x0000000e at #defineFile_device_mouse 0x0000000f - #defineFile_device_multi_unc_provider 0x00000010 - #defineFile_device_named_pipe 0x00000011 - #defineFile_device_network 0x00000012 - #defineFile_device_network_browser 0x00000013 - #defineFile_device_network_file_system 0x00000014 in #defineFile_device_null 0x00000015 - #defineFile_device_parallel_port 0x00000016 to #defineFile_device_physical_netcard 0x00000017 + #defineFile_device_printer 0x00000018 - #defineFile_device_scanner 0x00000019 the #defineFile_device_serial_mouse_port 0x0000001a * #defineFile_device_serial_port 0x0000001b $ #defineFile_device_screen 0x0000001cPanax Notoginseng #defineFile_device_sound 0x0000001d - #defineFile_device_streams 0x0000001e the #defineFile_device_tape 0x0000001f + #defineFile_device_tape_file_system 0x00000020 A #defineFile_device_transport 0x00000021 the #defineFile_device_unknown 0x00000022 + #defineFile_device_video 0x00000023 - #defineFile_device_virtual_disk 0x00000024 $ #defineFile_device_wave_in 0x00000025 $ #defineFile_device_wave_out 0x00000026 - #defineFile_device_8042_port 0x00000027 - #defineFile_device_network_redirector 0x00000028 the #defineFile_device_battery 0x00000029 - #defineFile_device_bus_extender 0x0000002aWuyi #defineFile_device_modem 0x0000002b the #defineFILE_DEVICE_VDM 0x0000002c - #defineFile_device_mass_storage 0x0000002d Wu #defineFILE_DEVICE_SMB 0x0000002e - #defineFile_device_ks 0x0000002f About #defineFile_device_changer 0x00000030 $ #defineFile_device_smartcard 0x00000031 - #defineFILE_DEVICE_ACPI 0x00000032 - #defineFile_device_dvd 0x00000033 - #defineFile_device_fullscreen_video 0x00000034 A #defineFile_device_dfs_file_system 0x00000035 + #defineFile_device_dfs_volume 0x00000036 the #defineFile_device_serenum 0x00000037 - #defineFile_device_termsrv 0x00000038 $ #defineFile_device_ksec 0x00000039 the #defineFile_device_fips 0x0000003a the #defineFile_device_infiniband 0x0000003B the #defineFile_device_vmbus 0x0000003e the #defineFile_device_crypt_provider 0x0000003F - #defineFILE_DEVICE_WPD 0x00000040 in #defineFile_device_bluetooth 0x00000041 the #defineFile_device_mt_composite 0x00000042 the #defineFile_device_mt_transport 0x00000043 About #defineFile_device_biometric 0x00000044 the #defineFILE_DEVICE_PMI 0x00000045 the #defineFile_device_ehstor 0x00000046 the #defineFile_device_devapi 0x00000047 + #defineFile_device_gpio 0x00000048 - #defineFile_device_usbex 0x00000049 the #defineFile_device_console 0x00000050Bayi #defineFILE_DEVICE_NFP 0x00000051 the #defineFile_device_sysenv 0x00000052 the #defineFile_device_virtual_block 0x00000053 - #defineFile_device_point_of_service 0x00000054 - #defineFile_device_storage_replication 0x00000055 the #defineFile_device_trust_env 0x00000056 the #defineFILE_DEVICE_UCM 0x00000057 the #defineFile_device_ucmtcpci 0x00000058 the #defineFile_device_persistent_memory 0x00000059 - #defineFile_device_nvdimm 0x0000005a the #defineFile_device_holographic 0x0000005b the #defineFILE_DEVICE_SDFXHCI 0x0000005c
Device Type Code
Caching methods:
1 // define how I/O and FS control how the cached method code is passed 2 3 #define method_buffered 04#define method_in_direct 15#define METHOD _out_direct 26#define method_neither 3
Caching Methods
IOCTL (Ctl_code)