From 76ea10e2816c7bd8fd577c3e4b6bf66838c8bd72 Mon Sep 17 00:00:00 2001 From: Richard Stanway Date: Mon, 11 Nov 2024 04:31:24 +0100 Subject: [PATCH] coreaudio-encoder: Avoid using SetDllDirectory, specify full path --- plugins/coreaudio-encoder/windows-imports.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/coreaudio-encoder/windows-imports.h b/plugins/coreaudio-encoder/windows-imports.h index f3565cdc5..27249c6db 100644 --- a/plugins/coreaudio-encoder/windows-imports.h +++ b/plugins/coreaudio-encoder/windows-imports.h @@ -386,12 +386,10 @@ static bool load_from_shell_path(REFKNOWNFOLDERID rfid, const wchar_t *subpath) } wchar_t path[MAX_PATH]; - _snwprintf(path, MAX_PATH, L"%s\\%s", sh_path, subpath); + _snwprintf(path, MAX_PATH, L"%s\\%s\\CoreAudioToolbox.dll", sh_path, subpath); CoTaskMemFree(sh_path); - SetDllDirectory(path); - audio_toolbox = LoadLibraryW(L"CoreAudioToolbox.dll"); - SetDllDirectory(nullptr); + audio_toolbox = LoadLibraryExW(path, NULL, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_DEFAULT_DIRS); return !!audio_toolbox; } @@ -401,7 +399,7 @@ static bool load_lib(void) /* -------------------------------------------- */ /* attempt to load from path */ - audio_toolbox = LoadLibraryW(L"CoreAudioToolbox.dll"); + audio_toolbox = LoadLibraryExW(L"CoreAudioToolbox.dll", NULL, LOAD_LIBRARY_SAFE_CURRENT_DIRS); if (!!audio_toolbox) return true;