From e1a0c607357b0fab361b439023322f37c07f7943 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Tue, 6 Oct 2020 07:50:38 -0700 Subject: [PATCH] coreaudio-encoder: Actually fix coreaudio loading Apparently using LoadLibrary on a full path doesn't work -- you need to use SetDllDirectory before loading a library. --- plugins/coreaudio-encoder/windows-imports.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/coreaudio-encoder/windows-imports.h b/plugins/coreaudio-encoder/windows-imports.h index 7bf4c19c4..3397b92ce 100644 --- a/plugins/coreaudio-encoder/windows-imports.h +++ b/plugins/coreaudio-encoder/windows-imports.h @@ -376,11 +376,13 @@ static bool load_from_shell_path(REFKNOWNFOLDERID rfid, const wchar_t *subpath) } wchar_t path[MAX_PATH]; - _snwprintf(path, MAX_PATH, L"%s\\%s\\%s", sh_path, subpath, - L"CoreAudioToolbox.dll"); + _snwprintf(path, MAX_PATH, L"%s\\%s", sh_path, subpath); CoTaskMemFree(sh_path); - audio_toolbox = LoadLibraryW(path); + SetDllDirectory(path); + audio_toolbox = LoadLibraryW(L"CoreAudioToolbox.dll"); + SetDllDirectory(nullptr); + return !!audio_toolbox; }