Question

I'm writing prog. which communicates with a Kernel driver using DeviceIoControl().

For different IOCTL codes, DeviceIoControl returns sometime -0x3ffffff3 and sometime -0x3ffffffb. (Negative values in both cases)

From this return value how do i understand whether the IOCTL code is supported by the target device or not ??

If i'm sending correct IOCTL code to device, should it return positive value always ???

Thanks,

Was it helpful?

Solution

Reading the MSDN page for DeviceIoControl says the following:

Return value

If the operation completes successfully, the return value is nonzero.

If the operation fails or is pending, the return value is zero. To get extended error information, call GetLastError.

So, it seems that your IOCtls are supported by the device since you get something other than zero. Remember that you may get negative value if you are using signed integers, try them with unsigned integers if you aren't supposed to get negative values.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top