SetupDiGetDeviceRegistryProperty failed with error code 13 when getting SPDRP_UI_NUMBER.

SetupDiGetDeviceRegistryProperty failed with error code 13 when getting SPDRP_UI_NUMBER using SetupDiGetDeviceRegistryProperty.

How can get VIP PID and serial number for USB device.

  1. UI means “User Interface”. No relations to serial number at all.
  2. UsbView is open source.

I am looking for serial number for USB device that is unique for each device with VID and PID and com port.

I got COM PORT and VID PID using SetupDiGetDeviceRegistryProperty but unable to get serial number.
please suggest if there is any way to find the all values or USB device serial number with respect to com port.

Most of the USB serial port devices do not embed a serial number, and in that case, there is no way to uniquely identify a device.

If you look at the Enum registry key for your device, you’ll see Enum\USB\VID_xxxx&PID_xxxx. There is one subkey in that key for each device the system has seen. If the devices have a serial number, then the subkey names are the serial numbers. That way, the system can track the device no matter where it is plugged. If the subkeys have names like 6&58e4b78&0&2, then the devices do not have serial number. That string encodes the hub and the port number where the device is plugged. Every time the device is plugged into a new port, it is seen as a new device.

You might try SPDRP_HARDWAREID. That’s the operating system’s unique identifier, and you can’t do any better.