Browse Source

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.
jp9000 5 years ago
parent
commit
e1a0c60735
1 changed files with 5 additions and 3 deletions
  1. 5 3
      plugins/coreaudio-encoder/windows-imports.h

+ 5 - 3
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];
 	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);
 	CoTaskMemFree(sh_path);
 
 
-	audio_toolbox = LoadLibraryW(path);
+	SetDllDirectory(path);
+	audio_toolbox = LoadLibraryW(L"CoreAudioToolbox.dll");
+	SetDllDirectory(nullptr);
+
 	return !!audio_toolbox;
 	return !!audio_toolbox;
 }
 }