Module: wine Branch: master Commit: 53baa4457438d90427ce1157644d0138a17a6355 URL: https://gitlab.winehq.org/wine/wine/-/commit/53baa4457438d90427ce1157644d013...
Author: Davide Beatrici git@davidebeatrici.dev Date: Fri Mar 10 03:51:05 2023 +0100
wineoss: Use GetModuleFileName() instead of hardcoded module filename for registry key.
---
dlls/wineoss.drv/mmdevdrv.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 6993fa88d0a..166f9408416 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -19,6 +19,7 @@
#define COBJMACROS #include <stdarg.h> +#include <wchar.h>
#include "windef.h" #include "winbase.h" @@ -124,9 +125,7 @@ typedef struct _OSSDevice {
static struct list g_devices = LIST_INIT(g_devices);
-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','o','s','s','.','d','r','v','\','d','e','v','i','c','e','s',0}; +static WCHAR drv_key_devicesW[256]; static const WCHAR guidW[] = {'g','u','i','d',0};
static CRITICAL_SECTION g_sessions_lock; @@ -207,9 +206,22 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) switch (reason) { case DLL_PROCESS_ATTACH: + { + WCHAR buf[MAX_PATH]; + WCHAR *filename; + if(__wine_init_unix_call()) return FALSE; - break;
+ 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); + + break; + } case DLL_PROCESS_DETACH: if (!reserved) {