+ /**
+ * There's alot of problem related to bad support -I parameters when building the kernel.
+ * Each OpenCL runtime handles it slightly different.
+ * The most problematic is with new AMD drivers on Windows, which can not handle quote characters!
+ * The best workaround found so far is to modify the TMP variable (only inside hashcat process) before the runtime is load
+ */
+
+ char cpath[1024] = { 0 };
+
+ #if _WIN
+
+ snprintf (cpath, sizeof (cpath) - 1, "%s\\OpenCL\\", shared_dir);
+
+ char *cpath_real = mymalloc (MAX_PATH);
+
+ if (GetFullPathName (cpath, MAX_PATH, cpath_real, NULL) == 0)
+ {
+ log_error ("ERROR: %s: %s", cpath, "GetFullPathName()");
+
+ return -1;
+ }
+
+ #else
+
+ snprintf (cpath, sizeof (cpath) - 1, "%s/OpenCL/", shared_dir);
+
+ char *cpath_real = mymalloc (PATH_MAX);
+
+ if (realpath (cpath, cpath_real) == NULL)
+ {
+ log_error ("ERROR: %s: %s", cpath, strerror (errno));
+
+ return -1;
+ }
+
+ #endif
+
+ if (getenv ("TMP") == NULL)
+ {
+ char tmp[1000];
+
+ snprintf (tmp, sizeof (tmp) - 1, "TMP=%s", cpath_real);
+
+ putenv (tmp);
+ }
+
+ #if _WIN
+
+ naive_replace (cpath_real, '\\', '/');
+
+ // not escaping here, windows using quotes later
+ // naive_escape (cpath_real, PATH_MAX, ' ', '\\');
+
+ #else
+
+ naive_escape (cpath_real, PATH_MAX, ' ', '\\');
+
+ #endif
+