Thanks for the help on Pending - it pointed me towards the answer.
Now I have another problem.
My serial driver (filter driver object) is now working okay in normal
operation mode. However, when I power down then windows hangs -
never actually shuts down. Using WinDbg I have isolated the problem
(I think) in the Power function:
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
NTSTATUS status = STATUS_SUCCESS;
The line that causes the hang is marked. I have removed it and just
returned STATUS_SUCCESS, but the de *** then tells me that it is
waiting for the Irp to complete. The Macro GET_NEXT_DEVICE_OBJECT
gets a pointer to the next device object from an extension structure.
As I said previously, it is code that I am bugfixing, not code I have
written entirely myself. In searching the code I have not been able
to locate anywhere IoCreateDevice(..) is called! I would have
expected to find it in AddDevice(). I am guessing this might have
something to do with the problem, but I am reluctant to mess around
with the AddDriver routine until I am sure. As I said before the
driver seems to work fine - it does exactly what I would expect.
Any ideas or pointers?