Hi All,
I have a KMDF function driver for a PCIe device which intercepts few of the PNP IRP and then forwards them to the lower stacks.
So in my EvtAddDevice I call
WdfDeviceInitAssignWdmIrpPreprocessCallback
so that I can tell the framework which PNP Irps I am interested in and want to preprocess them. Using this I register a PnpPreProcessIrp handler.
At the end of the EvtAddDevice after calling WdfDeviceInitAssignWdmIrpPreprocessCallback I create a lock. This lock is acquired in the PnpPreProcessIrp function. What I am seeing is that
- The PnpPreProcessIrp function is getting called.
- The PnpPreProcessIrp calls WdfWaitLockAcquire to acquire the Lock that I created in AddDevice.
- The WdfWaitLockAcquire crashes, saying that the lock is null, which inturn means that AddDevice did not create the lock yet.
In other words, my code makes an implicit assumption that till I do not return from AddDevice, none of the PNP IRP that my driver registered for will be dispatched to the Driver.
Is this assumption valid?
In my case, I am not ready to handle the PNP IRPS until I return from AddDevice. What is the correct way to serialize this?
Thanks
Aj