coreaudio-encoder: Avoid using SetDllDirectory, specify full path

This commit is contained in:
Richard Stanway
2024-11-11 04:31:24 +01:00
committed by Ryan Foster
parent 3b4872c5c0
commit 76ea10e281

View File

@@ -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;