[PATCH 1/2] winealsa: Remove the ability to read additional devices from the registry.

Huw Davies huw at codeweavers.com
Tue Feb 8 06:45:12 CST 2022


If necessary, this could be re-written using the NT registry api in
the unixlib.

Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/winealsa.drv/mmdevdrv.c | 53 ------------------------------------
 1 file changed, 53 deletions(-)

diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c
index 5aa1b4aab63..8713b6153ce 100644
--- a/dlls/winealsa.drv/mmdevdrv.c
+++ b/dlls/winealsa.drv/mmdevdrv.c
@@ -165,9 +165,6 @@ static struct list g_sessions = LIST_INIT(g_sessions);
 static const WCHAR defaultW[] = {'d','e','f','a','u','l','t',0};
 static const char defname[] = "default";
 
-static const WCHAR drv_keyW[] = {'S','o','f','t','w','a','r','e','\\',
-    'W','i','n','e','\\','D','r','i','v','e','r','s','\\',
-    'w','i','n','e','a','l','s','a','.','d','r','v',0};
 static const WCHAR drv_key_devicesW[] = {'S','o','f','t','w','a','r','e','\\',
     'W','i','n','e','\\','D','r','i','v','e','r','s','\\',
     'w','i','n','e','a','l','s','a','.','d','r','v','\\','d','e','v','i','c','e','s',0};
@@ -474,54 +471,6 @@ static HRESULT alsa_get_card_devices(EDataFlow flow, snd_pcm_stream_t stream,
     return S_OK;
 }
 
-static void get_reg_devices(EDataFlow flow, snd_pcm_stream_t stream, WCHAR ***ids,
-        GUID **guids, UINT *num)
-{
-    static const WCHAR ALSAOutputDevices[] = {'A','L','S','A','O','u','t','p','u','t','D','e','v','i','c','e','s',0};
-    static const WCHAR ALSAInputDevices[] = {'A','L','S','A','I','n','p','u','t','D','e','v','i','c','e','s',0};
-    HKEY key;
-    WCHAR reg_devices[256];
-    DWORD size = sizeof(reg_devices), type;
-    const WCHAR *value_name = (stream == SND_PCM_STREAM_PLAYBACK) ? ALSAOutputDevices : ALSAInputDevices;
-
-    /* @@ Wine registry key: HKCU\Software\Wine\Drivers\winealsa.drv */
-    if(RegOpenKeyW(HKEY_CURRENT_USER, drv_keyW, &key) == ERROR_SUCCESS){
-        if(RegQueryValueExW(key, value_name, 0, &type,
-                    (BYTE*)reg_devices, &size) == ERROR_SUCCESS){
-            WCHAR *p = reg_devices;
-
-            if(type != REG_MULTI_SZ){
-                ERR("Registry ALSA device list value type must be REG_MULTI_SZ\n");
-                RegCloseKey(key);
-                return;
-            }
-
-            while(*p){
-                char devname[64];
-
-                WideCharToMultiByte(CP_UNIXCP, 0, p, -1, devname, sizeof(devname), NULL, NULL);
-
-                if(alsa_try_open(devname, stream)){
-                    if(*num){
-                        *ids = HeapReAlloc(GetProcessHeap(), 0, *ids, sizeof(WCHAR *) * (*num + 1));
-                        *guids = HeapReAlloc(GetProcessHeap(), 0, *guids, sizeof(GUID) * (*num + 1));
-                    }else{
-                        *ids = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR *));
-                        *guids = HeapAlloc(GetProcessHeap(), 0, sizeof(GUID));
-                    }
-                    (*ids)[*num] = construct_device_id(flow, p, NULL);
-                    get_device_guid(flow, devname, &(*guids)[*num]);
-                    ++*num;
-                }
-
-                p += lstrlenW(p) + 1;
-            }
-        }
-
-        RegCloseKey(key);
-    }
-}
-
 struct card_type {
     struct list entry;
     int first_card_number;
@@ -570,8 +519,6 @@ static HRESULT alsa_enum_devices(EDataFlow flow, WCHAR ***ids, GUID **guids,
         ++*num;
     }
 
-    get_reg_devices(flow, stream, ids, guids, num);
-
     for(err = snd_card_next(&card); card != -1 && err >= 0;
             err = snd_card_next(&card)){
         char cardpath[64];
-- 
2.25.1




More information about the wine-devel mailing list