Hello Guys, We have one USB device whose driver was written in KMDF some years back. Now we are planning to convert it to WinUsb and get rid of driver. Well via WinUsb I am able to get device descriptor and interfaces. We used to copy firmware from our driver to our device. For which we were using below command.
UsbBuildVendorRequest( pUrb,
URB_FUNCTION_VENDOR_DEVICE,
siz,
0,
0,
req, // reguest, ID
value, // Value
index, // Index
fw,
NULL,
fwsize,
NULL
);
WDF_REQUEST_SEND_OPTIONS_INIT(&reqSendOptions,
WDF_REQUEST_SEND_OPTION_TIMEOUT |
WDF_REQUEST_SEND_OPTION_SYNCHRONOUS |
WDF_REQUEST_SEND_OPTION_IGNORE_TARGET_STATE);
reqSendOptions.Timeout = WDF_REL_TIMEOUT_IN_MS(100);
ntStatus = WdfUsbTargetDeviceSendUrbSynchronously(WdfUsbTargetDevice,
NULL,
&reqSendOptions,
pUrb);
Now for this purpose we have written following code
WINUSB_SETUP_PACKET SetupPacket;
SetupPacket.RequestType = 0x40;
SetupPacket.Request = req;
SetupPacket.Index = 0;
SetupPacket.Value = value;
SetupPacket.Length = size;
bResult = WinUsb_ControlTransfer(hDeviceHandle, SetupPacket, fw, size, &cbSent, NULL);
But it returns me an error code of 998 which is “Invalid access to memory location.”
Am I missing something over or am i doing something wrong here?