changeset 97:2f2292b029a4

Use VAMP_PATH_32 instead of VAMP_PATH when running as a 32-bit plugin on a 64-bit Windows installation
author Chris Cannam
date Wed, 16 Jan 2019 15:11:26 +0000
parents 4e5de05b6e71
children fdaddbb471bf
files PyPlugScanner.cpp
diffstat 1 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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<std::string>
 PyPlugScanner::getAllValidPath()
 {
-	
     std::vector<std::string> 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