Hi all, I wanna read harddisk in an ioctl to my disk filter. But
occasionally either the IoCallDriver hangs the system.
Here is the code and stack
BaseSHDReadWriteSector(.)
{
.
KeInitializeEvent(&event,NotificationEvent,FALSE);
.
Irp=IoBuildAsynchronousFsdRequest(readorwrite,
// pDeviceExtension->TargetDeviceObject,
SHDGlobalData.g_TargetPhysicalDevice,
pBuffFar,
length,
&offset,
&ioStatus);
.
IoSetCompletionRoutine(Irp,
SHDIrpCompletion,
&event,
TRUE,
TRUE,
TRUE);
// this call occasionally hangs
status= IoCallDriver(SHDGlobalData.g_TargetPhysicalDevice,Irp);
if (status == STATUS_PENDING)
{
// this call occasionally hangs too
KeWaitForSingleObject(&event,
Executive ,
KernelMode,
FALSE,
NULL);
}
.
}
Stack trace:
f6704620 8050117a nt!KiSwapContext+0x2e
f670462c 804fa9be nt!KiSwapThread+0x46
f6704654 8050112c nt!KeWaitForSingleObject+0x1c2
f670466c 804fe030 nt!KiSuspendThread+0x18
f67046b4 806d1c35 nt!KiDeliverApc+0x124
f67046b4 806d12e2 hal!HalpApcInterrupt+0xc5
f670473c 804efe46 hal!KfLowerIrql+0x12
f6704754 f8451c9a nt!IoStartPacket+0xaa
f6704780 804eedf9 atapi!IdePortDispatch+0x4e6
f6704790 f86db061 nt!IopfCallDriver+0x31
f67047a4 f86dad58 CLASSPNP!SubmitTransferPacket+0x82
f67047d4 f86dae49 CLASSPNP!ServiceTransferRequest+0xe4
f67047f8 804eedf9 CLASSPNP!ClassReadWrite+0xff
f6704808 f82ca78d nt!IopfCallDriver+0x31
f6704848 f82cf32d CSHD!BaseSHDReadWriteSector+0x13d
[e:\cshd\driver\shdsys\wdminit.c @ 1310]
f6704870 f82d57ad CSHD!SHDReadWriteSector+0x7d [e:\ cshd
\driver\shdsys\readwrite.c @ 458]
f67048ac f82d40e9 CSHD!GetAllAPInfoFromDisk+0xad [e:\ cshd
\driver\shdsys\control.c @ 1899]
f6704b84 f82d6e60 CSHD!ProtectSysCMDMain+0x719 [e:\ cshd
\driver\shdsys\control.c @ 1009]
f6704bc4 f82ca099 CSHD!DoShdDeviceIo+0x170 [e:\ cshd
\driver\shdsys\control.c @ 2938]
f6704c34 804eedf9 CSHD!SHDDeviceIoControl+0x59 [e:\ cshd
\driver\shdsys\wdminit
Please note that Irp->PendingReturned = TRUE when system hangs.
Regards
Haibo