WdfIoTargetSendIoctlSynchronously returning STATUS_INVALID_DEVICE_REQUEST in Windows

Hi,

We’ve created a small filter driver for the Microsoft CCID smartcard driver to overcome the lack of handling PS/SC2 SCardControl calls, and are running into an issue with Windows 7:

When sending IOCTLs to the CCID driver, WdfIoTargetSendIoctlSynchronously returns STATUS_INVALID_DEVICE_REQUEST (The request was already queued to an I/O target). The same code works fine in both Windows XP and Vista and is basically copied from the sample code listed on MSDN: http://msdn.microsoft.com/en-us/library/windows/hardware/ff544616(v=vs.85).aspx

I don’t understand the “request was already queued” since passing WDF_NO_HANDLE should trigger WdfIoTargetSendIoctlSynchronously to generate a WDFREQUEST object on the fly. Could the error indicate another issue? I’ve also tried breaking down the operation into a synchronous WdfRequestSend, but that returned the same error.

I’m a bit lost as where to look next. Anyone any suggestions? Help will be highly appreciated :).

Thanks and regards,
Rob.

!wdfkd.wdflogdump

Will tell you if the error is coming from kmdf or the lower driver

d

debt from my phone
________________________________
From: xxxxx@vasco.com
Sent: 2/16/2012 8:46 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] WdfIoTargetSendIoctlSynchronously returning STATUS_INVALID_DEVICE_REQUEST in Windows

Hi,

We’ve created a small filter driver for the Microsoft CCID smartcard driver to overcome the lack of handling PS/SC2 SCardControl calls, and are running into an issue with Windows 7:

When sending IOCTLs to the CCID driver, WdfIoTargetSendIoctlSynchronously returns STATUS_INVALID_DEVICE_REQUEST (The request was already queued to an I/O target). The same code works fine in both Windows XP and Vista and is basically copied from the sample code listed on MSDN: http://msdn.microsoft.com/en-us/library/windows/hardware/ff544616(v=vs.85).aspx

I don’t understand the “request was already queued” since passing WDF_NO_HANDLE should trigger WdfIoTargetSendIoctlSynchronously to generate a WDFREQUEST object on the fly. Could the error indicate another issue? I’ve also tried breaking down the operation into a synchronous WdfRequestSend, but that returned the same error.

I’m a bit lost as where to look next. Anyone any suggestions? Help will be highly appreciated :).

Thanks and regards,
Rob.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Hello Doron,

Thank you for your reply. I’ve tried to read out the log file, but it seems to be mostly about the PnP handling:

lkd> !wdfkd.wdflogdump CCIDFilter
Trace searchpath is:

