get USBDSTATUS using KMDF



Hi,
I developped a usb driver based on WDF, first with kmdf 1.5.
I used synchronous request to send control transfer to the device. As
I needed to get the USBDSTATUS (in fact I checked if there was no
STALL), I used WdfRequestGetCompletionParams function.

All is working fine with kmdf 1.5 but I had a problem when I wanted to
use the version 1.7.
Here is the code

nbBytes = 0;
status = WdfUsbTargetDeviceSendControlTransferSynchronously(
pDevContext->UsbDevice,
request,//WDF_NO_HANDLE, // Optional WDFREQUEST
&syncReqOptions, // PWDF_REQUEST_SEND_OPTIONS
&controlSetupPacket,
&outMemDesc, // MemoryDescriptor
&nbBytes); // BytesTransferred
WDF_REQUEST_COMPLETION_PARAMS_INIT(&completionParams);
WdfRequestGetCompletionParams(
request,
&completionParams);

usbCompletionParams = completionParams.Parameters.Usb.Completion;
if (usbCompletionParams != NULL)
{
KdPrint((DRIVERNAME " - nbBytes read = %d, usbCompletionParams-
Parameters.DeviceControlTransfer.Length = %d\n",
nbBytes, usbCompletionParams-
Parameters.DeviceControlTransfer.Length));
nbBytes = usbCompletionParams-
Parameters.DeviceControlTransfer.Length;
}
else
KdPrint((DRIVERNAME " - WdfRequestGetCompletionParams failed\n"));



In looking traces made by my driver I found this message:
"KMDF detected potentially invalid operation by mydriver.sys. Turn on
framework verifier to break into the debugger."


I turned on the framework verifier, I break into the debugger when
WdfRequestGetCompletionParams is called.
In fact, the completionparams is not retrieved, the structure's Type
member is still set to WdfRequestTypeNoFormat and usbCompletionParams
is null.
Of course in this configuration, I'm not able to get the USBDSTATUS.

For information I'm using wdfcoinstaller01007.dll version
1.7.6001.18000.
and I'm testing on windows XP SP2.

Could you tell me where I'm wrong?

Thanks in advance
.


Loading