I’m doing a series of read requests to a USB mass storage driver using
the following sequence of calls (some editing) :
{
KEVENT Event;
PIRP Irp;
IO_STATUS_BLOCK Iosb;
KeInitializeEvent( &Event, NotificationEvent, FALSE );
Irp = IoBuildSynchronousFsdRequest( IRP_MJ_WRITE,
TargetDeviceObject,
Buffer,
NumberOfBytesToRead,
&ByteOffset,
&Event,
&Iosb );
if ( Irp == NULL )
return( STATUS_INSUFFICIENT_RESOURCES ) ;
Status = IoCallDriver( TargetDeviceObject, Irp );
if (Status == STATUS_PENDING) {
KeWaitForSingleObject( &Event, Executive, KernelMode, FALSE,
(PLARGE_INTEGER)NULL );
Status = Iosb.Status;
}
…
This seems to work for a number of calls. Sometimes IoCallDriver
returns the STATUS_PENDING value but after the event is signaled, the
status value in the
status block indicates success.
However, after one STATUS_PENDING return, the event is never signaled.
The problem occurs at the same read on every run. My code looks
equivalent to a number of samples from the W2000 DDK. I tried replacing
the standard W2000 usbstor.sys driver with one specific to the H/W
device. The no-signal problem is not affected by the driver change.
Has anyone seen a problem like this before? Any suggestions for
possible causes? Or lines of investigation?
Bill Hunt