I have written this audio driver which is pretty stable when playing/
recording sound. However, when I try to update the driver (via Device
Manager), it generates a Fatal System Error:
*** Fatal System Error: 0x0000000a
(0x00000000,0x00000002,0x00000001,0x80525722)
with the following stack trace:
nt!RtlpBreakWithStatusInstruction
nt!KiBugCheckDebugBreak+0x19
nt!KeBugCheck2+0xa51
nt!KiTrap0E+0x233
nt!PoRegisterDeviceForIdleDetection+0x46
nt!PoRunDownDeviceObject+0x1c
nt!IoDeleteDevice+0x4d
portcls!PnpRemoveDevice+0x8f
portcls!DispatchPnp+0xce
portcls!PcDispatchIrp+0x34
adrvr!MyPnpHandler+0x236 <<<<<<< only function that is mine
nt!IopfCallDriver+0x31
nt!IopSynchronousCall+0xb7
nt!IopRemoveDevice+0x93
nt!IopRemoveLockedDeviceNode+0x160
nt!IopDeleteLockedDeviceNode+0x34
nt!IopDeleteLockedDeviceNodes+0x3f
nt!PiProcessQueryRemoveAndEject+0x76b
nt!PiProcessTargetDeviceEvent+0x2a
nt!PiWalkDeviceList+0x122
nt!ExpWorkerThread+0x100
nt!PspSystemThreadStartup+0x34
nt!KiThreadStartup+0x16
Clearly, bugcheck analysis gives me a strong clue where to look for:
MyPnpHandler().
Well, what I do in MyPnpHandler() is basically this:
NTSTATUS YzPnpHandler(IN PDEVICE_OBJECT fdo, IN PIRP irp)
{
PAGED_CODE();
ASSERT(fdo != NULL);
ASSERT(irp != NULL);
if (OurFDO(fdo) &&
pIoStackLocation->MinorFunction == IRP_MN_REMOVE_DEVICE)
{
// stop thread and wait for its exit
}
return ( PcDispatchIrp(fdo, irp) ); // pass the IRPs on to
PortCls
}
It seems that one of (or both?) paramaters to PcDispatchIrp are
invalid by the time PcDispatchIrp is called?
But how is this possible? as seen in my code, both fdo and irp are
used successfully and *never modified* until they reach
PcDispatchIrp(fdo, irp). How is this possible?
What Could Possibly Crash PnpRemoveDevice()?
Thanks,
Don