Nikolay Sivov (@nsivov) commented about dlls/mf/sac.c:
hr = IMMDevice_OpenPropertyStore(device, STGM_READ, &ps);IMMDevice_Release(device);if (FAILED(hr))goto done;hr = IPropertyStore_GetValue(ps, (const PROPERTYKEY*)&DEVPKEY_Device_FriendlyName, &pv);IPropertyStore_Release(ps);if (FAILED(hr))goto done;if (pv.vt != VT_LPWSTR){PropVariantClear(&pv);goto done;}IMFActivate_SetString(sources[i], &MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME, pv.pwszVal);PropVariantClear(&pv);
I think cascading checks for hr are better here than multiple jumps. And if property store becomes useful for instance id, we could have a helper that checks value types.