Signed-off-by: Andrew Eikum aeikum@codeweavers.com --- dlls/mmdevapi/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/mmdevapi/main.c b/dlls/mmdevapi/main.c index eac1da28f18..e9453da5ad2 100644 --- a/dlls/mmdevapi/main.c +++ b/dlls/mmdevapi/main.c @@ -413,6 +413,7 @@ static HRESULT get_mmdevice_by_activatepath(const WCHAR *path, IMMDevice **mmdev
static const WCHAR DEVINTERFACE_AUDIO_RENDER_WSTR[] = L"{E6327CAD-DCEC-4949-AE8A-991E976A79D2}"; static const WCHAR DEVINTERFACE_AUDIO_CAPTURE_WSTR[] = L"{2EEF81BE-33FA-4800-9670-1CD474972C3F}"; + static const WCHAR MMDEV_PATH_PREFIX[] = L"\\?\SWD#MMDEVAPI#";
hr = MMDevEnum_Create(&IID_IMMDeviceEnumerator, (void**)&devenum); if (FAILED(hr)) { @@ -424,8 +425,15 @@ static HRESULT get_mmdevice_by_activatepath(const WCHAR *path, IMMDevice **mmdev hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(devenum, eRender, eMultimedia, mmdev); } else if (!lstrcmpiW(path, DEVINTERFACE_AUDIO_CAPTURE_WSTR)){ hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(devenum, eCapture, eMultimedia, mmdev); + } else if (!memcmp(path, MMDEV_PATH_PREFIX, sizeof(MMDEV_PATH_PREFIX) - sizeof(WCHAR))) { + WCHAR device_id[56]; // == strlen("{0.0.1.00000000}.{fd47d9cc-4218-4135-9ce2-0c195c87405b}") + 1 + + wcsncpy(device_id, path + (ARRAY_SIZE(MMDEV_PATH_PREFIX) - 1), ARRAY_SIZE(device_id)); + device_id[ARRAY_SIZE(device_id) - 1] = 0; + + hr = IMMDeviceEnumerator_GetDevice(devenum, device_id, mmdev); } else { - FIXME("How to map path to device id? %s\n", debugstr_w(path)); + FIXME("Unrecognized device id format: %s\n", debugstr_w(path)); hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); }