WdfIoTargetFormatRequestForInternalIoctlOthers...

Returned to my lower KMDF Filter saga after break. I’m trying to get the descriptor of the USB device.

The code below (I removed some DgPrint) runs but fails to return the descriptor of the device that was just added. This method is thus called from the XXXDeviceAdd().

No status is ever wrong. But the descriptor returned is not valid.

Also when I look at “IoGetCurrentIrpStackLocation(WdfRequestWdmGetIrp(request))->Parameters.Others.Argument1” which, I believe, should be my URB, it is NULL !

Surely, I must be doing something very wrong. I don’t seem to be able to see it.

Any help greatly appreciated (feeling despondent and like writing a WDM driver ;-))

NTSTATUS get_descriptor(IN WDFDEVICE device, LONGLONG timeout)
{
NTSTATUS status;
PURB pUrb;
WDFMEMORY urbMemory;

USB_DEVICE_DESCRIPTOR deviceDescriptor;
WDF_REQUEST_SEND_OPTIONS syncReqOptions;

WDFREQUEST request;

PURB pUrb2; // for debugging
PIRP pirp; // ditto

status = WdfMemoryCreate(
WDF_NO_OBJECT_ATTRIBUTES,
NonPagedPool,
0,
sizeof(URB),
&urbMemory,
NULL
);

if (!NT_SUCCESS(status)) {
return status;
}

pUrb = WdfMemoryGetBuffer(
urbMemory,
NULL
);

UsbBuildGetDescriptorRequest(
pUrb,
sizeof(URB),
USB_DEVICE_DESCRIPTOR_TYPE,
0, // this parameter not used for device descriptors
0, // this parameter not used for device descriptors
&deviceDescriptor,
NULL,
sizeof(USB_DEVICE_DESCRIPTOR),
NULL);

status = WdfRequestCreate(
WDF_NO_OBJECT_ATTRIBUTES, WdfDeviceGetIoTarget(device), &request);

if (!NT_SUCCESS(status)) {
return status;
}

WDF_REQUEST_SEND_OPTIONS_INIT(
&syncReqOptions,
0
);
WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(
&syncReqOptions,
WDF_REL_TIMEOUT_IN_SEC(timeout)
);

status = WdfIoTargetFormatRequestForInternalIoctlOthers(
WdfDeviceGetIoTarget(device),
request,
IOCTL_INTERNAL_USB_SUBMIT_URB,
urbMemory,
0,
NULL,
0,
NULL,
0
);

if (!NT_SUCCESS(status)) {
return status;
}

pirp = WdfRequestWdmGetIrp(request);

if (pirp == NULL)
{
MyPrint(" IRP NULL \n");
}
else
{
MyDogPrint(" IRP %x \n",pirp);

MyDogPrint( " IRP STACK %x \n",IoGetCurrentIrpStackLocation(pirp));

if (IoGetCurrentIrpStackLocation(pirp) == NULL)
{
MyDogPrint( " IRP STACK NULL \n");
}
else
{
pUrb2 = (PURB) IoGetCurrentIrpStackLocation(WdfRequestWdmGetIrp(request))->Parameters.Others.Argument1;

MyDogPrint( " purB2 %x \n", pUrb2);
}
}

syncReqOptions.Flags |= WDF_REQUEST_SEND_OPTION_SYNCHRONOUS;
if (WdfRequestSend(
request,
WdfDeviceGetIoTarget(device),
&syncReqOptions
) == FALSE) {
status = WdfRequestGetStatus(request);
}
else {
status = STATUS_SUCCESS;
}

// code removed

// descriptor "returned " (?) is wrong

return status;
}

The current irp stack location is not valid, esp for requests your driver creates. When you format a request, you are manipulating the *next* stack location.

d

dent from a phpne with no keynoard

-----Original Message-----
From: xxxxx@live.ca
Sent: October 07, 2010 4:56 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] WdfIoTargetFormatRequestForInternalIoctlOthers…

Returned to my lower KMDF Filter saga after break. I’m trying to get the descriptor of the USB device.

The code below (I removed some DgPrint) runs but fails to return the descriptor of the device that was just added. This method is thus called from the XXXDeviceAdd().

No status is ever wrong. But the descriptor returned is not valid.

Also when I look at “IoGetCurrentIrpStackLocation(WdfRequestWdmGetIrp(request))->Parameters.Others.Argument1” which, I believe, should be my URB, it is NULL !

Surely, I must be doing something very wrong. I don’t seem to be able to see it.

