Module: wine Branch: master Commit: f58ef5a9c88d2f8da6e0bec833cf769bdbc80cac URL: https://gitlab.winehq.org/wine/wine/-/commit/f58ef5a9c88d2f8da6e0bec833cf769...
Author: Davide Beatrici git@davidebeatrici.dev Date: Fri Mar 10 03:48:59 2023 +0100
winecoreaudio: Use GetModuleFileName() instead of hardcoded module filename for registry key.
---
dlls/winecoreaudio.drv/mmdevdrv.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 877c1f7c3bc..8d1d14aa26f 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -18,6 +18,7 @@ #define COBJMACROS
#include <stdarg.h> +#include <wchar.h>
#include "windef.h" #include "winbase.h" @@ -125,7 +126,7 @@ typedef struct _SessionMgr { IMMDevice *device; } SessionMgr;
-static const WCHAR *drv_key_devicesW = L"Software\Wine\Drivers\winecoreaudio.drv\devices"; +static WCHAR drv_key_devicesW[256];
static HANDLE g_timer_q;
@@ -196,14 +197,27 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) switch (reason) { case DLL_PROCESS_ATTACH: + { + WCHAR buf[MAX_PATH]; + WCHAR *filename; + DisableThreadLibraryCalls(dll); if (__wine_init_unix_call()) return FALSE; + + GetModuleFileNameW(dll, buf, ARRAY_SIZE(buf)); + + filename = wcsrchr(buf, '\'); + filename = filename ? filename + 1 : buf; + + swprintf(drv_key_devicesW, ARRAY_SIZE(drv_key_devicesW), + L"Software\Wine\Drivers\%s\devices", filename); + g_timer_q = CreateTimerQueue(); if(!g_timer_q) return FALSE; break; - + } case DLL_PROCESS_DETACH: if (reserved) break; DeleteCriticalSection(&g_sessions_lock);