我遵循了“如何访问USB设备”的指南 http://msdn.microsoft.com/en-us/library/ff540174.aspx
//Open the device
//lpDevicePath is '\\?\usb#vid_4255&pid_1000#123456789abc#{a5dcbf10-6530-11d2-901f-00c04fb951ed}'
*hDeviceHandle = CreateFile (
lpDevicePath,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_ALWAYS,
FILE_FLAG_OVERLAPPED,
NULL);
完成此步骤后,*hDeviceHandle
不是INVALID_HANDLE_VALUE
。
然后,我打电话给WinUsb_Initialize(hDeviceHandle, phWinUSBHandle)
,但它返回错误50,有人知道如何解决它吗?
答案 0 :(得分:0)
如果您的hDeviceHandle是HANDLE*
类型,则应该像这样调用WinUsb_Initialize
:
WinUsb_Initialize(*hDeviceHandle, phWinUSBHandle)