Hi All,
I’m using WDF v1.5 from WinDDK 6000, compiling on a WinXP machine, running on a Win2K machine, and I’m having trouble with the BytesRead variable returned by WdfUsbTargetPipeReadSynchronously. I believe it is similar to the problem mentioned in the thread from Oct 6, 2006 titled “BytesWritten in WdfUsbTargetPipeWriteSynchronously”.
BytesRead gets set to 4, but I’m only expecting 1 byte. However, I do see the expected 1 when I check the PipeRead.Length value in the WDF_USB_REQUEST_COMPLETION_PARAMS. Shouldn’t these two parameters give me the same value?
Following Doron’s advice, I set the debugger to break when BytesRead is written. The break point triggers twice when I execute WdfUsbTargetPipeReadSynchronously. The first break clearly initializes BytesRead to 0 and the second fills it with [ebp-44h]. Is this correct or could my setup somehow contain corrupted or mismatched versions?
I’ve included below part of the code from the EvtIoDeviceControl function that handles this request. Can anyone see something I’ve
done wrong? Is there anything else I should be trying or checking?
Thanks, Wendy Tucker / Symmetric Research
WDFUSBPIPE PipeEp6In;
WDFMEMORY Memory;
WDF_MEMORY_DESCRIPTOR MemoryDesc;
WDF_REQUEST_SEND_OPTIONS RequestSendOptions;
WDF_REQUEST_COMPLETION_PARAMS CompletionParams;
WDF_USB_REQUEST_COMPLETION_PARAMS *UsbCompletionParams;
size_t BytesRead, CpBytesRead;
Status = WdfRequestRetrieveOutputMemory( Request, &Memory );
WDF_MEMORY_DESCRIPTOR_INIT_HANDLE( &MemoryDesc, Memory, NULL );
WDF_REQUEST_SEND_OPTIONS_INIT( &RequestSendOptions, 0 );
Status = WdfUsbTargetPipeReadSynchronously( PipeEp6In,
Request,
&RequestSendOptions,
&MemoryDesc,
&BytesRead
);
WDF_REQUEST_COMPLETION_PARAMS_INIT( &CompletionParams );
WdfRequestGetCompletionParams( Request, &CompletionParams );
UsbCompletionParams = CompletionParams.Parameters.Usb.Completion;
CpBytesRead = UsbCompletionParams->Parameters.PipeRead.Length;