/// <summary>This macro is used to create a unique system I/O control code (IOCTL).</summary> /// <param name="deviceType"> /// Defines the type of device for the given IOCTL. /// This parameter can be no bigger then a WORD value. /// The values used by Microsoft are in the range 0-32767 and the values 32768-65535 are reserved for use by OEMs and IHVs. /// </param> /// <param name="function"> /// Defines an action within the device category. /// That function codes 0-2047 are reserved for Microsoft, and 2048-4095 are reserved for OEMs and IHVs. /// The function code can be no larger then 4095. /// </param> /// <param name="method">Defines the method codes for how buffers are passed for I/O and file system controls.</param> /// <param name="access">Defines the access check value for any access.</param> /// <remarks> /// The macro can be used for defining IOCTL and FSCTL function control codes. /// All IOCTLs must be defined this way to ensure that no overlaps occur between Microsoft and OEMs and IHVs. /// </remarks> /// <returns>IO control code</returns> private static UInt32 CTL_CODE(UInt16 deviceType, UInt16 function, WinAPI.METHOD method, WinAPI.FILE_ACCESS access) { return((UInt32)((deviceType << 16) | ((UInt16)access << 14) | (function << 2) | (Byte)method)); }
/// <summary>This macro is used to create a unique system I/O control code (IOCTL).</summary> /// <param name="deviceType"> /// Defines the type of device for the given IOCTL. /// This parameter can be no bigger then a WORD value. /// The values used by Microsoft are in the range 0-32767 and the values 32768-65535 are reserved for use by OEMs and IHVs. /// </param> /// <param name="function"> /// Defines an action within the device category. /// That function codes 0-2047 are reserved for Microsoft, and 2048-4095 are reserved for OEMs and IHVs. /// The function code can be no larger then 4095. /// </param> /// <param name="access">Defines the access check value for any access.</param> /// <remarks> /// The macro can be used for defining IOCTL and FSCTL function control codes. /// All IOCTLs must be defined this way to ensure that no overlaps occur between Microsoft and OEMs and IHVs. /// </remarks> /// <returns>IO control code</returns> private static UInt32 CTL_CODE(UInt16 deviceType, UInt16 function, WinAPI.FILE_ACCESS access) { return(CTL_CODE(deviceType, function, WinAPI.METHOD.BUFFERED, access)); }