Any help greatly appreciated (feeling despondent and like writing a WDM driver ;-))

NTSTATUS get_descriptor(IN WDFDEVICE device, LONGLONG timeout)
{
NTSTATUS status;
PURB pUrb;
WDFMEMORY urbMemory;

USB_DEVICE_DESCRIPTOR deviceDescriptor;
WDF_REQUEST_SEND_OPTIONS syncReqOptions;

WDFREQUEST request;

PURB pUrb2; // for debugging
PIRP pirp; // ditto

status = WdfMemoryCreate(
WDF_NO_OBJECT_ATTRIBUTES,
NonPagedPool,
0,
sizeof(URB),
&urbMemory,
NULL
);

if (!NT_SUCCESS(status)) {
return status;
}

pUrb = WdfMemoryGetBuffer(
urbMemory,
NULL
);

UsbBuildGetDescriptorRequest(
pUrb,
sizeof(URB),
USB_DEVICE_DESCRIPTOR_TYPE,
0, // this parameter not used for device descriptors
0, // this parameter not used for device descriptors
&deviceDescriptor,
NULL,
sizeof(USB_DEVICE_DESCRIPTOR),
NULL);

status = WdfRequestCreate(
WDF_NO_OBJECT_ATTRIBUTES, WdfDeviceGetIoTarget(device), &request);

if (!NT_SUCCESS(status)) {
return status;
}

WDF_REQUEST_SEND_OPTIONS_INIT(
&syncReqOptions,
0
);
WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(
&syncReqOptions,
WDF_REL_TIMEOUT_IN_SEC(timeout)
);

status = WdfIoTargetFormatRequestForInternalIoctlOthers(
WdfDeviceGetIoTarget(device),
request,
IOCTL_INTERNAL_USB_SUBMIT_URB,
urbMemory,
0,
NULL,
0,
NULL,
0
);

if (!NT_SUCCESS(status)) {
return status;
}

pirp = WdfRequestWdmGetIrp(request);

if (pirp == NULL)
{
MyPrint(" IRP NULL \n");
}
else
{
MyDogPrint(" IRP %x \n",pirp);

MyDogPrint( " IRP STACK %x \n",IoGetCurrentIrpStackLocation(pirp));

if (IoGetCurrentIrpStackLocation(pirp) == NULL)
{
MyDogPrint( " IRP STACK NULL \n");
}
else
{
pUrb2 = (PURB) IoGetCurrentIrpStackLocation(WdfRequestWdmGetIrp(request))->Parameters.Others.Argument1;

MyDogPrint( " purB2 %x \n", pUrb2);
}
}

syncReqOptions.Flags |= WDF_REQUEST_SEND_OPTION_SYNCHRONOUS;
if (WdfRequestSend(
request,
WdfDeviceGetIoTarget(device),
&syncReqOptions
) == FALSE) {
status = WdfRequestGetStatus(request);
}
else {
status = STATUS_SUCCESS;
}

// code removed

// descriptor "returned " (?) is wrong

return status;
}


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

Okay, Thank you Doron, that explains the NULL.

Also, I was too optimist in this bit of code :

if (WdfRequestSend(
request,
WdfDeviceGetIoTarget(device),
&syncReqOptions
) == FALSE)

In interpreting a TRUE as success, looking at the actual status returned by WdfRequestGetStatus(request) when the WdfRequestSend() returns TRUE, I get INVALID PARAMETER as a status…

No idea what is missing or wrong.

Anything obviously wrong in the code above, anyone?

(I don’t have the proper setup to do kernel debugging at this stage… Do I really need to be a KMDF driver to intercept all requests to all USB mass storage devices? Why would a UMDF driver not do the job?)

TRUE means “Sent” as per the docs. You then have to get the status of
the completed request.
Mark Roddy

On Thu, Oct 7, 2010 at 10:50 AM, wrote:
> WdfRequestSend

Thank you Mark.

Yes, I understood about getting the error…

But why the error? Any idea what the invalid parameter is?

Mark,

Just wondering : "TRUE means “Sent” as per the docs…

Does that mean that it is the URB (pointed to by the wdfrequest) which contains a wrong parameter, rather than the (wdf)request itself?

What does !wdfkd.wdflogdump say after it returns? That will tell you where the error originated from

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@live.ca
Sent: Thursday, October 07, 2010 12:31 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] WdfIoTargetFormatRequestForInternalIoctlOthers…

Mark,

Just wondering : "TRUE means “Sent” as per the docs…

