]> granicus.if.org Git - imagemagick/commitdiff
Fixed invalid path check in MagickCoreGenesis under Windows and disabled ProvideDllMa...
authordirk <dirk@git.imagemagick.org>
Thu, 15 Jan 2015 21:44:28 +0000 (21:44 +0000)
committerdirk <dirk@git.imagemagick.org>
Thu, 15 Jan 2015 21:44:28 +0000 (21:44 +0000)
MagickCore/magick.c
MagickCore/nt-base.c

index 718d27bcf6b25bc84a4d7e8c05d19281c13cda7a..7a020241f3f1edfd7957000ca15bf8e8c6c3496b 100644 (file)
@@ -1270,10 +1270,15 @@ MagickExport void MagickCoreGenesis(const char *path,
   /*
     Set client name and execution path.
   */
-  (void) GetExecutionPath(execution_path,MaxTextExtent);
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
+  if ((path != (const char *) NULL) && (IsPathAccessible(path) != MagickFalse))
+#else
   if ((path != (const char *) NULL) && (*path == *DirectorySeparator) &&
       (IsPathAccessible(path) != MagickFalse))
+#endif
     (void) CopyMagickString(execution_path,path,MaxTextExtent);
+  else
+    (void) GetExecutionPath(execution_path,MaxTextExtent);
   GetPathComponent(execution_path,TailPath,filename);
   (void) SetClientName(filename);
   GetPathComponent(execution_path,HeadPath,execution_path);
index f3c6d4bd7ca1c11dec45d89c9f254801b6ef0a11..f1c2000aed252a9581faf04c04dad2be231bf7ed 100644 (file)
@@ -181,7 +181,7 @@ static inline char *create_utf8_string(const wchar_t *wideChar)
 %                   and DLL_PROCESS_DETACH.
 %
 */
-#if defined(_DLL) && defined( ProvideDllMain )
+#if defined(_DLL) && defined(ProvideDllMain)
 BOOL WINAPI DllMain(HINSTANCE handle,DWORD reason,LPVOID lpvReserved)
 {
   switch (reason)
@@ -197,6 +197,7 @@ BOOL WINAPI DllMain(HINSTANCE handle,DWORD reason,LPVOID lpvReserved)
       wchar_t
         *wide_path;
 
+      MagickCoreGenesis((const char *) NULL,MagickFalse);
       wide_path=(wchar_t *) AcquireQuantumMemory(MaxTextExtent,
         sizeof(*wide_path));
       if (wide_path == (wchar_t *) NULL)
@@ -214,7 +215,6 @@ BOOL WINAPI DllMain(HINSTANCE handle,DWORD reason,LPVOID lpvReserved)
                 module_path[count+1]='\0';
                 break;
               }
-          MagickCoreGenesis(module_path,MagickFalse);
           path=(char *) AcquireQuantumMemory(16UL*MaxTextExtent,sizeof(*path));
           if (path == (char *) NULL)
             {
@@ -749,7 +749,7 @@ MagickPrivate MagickBooleanType NTGetExecutionPath(char *path,
   wchar_t
     wide_path[MaxTextExtent];
 
-  (void) GetModuleFileNameW(0,wide_path,(DWORD) extent);
+  (void) GetModuleFileNameW((HMODULE) NULL,wide_path,(DWORD) extent);
   (void) WideCharToMultiByte(CP_UTF8,0,wide_path,-1,path,(int) extent,NULL,
     NULL);
   return(MagickTrue);