是因为你fileObject- >FsContext为null,fileObject- >FsContext可以记录任意信息,但从这里可以看出是记录PUSBD_PIPE_INFORMATION pipeInformation信息的。
Ezusb驱动我没用过,但大体应该和ddk中的例子bulkusb差不多,fileObject- >FsContext应该在IRP_CREATE中就被赋值了,但你的程序没有成功赋值。
下面摘抄一段bulkusb中的代码
C/C++ code
NTSTATUS
BulkUsb_DispatchCreate(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
{
。。。。
for(i=0; i<interface->NumberOfPipes; i++) {
if(pipeContext == &deviceExtension->PipeContext[i]) {
//
// found a match
//
BulkUsb_DbgPrint(3, ("open pipe %d\n", i));
fileObject->FsContext = &interface->Pipes[i];
ASSERT(fileObject->FsContext);
pipeContext->PipeOpen = TRUE;
ntStatus = STATUS_SUCCESS;
//
// increment OpenHandleCounts
//
InterlockedIncrement(&deviceExtension->OpenHandleCount);
//
// the device is idle if it has no open handles or pending PnP Irps
// since we just received an open handle request, cancel idle req.
//
if(deviceExtension->SSEnable) {
CancelSelectSuspend(deviceExtension);
}
}
}
|