Does that mean that it is the URB (pointed to by the wdfrequest) which contains a wrong parameter, rather than the (wdf)request itself?


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

I think the list software bounced my reply.

You are missing a PWDFMEMORY_OFFSET parameter value ?for your
urbMemory, in your call to
WdfIoTargetFormatRequestForInternalIoctlOthers.

Mark Roddy

On Thu, Oct 7, 2010 at 3:31 PM, ? wrote:
> Mark,
>
> Just wondering ?: "TRUE means “Sent” as per the docs…
>
> Does that mean that it is the URB (pointed to by the wdfrequest) which contains a wrong parameter, rather than the (wdf)request itself?
>
>
> —
> 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
>

He should not need an offset and it is optional

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Thursday, October 07, 2010 2:04 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] WdfIoTargetFormatRequestForInternalIoctlOthers…

I think the list software bounced my reply.

You are missing a PWDFMEMORY_OFFSET parameter value ?for your urbMemory, in your call to WdfIoTargetFormatRequestForInternalIoctlOthers.

Mark Roddy

On Thu, Oct 7, 2010 at 3:31 PM, ? wrote:
> Mark,
>
> Just wondering ?: "TRUE means “Sent” as per the docs…
>
> Does that mean that it is the URB (pointed to by the wdfrequest) which contains a wrong parameter, rather than the (wdf)request itself?
>
>
> —
> 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
>


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

As suggested last time I set a break point in the code at this stage :

syncReqOptions.Flags |= WDF_REQUEST_SEND_OPTION_SYNCHRONOUS;
if (WdfRequestSend(
request,
WdfDeviceGetIoTarget(device),
&syncReqOptions
) == FALSE) {
status = WdfRequestGetStatus(request);
}
else {
status = WdfRequestGetStatus(request);
MyPrint(“Request send status 0x%x\n”,status);
}

if (!NT_SUCCESS(status)) {
DbgBreakPoint();
MyPrint(“WdfIoTargetSendInternalIoctlSynchronously Failed with error 0x%x\n”,status);
return status;
}

WinDbg stops at the “DbgBreakPoint();” (I see this line highlighted in the left pane where the source appears).

And this is what I obtain when I call !wdfkd.wdflogdump (sorry if it is long, I don’t know what is needed) :

kd> !wdfkd.wdflogdump busdog
Trace searchpath is: \NTREL202.ntdev.corp.microsoft.com\4F18C3A5-CA09-4DBD-B6FC-219FDD4C6BE0\TraceFormat

