Sunday, June 5, 2016

What Should I Do in a PnP Minor Function Handler?

A PnP minor function handler, when invoked, will receive two parameters:
  1. One is the WDF general object handle to the bus filter device object.
  2. The other is the PnP IRP itself.
Similar to a callback function registered with WdfDeviceInitAssignWdmIrpPreprocessCallback, the handler, before returning to BFF, must do one of the following actions:
  1. Complete the PnP IRP if appropriate.
  2. Optionally register an WDM IoCompletion routine and pass the PnP IRP down to the next lower driver.
If the latter is the case, the handler will end like:
NTSTATUS PnPMinorFunctionHandler(WDFOBJECT BffDevice, PIRP Irp)
{
    ...
    ...
    ...
    return IoCallDriver(BffDeviceWdmGetAttachedDevice(BffDevice), Irp);
}

No comments:

Post a Comment