]> granicus.if.org Git - imagemagick/commitdiff
Workaround for issue when loading libraries with installed support.
authorDirk Lemstra <dirk@git.imagemagick.org>
Sun, 24 Dec 2017 16:49:16 +0000 (17:49 +0100)
committerDirk Lemstra <dirk@git.imagemagick.org>
Sun, 24 Dec 2017 16:49:16 +0000 (17:49 +0100)
MagickCore/nt-base.c

index b4ee8b46035ca49143ce9ab71324481cd08b9cfd..cb76cb2ebbda6098dc053348f6cd7fe0a1292968 100644 (file)
@@ -2804,6 +2804,28 @@ MagickPrivate void NTWindowsGenesis(void)
       _ASSERTE(_CrtCheckMemory());
     }
 #endif
+#if defined(MAGICKCORE_INSTALLED_SUPPORT)
+  {
+    unsigned char
+      *path;
+
+    path=NTRegistryKeyLookup("LibPath");
+    if (path != (unsigned char *) NULL)
+      {
+        size_t
+          length;
+
+        wchar_t
+          lib_path[MagickPathExtent];
+
+        length=MultiByteToWideChar(CP_UTF8,0,(char *) path,-1,lib_path,
+          MagickPathExtent);
+        if (length != 0)
+          SetDllDirectoryW(lib_path);
+        path=(unsigned char *) RelinquishMagickMemory(path);
+      }
+  }
+#endif
 }
 \f
 /*