Trace format prefix is: %7!u!: %!FUNC! -
TMF file used for formatting log is: C:\WinDDK\7600.16385.1\tools\tracing\i386\Wdf01009.tmf
*** ERROR: Module load completed but symbols could not be loaded for ipnat.sys
*** ERROR: Module load completed but symbols could not be loaded for ipsec.sys
Log at 8249d000
Gather log: Please wait, this may take a moment (reading 4032 bytes).
% read so far … 10, 20, 30, 40, 50, 60, 70, 80, 90, 100
There are 91 log entries
— start of log —
63: FxPkgPnp::NotPowerPolicyOwnerEnterNewState - WDFDEVICE 0x7DB486B8 !devobj 0x82455460 entering not power policy owner state WdfDevStatePwrPolStartingSucceeded from WdfDevStatePwrPolStarted
64: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DB486B8 !devobj 0x82455460 entering PnP State WdfDevStatePnpEnableInterfaces from WdfDevStatePnpHardwareAvailable
65: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DB486B8 !devobj 0x82455460 entering PnP State WdfDevStatePnpStarted from WdfDevStatePnpEnableInterfaces
66: FxPkgPnp::Dispatch - WDFDEVICE 0x7DB486B8 !devobj 0x82455460, IRP_MJ_PNP, 0x00000014(IRP_MN_QUERY_PNP_DEVICE_STATE) IRP 0x824998B0
67: FxPkgFdo::HandleQueryPnpDeviceStateCompletion - WDFDEVICE 0x7DB486B8 !devobj 0x82455460 returning PNP_DEVICE_STATE 0x0 IRP 0x824998B0
68: FxPkgPnp::Dispatch - WDFDEVICE 0x7DB486B8 !devobj 0x82455460, IRP_MJ_PNP, 0x00000007(IRP_MN_QUERY_DEVICE_RELATIONS) type BusRelations IRP 0x824998B0
69: FxPkgPnp::Dispatch - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020, IRP_MJ_PNP, 0x00000000(IRP_MN_START_DEVICE) IRP 0x824998B0
70: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020 entering PnP State WdfDevStatePnpInitStarting from WdfDevStatePnpInit
71: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020 entering PnP State WdfDevStatePnpHardwareAvailable from WdfDevStatePnpInitStarting
72: FxPkgPnp::NotPowerPolicyOwnerEnterNewState - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020 entering not power policy owner state WdfDevStatePwrPolStarting from WdfDevStatePwrPolObjectCreated
73: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020 entering Power State WdfDevStatePowerStartingCheckDeviceType from WdfDevStatePowerObjectCreated
74: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020 entering Power State WdfDevStatePowerD0Starting from WdfDevStatePowerStartingCheckDeviceType
75: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020 entering Power State WdfDevStatePowerD0StartingConnectInterrupt from WdfDevStatePowerD0Starting
76: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020 entering Power State WdfDevStatePowerD0StartingDmaEnable from WdfDevStatePowerD0StartingConnectInterrupt
77: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020 entering Power State WdfDevStatePowerD0StartingStartSelfManagedIo from WdfDevStatePowerD0StartingDmaEnable
78: FxPkgIo::ResumeProcessingForPower - Power resume all queues of WDFDEVICE 0x7DF5F2F0
79: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020 entering Power State WdfDevStatePowerDecideD0State from WdfDevStatePowerD0StartingStartSelfManagedIo
80: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020 entering Power State WdfDevStatePowerD0 from WdfDevStatePowerDecideD0State
81: FxPkgPnp::NotPowerPolicyOwnerEnterNewState - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020 entering not power policy owner state WdfDevStatePwrPolStarted from WdfDevStatePwrPolStarting
82: FxPkgPnp::NotPowerPolicyOwnerEnterNewState - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020 entering not power policy owner state WdfDevStatePwrPolStartingSucceeded from WdfDevStatePwrPolStarted
83: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020 entering PnP State WdfDevStatePnpEnableInterfaces from WdfDevStatePnpHardwareAvailable
84: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020 entering PnP State WdfDevStatePnpStarted from WdfDevStatePnpEnableInterfaces
85: FxPkgPnp::Dispatch - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020, IRP_MJ_PNP, 0x00000014(IRP_MN_QUERY_PNP_DEVICE_STATE) IRP 0x820511F8
86: FxPkgFdo::HandleQueryPnpDeviceStateCompletion - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020 returning PNP_DEVICE_STATE 0x0 IRP 0x820511F8
87: FxPkgPnp::Dispatch - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020, IRP_MJ_PNP, 0x00000007(IRP_MN_QUERY_DEVICE_RELATIONS) type BusRelations IRP 0x820511F8
88: FxPkgPnp::Dispatch - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8, IRP_MJ_PNP, 0x00000000(IRP_MN_START_DEVICE) IRP 0x8209CB30
89: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8 entering PnP State WdfDevStatePnpInitStarting from WdfDevStatePnpInit
90: FxPkgPnp::Dispatch - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8 IRP_MJ_POWER, 0x00000002(IRP_MN_SET_POWER) IRP 0x82054410 for PowerDeviceD3
91: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8 entering PnP State WdfDevStatePnpHardwareAvailable from WdfDevStatePnpInitStarting
92: FxPkgPnp::PnpMatchResources - Not enough interrupt objects created by WDFDEVICE 0x7DB3D9C8
93: FxPkgPnp::NotPowerPolicyOwnerEnterNewState - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8 entering not power policy owner state WdfDevStatePwrPolStarting from WdfDevStatePwrPolObjectCreated
94: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8 entering Power State WdfDevStatePowerStartingCheckDeviceType from WdfDevStatePowerObjectCreated
95: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8 entering Power State WdfDevStatePowerD0Starting from WdfDevStatePowerStartingCheckDeviceType
96: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8 entering Power State WdfDevStatePowerD0StartingConnectInterrupt from WdfDevStatePowerD0Starting
97: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8 entering Power State WdfDevStatePowerD0StartingDmaEnable from WdfDevStatePowerD0StartingConnectInterrupt
98: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8 entering Power State WdfDevStatePowerD0StartingStartSelfManagedIo from WdfDevStatePowerD0StartingDmaEnable
99: FxPkgIo::ResumeProcessingForPower - Power resume all queues of WDFDEVICE 0x7DB3D9C8
100: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8 entering Power State WdfDevStatePowerDecideD0State from WdfDevStatePowerD0StartingStartSelfManagedIo
101: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8 entering Power State WdfDevStatePowerD0 from WdfDevStatePowerDecideD0State
102: FxPkgPnp::NotPowerPolicyOwnerEnterNewState - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8 entering not power policy owner state WdfDevStatePwrPolStarted from WdfDevStatePwrPolStarting
103: FxPkgPnp::NotPowerPolicyOwnerEnterNewState - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8 entering not power policy owner state WdfDevStatePwrPolStartingSucceeded from WdfDevStatePwrPolStarted
104: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8 entering PnP State WdfDevStatePnpEnableInterfaces from WdfDevStatePnpHardwareAvailable
105: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8 entering PnP State WdfDevStatePnpStarted from WdfDevStatePnpEnableInterfaces
106: FxPkgPnp::Dispatch - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8, IRP_MJ_PNP, 0x00000014(IRP_MN_QUERY_PNP_DEVICE_STATE) IRP 0x82208CD8
107: FxPkgFdo::HandleQueryPnpDeviceStateCompletion - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8 returning PNP_DEVICE_STATE 0x0 IRP 0x82208CD8
108: FxPkgPnp::Dispatch - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8, IRP_MJ_PNP, 0x00000007(IRP_MN_QUERY_DEVICE_RELATIONS) type BusRelations IRP 0x824F1B40
109: FxPkgPnp::Dispatch - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00, IRP_MJ_PNP, 0x00000000(IRP_MN_START_DEVICE) IRP 0x824F1B40
110: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00 entering PnP State WdfDevStatePnpInitStarting from WdfDevStatePnpInit
111: FxPkgPnp::Dispatch - WDFDEVICE 0x7DB3D9C8 !devobj 0x820B5AF8 IRP_MJ_POWER, 0x00000002(IRP_MN_SET_POWER) IRP 0x8220BA48 for PowerDeviceD0
112: FxPkgPnp::Dispatch - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00 IRP_MJ_POWER, 0x00000002(IRP_MN_SET_POWER) IRP 0x8220BE70 for PowerDeviceD3
113: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00 entering PnP State WdfDevStatePnpHardwareAvailable from WdfDevStatePnpInitStarting
114: FxPkgPnp::PnpMatchResources - Not enough interrupt objects created by WDFDEVICE 0x7DEFD1D8
115: FxPkgPnp::NotPowerPolicyOwnerEnterNewState - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00 entering not power policy owner state WdfDevStatePwrPolStarting from WdfDevStatePwrPolObjectCreated
116: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00 entering Power State WdfDevStatePowerStartingCheckDeviceType from WdfDevStatePowerObjectCreated
117: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00 entering Power State WdfDevStatePowerD0Starting from WdfDevStatePowerStartingCheckDeviceType
118: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00 entering Power State WdfDevStatePowerD0StartingConnectInterrupt from WdfDevStatePowerD0Starting
119: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00 entering Power State WdfDevStatePowerD0StartingDmaEnable from WdfDevStatePowerD0StartingConnectInterrupt
120: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00 entering Power State WdfDevStatePowerD0StartingStartSelfManagedIo from WdfDevStatePowerD0StartingDmaEnable
121: FxPkgIo::ResumeProcessingForPower - Power resume all queues of WDFDEVICE 0x7DEFD1D8
122: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00 entering Power State WdfDevStatePowerDecideD0State from WdfDevStatePowerD0StartingStartSelfManagedIo
123: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00 entering Power State WdfDevStatePowerD0 from WdfDevStatePowerDecideD0State
124: FxPkgPnp::NotPowerPolicyOwnerEnterNewState - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00 entering not power policy owner state WdfDevStatePwrPolStarted from WdfDevStatePwrPolStarting
125: FxPkgPnp::NotPowerPolicyOwnerEnterNewState - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00 entering not power policy owner state WdfDevStatePwrPolStartingSucceeded from WdfDevStatePwrPolStarted
126: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00 entering PnP State WdfDevStatePnpEnableInterfaces from WdfDevStatePnpHardwareAvailable
127: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00 entering PnP State WdfDevStatePnpStarted from WdfDevStatePnpEnableInterfaces
128: FxPkgPnp::Dispatch - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00, IRP_MJ_PNP, 0x00000014(IRP_MN_QUERY_PNP_DEVICE_STATE) IRP 0x82013298
129: FxPkgFdo::HandleQueryPnpDeviceStateCompletion - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00 returning PNP_DEVICE_STATE 0x0 IRP 0x82013298
130: FxPkgPnp::Dispatch - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00, IRP_MJ_PNP, 0x00000007(IRP_MN_QUERY_DEVICE_RELATIONS) type BusRelations IRP 0x822CBCD8
131: FxPkgPnp::Dispatch - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370, IRP_MJ_PNP, 0x00000000(IRP_MN_START_DEVICE) IRP 0x822CB8B0
132: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370 entering PnP State WdfDevStatePnpInitStarting from WdfDevStatePnpInit
133: FxPkgPnp::Dispatch - WDFDEVICE 0x7DEFD1D8 !devobj 0x8202AF00 IRP_MJ_POWER, 0x00000002(IRP_MN_SET_POWER) IRP 0x8220BA48 for PowerDeviceD0
134: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370 entering PnP State WdfDevStatePnpHardwareAvailable from WdfDevStatePnpInitStarting
135: FxPkgPnp::NotPowerPolicyOwnerEnterNewState - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370 entering not power policy owner state WdfDevStatePwrPolStarting from WdfDevStatePwrPolObjectCreated
136: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370 entering Power State WdfDevStatePowerStartingCheckDeviceType from WdfDevStatePowerObjectCreated
137: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370 entering Power State WdfDevStatePowerD0Starting from WdfDevStatePowerStartingCheckDeviceType
138: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370 entering Power State WdfDevStatePowerD0StartingConnectInterrupt from WdfDevStatePowerD0Starting
139: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370 entering Power State WdfDevStatePowerD0StartingDmaEnable from WdfDevStatePowerD0StartingConnectInterrupt
140: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370 entering Power State WdfDevStatePowerD0StartingStartSelfManagedIo from WdfDevStatePowerD0StartingDmaEnable
141: FxPkgIo::ResumeProcessingForPower - Power resume all queues of WDFDEVICE 0x7DEFD938
142: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370 entering Power State WdfDevStatePowerDecideD0State from WdfDevStatePowerD0StartingStartSelfManagedIo
143: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370 entering Power State WdfDevStatePowerD0NP from WdfDevStatePowerDecideD0State
144: FxPkgPnp::NotPowerPolicyOwnerEnterNewState - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370 entering not power policy owner state WdfDevStatePwrPolStarted from WdfDevStatePwrPolStarting
145: FxPkgPnp::NotPowerPolicyOwnerEnterNewState - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370 entering not power policy owner state WdfDevStatePwrPolStartingSucceeded from WdfDevStatePwrPolStarted
146: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370 entering PnP State WdfDevStatePnpEnableInterfaces from WdfDevStatePnpHardwareAvailable
147: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370 entering PnP State WdfDevStatePnpStarted from WdfDevStatePnpEnableInterfaces
148: FxPkgPnp::Dispatch - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370, IRP_MJ_PNP, 0x00000014(IRP_MN_QUERY_PNP_DEVICE_STATE) IRP 0x8252A1F8
149: FxPkgFdo::HandleQueryPnpDeviceStateCompletion - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370 returning PNP_DEVICE_STATE 0x0 IRP 0x8252A1F8
150: FxPkgPnp::Dispatch - WDFDEVICE 0x7DEFD938 !devobj 0x824CA370, IRP_MJ_PNP, 0x00000007(IRP_MN_QUERY_DEVICE_RELATIONS) type BusRelations IRP 0x8252A1F8
151: FxPkgPnp::Dispatch - WDFDEVICE 0x7DF5F2F0 !devobj 0x820A1020, IRP_MJ_PNP, 0x00000007(IRP_MN_QUERY_DEVICE_RELATIONS) type BusRelations IRP 0x82095298
152: FxPkgPnp::HandleQueryBusRelations - WDFDEVICE 7DF5F2F0 returning 2 devices in relations 8202CD80
153: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DE597D0 !devobj 0x821A7778 entering PnP State WdfDevStatePnpInit from WdfDevStatePnpObjectCreated
---- end of log ----

