I can't find any good examples or documentation on how winusb works. I'm trying to interface with a device but calling my send data function results in an access violation.
void WUSB_SendData(WINUSB_INTERFACE_HANDLE hndl, uint16_t rType, uint16_t req, uint16_t val, uint16_t ind, byte* data, uint16_t dLen) {
WINUSB_SETUP_PACKET wsp;
ZeroMemory(&wsp, sizeof(WINUSB_SETUP_PACKET));
wsp.RequestType = (rType | 0x00);
wsp.Request = req;
wsp.Value = val;
wsp.Index = ind;
wsp.Length = dLen;
ULONG sentData = 0;
WinUsb_ControlTransfer(hndl, wsp, (PUCHAR)data, dLen, &sentData, 0);
}
this is being called using
WUSB_SendData(this->dd.DeviceHandle, 0x41, 0x54, 0, 0, (byte*)("\x01"), 1);
I've tried storing the data I want to transfer in an array that didn't change anything. I've tried setting it to different data types, I've tried changing the data type of the length, and nothing has worked. I've also tried using winusb both from winusb. Lib and from directly accessing winusb.dll through LoadLibraryA.
the exact error is Exception thrown at 0x00007FF871462CE4 (winusb.dll) in winseek.exe: 0xC0000005: Access violation reading location 0x0000000000000590.