From: dirk Date: Thu, 15 Jan 2015 21:44:28 +0000 (+0000) Subject: Fixed invalid path check in MagickCoreGenesis under Windows and disabled ProvideDllMa... X-Git-Tag: 7.0.1-0~1435 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a7bd34fe0dd77575cf2161a7a130df3e25a8b3eb;p=imagemagick Fixed invalid path check in MagickCoreGenesis under Windows and disabled ProvideDllMain by default --- diff --git a/MagickCore/magick.c b/MagickCore/magick.c index 718d27bcf..7a020241f 100644 --- a/MagickCore/magick.c +++ b/MagickCore/magick.c @@ -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); diff --git a/MagickCore/nt-base.c b/MagickCore/nt-base.c index f3c6d4bd7..f1c2000ae 100644 --- a/MagickCore/nt-base.c +++ b/MagickCore/nt-base.c @@ -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);