http://bugs.winehq.org/show_bug.cgi?id=58204
--- Comment #2 from Patrick Hibbs hibbsncc1701@gmail.com --- Created attachment 78544 --> http://bugs.winehq.org/attachment.cgi?id=78544 POC patch to fix audio tab
OK looking at this some more....
programs/winecfg/audio.c uses the result of the get_driver_name() function to determine if an audio driver has been loaded, but that function uses a call to IMMDeviceEnumerator_GetDevice() with a "Wine info device" device name to make that determination.
Grepping through the entire wine tree for "Wine info device" returned no results except for the single use of it in winecfg already mentioned. A grep for the "'W', 'i', 'n', 'e'" string, and manually reading through all of mmdevapi's and winealsa.drv's source files found no use at all.
Adding an ERR() call to the FAILED(hr) check for IMMDeviceEnumerator_GetDevice() resulted in it being printed every time the audio tab was opened regardless of audio driver settings.
Replacing that IMMDeviceEnumerator_GetDevice() call with a call to IMMDeviceEnumerator_GetDefaultAudioEndpoint(devenum, eRender, eConsole, &device), gets an instant segfault when opening the audio tab in winecfg.
This is due to DEVPKEY_Device_Driver not being defined, and the call to IPropertyStore_GetValue() returning a false positive. (That's due to dlls/mmdevapi/devenum.c masking the ERROR_FILE_NOT_FOUND from RegGetValueW(), setting the value to VT_EMPTY, and returning S_OK on line 284.) Resulting in a null deref on the returned string value.
A quick grep of the wine source tree for DEVPKEY_Device_Driver only resulted in the use in programs/winecfg/audio.c, and include/devpkey.h. Checking for the GUID only found results in include/devpkey.h and include/propkey.h.
Manually defining DEVPKEY_Device_Driver during MMDevice_Create() (apparently the other code in that function only considers the first driver listed in the DriverFuncs array), makes the audio tab UI work again. (We have valid audio devices listed in the Defaults section drop downs and under Speaker configuration.)
I've attached a patch to fix it against (as of this posting) current git, but I'm not sure if this is the proper way to fix it.