public static void CtlCodeDecode(uint code, out EDeviceType device_type, out uint function, out EDeviceIoMethod method, out EDeviceAccess access) { device_type = (EDeviceType)((code >> 16) & 0xFFFF); access = (EDeviceAccess)((code >> 14) & 0x3); function = (code >> 2) & 0xFFF; method = (EDeviceIoMethod)((code >> 0) & 0x3); }
/// <summary>The native macros (CTL_CODE) used to encode commands passed to DeviceIoControl (see winioctl.h, bthioctl.h)</summary> public static uint CtlCodeEncode(EDeviceType device_type, uint function, EDeviceIoMethod method, EDeviceAccess access) { return(((uint)device_type << 16) | ((uint)access << 14) | (function << 2) | ((uint)method)); }