WinUSB createFile succes but WinUSBInitialize failed

2k views Asked by At

I followed the guide of 'How to access the USB Device' 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);

After this step, *hDeviceHandle is not INVALID_HANDLE_VALUE.

Then, I called WinUsb_Initialize(hDeviceHandle, phWinUSBHandle) but it returns error 50, does anybody know how to solve it?

1

There are 1 answers

0
Preston On

If your hDeviceHandle is a HANDLE* type you should call WinUsb_Initialize like this:

WinUsb_Initialize(*hDeviceHandle, phWinUSBHandle)