who can give me some advice to solve this problem.
thank you all my friend,now,I have a question.
I am beginner in wdf,and can not send vendor request. I send vendor request
through UsbBuildVendorRequest function. and the prototype is
void UsbBuildVendorRequest(
[in] PURB Urb,
[in] USHORT Function,
[in] USHORT Length,
[in] ULONG TransferFlags,
[in] UCHAR ReservedBits,
[in] UCHAR Request,
[in] USHORT Value,
[in] USHORT Index,
[in, optional] PVOID TransferBuffer,
[in, optional] PMDL TransferBufferMDL,
[in] ULONG TransferBufferLength,
[in] PURB Link
);
but i use wdf’s function WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR and
WdfUsbTargetDeviceSendControlTransferSynchronously to send the vendor request
,but how to fill the controlSetupPacket,such as transfer length .my code is:
case IOCTL_USBSAMP_CUSTOM_COMMAND:
status=WdfRequestRetrieveInputBuffer(Request,10,&ioBuffer,&bufLength);
cmd=((UCHAR*)ioBuffer)[1];
WDF_REQUEST_SEND_OPTIONS_INIT(
&sendOptions,
WDF_REQUEST_SEND_OPTION_TIMEOUT
);
WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(
&sendOptions,
DEFAULT_CONTROL_TRANSFER_TIMEOUT
);
WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR(&controlSetupPacket,
BmRequestHostToDevice,
BmRequestToDevice,
cmd, // Request
0, // Value
0); // Index
status = WdfUsbTargetDeviceSendControlTransferSynchronously(
pDevContext->WdfUsbTargetDevice,
WDF_NO_HANDLE, // Optional WDFREQUEST
&sendOptions,
&controlSetupPacket,
NULL, // MemoryDescriptor
NULL); // BytesTransferred
if(!NT_SUCCESS(status)) {
UsbSamp_DbgPrint(1, (“UsbBuildVendorRequest Failed\n”));
}
status= STATUS_SUCCESS;
break;
in my appliction i use deviceiocontrol send control command ,and i use
bushound to see the packet that send to driver,but I find the SetupPacket’s
length=0. how to fill the length,such as wdm usbbuildvendorrequest function 's
TransferBufferLength.