Hi,
I’m creating an USB driver for a FX2 based device. The device particularly is a scanner,
so I wish to treat 2 of in endpoints as “interrupt” endpoints (one EP is a real INT
EP, thus providing status information, the other is a simple bulk in EP but it provides
scanned image information, thus it is the driver who has to buffer ALL incoming
data from this pipe, as nothing can be lost).
Everything seems to be going fine, I modified the usb sample code within the DDK,
added support for continous readers per pipes, added EvtFileCreate/EvtFileClose
to the EvtDeviceAdd.
Within the file create I:
- open the pipe
- setup and start the pipe with a continous reader (if it’s an INT or a “simulated” INT pipe).
Within the file close I would like to WdfIoTargetStop() the specific pipes naturally
that are having continous readers assigned to them.
Here comes the sad part I get BSOD when doing that so.
From the windbg analyzation it seems my code fails on the WdfIoTargetStop().
I was checking the code and the PipeHandle is not NULL, but apart from that
it seems (at least from the registers) that the WdfIoTargetStop() gets a NULL
parameter, so I would assume that the WdfUsbTargetPipeGetIoTarget() returns
NULL.
So technically what I would like to know:
- what is the lifecycle of a pipe within the framework? (when is it "auto"closed)
- how/when should I make sure that the continous readers are stopped when the
file descriptors (to the pipes) are closed?
Thanks,
t.
Here are some details about the bug:
BugCheck 8E, {80000003, 804e3b14, bae8f9d0, 0}
EXCEPTION_CODE: (HRESULT) 0x80000003 (2147483651) - One or more arguments are invalid
FAULTING_IP:
nt!DbgBreakPoint+0
804e3b14 cc int 3
TRAP_FRAME: bae8f9d0 – (.trap 0xffffffffbae8f9d0)
ErrCode = 00000000
eax=00000000 ebx=00000000 ecx=00000001 edx=00000000 esi=ba51572c edi=82133008
eip=804e3b15 esp=bae8fa44 ebp=bae8fa58 iopl=0 nv up ei pl nz na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000202
nt!DbgBreakPoint+0x1:
804e3b15 c3 ret
Resetting default scope
DEFAULT_BUCKET_ID: DRIVER_FAULT
BUGCHECK_STR: 0x8E
PROCESS_NAME: scanner_test.ex
LAST_CONTROL_TRANSFER: from 8051dea6 to 805339ae
STACK_TEXT:
bae8f598 8051dea6 0000008e 80000003 804e3b14 nt!KeBugCheckEx+0x1b
bae8f960 804dfada bae8f97c 00000000 bae8f9d0 nt!KiDispatchException+0x3b1
bae8f9c8 804e0208 bae8fa58 804e3b15 badb0d00 nt!CommonDispatchException+0x4d
bae8f9c8 804e3b15 bae8fa58 804e3b15 badb0d00 nt!KiTrap03+0xad
bae8fa40 ba4b584f 8228a8c8 8228a934 81f2239c nt!DbgBreakPoint+0x1
bae8fa58 baf3199a 021330c0 7e2925d0 00000001 wdf01000!imp_WdfIoTargetStop+0x9a
bae8fa6c baf318ff 7e2925d0 00000001 ba509f54 e6usb!WdfIoTargetStop+0x1a [c:\winddk\6001.18001\inc\wdf\kmdf\1.7\wdfiotarget.h @ 413]
bae8fa94 baf3114c 81d8f450 00000000 822d0c68 e6usb!StopInterruptEndPoint+0x1af [c:\wo2711\fx2drv.new\device.c @ 592]
bae8facc ba4eb944 7e22f4a8 81f222c0 8228a934 e6usb!E6UsbEvtFileClose+0x1cc [c:\wo2711\fx2drv.new\device.c @ 406]
bae8fae0 ba4ec0bc 7e22f4a8 8228a8c8 81f2239c wdf01000!FxFileObjectFileCleanup::Invoke+0x24
bae8fb04 ba4ec782 00000000 81f222d0 81eec1e8 wdf01000!FxPkgGeneral::OnClose+0x70
bae8fb20 ba4e2665 81f222c0 bae8fb74 804e3d77 wdf01000!FxPkgGeneral::Dispatch+0xdf
bae8fb2c 804e3d77 81de36e0 81f222c0 81f222c0 wdf01000!FxDevice::Dispatch+0x7f
bae8fb3c 8056afec 8235cc68 00000000 00000000 nt!IopfCallDriver+0x31
bae8fb74 80563ff6 0035cc80 8235cc68 00000000 nt!IopDeleteFile+0x132
bae8fb90 804e3c55 8235cc80 00000000 00000740 nt!ObpRemoveObjectRoutine+0xdf
bae8fbb4 80567543 8235cc69 00000740 e1524e80 nt!ObfDereferenceObject+0x5f
bae8fbcc 8058ad2d e1298788 8235cc80 00000740 nt!ObpCloseHandleTableEntry+0x155
bae8fbec 8058b12d e1524e80 00000740 bae8fc3c nt!ObpCloseHandleProcedure+0x1f
bae8fc1c 8058aa46 e1298788 8058ad0e bae8fc3c nt!ExSweepHandleTable+0x4f
bae8fc48 8058b04a 81dd0650 821d20b8 c000013a nt!ObKillProcess+0x5c
bae8fcf0 8058b341 c000013a bae8fd4c 804e6851 nt!PspExitThread+0x5e9
bae8fcfc 804e6851 821d20b8 bae8fd48 bae8fd3c nt!PsExitSpecialApc+0x22
bae8fd4c 804df0d4 00000001 00000000 bae8fd64 nt!KiDeliverApc+0x1af
bae8fd4c 7c90eb94 00000001 00000000 bae8fd64 nt!KiServiceExit+0x58
00f1fe8c 7c90d8ef 7c801671 00000754 00000000 ntdll!KiFastSystemCallRet
00f1fe90 7c801671 00000754 00000000 00000000 ntdll!ZwDeviceIoControlFile+0xc
00f1fef0 00403bb1 00000754 5500600e 00000000 kernel32!DeviceIoControl+0xdd
WARNING: Stack unwind information not available. Following frames may be wrong.
00f1ff30 004012ad 00413590 00000006 00f1ff58 scanner_test!_GetExceptDLLinfo+0x2b58
00f1ffb4 7c80b50b 00942c4c 00000000 00000005 scanner_test!_GetExceptDLLinfo+0x254
00f1ffec 00000000 00401231 00942c4c 00000000 kernel32!BaseThreadStart+0x37
STACK_COMMAND: kb
FOLLOWUP_IP:
e6usb!WdfIoTargetStop+1a [c:\winddk\6001.18001\inc\wdf\kmdf\1.7\wdfiotarget.h @ 413]
baf3199a 5d pop ebp
FAULTING_SOURCE_CODE:
409: WDF_IO_TARGET_SENT_IO_ACTION Action
410: )
411: {
412: ((PFN_WDFIOTARGETSTOP) WdfFunctions[WdfIoTargetStopTableIndex])(WdfDriverGlobals, IoTarget, Action);
413: }
414:
415: //
416: // WDF Function: WdfIoTargetGetState
417: //
418: typedef
SYMBOL_STACK_INDEX: 6
SYMBOL_NAME: e6usb!WdfIoTargetStop+1a
FOLLOWUP_NAME: MachineOwner
MODULE_NAME: e6usb
IMAGE_NAME: e6usb.sys
DEBUG_FLR_IMAGE_TIMESTAMP: 48eb187d
FAILURE_BUCKET_ID: 0x8E_e6usb!WdfIoTargetStop+1a
BUCKET_ID: 0x8E_e6usb!WdfIoTargetStop+1a