WinUSB - iterating devices to get serial numbers.

Discussion in 'Windows Vista Drivers' started by Jake, Dec 8, 2009.

  1. Jake

    Jake Guest

    Scene: Multiple devices with the same GUID attached to a machine. They
    report serial numbers and that is a known-working configuration. As I
    understand it, the proper way to iterate serial numbers is basically:

    1. SetupDiGetClassDevs with the GUID then iterate:
    1.a. getDevicePath(n++)
    1.b. hDev = CreateFile()
    1.c. hUsb = WinUsb_Initialize(hDev)
    1.d. WinUsb_GetDescriptor(hUsb)

    This works fine. However, a problem occurs when one of these devices is
    then opened (or shall I say, left open because the calls above actually
    "open" the device). The NEXT time the above block is called, the device that
    is open cannot be opened again.

    The call in 1. Lists all the devices.
    The call in 1.a. also succeeds.
    The call in 1.b. fails. It returns an INVALID_HANDLE_VALUE and the last

    The CreateFile was called with GENERIC_WRITE|GENERIC_READ and

    Is there an alternate way to iterate serial numbers of attached devices that
    does not require them to be opened? Or is there an alternate way to open the
    device which does not prevent access to iterate them.
    Jake, Dec 8, 2009
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.