mem = NULL; \
} while (0)
-#ifdef _WIN64
static const char OPENCL_REG_SUB_KEY[] = "OpenCLDriverName";
+
+#ifndef _WIN64
+static const char OPENCL_REG_SUB_KEY_WOW[] = "OpenCLDriverNameWow";
+#endif
+
+// Do not free the memory returned by this function.
+static const char* GetOpenCLRegKeyName(void)
+{
+#ifdef _WIN64
+ return OPENCL_REG_SUB_KEY;
#else
-static const char OPENCL_REG_SUB_KEY[] = "OpenCLDriverNameWow";
+ // The suffix/substring "WoW" is meaningful only when a 32-bit
+ // application is running on a 64-bit Windows OS. A 32-bit application
+ // running on a 32-bit OS uses non-WoW names.
+ BOOL is_wow64;
+ if (IsWow64Process(GetCurrentProcess(), &is_wow64) && is_wow64)
+ {
+ return OPENCL_REG_SUB_KEY_WOW;
+ }
+
+ return OPENCL_REG_SUB_KEY;
#endif
+}
static bool ReadOpenCLKey(DEVINST dnDevNode)
{
{
result = RegQueryValueExA(
hkey,
- OPENCL_REG_SUB_KEY,
+ GetOpenCLRegKeyName(),
NULL,
&dwLibraryNameType,
NULL,
devnode,
0);
- // TODO: consider extracting warning messages out of this function
if (CR_SUCCESS != ret)
{
KHR_ICD_TRACE(" WARNING: failed to probe the status of the device 0x%x\n", ret);
&szGuid,
0);
- KHR_ICD_ASSERT(devpropType == DEVPROP_TYPE_GUID);
-
if (CR_SUCCESS != ret ||
!IsEqualGUID(&OCL_GUID_DEVCLASS_SOFTWARECOMPONENT, &guid))
{