WinUSB Device: DeviceInterfaceGUIDs or DeviceInterfaceGUID?

I have a doubt with regard to the two documentations from Microsoft.

  1. The following document is clear to use “DeviceInterfaceGUID” and
    the example FW I
    saw uses this.
    https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/automatic-installation-of-winusb

+++++++++++++++++++++++++
The extended properties OS feature descriptor includes a header
section that is followed by one or
more custom property sections. The header section describes the
entire extended properties descriptor,
including its total length, the version number, and the number
ofcustom property sections. To register
the device interface GUID, add a custom property section that sets the
bPropertyName field to
“DeviceInterfaceGUID” and wPropertyNameLength to 40 bytes. Generate a
unique device interface
GUID by using a GUID generator and set the bPropertyData field to that
GUID, such as
“{8FE6D4D7-49DD-41E7-9486-49AFC6BFE475}”. Note that the GUID is
specified as a Unicode
string and the length of the string is 78 bytes (including the null terminator).
++++++++++++++++++++++++++

  1. However, in the other official Microsoft document here, the sample inf uses
    “DeviceInterfaceGUIDs”,
    https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/winusb-installation#inf
    +++++++++++++++++++++++++++++
    [Dev_AddReg] HKR,DeviceInterfaceGUIDs,0x10000,“{9f543223-cede-4fa3-b376-a25ce9a30e74}”

USB_Install.HW: This section is the key in the .inf file. It specifies
the device interface globally
unique identifier (GUID) for your device. The AddReg directive sets
the specified interface
GUID in a standard registry value. When Winusb.sys is loaded as the
device’s function driver,
it reads the registry value DeviceInterfaceGUIDs key and uses the
specified GUID to represent
the device interface. You should replace the GUID in this example with
one that you create
specifically for your device. If the protocols for the device change,
create a new device
interface GUID.

Note User-mode software must call SetupDiGetClassDevs to enumerate the
registered device
interfaces that are associated with one of the device interface
classes specified under the
DeviceInterfaceGUIDs key. SetupDiGetClassDevs returns the device
handle for the device that
the user-mode software must then pass to the WinUsb_Initialize routine
to obtain a WinUSB
handle for the device interface. For more info about these routines,
see How to Access a USB
Device by Using WinUSB Functions.
++++++++++++++++++++++++++++++++

Question: which is correct? Or the device can use both?

The following site recommends to use DeviceInterfaceGUIDs only for USB
Composite device
and DeviceInterfaceGUID for non-composite device. Is that correct?
https://github.com/pbatard/libwdi/wiki/WCID-Devices

+++++++++++++++++++++++++
IMPORTANT NOTE 1: There is a bug/limitation in WinUSB that will force
the wIndex of any
Interface Request to the interface number. This means that, if you are
using WinUSB to
verify the content of your Extended Properties Feature Descriptor, you
won’t be able to
retrieve it (unless it is only defined for interface #5).
+++++++++++++++++++++++++

Another question, in the above question, it is saying that WinUSB has
a limitation so that it
can not be used to retrieve the Extended Properties Feature
Descriptor. Is this correct?
Is the limitation a bug or a feature?


Xiaofan

xxxxx@gmail.com wrote:

I have a doubt with regard to the two documentations from Microsoft.

  1. The following document is clear to use “DeviceInterfaceGUID” and
  2. However, in the other official Microsoft document here, the sample inf uses
    “DeviceInterfaceGUIDs”,

    Question: which is correct? Or the device can use both?

If you do a hex dump of winusb.sys, you’ll see that it contains both
strings.  The original author probably made one choice, someone else
accidentally used the wrong one in an important place, and the author
was forced to add support for both.

So, basically, you can use either one.

Another question, in the above question, it is saying that WinUSB has
a limitation so that it
can not be used to retrieve the Extended Properties Feature
Descriptor. Is this correct?
Is the limitation a bug or a feature?

It’s a security feature.  You are only allowed to make interface-related
requests on the interfaces that you have been assigned.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.