How to get "FriendlyName" of a Device ContainerID (SPDRP_BASE_CONTAINERID)

Greg Visser 11 Reputation points
2020-12-14T18:30:55.63+00:00

I want to get the "FriendlyName" of a device containerID.

For example, when you open Device Manager, View => Devices By Container, each container has a friendly name. I can get the container GUID, but do not know how to get the friendly name. In the picture below, you can see the "Logitech Unifying Receiver" container name that contains all the HID devices.

47940-logitech.png

To get the Container ID GUID to list all associated devices, i'm using SetupDi

eg:

Guid guid = Guid.Empty;  
IntPtr infoList = SetupDiGetClassDevs(ref guid, null, IntPtr.Zero, DIGCF_PRESENT | DIGCF_ALLCLASSES);  
  
for (uint i = 0; SetupDiEnumDeviceInfo(infoList, i, out spDevInfo); i++)  
{  
    if (SetupDiGetDeviceRegistryPropertyW(infoList, ref spDevInfo,   
SPDRP_BASE_CONTAINERID, out _, sb, BUFSIZE, out _))  
    {  
          dev.ContainerId = sb.ToString();  
     }  
}  

dev.ContainerId will now be a unique GUID.

Using this containerid, I'm able to group all the devices that belong to this container. I cannot find how to retreive the friendly name of this container (such as the "Logitech Unifying Receiver")

Windows Hardware Performance
Windows Hardware Performance
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.Hardware Performance: Delivering / providing hardware or hardware systems or adjusting / adapting hardware or hardware systems.
1,546 questions
0 comments No comments
{count} vote

7 answers

Sort by: Most helpful
  1. ABDUS SAMAD 0 Reputation points
    2023-11-23T23:08:41.27+00:00

    I have have already completed my training

    0 comments No comments

  2. ABDUS SAMAD 0 Reputation points
    2023-11-23T23:09:59.3333333+00:00

    Hybrid learning and lavenir I'd 7435.AbdusSamad@lavenir.cc

    0 comments No comments