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>

Re: UsbBuildInterruptOrBulkTransferRequest by Doron

Doron
Fri Dec 30 10:11:15 CST 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.googlegroups.com...
> 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>
>



Re: UsbBuildInterruptOrBulkTransferRequest by Eric

Eric
Fri Dec 30 10:39:01 CST 2005

> the 2nd parameter should be sizeof(struct _URB_BULK_OR_INTERRUPT_TRANSFER)
> instead of sizeof(URB).

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

Actually I didn't notice these two size were different :(



> Also, you are passing a single byte value, UCHAR
> buffer, as a pointer value (TransferBuffer), which will cause a bluescreen

My mistake.
I intended to write UCHAR *buffer.

Thank you :)