> #define CTL_CODE( DeviceType, Function, Method, Access ) > ( \ > ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) > \ This cryptic #define makes 32 bits constants as follows: dddd dddd dddd dddd aaff ffff ffff ffmm Legend: d: DeviceType a: Access f: Function m: Method You can construct the constant in this simpler way: CTL_CODE = DeviceType * 65536 + Function * 4 + Method + Access * 16384 > #define IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER CTL_CODE(IOCTL_STORAGE_BASE, > 0x0304, METHOD_BUFFERED, FILE_ANY_ACCESS) In the above, we have these constants: IOCTL_STORAGE_BASE = 0x0000002d, or 45 decimal METHOD_BUFFERED = 0 FILE_ANY_ACCESS = 0 So, IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER would be: CTL_CODE = DeviceType * 65536 + Function * 4 + Method + Access * 16384 = 45 * 65536 + 0x0304 * 4 + 0 + 0 * 16384 = 45 * 65536 + 772 * 4 = 2952208, or 0x002D0C10 > In the above example, how was the value of parameter 0x2D1400 determined? See the bits distribution above. When 0x002D1400 is broken down, you get: DeviceType = 0x002D Access = 0 Function = 0x1400 / 4 = 0x500 or 1280 decimal Method = 0 I couldn't find any constant for 0x500, so it's either for later versions of Windows, or undocumented.