Mercurial > hg > vamp-plugin-sdk
comparison src/vamp-hostsdk/Files.cpp @ 513:4b619c5871ee
Use VAMP_PATH_32 environment variable instead of VAMP_PATH, when running in a 32-bit process within 64-bit Windows (WoW64)
author | Chris Cannam |
---|---|
date | Mon, 11 Jun 2018 11:31:47 +0100 |
parents | 54277cb679ff |
children | da86fb0bccb3 |
comparison
equal
deleted
inserted
replaced
512:54277cb679ff | 513:4b619c5871ee |
---|---|
322 | 322 |
323 return files; | 323 return files; |
324 } | 324 } |
325 | 325 |
326 bool | 326 bool |
327 Files::isNonNative32Bit() | |
328 { | |
329 // Return true if we are running on a system for which we should | |
330 // use the VAMP_PATH_32 variable instead of VAMP_PATH. This will | |
331 // be the case if we are a 32-bit executable but the OS is | |
332 // natively 64-bit. | |
333 // | |
334 // This currently works only on Windows; other operating systems | |
335 // will use VAMP_PATH always. | |
336 | |
337 if (sizeof(void *) == 8) { | |
338 return false; | |
339 } | |
340 | |
341 #ifdef _WIN32 | |
342 BOOL wow64 = FALSE; | |
343 BOOL (WINAPI *fnIsWow64Process)(HANDLE, PBOOL) = | |
344 (BOOL (WINAPI *)(HANDLE, PBOOL)) GetProcAddress | |
345 (GetModuleHandle(TEXT("kernel32")), "IsWow64Process"); | |
346 if (fnIsWow64Process) { | |
347 if (fnIsWow64Process(GetCurrentProcess(), &wow64)) { | |
348 if (wow64) { | |
349 return true; | |
350 } else { | |
351 return false; | |
352 } | |
353 } else { | |
354 cerr << "Vamp::HostExt: Unable to query process architecture" | |
355 << endl; | |
356 return false; | |
357 } | |
358 } else { | |
359 cerr << "Vamp::HostExt: Unable to query process architecture: " | |
360 << "Function not available" << endl; | |
361 return false; | |
362 } | |
363 #endif | |
364 | |
365 return false; | |
366 } | |
367 | |
368 bool | |
327 Files::getEnvUtf8(std::string variable, std::string &value) | 369 Files::getEnvUtf8(std::string variable, std::string &value) |
328 { | 370 { |
329 value = ""; | 371 value = ""; |
330 | 372 |
331 #ifdef _WIN32 | 373 #ifdef _WIN32 |