# HG changeset patch # User Chris Cannam # Date 1547651486 0 # Node ID 2f2292b029a4d3509ad0e1cd8ebf02e55db48862 # Parent 4e5de05b6e719bac1f4ccf1b84da05a35a8c01ef Use VAMP_PATH_32 instead of VAMP_PATH when running as a 32-bit plugin on a 64-bit Windows installation diff -r 4e5de05b6e71 -r 2f2292b029a4 PyPlugScanner.cpp --- a/PyPlugScanner.cpp Tue Jan 15 13:54:12 2019 +0000 +++ b/PyPlugScanner.cpp Wed Jan 16 15:11:26 2019 +0000 @@ -325,11 +325,28 @@ std::vector PyPlugScanner::getAllValidPath() { - std::vector path; std::string envPath; - char *cpath = getenv("VAMP_PATH"); + bool nonNative32 = false; +#ifdef _WIN32 + BOOL (WINAPI *fnIsWow64Process)(HANDLE, PBOOL) = + (BOOL (WINAPI *)(HANDLE, PBOOL)) GetProcAddress + (GetModuleHandle(TEXT("kernel32")), "IsWow64Process"); + if (fnIsWow64Process) { + BOOL wow64 = FALSE; + if (fnIsWow64Process(GetCurrentProcess(), &wow64) && wow64) { + nonNative32 = true; + } + } +#endif + + char *cpath; + if (nonNative32) { + cpath = getenv("VAMP_PATH_32"); + } else { + cpath = getenv("VAMP_PATH"); + } if (cpath) envPath = cpath; #ifdef _WIN32