Tech Support > Microsoft Windows > Drivers > UsbBuildInterruptOrBulkTransferRequest
UsbBuildInterruptOrBulkTransferRequest
Posted by Eric on December 30th, 2005


Hello,

Is there anything wrong in this sample of code ? I'm calling it from a
lower filter driver, and I get in return the error code
STATUS_INVALID_PARAMETER.


<code>
void writeCommand( IN PDEVICE_OBJECT DeviceObject, UCHAR buffer, int
size )
{
URB urb;
PDEVICE_EXTENSION Extension = DeviceObject->DeviceExtension;

UsbBuildInterruptOrBulkTransferRequest(
&Urb,
sizeof( URB ), //Length,
Extension->hOut, //PipeHandle,
buffer, //TransferBuffer
NULL, //TransferBufferMDL
size, //TransferBufferLength,
USBD_TRANSFER_DIRECTION_OUT , //TransferFlags,
NULL //Link
);

SendAwaitUrb( DeviceObject, &Urb );
}
</code>

Posted by Doron Holan [MS] on December 30th, 2005


the 2nd parameter should be sizeof(struct _URB_BULK_OR_INTERRUPT_TRANSFER)
instead of sizeof(URB). Also, you are passing a single byte value, UCHAR
buffer, as a pointer value (TransferBuffer), which will cause a bluescreen


--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Eric" <minso@altern.org> wrote in message
news:1135941928.374330.189270@g44g2000cwa.googlegr oups.com...


Posted by Eric on December 30th, 2005


Argh. You're right, that's it. Thanks !

Actually I didn't notice these two size were different



My mistake.
I intended to write UCHAR *buffer.

Thank you



Similar Posts