Doron,

I realize the log info above is similar (except that 2 USB keys were plugged in this time instead of one) to the log I get for the WdfIoTargetSendInternalIoctlSynchronously log I already provided which you said was not helpful.

Is there something else I should do?

Peter

Run wdfverifier.exe on the target machine, enable verbose logging for your driver, and crank up the number of log memory pages to 10. Then, just plug in /one/ device and get to the point of error and dump the log.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@live.ca
Sent: Friday, October 08, 2010 11:39 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] WdfIoTargetFormatRequestForInternalIoctlOthers…

Doron,

I realize the log info above is similar (except that 2 USB keys were plugged in this time instead of one) to the log I get for the WdfIoTargetSendInternalIoctlSynchronously log I already provided which you said was not helpful.

Is there something else I should do?

Peter


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

Doron,

here is the end of the log (don’t know if it is enough for you to determine the issue) :

8380: FxPkgIo::Dispatch - WDFDEVICE 0x7E55A838 !devobj 0x81F642C8 0x0000000f(IRP_MJ_INTERNAL_DEVICE_CONTROL), IRP_MN 0, IRP 0x81BDF008
8381: FxPkgIo::Dispatch - WDFDEVICE 0x7E55A838 !devobj 0x81F642C8 0x0000000f(IRP_MJ_INTERNAL_DEVICE_CONTROL), IRP_MN 0, IRP 0x81FDD390
8382: FxPkgIo::Dispatch - WDFDEVICE 0x7E55A838 !devobj 0x81F642C8 0x0000000f(IRP_MJ_INTERNAL_DEVICE_CONTROL), IRP_MN 0, IRP 0x81FDD390
8383: FxPkgIo::Dispatch - WDFDEVICE 0x7E55A838 !devobj 0x81F642C8 0x0000000f(IRP_MJ_INTERNAL_DEVICE_CONTROL), IRP_MN 0, IRP 0x81FDD390
8384: FxPkgIo::Dispatch - WDFDEVICE 0x7E55A838 !devobj 0x81F642C8 0x0000000f(IRP_MJ_INTERNAL_DEVICE_CONTROL), IRP_MN 0, IRP 0x81FDD390
8385: FxPkgIo::Dispatch - WDFDEVICE 0x7E55A838 !devobj 0x81F642C8 0x0000000f(IRP_MJ_INTERNAL_DEVICE_CONTROL), IRP_MN 0, IRP 0x81FDD390
8386: FxPkgIo::Dispatch - WDFDEVICE 0x7E55A838 !devobj 0x81F642C8 0x0000000f(IRP_MJ_INTERNAL_DEVICE_CONTROL), IRP_MN 0, IRP 0x81B51E70
8387: FxPkgIo::Dispatch - WDFDEVICE 0x7E55A838 !devobj 0x81F642C8 0x0000000f(IRP_MJ_INTERNAL_DEVICE_CONTROL), IRP_MN 0, IRP 0x81B51E70
8388: FxPkgIo::Dispatch - WDFDEVICE 0x7E55A838 !devobj 0x81F642C8 0x0000000f(IRP_MJ_INTERNAL_DEVICE_CONTROL), IRP_MN 0, IRP 0x81BDF008
8389: FxPkgIo::Dispatch - WDFDEVICE 0x7E55A838 !devobj 0x81F642C8 0x0000000f(IRP_MJ_INTERNAL_DEVICE_CONTROL), IRP_MN 0, IRP 0x81FDD390
8390: FxPkgIo::Dispatch - WDFDEVICE 0x7E55A838 !devobj 0x81F642C8 0x0000000f(IRP_MJ_INTERNAL_DEVICE_CONTROL), IRP_MN 0, IRP 0x81FDD390
8391: FxPkgIo::Dispatch - WDFDEVICE 0x7E55A838 !devobj 0x81F642C8 0x0000000f(IRP_MJ_INTERNAL_DEVICE_CONTROL), IRP_MN 0, IRP 0x81FDD390
8392: FxPkgIo::Dispatch - WDFDEVICE 0x7E55A838 !devobj 0x81F642C8 0x0000000f(IRP_MJ_INTERNAL_DEVICE_CONTROL), IRP_MN 0, IRP 0x81FDD390
8393: FxPkgIo::Dispatch - WDFDEVICE 0x7E55A838 !devobj 0x81F642C8 0x0000000f(IRP_MJ_INTERNAL_DEVICE_CONTROL), IRP_MN 0, IRP 0x81FDD390
8394: FxPkgIo::Dispatch - WDFDEVICE 0x7E55A838 !devobj 0x81F642C8 0x0000000f(IRP_MJ_INTERNAL_DEVICE_CONTROL), IRP_MN 0, IRP 0x81FDD390
8395: FxPkgPnp::Dispatch - WDFDEVICE 0x7E55A838 !devobj 0x81F642C8, IRP_MJ_PNP, 0x00000007(IRP_MN_QUERY_DEVICE_RELATIONS) type BusRelations IRP 0x81B38650
8396: FxPkgFdo::PnpQueryDeviceRelations - Entering QueryDeviceRelations handler, type BusRelations
8397: FxChildList::ProcessBusRelations - Nothing to report on WDFCHILDLIST 7E4BB780, returning early
8398: FxChildList::ProcessModificationsLocked - Begin processing modifications on WDFCHILDLIST 7E4BB780
8399: FxChildList::ProcessModificationsLocked - end processing modifications on WDFCHILDLIST 7E4BB780
8400: FxPkgPnp::HandleQueryBusRelations - WDFDEVICE 7E55A838, returning STATUS_SUCCESS from processing bus relations
8401: FxPkgPnp::HandleQueryBusRelations - WDFDEVICE 7E55A838 returning 1 devices in relations 81B06E98
8402: FxPkgPnp::HandleQueryBusRelations - PDO 81AC2218
8403: FxPkgFdo::PnpQueryDeviceRelations - Exiting QueryDeviceRelations handler, status STATUS_SUCCESS
8404: FxDriver::AddDevice - Enter AddDevice PDO 81AC2218
8405: FxPkgIo::FxPkgIo - Constructed FxPkgIo 0x81BC9B48
8406: FxPkgPnp::AddChildList - Adding FxChildList 81AC02B8, WDFCHILDLIST 7E53FD40
8407: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7E543CB0 !devobj 0x81B79B50 entering PnP State WdfDevStatePnpInit from WdfDevStatePnpObjectCreated
8408: imp_WdfDeviceAllocAndQueryProperty - exit WDFDEVICE 7E543CB0, Property 1, STATUS_SUCCESS
8409: imp_WdfDeviceAllocAndQueryProperty - exit WDFDEVICE 7E543CB0, Property 2, STATUS_SUCCESS
8410: FxRequest::_Create - Irp 00000000 Ownership FxRequestOwnsIrp FxRequest 81B6B9B0, status STATUS_SUCCESS
8411: imp_WdfIoTargetFormatRequestForInternalIoctlOthers - Enter: WDFIOTARGET 0x7E877E40, WDFREQUEST 0x7E494648, IOCTL 0x220003, WDFMEMORY 1 0x7E879108, 2 0x00000000, 3 0x00000000
8412: imp_WdfIoTargetFormatRequestForInternalIoctlOthers - Exit: WDFIOTARGET 7E877E40, WDFREQUEST 7E494648, IOCTL 0x220003, Arg Handles 7E879108 00000000 00000000, status STATUS_SUCCESS
8413: FxIoTarget::SubmitSync - WDFIOTARGET 7E877E40, WDFREQUEST 7E494648
8414: FxIoTarget::SubmitSync - WDFREQUEST 7E494648, Action 0x21
8415: FxIoTarget::SubmitSync - Sending WDFREQUEST 7E494648, Irp 81B38650
8416: FxIoTarget::RequestCompletionRoutine - WDFREQUEST 7E494648
8417: FxIoTarget::RemoveCompletedRequestLocked - WDFIOTARGET 7E877E40, WDFREQUEST 7E494648
8418: FxIoTarget::RequestCompletionRoutine - WDFREQUEST 7E494648 completed in completion routine
---- end of log ----