Trace format prefix is: %7!u!: %!FUNC! -
TMF file used for formatting log is: c:\wdf01009.tmf
Log at 85295000
Gather log: Please wait, this may take a moment (reading 4032 bytes).
% read so far … 10, 20, 100
There are 26 log entries
— start of log —
1: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8 entering PnP State WdfDevStatePnpInit from WdfDevStatePnpObjectCreated
2: FxPkgPnp::Dispatch - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8, IRP_MJ_PNP, 0x00000000(IRP_MN_START_DEVICE) IRP 0x85231008
3: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8 entering PnP State WdfDevStatePnpInitStarting from WdfDevStatePnpInit
4: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8 entering PnP State WdfDevStatePnpHardwareAvailable from WdfDevStatePnpInitStarting
5: FxPkgPnp::NotPowerPolicyOwnerEnterNewState - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8 entering not power policy owner state WdfDevStatePwrPolStarting from WdfDevStatePwrPolObjectCreated
6: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8 entering Power State WdfDevStatePowerStartingCheckDeviceType from WdfDevStatePowerObjectCreated
7: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8 entering Power State WdfDevStatePowerD0Starting from WdfDevStatePowerStartingCheckDeviceType
8: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8 entering Power State WdfDevStatePowerD0StartingConnectInterrupt from WdfDevStatePowerD0Starting
9: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8 entering Power State WdfDevStatePowerD0StartingDmaEnable from WdfDevStatePowerD0StartingConnectInterrupt
10: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8 entering Power State WdfDevStatePowerD0StartingStartSelfManagedIo from WdfDevStatePowerD0StartingDmaEnable
11: FxPkgIo::ResumeProcessingForPower - Power resume all queues of WDFDEVICE 0x7AACB370
12: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8 entering Power State WdfDevStatePowerDecideD0State from WdfDevStatePowerD0StartingStartSelfManagedIo
13: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8 entering Power State WdfDevStatePowerD0 from WdfDevStatePowerDecideD0State
14: FxPkgPnp::NotPowerPolicyOwnerEnterNewState - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8 entering not power policy owner state WdfDevStatePwrPolStarted from WdfDevStatePwrPolStarting
15: FxPkgPnp::NotPowerPolicyOwnerEnterNewState - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8 entering not power policy owner state WdfDevStatePwrPolStartingSucceeded from WdfDevStatePwrPolStarted
16: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8 entering PnP State WdfDevStatePnpEnableInterfaces from WdfDevStatePnpHardwareAvailable
17: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8 entering PnP State WdfDevStatePnpStarted from WdfDevStatePnpEnableInterfaces
18: FxPkgPnp::Dispatch - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8, IRP_MJ_PNP, 0x00000014(IRP_MN_QUERY_PNP_DEVICE_STATE) IRP 0x853F7730
19: FxPkgFdo::HandleQueryPnpDeviceStateCompletion - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8 returning PNP_DEVICE_STATE 0x0 IRP 0x853F7730
20: FxPkgPnp::Dispatch - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8, IRP_MJ_PNP, 0x00000007(IRP_MN_QUERY_DEVICE_RELATIONS) type BusRelations IRP 0x853F7730
21: FxPkgPnp::HandleQueryBusRelations - WDFDEVICE 7AACB370 returning 1 devices in relations 93289230
22: FxPkgPnp::Dispatch - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8, IRP_MJ_PNP, 0x00000007(IRP_MN_QUERY_DEVICE_RELATIONS) type BusRelations IRP 0x853F7730
23: FxPkgPnp::HandleQueryBusRelations - WDFDEVICE 7AACB370 returning 1 devices in relations 93289230
24: FxPkgPnp::Dispatch - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8, IRP_MJ_PNP, 0x00000007(IRP_MN_QUERY_DEVICE_RELATIONS) type TargetDeviceRelation IRP 0x85569008
25: FxPkgPnp::Dispatch - WDFDEVICE 0x7AACB370 !devobj 0x855F35C8, IRP_MJ_PNP, 0x00000007(IRP_MN_QUERY_DEVICE_RELATIONS) type BusRelations IRP 0x85561008
26: FxPkgPnp::HandleQueryBusRelations - WDFDEVICE 7AACB370 returning 2 devices in relations B26BB068
---- end of log ----

Should I enable anything specific? I’m using a checked build of the driver, but I don’t have access to a checked Windows 7 build unfortunately.

  • Rob

From: Doron Holan

!wdfkd.wdflogdump

Will tell you if the error is coming from kmdf or the lower driver

________________________________
From: xxxxx@vasco.com
Sent: 2/16/2012 8:46 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] WdfIoTargetSendIoctlSynchronously returning
STATUS_INVALID_DEVICE_REQUEST in Windows

Hi,

We’ve created a small filter driver for the Microsoft CCID smartcard driver to
overcome the lack of handling PS/SC2 SCardControl calls, and are running into an
issue with Windows 7:

When sending IOCTLs to the CCID driver, WdfIoTargetSendIoctlSynchronously
returns STATUS_INVALID_DEVICE_REQUEST (The request was already queued to an I/O
target). The same code works fine in both Windows XP and Vista and is basically
copied from the sample code listed on MSDN:
http://msdn.microsoft.com/en-us/library/windows/hardware/ff544616(v=vs.85).aspx

I don’t understand the “request was already queued” since passing WDF_NO_HANDLE
should trigger WdfIoTargetSendIoctlSynchronously to generate a WDFREQUEST object
on the fly. Could the error indicate another issue? I’ve also tried breaking
down the operation into a synchronous WdfRequestSend, but that returned the same
error.