Is there a good way to get the Device Instance path(e.g: USB\VID_021D&PID_0C51&MI_00\6&192CE49&4&0000) from Bus Relations (e.g:{0.0.1.00000000}.{4234a4c6-3535-49d6-971c-76ce1f22521e}) ?
I realize some terms in Windows have aliases, by "Device Instance path" and "Bus Relations", I mean the two properties found in the device manager:

I have tried to get the Device Instance path from the PropertyStore
int getProperty(std::string& sampleID)
{
HRESULT hr = S_OK;
IMMDeviceEnumerator* pEnumerator = NULL;
//CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
hr = CoCreateInstance(__uuidof(MMDeviceEnumerator),
NULL,
CLSCTX_INPROC_SERVER,
__uuidof(IMMDeviceEnumerator),
(void**)&pEnumerator);
if (hr != S_OK)
{
// error cleanup
return hr;
}
IMMDevice* pEndpoint = NULL;
std::wstring wSampleID(sampleID.begin(), sampleID.end());
hr = pEnumerator->GetDevice(wSampleID.c_str(), &pEndpoint);
if (hr != S_OK || pEndpoint == NULL)
{
// error cleanup
return hr;
}
if (!pEndpoint)
{
// error cleanup
return hr;
}
IPropertyStore* pProps = NULL;
hr = pEndpoint->OpenPropertyStore(
STGM_READ, &pProps);
PROPVARIANT varName;
// Initialize container for property value.
PropVariantInit(&varName);
hr = pProps->GetValue(
PKEY_AudioEndpoint_GUID, &varName);
if (hr != S_OK)
{
//error cleanup
return hr;
}
std::cout << varName.pwszVal << std::endl;
PropVariantClear(&varName);
SAFE_RELEASE(pProps)
SAFE_RELEASE(pEndpoint)
SAFE_RELEASE(pEnumerator);
return hr;
}
but there does not seem to be a property key to retrieve this piece of information for Audio Endpoint IMMDevice. Any suggestion is appreciated.


PropertyStorewith keyPKEY_AudioEndpoint_GUID. It can also be found in device manager -> device property -> Bus Relations. I got this GUID from Goodle Webrtc audio device enumeration.