Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
If you receive an IOCTL that does not belong to your driver, you must send it down to the next-lower-level driver.
Most drivers implement IOCTLs in switch statements, and merely define their default section to use IoCallDriver to send the unknown request down to the next driver.
If an application sends down a request that is unrecognized by any driver in the stack, it will eventually fail by either a specific level in the stack or at the bottom, where there is no driver below to pass it to.
The following code example is an example of appropriate code.
Irp->IoStatus.Information = 0;
switch (IrpStack->Parameters.DeviceIoControl.IoControlCode)
{
default:
IoCopyCurrentIrpStackLocationToNext(Irp);
//
// 'ParentDeviceObject', below, is the value returned from your
// call to IoAttachDeviceToDeviceStack().
//
status = IoCallDriver(ParentDeviceObject, Irp);
return(status);
}
Send Feedback on this topic to the authors