I don’t know if it is indicative of anything, but when I look at the “locals” in windbg I see that my request structure looks like this :

request 0x7e494648 struct WDFREQUEST__ *
unused

Is it normal?

xxxxx@live.ca wrote:

I don’t know if it is indicative of anything, but when I look at the “locals” in windbg I see that my request structure looks like this :

request 0x7e494648 struct WDFREQUEST__ *
unused
>
> Is it normal?

Yes. A WDFREQUEST is a handle, not a pointer. If you use the wdfkd
extension command !wdfrequest, it knows how to translate the handle to a
pointer.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Okay, thanks Tim (learning). Still don’t have this simple thing to work though…

You should try to read the log yourself and learn to be self sufficient. At the end of the log it states the request was sent and completed back to the framework. This means the URB is not formatted correctly and the request is failing at the usb level.

d

dent from a phpne with no keynoard

-----Original Message-----
From: xxxxx@live.ca
Sent: October 08, 2010 5:23 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] WdfIoTargetFormatRequestForInternalIoctlOthers…

Okay, thanks Tim (learning). Still don’t have this simple thing to work though…


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

Thank you Doran, yes I’m trying to be self sufficient.

Will look again at the URB (it is created by UsbBuildGetDescriptorRequest() though, maybe some wrong pointer).