Page 1 of 1

ImageMagicObject - non-ASCII characters

Posted: 2009-02-18T13:39:02-07:00
by roed
Hello everyone.

Here is my patch of OLE Automation wrapper of ImageMagick (ATL7 version).

ImageMagickObject is a fine simple wrapper but I cannot open any graphics file whitch name contains any non-ASCII character such as zażółć_gęślą_jaźń.jpg.
Additionaly I cannot render any text with non-ASCII (polish) characters.

The solution seems simple: instead of converting parameter strings from UTF-16 (all OLE Automation strings) to ANSI use UTF-16 to UTF-8 conversion. It seems that ImageMagic uses UTF-8 encoded strings internally.

Additionaly I decided to remove all ATL3 string conversion macros (USING_CONVERSION macro etc.) to new ATL7 class/macros.
I also removed usage of STL library (string class) and use CStringA and CStringW classes instead.
Additionaly code cleanup was performed - many unused macros,variables and funcions were removed.

I'm using VC++ 2005 and VC++ 2008.
Previous versions may not work.

Command line tools such ach convert.exe (Windows version) still have problems with non-ASII characters.

Because I cannot attach file to message here it is:

Code: Select all

Index: ImageMagickObject.cpp
===================================================================
--- ImageMagickObject.cpp	(revision 14073)
+++ ImageMagickObject.cpp	(working copy)
@@ -117,7 +117,7 @@
 // MagickImage
 [
   coclass,
-  threading("both"),
+  threading(both),
   support_error_info("IMagickImage"),
   vi_progid("ImageMagickObject.MagickImage"),
   progid("ImageMagickObject.MagickImage.1"),
@@ -144,6 +144,9 @@
       "MagickImage constructor");
     m_bOnStartPageCalled = FALSE;
   }
+  
+private:
+  
   HRESULT TestHarness(SAFEARRAY **pArrayVar, VARIANT *pVar);
   HRESULT Compare(SAFEARRAY **pArrayVar, VARIANT *pVar);
   HRESULT Composite(SAFEARRAY **pArrayVar, VARIANT *pVar);
@@ -158,23 +161,26 @@
   HRESULT Perform(MagickLib::MagickBooleanType (*func)(MagickLib::ImageInfo *image_info,
   const int argc,char **argv,char **text,MagickLib::ExceptionInfo *exception),
     SAFEARRAY **pArrayVar,VARIANT *pVar2,MagickLib::ExceptionInfo *exception);
+    
 private:
+
   char **m_argv;
-  char **m_argv_t;
   int m_argc;
   int m_argvIndex;
-public:
+  
+
   HRESULT AllocateArgs(int iArgs);
   HRESULT ReAllocateArgs(int iArgs);
   void DeleteArgs(void);
   char **GetArgv(void);
-  char **GetArgvT(void);
   int GetArgc(void);
   void EmptyArgs(void);
-  //HRESULT AddArgs(VARIANTARG *arg);
-  HRESULT AddArgs(BSTR arg);
-  HRESULT AddArgs(LPTSTR arg);
 
+  HRESULT AddArgs(LPCWSTR);
+  HRESULT AddArgs(LPCSTR);
+  
+ private:
+
   static void warninghandler(const MagickLib::ExceptionType warning,const char *message,
     const char *qualifier);
 
@@ -184,7 +190,9 @@
   static void fatalerrorhandler(const MagickLib::ExceptionType error,const char *message,
     const char *qualifier);
 
-  void CheckAndReportError(MagickImageError &error, HRESULT &hr, const char *program);
+  static void CheckAndReportError(MagickImageError &error, HRESULT &hr, const char *program);
+  
+  public:
 
   DECLARE_PROTECT_FINAL_CONSTRUCT()
   HRESULT FinalConstruct()
@@ -233,7 +241,7 @@
   CComPtr<IObjectContext> m_spObjectContext;
 };
 
-static char *translate_exception(DWORD code)
+static const char *translate_exception(DWORD code)
 {
   switch (code)
   {
@@ -286,21 +294,6 @@
   }
 }
 
-static LPTSTR StrChr(LPTSTR lpsz, TCHAR ch)
-{
-  LPTSTR p = NULL;
-  while (*lpsz)
-  {
-    if (*lpsz == ch)
-    {
-      p = lpsz;
-      break;
-    }
-    lpsz = CharNext(lpsz);
-  }
-  return p;
-}
-
 const char *objName = "ImageMagickObject";
 
 #define ThrowPerformException(exception,code,reason,description) \
@@ -347,8 +340,6 @@
 
 STDMETHODIMP MagickImage::get_Item(VARIANT varIndex, VARIANT *pVal)
 {
-  USES_CONVERSION;
-
   HRESULT hr = E_INVALIDARG;
   VARIANTARG *pvarIndex = &varIndex;
   VARTYPE vt = V_VT(pvarIndex);
@@ -364,10 +355,9 @@
     return hr;
   if ((vt & ~VT_BYREF) == VT_BSTR)
     {
-      LPTSTR lpszNext;
-      LPTSTR lpszVal = W2T(V_BSTR(pvarIndex));
+      CW2A szVal( V_BSTR(pvarIndex) );
       var = _T("");
-      if (lpszVal)
+      if (szVal)
         {
           MagickLib::Image
             *image;
@@ -380,15 +370,17 @@
 
           long
             id;
+            
+           LPSTR lpszNext;
 
-				  lpszNext = StrChr(lpszVal, _T('.'));
-				  if (lpszNext == NULL)
-            lpszNext = _T("%w,%h,%m");
+		    lpszNext = StrChr(szVal, '.');
+		  if (lpszNext == NULL)
+            lpszNext = "%w,%h,%m";
           else
-            *lpszNext++ = _T('\0');
+            *lpszNext++ = '\0';
           // lookup the registry id using token and pass the image in
           MagickLib::GetExceptionInfo(&exception);
-          image=MagickLib::GetImageFromMagickRegistry(lpszVal, &id, &exception);
+          image=MagickLib::GetImageFromMagickRegistry(szVal, &id, &exception);
           if (image != (MagickLib::Image *) NULL)
             {
               TCHAR *text;
@@ -506,8 +498,6 @@
 
 STDMETHODIMP MagickImage::Remove(VARIANT varIndex)
 {
-  USES_CONVERSION;
-
   HRESULT hr = E_INVALIDARG;
   VARIANTARG *pvarIndex = &varIndex;
   VARTYPE vt = V_VT(pvarIndex);
@@ -526,10 +516,9 @@
       if (!V_ISBYREF(pvarIndex))
       {
         CComVariant var;
-        LPTSTR lpszNext;
-        LPTSTR lpszVal = W2T(V_BSTR(pvarIndex));
         var = _T("");
-        if (lpszVal)
+        CW2A szVal( V_BSTR(pvarIndex) );
+        if (szVal)
           {
             MagickLib::Image
               *image;
@@ -539,15 +528,18 @@
 
             long
               id;
+              
+             LPTSTR 
+               lpszNext;
 
-				    lpszNext = StrChr(lpszVal, _T('.'));
+				    lpszNext = StrChr(szVal, '.');
 				    if (lpszNext == NULL)
-              lpszNext = _T("%w,%h,%m");
+              lpszNext = "%w,%h,%m";
             else
-              *lpszNext++ = _T('\0');
+              *lpszNext++ = '\0';
             // lookup the registry id using token and pass the image in
             MagickLib::GetExceptionInfo(&exception);
-            image=MagickLib::GetImageFromMagickRegistry(lpszVal, &id, &exception);
+            image=MagickLib::GetImageFromMagickRegistry(szVal, &id, &exception);
             if (image != (MagickLib::Image *) NULL)
               {
                 MagickLib::DestroyImageList(image);
@@ -765,28 +757,17 @@
                       // is the way that VB does it.
                       LPCWSTR pReturnBuffer = NULL;
                       long size = SafeArraySize(psa);
-                      long sizeneeded;
-                      char *ptrANSI;
                       hr = SafeArrayAccessData(psa, (void**)&pReturnBuffer);
 	                    if(SUCCEEDED(hr))
                         {
-                          sizeneeded = WideCharToMultiByte(
-                            CP_ACP, 0, pReturnBuffer, size/2, (LPSTR)NULL, 0, NULL, NULL);
-                          if (sizeneeded)
-                            {
-                              ptrANSI = new char [sizeneeded + 1];
-                              WideCharToMultiByte(
-                                CP_ACP, 0, pReturnBuffer, size, (LPSTR)ptrANSI, sizeneeded, NULL, NULL);
-                              ptrANSI[sizeneeded]='\0';
-                              hr = SafeArrayUnaccessData(psa);
-                              SafeArrayDestroy(psa);
-
-                              SAFEARRAY* pSafeArray = SafeArrayCreateVector(VT_UI1,0,0);
-                              wsprintf(sz, _T("xtrnarray:0x%lx,%s"),
-                                (unsigned long)(pSafeArray),ptrANSI);
-                              hr = AddArgs(sz);
-                              if (ptrANSI)
-                                delete ptrANSI;
+							CStringW ws( pReturnBuffer, size );
+                            hr = SafeArrayUnaccessData(psa);
+                            SafeArrayDestroy(psa);
+							
+                            SAFEARRAY* pSafeArray = SafeArrayCreateVector(VT_UI1,0,0);
+                            wsprintf(sz, _T("xtrnarray:0x%lx,%ws"),
+                                (unsigned long)(pSafeArray),(LPCWSTR)ws);
+                            hr = AddArgs( sz );
                               if (V_ISBYREF(pvarIndex))
                                 {
                                   V_VT(pvarIndex) = VT_ARRAY | VT_UI1 | VT_BYREF;		
@@ -797,12 +778,7 @@
                                   V_VT(pvarIndex) = VT_ARRAY | VT_UI1;		
                                   V_ARRAY(pvarIndex) = pSafeArray;
                                 }
-                            }
-                          else
-                            {
-                              ThrowPerformException(exception,MagickLib::ErrorException,
-                                "Perform","Output array for blob did not specify image format");
-                            }
+                            
                         }
                       else
                       {
@@ -1022,7 +998,6 @@
 
 void MagickImage::CheckAndReportError(MagickImageError &error, HRESULT &hr, const char *program)
 {
-  USES_CONVERSION;
   char message_text[MaxTextExtent];
 
   if (FAILED(hr))
@@ -1062,7 +1037,8 @@
 #ifdef _DEBUG
     //DebugBreak();
 #endif
-    Error(A2W(message_text), __uuidof(IMagickImage), hr);
+	CA2WEX<MaxTextExtent> wsMessageText( message_text);
+    Error( wsMessageText, __uuidof(IMagickImage), hr);
   }
   MagickLib::DestroyExceptionInfo(&error.exception);
 }
@@ -1355,7 +1331,7 @@
   return hr;
 }
 
-HRESULT MagickImage::AddArgs(BSTR widestr)
+HRESULT MagickImage::AddArgs(LPCWSTR widestr)
 {
   HRESULT hr = E_OUTOFMEMORY;
 
@@ -1364,11 +1340,12 @@
 
   hr = S_OK;
 
-  MAKE_ANSIPTR_FROMWIDE(ptrANSI, widestr);
-  m_argv[m_argvIndex++] = ptrANSI;
+  CW2A sArgUTF8( widestr, CP_UTF8 );
+  m_argv[m_argvIndex++] = strdup( sArgUTF8 );
 
+  CW2A sArgANSI( widestr );
   (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-    "arg: %s",ptrANSI);
+    "arg: %s", (LPSTR)sArgANSI );
 
   if (m_argvIndex >= m_argc)
     hr = ReAllocateArgs( nDefaultArgumentSize );
@@ -1376,7 +1353,7 @@
   return hr;
 }
 
-HRESULT MagickImage::AddArgs(LPTSTR lpstr)
+HRESULT MagickImage::AddArgs(LPCSTR lpstr)
 {
   HRESULT hr = E_OUTOFMEMORY;
 
@@ -1384,15 +1361,15 @@
     return hr;
 
   hr = S_OK;
-#ifdef _UNICODE
-  MAKE_ANSIPTR_FROMWIDE(ptrANSI, lpstr);
-#else
-  MAKE_COPY_OF_ANSI(ptrANSI, lpstr);
-#endif
-  m_argv[m_argvIndex++] = ptrANSI;
+  
+  CA2W wsArg( lpstr );
+  CW2A sArgUTF8( wsArg, CP_UTF8 );
+  CW2A sArgANSI( wsArg );
+  
+  m_argv[m_argvIndex++] = strdup( sArgUTF8 );
 
   (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-    "arg: %s",ptrANSI);
+    "arg: %s", (LPSTR)sArgANSI );
 
   if (m_argvIndex >= m_argc)
     hr = ReAllocateArgs( nDefaultArgumentSize );
@@ -1403,17 +1380,15 @@
 HRESULT MagickImage::AllocateArgs(int cArgc)
 {
   m_argv = new LPTSTR [cArgc];
-  m_argv_t = new LPTSTR [cArgc];
 
-  if ((m_argv == NULL) || (m_argv_t == NULL))
+  if (m_argv == NULL)
     return E_OUTOFMEMORY;
+    
   m_argc = cArgc;
-
   m_argvIndex = 0;
   for (int i=0; i<m_argc; i++)
   {
     m_argv[i] = NULL;
-    m_argv_t[i] = NULL;
   }
   return S_OK;
 }
@@ -1421,13 +1396,11 @@
 HRESULT MagickImage::ReAllocateArgs(int cArgc)
 {
   LPTSTR *argv = m_argv;
-  LPTSTR *argv_t = m_argv_t;
   int argc = m_argc + cArgc;
 
   argv = new LPTSTR [argc];
-  argv_t = new LPTSTR [argc];
 
-  if ((argv == NULL) || (argv_t == NULL))
+  if (argv == NULL)
     return E_OUTOFMEMORY;
 
   for (int i=0; i<argc; i++)
@@ -1435,12 +1408,10 @@
     if (i < m_argc)
     {
       argv[i] = m_argv[i];
-      argv_t[i] = m_argv_t[i];
     }
     else
     {
       argv[i] = NULL;
-      argv_t[i] = NULL;
     }
   }
   if (m_argv)
@@ -1448,11 +1419,6 @@
     delete m_argv;
     m_argv = argv;
   }
-  if (m_argv_t)
-  {
-    delete m_argv_t;
-    m_argv_t = argv_t;
-  }
   m_argc = argc;
   return S_OK;
 }
@@ -1462,8 +1428,6 @@
   EmptyArgs();
   if (m_argv)
     delete m_argv;
-  if (m_argv_t)
-    delete m_argv_t;
 }
 
 char **MagickImage::GetArgv()
@@ -1471,11 +1435,6 @@
   return m_argv;
 }
 
-char **MagickImage::GetArgvT()
-{
-  return m_argv_t;
-}
-
 int MagickImage::GetArgc()
 {
   return m_argvIndex;
@@ -1485,12 +1444,8 @@
 {
   for (int i=0; i<m_argc; i++)
   {
-    if (m_argv[i] != NULL)
-      delete (void *) (m_argv[i]);
+    free( (void *) (m_argv[i]) );
     m_argv[i] = NULL;
-    if (m_argv_t[i] != NULL)
-      delete (void *) (m_argv_t[i]);
-    m_argv_t[i] = NULL;
   }
   m_argvIndex = 0;
 }
@@ -1652,86 +1607,28 @@
   m_spObjectContext.Release();
 } 
 
-int LocalGetFieldCount( string &s, const TCHAR* psz )
-{
-  int len = _tcslen( psz );
-  int pos = 0;
-  int iCount = 1;
+typedef CAtlArray<CStringA> CStringArray;
 
-  while( (pos = s.find(psz, pos)) >= 0 )
-  {
-    pos += len;
-    iCount++;
-  }
-  return iCount;
-};
-
-int LocalGetFieldCount( string &s, const TCHAR& ch )
+static void LocalTokenize( const CString& s, LPCSTR sz, CStringArray& asToken )
 {
-  int pos = 0;
-  int iCount = 1;
+	int nPos = 0;
+	CStringA sToken;
+	
+	asToken.RemoveAll();
+	sToken = s.Tokenize( sz, nPos );
+	while( !sToken.IsEmpty() )
+	{
+		asToken.Add( sToken );
+	}
+	
+	if ( asToken.GetCount() == 0 )
+	{
+		asToken.Add( s );
+	}
+}
 
-  while( (pos = s.find(ch, pos)) >= 0 )
-  {
-    pos++;
-    iCount++;
-  }
-  return iCount;
-};
-
-string LocalGetField( string &s, const TCHAR* delim, int fieldnum )
-{
-  int lenDelim = _tcslen( delim );
-  int pos = 0, term = 0;
-  int retlen = 0, retpos = 0;
-
-  while( fieldnum-- >= 0 )
-  {
-    term = s.find(delim, pos);
-    if( term >= 0 )
-    {
-      retpos = pos;
-      retlen = term - pos;
-      pos = term + lenDelim;
-    }
-    else
-    {
-      retpos = pos;
-      retlen = s.length() - pos;
-      break;
-    }
-  }
-  return s.substr(retpos, retlen);
-};
-
-string LocalGetField( string &s, const TCHAR& ch, int fieldnum )
-{
-  int pos = 0, term = 0;
-  int retlen = 0, retpos = 0;
-
-  while( fieldnum-- >= 0 )
-  {
-    term = s.find(ch, pos);
-    if( term >= 0 )
-    {
-      retpos = pos;
-      retlen = term - pos;
-      pos = term + 1;
-    }
-    else
-    {
-      retpos = pos;
-      retlen = s.length() - pos;
-      break;
-    }
-  }
-  return s.substr(retpos, retlen);
-};
-
 HRESULT MagickImage::Construct(IDispatch * pCtorObj)
 {
-  USES_CONVERSION;
-
   (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
     "Construct");
   CComPtr<IObjectConstructString> spObjectConstructString;
@@ -1742,34 +1639,46 @@
     hr = spObjectConstructString->get_ConstructString(&bstrConstruct);
     if (SUCCEEDED(hr))
     {
-      string options;
-      MAKE_ANSIPTR_FROMWIDE(ptrANSI, bstrConstruct);
+      CStringA sOptions( bstrConstruct );
+      int nPos = 0;
+      CStringA sToken;
+      CStringArray asToken;
+      
       (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-        "Construct data: %s",ptrANSI);
-      options = W2CA(bstrConstruct);
-      int nOptions = LocalGetFieldCount(options,_T(','));
-      for (int nOptionIndex = 0; nOptionIndex < nOptions; nOptionIndex++)
+        "Construct data: %s", (LPCSTR)sOptions );
+        
+      sToken = sOptions.Tokenize( ".", nPos );
+      while( !sToken.IsEmpty() )
       {
-        string param = LocalGetField( options, _T(','), nOptionIndex );
-        int nParams = LocalGetFieldCount(param,_T('='));
-        if (nParams == 2)
-        {
-          string name = LocalGetField( param, _T('='), 0 );
-          string value = LocalGetField( param, _T('='), 1 );
+		LocalTokenize( sToken, "=", asToken );
+		if ( asToken.GetCount() == 2 )
+		{
+			const CStringA& sName = asToken[0];
+			const CStringA& sValue = asToken[1];
+			
           (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
             "Construct name: %s value: %s",
-              name.c_str(),value.c_str());
+              (LPCSTR)sName,(LPCSTR)sValue);
+              
 #if defined(_ENABLE_OLD_LOGGING_SUPPORT_)
-          if (name.compare(_T("MAGICK_DEBUG_LEVEL")) == 0)
-            MagickLib::DebugLevel(atoi(value.c_str()));
-          if (name.compare(_T("MAGICK_DEBUG_PATH")) == 0)
-            MagickLib::DebugFilePath(value.c_str());           
-          if (name.compare(_T("MAGICK_LOG_EVENTMASK")) == 0)
-            MagickLib::SetLogEventMask(value.c_str());
+          if (sName.Compare("MAGICK_DEBUG_LEVEL") == 0)
+          {
+            MagickLib::DebugLevel( atoi(sValue) );
+          }
+          
+          if (sName.Compare("MAGICK_DEBUG_PATH") == 0)
+          {
+            MagickLib::DebugFilePath(sValue);           
+          }
+          
+          if (sName.Compare("MAGICK_LOG_EVENTMASK") == 0)
+          {
+            MagickLib::SetLogEventMask(sValue);
+          }
 #endif
-        }
-     }
-    }
-  }
+		} // if
+      } // while
+    } // if
+   }
   return hr;
 }
Index: ImageMagickObject_.h
===================================================================
--- ImageMagickObject_.h	(revision 14073)
+++ ImageMagickObject_.h	(working copy)
@@ -1,98 +1,60 @@
-#pragma once
-#ifndef STRICT
-#define STRICT
-#endif
-#ifndef WINVER
-#define WINVER 0x0400
-#endif
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0400
-#endif						
-#ifndef _WIN32_WINDOWS
-#define _WIN32_WINDOWS 0x0410
-#endif
-#ifndef _WIN32_IE
-#define _WIN32_IE 0x0400
-#endif
-#define _ATL_ATTRIBUTES
-#define _ATL_APARTMENT_THREADED
-#define _ATL_NO_AUTOMATIC_NAMESPACE
-#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
-#define _ATL_ALL_WARNINGS
-#pragma warning(disable: 4103) // pragma pack
-#define _WINSOCKAPI_
-#include <atlbase.h>
-#include <atlcom.h>
-#include <atlwin.h>
-#include <atltypes.h>
-#include <atlctl.h>
-#include <atlhost.h>
-#include <atlsafe.h>
-using namespace ATL;
-
-#include <asptlb.h>         // Active Server Pages Definitions
-#include <comsvcs.h>
-
-#include <iostream>
-using namespace std;
-
-
-namespace MagickLib
-{
-#define _VISUALC_
-//#define _MAGICKDLL_
-//#define _MAGICKLIB_
-#include <wand/MagickWand.h>
-#include <magick/semaphore.h>
-#include <magick/nt-base.h>
-#include <magick/log.h>
-#include <magick/hashmap.h>
-//#undef _MAGICKDLL_
-//#undef _MAGICKLIB_
-#undef inline
-#undef class
-}
-
-
-const DWORD dwErrorBase = 5000;
-const int nDefaultArgumentSize = 128;
-const LCID lcidDefault = 0;
-
-//
-// This routine converts a wide character string to ANSI and stores the new
-// string in a buffer allocated by the new operator
-//
-#define MAKE_WIDEPTR_FROMANSI(ptrname, ansistr) \
-    long __l##ptrname = (lstrlen(ansistr) + 1) * sizeof(WCHAR); \
-    void * __TempBuffer##ptrname = (void *) new char [ __l##ptrname ]; \
-    MultiByteToWideChar(CP_ACP, 0, ansistr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname); \
-    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname
-
-//
-// This routine converts an ANSI string to a wide character string in a new
-// buffer area allocated using the new operator
-// We allocate lstrlenW(widestr) * 2 because its possible for a UNICODE char
-// to map to 2 ansi characters this is a quick guarantee that enough space
-// will be allocated.
-//
-#define MAKE_ANSIPTR_FROMWIDE(ptrname, widestr) \
-    long __l##ptrname = (lstrlenW(widestr) + 1) * 2 * sizeof(char); \
-    void * __TempBuffer##ptrname = (void *) new char [ __l##ptrname]; \
-    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname, __l##ptrname, NULL, NULL); \
-    LPSTR ptrname = (LPSTR)__TempBuffer##ptrname
-
-#define MAKE_ANSIPTR_FROMWIDE_2(ptrname, widestr, wlen) \
-    long __l##ptrname = (wlen + 1) * 2 * sizeof(char); \
-    void * __TempBuffer##ptrname = (void *) new char [ __l##ptrname]; \
-    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname, __l##ptrname, NULL, NULL); \
-    LPSTR ptrname = (LPSTR)__TempBuffer##ptrname
-//
-// This routine is used to make a copy of an existing ANSI string
-//
-#define MAKE_COPY_OF_ANSI(ptrname, ansistr) \
-    long __l##ptrname = (lstrlen(ansistr) + 1); \
-    void * __TempBuffer##ptrname = (void *) new char [ __l##ptrname ]; \
-    lstrcpyn((LPSTR)__TempBuffer##ptrname, (LPCSTR)ansistr, __l##ptrname); \
-    LPSTR ptrname = (LPSTR)__TempBuffer##ptrname
-
-#define _DbgBreak() __asm { int 3 }
+#pragma once
+#ifndef STRICT
+#define STRICT
+#endif
+#ifndef WINVER
+#define WINVER 0x0400
+#endif
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0400
+#endif						
+#ifndef _WIN32_WINDOWS
+#define _WIN32_WINDOWS 0x0410
+#endif
+#ifndef _WIN32_IE
+#define _WIN32_IE 0x0400
+#endif
+#define _ATL_ATTRIBUTES
+#define _ATL_APARTMENT_THREADED
+#define _ATL_NO_AUTOMATIC_NAMESPACE
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
+#define _ATL_ALL_WARNINGS
+#pragma warning(disable: 4103) // pragma pack
+#define _WINSOCKAPI_
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlwin.h>
+#include <atltypes.h>
+#include <atlctl.h>
+#include <atlhost.h>
+#include <atlsafe.h>
+#include <atlconv.h>
+#include <atlstr.h>
+#include <atlcoll.h>
+using namespace ATL;
+
+#include <asptlb.h>         // Active Server Pages Definitions
+#include <comsvcs.h>
+
+namespace MagickLib
+{
+#define _VISUALC_
+//#define _MAGICKDLL_
+//#define _MAGICKLIB_
+#include <wand/MagickWand.h>
+#include <magick/semaphore.h>
+#include <magick/nt-base.h>
+#include <magick/log.h>
+#include <magick/hashmap.h>
+//#undef _MAGICKDLL_
+//#undef _MAGICKLIB_
+#undef inline
+#undef class
+}
+
+
+const DWORD dwErrorBase = 5000;
+const int nDefaultArgumentSize = 128;
+const LCID lcidDefault = 0;
+
+#define _DbgBreak() __asm { int 3 }

Re: ImageMagicObject - non-ASCII characters

Posted: 2009-02-18T13:49:30-07:00
by magick
Thanks for the patch. We will get it into the Subversion trunk by sometime tomorrow.

Re: ImageMagicObject - non-ASCII characters

Posted: 2009-02-20T08:04:29-07:00
by roed
Here is another patch.

List of modifications:
  • Generally more code cleanup to make code more readable. This may help in future modifications. Many definitions removed from header file. Many constants at the beginning of CPP file.
  • Using TCHAR-related functions and macros where possible. Not important for now but maybe someone want to build this library using Unicode runtime library.
  • Memory program register: methods Item and Remove now works. Access to image from registry only by name. Access by number was removed.
  • Some not implemented methods now returns E_NOTIMPL error instead of S_OK (sucess).
  • Modifications in blob handling: adding GetXtrnArrayStr methods to fomat "xtrnarray" string in one place only.
Please note that these modifications requires more testing.
Especially blob handling (VB Arrays) is practically not tested because I do not use VB.

Code: Select all

Property changes on: BuildImageMagickObject.cmd
___________________________________________________________________
Added: svn:eol-style
   + CRLF

Index: ImageMagickObject.cpp
===================================================================
--- ImageMagickObject.cpp	(revision 14093)
+++ ImageMagickObject.cpp	(working copy)
@@ -1,1684 +1,1949 @@
+/*
+	ImageMagickObject.cpp
+*/
+
 #include "ImageMagickObject_.h"
 
-[ module(dll, name = "ImageMagickObject", helpstring = "ImageMagickObject 1.0 Type Library") ]
-// module attribute now applies to this class
+static const DWORD dwErrorBase = 5000;
+static const int nDefaultArgumentSize = 128;
+static const LCID lcidDefault = 0;
+
+static const int DEF_DEBUG_MODE = _CRTDBG_MODE_WNDW;
+
+// for logging
+static const char objName[] = "ImageMagickObject";
+static const char methodName[] = "Perform";
+
+// xtrnarray
+static const TCHAR xtrnarray_fmt[] = _T("xtrnarray:0x%lx,%ws");
+
+
+[ module( dll, name = "ImageMagickObject", helpstring = "ImageMagickObject 1.0 Type Library" ) ]
 class CModuelOverrideClass
 {
-  public:
-  TCHAR m_szAppPath[MAX_PATH];
-  BOOL WINAPI DllMain(DWORD dwReason, LPVOID lpReserved)
-  {
-    //DebugBreak();
-    if (dwReason == DLL_PROCESS_ATTACH)
-    {
-      MagickLib::ExceptionInfo
-        exception;
+	private:
 
+	TCHAR m_szAppPath[ MAX_PATH ];
+
+	public:
+
+		BOOL WINAPI DllMain(
+			DWORD dwReason,
+			LPVOID lpReserved
+		)
+		{
+			//ATLASSERT( FALSE );
+			if( dwReason == DLL_PROCESS_ATTACH )
+			{
+				MagickLib::ExceptionInfo
+				exception;
+
 #ifdef _DEBUG
-      int tmpDbgFlag;
+				int tmpDbgFlag;
 #endif
-      HINSTANCE hModuleInstance = _AtlBaseModule.GetModuleInstance();
-      HINSTANCE hMResourceInstance = _AtlBaseModule.GetResourceInstance();
-      if (!GetModuleFileName (hModuleInstance, m_szAppPath, MAX_PATH))
-        return FALSE;
+				HINSTANCE hModuleInstance = _AtlBaseModule.GetModuleInstance();
+				HINSTANCE hMResourceInstance = _AtlBaseModule.GetResourceInstance();
+				if( !GetModuleFileName( hModuleInstance, m_szAppPath, MAX_PATH ) )
+				{
+					return FALSE;
+				}
+
 #ifdef _DEBUG
-      tmpDbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
-      tmpDbgFlag |= _CRTDBG_CHECK_ALWAYS_DF;
-      //tmpDbgFlag |= _CRTDBG_DELAY_FREE_MEM_DF;
-      tmpDbgFlag |= _CRTDBG_LEAK_CHECK_DF;
-      tmpDbgFlag |= _CRTDBG_ALLOC_MEM_DF;
-      _CrtSetDbgFlag(tmpDbgFlag);
-      _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_DEBUG );
-      _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_DEBUG );
-      _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG );
+				tmpDbgFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
+				tmpDbgFlag |= _CRTDBG_CHECK_ALWAYS_DF;
+
+				//tmpDbgFlag |= _CRTDBG_DELAY_FREE_MEM_DF;
+				tmpDbgFlag |= _CRTDBG_LEAK_CHECK_DF;
+				tmpDbgFlag |= _CRTDBG_ALLOC_MEM_DF;
+				_CrtSetDbgFlag( tmpDbgFlag );
+				_CrtSetReportMode( _CRT_ASSERT, DEF_DEBUG_MODE );
+				_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_DEBUG );
+				_CrtSetReportMode( _CRT_ERROR, DEF_DEBUG_MODE );
 #endif
 
-      /* The first thing to do is make sure that basic critical sections are
-         initialized properly. This should prevent ANY other race conditions
-       */
-      // MagickLib::InitializeSemaphore();
-      /* Next we use a back door to init the path to US so that the logging
-         system can find its configuration file log.gk and load it
-       */
-      (void) MagickLib::SetClientPath(m_szAppPath);
-      //(void) MagickLib::SetLogEventMask("All");
-      (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-        "DLL Attach -  path: %s",m_szAppPath);
-      // MagickLib::InitializeTracingCriticalSection();
-      // MagickLib::DebugString("DLL Attach -  path: %s\n",m_szAppPath);
-      MagickLib::InitializeMagick(m_szAppPath);
-      MagickLib::RegisterStaticModules();
-      MagickLib::GetExceptionInfo(&exception);
-      (void) MagickLib::GetMagicInfo((unsigned char *) NULL,0,&exception);
-      (void) MagickLib::GetDelegateInfo("*","*",&exception);
-      MagickLib::DestroyExceptionInfo(&exception);
-    }
-    else if (dwReason == DLL_PROCESS_DETACH)
-    {
-      (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-        "DLL Detach -  path: %s",m_szAppPath);
-      MagickLib::DestroyMagick();
+				/* The first thing to do is make sure that basic critical sections are
+				   initialized properly. This should prevent ANY other race conditions
+				 */
+
+				// MagickLib::InitializeSemaphore();
+
+				/* Next we use a back door to init the path to US so that the logging
+				   system can find its configuration file log.gk and load it
+				 */
+				(void)MagickLib::SetClientPath( m_szAppPath );
+
+				//(void) MagickLib::SetLogEventMask("All");
+				(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+					"DLL Attach -  path: %s", m_szAppPath );
+
+				// MagickLib::InitializeTracingCriticalSection();
+				// MagickLib::DebugString("DLL Attach -  path: %s\n",m_szAppPath);
+				MagickLib::InitializeMagick( m_szAppPath );
+				MagickLib::RegisterStaticModules();
+				MagickLib::GetExceptionInfo( &exception );
+				(void)MagickLib::GetMagicInfo( (unsigned char*)NULL, 0, &exception );
+				(void)MagickLib::GetDelegateInfo( "*", "*", &exception );
+				MagickLib::DestroyExceptionInfo( &exception );
+			}
+			else if( dwReason == DLL_PROCESS_DETACH )
+			{
+				(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+					"DLL Detach -  path: %s", m_szAppPath );
+				MagickLib::DestroyMagick();
 #ifdef _DEBUG
-      if (_CrtDumpMemoryLeaks())
-        {
-          /* MagickLib::DebugString("ImageMagickObject - DLL Detach - leaks detected\n"); */
-        }
+				if( _CrtDumpMemoryLeaks() )
+				{
+					/* MagickLib::DebugString("ImageMagickObject - DLL Detach - leaks detected\n"); */
+				}
+
 #endif
-    }
-    return __super::DllMain(dwReason, lpReserved);
-  }
+			}
+
+			return __super::DllMain( dwReason, lpReserved );
+		}
 };
 [ emitidl ];
+
 /////////////////////////////////////////////////////////////////////////////
 // IMagickImage
 [
-  object,
-  uuid("7F670536-00AE-4EDF-B06F-13BD22B25624"),
-  dual,
-  helpstring("IMagickImage Interface"),
-  pointer_default(unique)
+	object,
+	uuid( "7F670536-00AE-4EDF-B06F-13BD22B25624" ),
+	dual,
+	helpstring( "IMagickImage Interface" ),
+	pointer_default( unique )
 ]
 __interface IMagickImage : IDispatch
 {
-  //Standard Server Side Component Methods
-  HRESULT OnStartPage([in] IUnknown* piUnk);
-  HRESULT OnEndPage();	
-  [propget, id(1)] HRESULT Count([out, retval] long *pVal);
-  [vararg, id(2)] HRESULT Add([in, out, satype(VARIANT)] SAFEARRAY** pArrayVar, [out, retval] VARIANT *pVar);
-  [id(3)] HRESULT Remove([in] VARIANT varIndex);
-  [vararg, id(4)] HRESULT Compare([in, out, satype(VARIANT)] SAFEARRAY** pArrayVar, [out, retval] VARIANT *pVar);
-  [vararg, id(5)] HRESULT Composite([in, out, satype(VARIANT)] SAFEARRAY** pArrayVar, [out, retval] VARIANT *pVar);
-  [vararg, id(6)] HRESULT Convert([in, out, satype(VARIANT)] SAFEARRAY** pArrayVar, [out, retval] VARIANT *pVar);
-  [vararg, id(7)] HRESULT Identify([in, out, satype(VARIANT)] SAFEARRAY** pArrayVar, [out, retval] VARIANT *pVar);
-  [vararg, id(8)] HRESULT Mogrify([in, out, satype(VARIANT)] SAFEARRAY** pArrayVar, [out, retval] VARIANT *pVar);
-  [vararg, id(9)] HRESULT Montage([in, out, satype(VARIANT)] SAFEARRAY** pArrayVar, [out, retval] VARIANT *pVar);
-  [vararg, id(10)] HRESULT Stream([in, out, satype(VARIANT)] SAFEARRAY** pArrayVar, [out, retval] VARIANT *pVar);
-  [vararg, id(11)] HRESULT TestHarness([in, out, satype(VARIANT)] SAFEARRAY** pArrayVar, [out, retval] VARIANT *pVar);
-  [propget, id(DISPID_NEWENUM)] HRESULT _NewEnum([out, retval] LPUNKNOWN *pVal);
-  [propget, id(DISPID_VALUE)] HRESULT Item([in] VARIANT varIndex, [out, retval] VARIANT *pVal);
-  [propget, id(14)] HRESULT Messages([out, retval] VARIANT *pVal);
+	//Standard Server Side Component Methods
+	HRESULT OnStartPage([ in ] IUnknown * piUnk );
+	HRESULT OnEndPage();
+	[ propget, id( 1 ) ] HRESULT Count([ out, retval ] long* pVal );
+	[ vararg, id( 2 ) ] HRESULT Add([ in, out, satype( VARIANT ) ] SAFEARRAY * *pArrayVar, [ out, retval ] VARIANT * pVar );
+	[ id( 3 ) ] HRESULT Remove([ in ] VARIANT varIndex );
+	[ vararg, id( 4 ) ] HRESULT Compare([ in, out, satype( VARIANT ) ] SAFEARRAY * *pArrayVar, [ out, retval ] VARIANT * pVar );
+	[ vararg, id( 5 ) ] HRESULT Composite([ in, out, satype( VARIANT ) ] SAFEARRAY * *pArrayVar, [ out, retval ] VARIANT * pVar );
+	[ vararg, id( 6 ) ] HRESULT Convert([ in, out, satype( VARIANT ) ] SAFEARRAY * *pArrayVar, [ out, retval ] VARIANT * pVar );
+	[ vararg, id( 7 ) ] HRESULT Identify([ in, out, satype( VARIANT ) ] SAFEARRAY * *pArrayVar, [ out, retval ] VARIANT * pVar );
+	[ vararg, id( 8 ) ] HRESULT Mogrify([ in, out, satype( VARIANT ) ] SAFEARRAY * *pArrayVar, [ out, retval ] VARIANT * pVar );
+	[ vararg, id( 9 ) ] HRESULT Montage([ in, out, satype( VARIANT ) ] SAFEARRAY * *pArrayVar, [ out, retval ] VARIANT * pVar );
+	[ vararg, id( 10 ) ] HRESULT Stream([ in, out, satype( VARIANT ) ] SAFEARRAY * *pArrayVar, [ out, retval ] VARIANT * pVar );
+	[ vararg, id( 11 ) ] HRESULT TestHarness([ in, out, satype( VARIANT ) ] SAFEARRAY * *pArrayVar, [ out, retval ] VARIANT * pVar );
+	[ propget, id( DISPID_NEWENUM ) ] HRESULT _NewEnum([ out, retval ] LPUNKNOWN * pVal );
+	[ propget, id( DISPID_VALUE ) ] HRESULT Item([ in ] VARIANT varIndex, [ out, retval ] VARIANT * pVal );
+	[ propget, id( 14 ) ] HRESULT Messages([ out, retval ] VARIANT * pVal );
 };
 
-struct MagickImageError
+class MagickImageError
 {
-public:
-  MagickLib::ExceptionInfo  exception;
-  bool                      fullException;
-  DWORD                     fullExceptionCode;
-  MagickImageError()
-  {
-    fullException = FALSE;
-    fullExceptionCode = 0;
-    MagickLib::GetExceptionInfo(&exception);
-  }
+	public:
+
+		MagickLib::ExceptionInfo exception;
+		bool fullException;
+		DWORD fullExceptionCode;
+
+	public:
+
+		MagickImageError()
+		{
+			fullException = FALSE;
+			fullExceptionCode = 0;
+
+			MagickLib::GetExceptionInfo(& exception );
+		}
+
+		static LPCSTR translate_exception( DWORD );
+		LPCTSTR translate_exception() const
+		{
+			return translate_exception( fullExceptionCode );
+		}
 };
 
 /////////////////////////////////////////////////////////////////////////////
 // MagickImage
 [
-  coclass,
-  threading(both),
-  support_error_info("IMagickImage"),
-  vi_progid("ImageMagickObject.MagickImage"),
-  progid("ImageMagickObject.MagickImage.1"),
-  version(1.0),
-  uuid("5630BE5A-3F5F-4BCA-A511-AD6A6386CAC1"),
-  helpstring("MagickImage Class")
+	coclass,
+	threading( both ),
+	support_error_info( "IMagickImage" ),
+	vi_progid( "ImageMagickObject.MagickImage" ),
+	progid( "ImageMagickObject.MagickImage.1" ),
+	version( 1.0 ),
+	uuid( "5630BE5A-3F5F-4BCA-A511-AD6A6386CAC1" ),
+	helpstring( "MagickImage Class" )
 ]
-class ATL_NO_VTABLE MagickImage : 
-  public IObjectControl,
-  public IObjectConstruct,
-  public IObjectWithSiteImpl<MagickImage>,
-  public IMagickImage
+class ATL_NO_VTABLE MagickImage:
+	public IObjectControl,
+	public IObjectConstruct,
+	public ISupportErrorInfoImpl<&__uuidof(IMagickImage)>,
+	public IObjectWithSiteImpl<MagickImage>,
+	public IMagickImage
 {
-public:
-  MagickImage()
-  {
+	public:
+
+		MagickImage()
+		{
 #ifdef _DEBUG
-    //DebugBreak();
+			//ATLASSERT( FALSE );
 #endif
-    MagickLib::SetWarningHandler(warninghandler);
-    MagickLib::SetErrorHandler(errorhandler);
-    MagickLib::SetFatalErrorHandler(fatalerrorhandler);
-    (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-      "MagickImage constructor");
-    m_bOnStartPageCalled = FALSE;
-  }
-  
-private:
-  
-  HRESULT TestHarness(SAFEARRAY **pArrayVar, VARIANT *pVar);
-  HRESULT Compare(SAFEARRAY **pArrayVar, VARIANT *pVar);
-  HRESULT Composite(SAFEARRAY **pArrayVar, VARIANT *pVar);
-  HRESULT Convert(SAFEARRAY **pArrayVar, VARIANT *pVar);
-  HRESULT Identify(SAFEARRAY **pArrayVar, VARIANT *pVar);
-  HRESULT Mogrify(SAFEARRAY **pArrayVar, VARIANT *pVar);
-  HRESULT Montage(SAFEARRAY **pArrayVar, VARIANT *pVar);
-  HRESULT Stream(SAFEARRAY **pArrayVar, VARIANT *pVar);
-  HRESULT Execute(MagickLib::MagickBooleanType (*func)(MagickLib::ImageInfo *image_info,
-    const int argc,char **argv,char **text,MagickLib::ExceptionInfo *exception),
-      char **text,MagickLib::ImageInfo *info,MagickLib::ExceptionInfo *exception);
-  HRESULT Perform(MagickLib::MagickBooleanType (*func)(MagickLib::ImageInfo *image_info,
-  const int argc,char **argv,char **text,MagickLib::ExceptionInfo *exception),
-    SAFEARRAY **pArrayVar,VARIANT *pVar2,MagickLib::ExceptionInfo *exception);
-    
-private:
+			MagickLib::SetWarningHandler( warninghandler );
+			MagickLib::SetErrorHandler( errorhandler );
+			MagickLib::SetFatalErrorHandler( fatalerrorhandler );
+			(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+				"MagickImage constructor" );
+			m_bOnStartPageCalled = FALSE;
+		}
 
-  char **m_argv;
-  int m_argc;
-  int m_argvIndex;
-  
+	private:
 
-  HRESULT AllocateArgs(int iArgs);
-  HRESULT ReAllocateArgs(int iArgs);
-  void DeleteArgs(void);
-  char **GetArgv(void);
-  int GetArgc(void);
-  void EmptyArgs(void);
+		HRESULT TestHarness(
+			SAFEARRAY** pArrayVar,
+			VARIANT* pVar
+		);
 
-  HRESULT AddArgs(LPCWSTR);
-  HRESULT AddArgs(LPCSTR);
-  
- private:
+		HRESULT Compare(
+			SAFEARRAY** pArrayVar,
+			VARIANT* pVar
+		);
 
-  static void warninghandler(const MagickLib::ExceptionType warning,const char *message,
-    const char *qualifier);
+		HRESULT Composite(
+			SAFEARRAY** pArrayVar,
+			VARIANT* pVar
+		);
 
-  static void errorhandler(const MagickLib::ExceptionType error,const char *message,
-    const char *qualifier);
+		HRESULT Convert(
+			SAFEARRAY** pArrayVar,
+			VARIANT* pVar
+		);
 
-  static void fatalerrorhandler(const MagickLib::ExceptionType error,const char *message,
-    const char *qualifier);
+		HRESULT Identify(
+			SAFEARRAY** pArrayVar,
+			VARIANT* pVar
+		);
 
-  static void CheckAndReportError(MagickImageError &error, HRESULT &hr, const char *program);
-  
-  public:
+		HRESULT Mogrify(
+			SAFEARRAY** pArrayVar,
+			VARIANT* pVar
+		);
 
-  DECLARE_PROTECT_FINAL_CONSTRUCT()
-  HRESULT FinalConstruct()
-  {
-    (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-      "FinalConstruct");
-    AllocateArgs( nDefaultArgumentSize );
-    //MagickLib::InitializeMagick(NULL);
-    return S_OK;
-  }
-  
-  void FinalRelease() 
-  {
-     (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-        "FinalRelease");
-    DeleteArgs();
-  }
+		HRESULT Montage(
+			SAFEARRAY** pArrayVar,
+			VARIANT* pVar
+		);
 
-  // Support for ASP page notifications methods
-public:
-  //Active Server Pages Methods
-  STDMETHOD(OnStartPage)(IUnknown* IUnk);
-  STDMETHOD(OnEndPage)();
-	STDMETHOD(get_Item)(/*[in]*/ VARIANT varIndex, /*[out, retval]*/ VARIANT *pVar);
-	STDMETHOD(get__NewEnum)(/*[out, retval]*/ LPUNKNOWN *pVal);
-	STDMETHOD(get_Count)(/*[out, retval]*/ long *pVal);
-	STDMETHOD(get_Messages)(/*[out, retval]*/ VARIANT *pVar);
-	STDMETHOD(Remove)(/*[in]*/ VARIANT varIndex);
-	STDMETHOD(Add)(/*[in,out]*/ SAFEARRAY **pArrayVar, /*[out, retval]*/ VARIANT *pVar);
+		HRESULT Stream(
+			SAFEARRAY** pArrayVar,
+			VARIANT* pVar
+		);
 
-private:
-  CComPtr<IRequest> m_piRequest; //Request Object
-  CComPtr<IResponse> m_piResponse; //Response Object
-  CComPtr<ISessionObject> m_piSession; //Session Object
-  CComPtr<IServer> m_piServer; //Server Object
-  CComPtr<IApplicationObject> m_piApplication; //Application Object
-  BOOL m_bOnStartPageCalled; //OnStartPage successful?
+		HRESULT Execute( 
+			MagickLib::MagickBooleanType (*func)( MagickLib::ImageInfo* image_info, const int argc, char** argv, char** text, MagickLib::ExceptionInfo* exception ),
+			char** text,
+			MagickLib::ImageInfo * info,
+			MagickLib::ExceptionInfo * exception
+		);
 
-public:
-  // Support for COM+ activation and deactivation
-  STDMETHOD(Activate)();
-  STDMETHOD_(BOOL, CanBePooled)();
-  STDMETHOD_(void, Deactivate)();
-  STDMETHOD(Construct)(IDispatch * pCtorObj);
+		HRESULT Perform( 
+			MagickLib::MagickBooleanType (*func)( MagickLib::ImageInfo* image_info, const int argc, char** argv, char** text, MagickLib::ExceptionInfo* exception ),
+			SAFEARRAY * *pArrayVar,
+			VARIANT * pVar2,
+			MagickLib::ExceptionInfo * exception
+		);
 
-  CComPtr<IObjectContext> m_spObjectContext;
+	private:
+
+		char** m_argv;
+		int m_argc;
+		int m_argvIndex;
+
+		HRESULT AllocateArgs(
+			int iArgs
+		);
+
+		HRESULT ReAllocateArgs(
+			int iArgs
+		);
+
+		void DeleteArgs(
+			void
+		);
+
+		char** GetArgv(
+			void
+		);
+
+		int GetArgc(
+			void
+		);
+
+		void EmptyArgs(
+			void
+		);
+
+		HRESULT AddArgs( LPCWSTR );
+		HRESULT AddArgs( LPCSTR );
+
+	private:
+
+		static void warninghandler(
+			const MagickLib::ExceptionType warning,
+			const char* message,
+			const char* qualifier
+		);
+
+		static void errorhandler(
+			const MagickLib::ExceptionType error,
+			const char* message,
+			const char* qualifier
+		);
+
+		static void fatalerrorhandler(
+			const MagickLib::ExceptionType error,
+			const char* message,
+			const char* qualifier
+		);
+
+		static void CheckAndReportError(
+			MagickImageError& error,
+			HRESULT& hr,
+			const char* program
+		);
+
+		static void GetXtrnArrayStr( CString&, const SAFEARRAY*, LPCWSTR );
+		static void GetXtrnArrayStr( CString&, const SAFEARRAY* );
+
+	public:
+
+		DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+		HRESULT FinalConstruct()
+		{
+			(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+				"FinalConstruct" );
+			AllocateArgs( nDefaultArgumentSize );
+
+			//MagickLib::InitializeMagick(NULL);
+			return S_OK;
+		}
+
+		void FinalRelease()
+		{
+			(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+				"FinalRelease" );
+			DeleteArgs();
+		}
+
+		// Support for ASP page notifications methods
+	public:
+
+		//Active Server Pages Methods
+		STDMETHOD( OnStartPage ) ( IUnknown * IUnk );
+		STDMETHOD( OnEndPage ) ();
+		STDMETHOD( get_Item ) ( /*[in]*/ VARIANT varIndex, /*[out, retval]*/ VARIANT * pVar );
+		STDMETHOD( get__NewEnum ) ( /*[out, retval]*/ LPUNKNOWN * pVal );
+		STDMETHOD( get_Count ) ( /*[out, retval]*/ long* pVal );
+		STDMETHOD( get_Messages ) ( /*[out, retval]*/ VARIANT * pVar );
+		STDMETHOD( Remove ) ( /*[in]*/ VARIANT varIndex );
+		STDMETHOD( Add ) ( /*[in,out]*/ SAFEARRAY * *pArrayVar, /*[out, retval]*/ VARIANT * pVar );
+
+	private:
+
+		CComPtr<IRequest>m_piRequest;               //Request Object
+		CComPtr<IResponse>m_piResponse;             //Response Object
+		CComPtr<ISessionObject>m_piSession;         //Session Object
+		CComPtr<IServer>m_piServer;                 //Server Object
+		CComPtr<IApplicationObject>m_piApplication; //Application Object
+		BOOL m_bOnStartPageCalled;                  //OnStartPage successful?
+		CComPtr<IObjectContext> m_spObjectContext;
+
+	public:
+
+		// Support for COM+ activation and deactivation
+		STDMETHOD( Activate ) ();
+		STDMETHOD_( BOOL, CanBePooled ) ();
+		STDMETHOD_( void, Deactivate ) ();
+		STDMETHOD( Construct ) ( IDispatch * pCtorObj );
 };
 
-static const char *translate_exception(DWORD code)
+LPCSTR MagickImageError::translate_exception( DWORD code )
 {
-  switch (code)
-  {
-    case EXCEPTION_ACCESS_VIOLATION:
-      return "access violation";
-    case EXCEPTION_DATATYPE_MISALIGNMENT:
-      return "data misalignment";
-    case EXCEPTION_BREAKPOINT:
-      return "debug breakpoint";
-    case EXCEPTION_SINGLE_STEP:
-      return "debug single step";
-    case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
-      return "array out of bounds";
-    case EXCEPTION_FLT_DENORMAL_OPERAND:
-      return "float denormal operand";
-    case EXCEPTION_FLT_DIVIDE_BY_ZERO:
-      return "float devide by zero";
-    case EXCEPTION_FLT_INEXACT_RESULT:
-      return "float inexact result";
-    case EXCEPTION_FLT_INVALID_OPERATION:
-      return "float invalid operation";
-    case EXCEPTION_FLT_OVERFLOW:
-      return "float overflow";
-    case EXCEPTION_FLT_STACK_CHECK:
-      return "float stack check";
-    case EXCEPTION_FLT_UNDERFLOW:
-      return "float underflow";
-    case EXCEPTION_INT_DIVIDE_BY_ZERO:
-      return "integer divide by zero";
-    case EXCEPTION_INT_OVERFLOW:
-      return "integer overflow";
-    case EXCEPTION_PRIV_INSTRUCTION:
-      return "privleged instruction";
-    case EXCEPTION_IN_PAGE_ERROR:
-      return "page error";
-    case EXCEPTION_ILLEGAL_INSTRUCTION:
-      return "illegal instruction";
-    case EXCEPTION_NONCONTINUABLE_EXCEPTION:
-      return "noncontinuable instruction";
-    case EXCEPTION_STACK_OVERFLOW:
-      return "stack overflow";
-    case EXCEPTION_INVALID_DISPOSITION:
-      return "invalid disosition";
-    case EXCEPTION_GUARD_PAGE:
-      return "guard page";
-    case EXCEPTION_INVALID_HANDLE:
-      return "invalid handle";
-    default:
-      return "operating system exception";
-  }
-}
+	switch( code )
+	{
+		case EXCEPTION_ACCESS_VIOLATION:
+		return "access violation";
 
-const char *objName = "ImageMagickObject";
+		case EXCEPTION_DATATYPE_MISALIGNMENT:
+		return "data misalignment";
 
-#define ThrowPerformException(exception,code,reason,description) \
-{ \
-  (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(), \
-    "%s - %s %s",objName,reason,description); \
-  MagickLib::ThrowException(exception,code,reason,description); \
-  return E_INVALIDARG; \
-}
+		case EXCEPTION_BREAKPOINT:
+		return "debug breakpoint";
 
-#define LogInformation(reason,description) \
-{ \
-  (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(), \
-    "%s - %s %s",objName,reason,description); \
+		case EXCEPTION_SINGLE_STEP:
+		return "debug single step";
+
+		case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
+		return "array out of bounds";
+
+		case EXCEPTION_FLT_DENORMAL_OPERAND:
+		return "float denormal operand";
+
+		case EXCEPTION_FLT_DIVIDE_BY_ZERO:
+		return "float devide by zero";
+
+		case EXCEPTION_FLT_INEXACT_RESULT:
+		return "float inexact result";
+
+		case EXCEPTION_FLT_INVALID_OPERATION:
+		return "float invalid operation";
+
+		case EXCEPTION_FLT_OVERFLOW:
+		return "float overflow";
+
+		case EXCEPTION_FLT_STACK_CHECK:
+		return "float stack check";
+
+		case EXCEPTION_FLT_UNDERFLOW:
+		return "float underflow";
+
+		case EXCEPTION_INT_DIVIDE_BY_ZERO:
+		return "integer divide by zero";
+
+		case EXCEPTION_INT_OVERFLOW:
+		return "integer overflow";
+
+		case EXCEPTION_PRIV_INSTRUCTION:
+		return "privleged instruction";
+
+		case EXCEPTION_IN_PAGE_ERROR:
+		return "page error";
+
+		case EXCEPTION_ILLEGAL_INSTRUCTION:
+		return "illegal instruction";
+
+		case EXCEPTION_NONCONTINUABLE_EXCEPTION:
+		return "noncontinuable instruction";
+
+		case EXCEPTION_STACK_OVERFLOW:
+		return "stack overflow";
+
+		case EXCEPTION_INVALID_DISPOSITION:
+		return "invalid disosition";
+
+		case EXCEPTION_GUARD_PAGE:
+		return "guard page";
+
+		case EXCEPTION_INVALID_HANDLE:
+		return "invalid handle";
+
+		default:
+		return "operating system exception";
+	}
 }
 
-const char *methodName = "Perform";
+#define ThrowPerformException( exception, code, reason, description )\
+	{\
+		(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),\
+			"%s - %s %s", objName, reason, description );\
+		MagickLib::ThrowException( exception, code, reason, description );\
+		return E_INVALIDARG;\
+	}
 
-static long SafeArraySize(SAFEARRAY *psa)
+#define LogInformation( reason, description )\
+	{\
+		(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),\
+			"%s - %s %s", objName, reason, description );\
+	}
+
+static long SafeArraySize(
+	SAFEARRAY* psa
+)
 {
-  HRESULT hr;
-  long lBoundl, lBoundu;
+	HRESULT hr;
+	long lBoundl, lBoundu;
 
-  hr = ::SafeArrayGetLBound(psa, 1, &lBoundl);
-  if (FAILED(hr))
-    return 0;
-  hr = ::SafeArrayGetUBound(psa, 1, &lBoundu);
-  if (FAILED(hr))
-    return 0;
-  return (lBoundu - lBoundl + 1);
+	hr = ::SafeArrayGetLBound( psa, 1, &lBoundl );
+	if( FAILED( hr ) )
+	{
+		return 0;
+	}
+
+	hr = ::SafeArrayGetUBound( psa, 1, &lBoundu );
+	if( FAILED( hr ) )
+	{
+		return 0;
+	}
+
+	return (lBoundu - lBoundl + 1);
 }
 
-STDMETHODIMP MagickImage::get_Count(long *pVal)
+void MagickImage::GetXtrnArrayStr( CString& s, const SAFEARRAY* psa, LPCWSTR wszName )
 {
-  HRESULT hr = S_OK;
-  return hr;
+	s.Format( xtrnarray_fmt, (unsigned long)psa, wszName );
 }
 
-STDMETHODIMP MagickImage::get__NewEnum(LPUNKNOWN *pVal)
+void MagickImage::GetXtrnArrayStr( CString& s, const SAFEARRAY* psa )
 {
-  HRESULT hr = S_OK;
-  return hr;
+	GetXtrnArrayStr( s, psa, L"" );
 }
 
-STDMETHODIMP MagickImage::get_Item(VARIANT varIndex, VARIANT *pVal)
+STDMETHODIMP MagickImage::get_Count(
+	long* pVal
+)
 {
-  HRESULT hr = E_INVALIDARG;
-  VARIANTARG *pvarIndex = &varIndex;
-  VARTYPE vt = V_VT(pvarIndex);
-  long lIndex = 0;
-  CComVariant var;
- 
-  while (vt == (VT_VARIANT|VT_BYREF))
-  {
-	  pvarIndex = V_VARIANTREF(pvarIndex);
-	  vt = V_VT(pvarIndex);
-  }
-  if (V_ISARRAY(pvarIndex))
-    return hr;
-  if ((vt & ~VT_BYREF) == VT_BSTR)
-    {
-      CW2A szVal( V_BSTR(pvarIndex) );
-      var = _T("");
-      if (szVal)
-        {
-          MagickLib::Image
-            *image;
+	ATLTRACENOTIMPL( _T( "MagickImage::get_Count" ) );
+}
 
-          MagickLib::ImageInfo
-            *image_info;
+STDMETHODIMP MagickImage::get__NewEnum(
+	LPUNKNOWN* pVal
+)
+{
+	ATLTRACENOTIMPL( _T( "MagickImage::get__NewEnum" ) );
+}
 
-          MagickLib::ExceptionInfo
-            exception;
+STDMETHODIMP MagickImage::get_Item(
+	VARIANT varIndex,
+	VARIANT* pVal
+)
+{
+	HRESULT hr = E_INVALIDARG;
+	VARIANTARG* pvarIndex = &varIndex;
+	VARTYPE vt = V_VT( pvarIndex );
+	long lIndex = 0;
+	CComVariant var;
 
-          long
-            id;
-            
-           LPSTR lpszNext;
+	while( vt == (VT_VARIANT | VT_BYREF) )
+	{
+		pvarIndex = V_VARIANTREF( pvarIndex );
+		vt = V_VT( pvarIndex );
+	}
 
-		    lpszNext = StrChr(szVal, '.');
-		  if (lpszNext == NULL)
-            lpszNext = "%w,%h,%m";
-          else
-            *lpszNext++ = '\0';
-          // lookup the registry id using token and pass the image in
-          MagickLib::GetExceptionInfo(&exception);
-          image=MagickLib::GetImageFromMagickRegistry(szVal, &id, &exception);
-          if (image != (MagickLib::Image *) NULL)
-            {
-              TCHAR *text;
+	if( V_ISARRAY( pvarIndex ) )
+	{
+		return hr;
+	}
 
-              image_info=MagickLib::CloneImageInfo((MagickLib::ImageInfo *) NULL);                
-              text=MagickLib::TranslateText(image_info,image,lpszNext);
-              MagickLib::DestroyImageList(image);
-              MagickLib::DestroyImageInfo(image_info);
-              var = text;
-              MagickLib::RelinquishMagickMemory(text);
-              hr = S_OK;
-            }
-        }
-    }
-  else
-    {
-      MagickLib::Image
-        *image;
+	if( (vt & ~VT_BYREF) == VT_BSTR )
+	{
+		CW2A szVal( V_BSTR( pvarIndex ) );
+		var = _T( "" );
+		if( szVal )
+		{
+			MagickLib::Image* image;
+			MagickLib::ImageInfo* image_info;
+			MagickLib::ExceptionInfo exception;
+			long id;
+			LPSTR lpszNext;
 
-      MagickLib::ImageInfo
-        *image_info;
+			lpszNext = StrChr( szVal, '.' );
+			if( lpszNext == NULL )
+			{
+				lpszNext = "%w,%h,%m";
+			}
+			else
+			{
+				*lpszNext++ = '\0';
+			}
 
-      MagickLib::ExceptionInfo
-        exception;
+			// lookup the registry id using token and pass the image in
+			MagickLib::GetExceptionInfo( &exception );
+			image = MagickLib::GetImageFromMagickRegistry( szVal, &id, &exception );
+			if( image != (MagickLib::Image*)NULL )
+			{
+				LPSTR text;
 
-      long
-        id;
+				image_info = MagickLib::CloneImageInfo( (MagickLib::ImageInfo*)NULL );
+				text = MagickLib::TranslateText( image_info, image, lpszNext );
+				MagickLib::DestroyImageList( image );
+				MagickLib::DestroyImageInfo( image_info );
+				var = text;
+				MagickLib::RelinquishMagickMemory( text );
+				hr = S_OK;
+			}
+		}
+	}
 
-      MagickLib::RegistryType
-        type;
-
-      size_t
-        length;
-
-      id = 0;
-      var = _T("");
-      switch(vt & ~VT_BYREF)
-      {
-        case VT_UI1:
-          id = V_UI1(pvarIndex);
-          break;
-        case VT_I2:
-          id = V_I2(pvarIndex);
-          break;
-        case VT_I4:
-          id = V_I4(pvarIndex);
-          break;
-      }
-      // lookup the registry id using token and pass the image in
-      MagickLib::GetExceptionInfo(&exception);
-      image=(MagickLib::Image *)MagickLib::GetMagickRegistry(id,&type,&length,&exception);
-      if (image != (MagickLib::Image *) NULL)
-        {
-          TCHAR *text;
-
-          image_info=MagickLib::CloneImageInfo((MagickLib::ImageInfo *) NULL);                
-          text=MagickLib::TranslateText(image_info,image,_T("%w,%h,%m"));
-          MagickLib::DestroyImageList(image);
-          MagickLib::DestroyImageInfo(image_info);
-          var = text;
-          MagickLib::RelinquishMagickMemory(text);
-          hr = S_OK;
-        }
-    }
-  var.Detach(pVal);
+	var.Detach( pVal );
 	return hr;
 }
 
-STDMETHODIMP MagickImage::get_Messages(VARIANT *pVar)
+STDMETHODIMP MagickImage::get_Messages(
+	VARIANT* pVar
+)
 {
-  HRESULT hr = S_OK;
+	HRESULT hr = E_NOTIMPL;
+
 #ifdef PERFORM_MESSAGE_CACHING
-  if (m_coll.size())
-  {
-    CSAVector<VARIANT> v(m_coll.size());
-    if( !v )
-    {
-      //m_coll.clear();
-      return E_OUTOFMEMORY;
-    }
-    else
-    {
-      // WARNING: This nested code block is required because
-      // CSAVectorData ctor performs a SafeArrayAccessData
-      // and you have to make sure the SafeArrayUnaccessData
-      // is called (which it is in the CSAVectorData dtor)
-      // before you use the CSAVector::DetachTo(...).
-      CSAVectorData<VARIANT> msgs(v);
-      if( !msgs )
-      {
-        //m_coll.clear();
-        return E_OUTOFMEMORY;
-      }
-      else
-      {
-        for(int index = 0; index < m_coll.size(); ++index)
-        {
-          CComVariant vt(m_coll[index]);
-          HRESULT hr = vt.Detach(&msgs[index]);
-        }
-      }
-    }    
-    V_VT(pVar) = VT_ARRAY | VT_VARIANT;
-    V_ARRAY(pVar) = v.Detach();
-    //m_coll.clear();
-  }
+	if( m_coll.size() )
+	{
+		CSAVector<VARIANT>v( m_coll.size() );
+		if( !v )
+		{
+			//m_coll.clear();
+			return E_OUTOFMEMORY;
+		}
+		else
+		{
+			// WARNING: This nested code block is required because
+			// CSAVectorData ctor performs a SafeArrayAccessData
+			// and you have to make sure the SafeArrayUnaccessData
+			// is called (which it is in the CSAVectorData dtor)
+			// before you use the CSAVector::DetachTo(...).
+			CSAVectorData<VARIANT>msgs( v );
+			if( !msgs )
+			{
+				//m_coll.clear();
+				return E_OUTOFMEMORY;
+			}
+			else
+			{
+				for( int index = 0; index < m_coll.size(); ++index )
+				{
+					CComVariant vt( m_coll[ index ] );
+					HRESULT hr = vt.Detach( &msgs[ index ] );
+				}
+			}
+		}
+
+		V_VT( pVar ) = VT_ARRAY | VT_VARIANT;
+		V_ARRAY( pVar ) = v.Detach();
+
+		//m_coll.clear();
+	}
+
 #endif
-  return hr;
+	return hr;
 }
 
-STDMETHODIMP MagickImage::Add(SAFEARRAY **pArrayVar, VARIANT *pVar)
+STDMETHODIMP MagickImage::Add(
+	SAFEARRAY** pArrayVar,
+	VARIANT* pVar
+)
 {
-  return S_OK;
+	ATLTRACENOTIMPL( _T( "MagickImage::Add" ) );
 }
 
-STDMETHODIMP MagickImage::Remove(VARIANT varIndex)
+STDMETHODIMP MagickImage::Remove(
+	VARIANT varIndex
+)
 {
-  HRESULT hr = E_INVALIDARG;
-  VARIANTARG *pvarIndex = &varIndex;
-  VARTYPE vt = V_VT(pvarIndex);
- 
-  while (vt == (VT_VARIANT|VT_BYREF))
-  {
-	  pvarIndex = V_VARIANTREF(pvarIndex);
-	  vt = V_VT(pvarIndex);
-  }
-  if (V_ISARRAY(pvarIndex))
-    return hr;
-  switch(vt & ~VT_BYREF)
-  {
-    case VT_BSTR:
-    {
-      if (!V_ISBYREF(pvarIndex))
-      {
-        CComVariant var;
-        var = _T("");
-        CW2A szVal( V_BSTR(pvarIndex) );
-        if (szVal)
-          {
-            MagickLib::Image
-              *image;
+	HRESULT hr = E_INVALIDARG;
+	VARIANTARG* pvarIndex = &varIndex;
+	VARTYPE vt = V_VT( pvarIndex );
 
-            MagickLib::ExceptionInfo
-              exception;
+	while( vt == (VT_VARIANT | VT_BYREF) )
+	{
+		pvarIndex = V_VARIANTREF( pvarIndex );
+		vt = V_VT( pvarIndex );
+	}
 
-            long
-              id;
-              
-             LPTSTR 
-               lpszNext;
+	if( V_ISARRAY( pvarIndex ) )
+	{
+		return hr;
+	}
 
-				    lpszNext = StrChr(szVal, '.');
-				    if (lpszNext == NULL)
-              lpszNext = "%w,%h,%m";
-            else
-              *lpszNext++ = '\0';
-            // lookup the registry id using token and pass the image in
-            MagickLib::GetExceptionInfo(&exception);
-            image=MagickLib::GetImageFromMagickRegistry(szVal, &id, &exception);
-            if (image != (MagickLib::Image *) NULL)
-              {
-                MagickLib::DestroyImageList(image);
-                if (MagickLib::DeleteMagickRegistry(id))
-                  hr = S_OK;
-              }
-          }
-      }
-      break;
-    }
-    case VT_UI1:
-    {
-      long id = V_UI1(pvarIndex);
-      if (MagickLib::DeleteMagickRegistry(id))
-        hr = S_OK;
-    }
-    case VT_I2:
-    {
-      long id = V_I2(pvarIndex);
-      if (MagickLib::DeleteMagickRegistry(id))
-        hr = S_OK;
-    }
-    case VT_I4:
-    {
-      long id = V_I4(pvarIndex);
-      if (MagickLib::DeleteMagickRegistry(id))
-        hr = S_OK;
-    }
-  }
+	switch( vt & ~VT_BYREF )
+	{
+		case VT_BSTR:
+		{
+			if( !V_ISBYREF( pvarIndex ) )
+			{
+				CW2A szVal( V_BSTR( pvarIndex ) );
+				if( szVal )
+				{
+					MagickLib::Image* image;
+
+					if( MagickLib::DeleteImageRegistry( szVal ) )
+					{
+						hr = S_OK;
+					}
+				}
+			}
+
+			break;
+		}
+	}
 	return hr;
 }
 
-HRESULT MagickImage::Perform(MagickLib::MagickBooleanType (*func)(MagickLib::ImageInfo *image_info,
-  const int argc,LPTSTR *argv,LPTSTR *text,MagickLib::ExceptionInfo *exception),
-  SAFEARRAY **pArrayVar, VARIANT *pVar,MagickLib::ExceptionInfo *exception)
+HRESULT MagickImage::Perform(
+	MagickLib::MagickBooleanType (* func)(MagickLib::ImageInfo* image_info,const int argc, LPTSTR* argv, LPTSTR* text, MagickLib::ExceptionInfo* exception),
+	SAFEARRAY** pArrayVar,
+	VARIANT* pVar,
+	MagickLib::ExceptionInfo* exception
+)
 {
-  bool bDebug = false;
-  HRESULT hr = E_INVALIDARG;
-  char *text;
+	bool bDebug = false;
+	HRESULT hr = E_INVALIDARG;
+	char* text;
 
 #ifdef _DEBUG
-  //DebugBreak();
+	//ATLASSERT( FALSE );
 #endif
 
-  LogInformation(methodName,"enter");
+	LogInformation( methodName, "enter" );
+	text = (char*)NULL;
+	if( !pArrayVar )
+	{
+		ThrowPerformException( exception, MagickLib::ErrorException,
+			"Perform", "Argument list is NULL" );
+	}
 
-  //text = (char *) 0xffffffffL;
-  //char c = *text;  // causes and access violation
+	CComSafeArray<VARIANT>rg( *pArrayVar );
+	if( !rg )
+	{
+		ThrowPerformException( exception, MagickLib::ErrorException,
+			"Perform", "Argument list is bad" );
+	}
 
-  text = (char *)NULL;
+	if( rg.GetDimensions() != 1 )
+	{
+		ThrowPerformException( exception, MagickLib::ErrorException,
+			"Perform", "Multi dimensional array passed" );
+	}
 
-  if( !pArrayVar ) 
-  {
-    ThrowPerformException(exception,MagickLib::ErrorException,
-      "Perform","Argument list is NULL");
-  }
+	if( rg.GetType() != VT_VARIANT )
+	{
+		ThrowPerformException( exception, MagickLib::ErrorException,
+			"Perform", "Non VARIANT array type passed" );
+	}
 
-  CComSafeArray<VARIANT> rg(*pArrayVar);
-  if( !rg ) 
-  {
-    ThrowPerformException(exception,MagickLib::ErrorException,
-      "Perform","Argument list is bad");
-  }
-  if( rg.GetDimensions() != 1 ) 
-  {
-    ThrowPerformException(exception,MagickLib::ErrorException,
-      "Perform","Multi dimensional array passed");
-  }
-  if( rg.GetType() != VT_VARIANT ) 
-  {
-    ThrowPerformException(exception,MagickLib::ErrorException,
-      "Perform","Non VARIANT array type passed");
-  }
+	int iLastVal = rg.GetCount();
+	bool bFoundOption = false;
+	for( int i = 0; i < iLastVal; ++i )
+	{
+		VARIANT& varIndex = rg[ i ];
+		VARIANTARG* pvarIndex = &varIndex;
+		VARTYPE vt = V_VT( pvarIndex );
 
-  int iLastVal = rg.GetCount();
-  bool bFoundOption = false;
-  for( int i = 0; i < iLastVal; ++i )
-  {
-    VARIANT &varIndex = rg[i];
-    VARIANTARG *pvarIndex = &varIndex;
-    VARTYPE vt = V_VT(pvarIndex);
+		while( vt == (VT_VARIANT | VT_BYREF) )
+		{
+			pvarIndex = V_VARIANTREF( pvarIndex );
+			vt = V_VT( pvarIndex );
+		}
 
-    while (vt == (VT_VARIANT|VT_BYREF))
-    {
-      pvarIndex = V_VARIANTREF(pvarIndex);
-      vt = V_VT(pvarIndex);
-    }
 //->
-    if (V_ISARRAY(pvarIndex))
-    {
-      TCHAR sz[128];
-      SAFEARRAY *psa;
+		if( V_ISARRAY( pvarIndex ) )
+		{
+			CString sArg;
+			SAFEARRAY* psa;
 
-      if (V_ISBYREF(pvarIndex))
-        psa = *V_ARRAYREF(pvarIndex);
-      else
-        psa = V_ARRAY(pvarIndex);
+			if( V_ISBYREF( pvarIndex ) )
+			{
+				psa = *V_ARRAYREF( pvarIndex );
+			}
+			else
+			{
+				psa = V_ARRAY( pvarIndex );
+			}
+
 //----->
-        {
+			{
 //------->
-          if (psa)
-            {
-              VARTYPE vatype = (V_VT(pvarIndex) & ~(VT_ARRAY | VT_BYREF));
-              int ndim = SafeArrayGetDim(psa);
-              if (ndim != 1)
-              {
-                ThrowPerformException(exception,MagickLib::ErrorException,
-                  "Perform","Multi-dimensional arrays not supported");
-              }
-              if (i < (iLastVal-1))
+				if( psa )
+				{
+					VARTYPE vatype = ( V_VT( pvarIndex ) & ~(VT_ARRAY | VT_BYREF) );
+					int ndim = SafeArrayGetDim( psa );
+					if( ndim != 1 )
+					{
+						ThrowPerformException( exception, MagickLib::ErrorException,
+							"Perform", "Multi-dimensional arrays not supported" );
+					}
+
+					if( i < (iLastVal - 1) )
+
 //------------>
-               {
-                  bool bFoundIt = false;
-                  // This is any array that is not the last one in the arg
-                  // list. This means it must be an input so we just pass
-                  // it along.
-                  switch(vatype)
+					{
+						bool bFoundIt = false;
+
+						// This is any array that is not the last one in the arg
+						// list. This means it must be an input so we just pass
+						// it along.
+						switch( vatype )
+
 //--------------->
-                  {
-                    case VT_UI1:
-                    {
-                      wsprintf(sz, _T("xtrnarray:0x%lx,"),(unsigned long)(psa));
-                      hr = AddArgs(sz);
-                      break;
-                    }
-                    default:
+						{
+							case VT_UI1:
+							{
+								GetXtrnArrayStr( sArg, psa );
+								hr = AddArgs( sArg );
+								break;
+							}
+
+							default:
+
 //----------------->
-                    {
-                      CComSafeArray<VARIANT> vals(psa);
-                      if (vals)
+							{
+								CComSafeArray<VARIANT>vals( psa );
+								if( vals )
+
 //--------------------->
-                        {
-                          VARIANT &varFirst = vals[0];
-                          VARIANTARG *pvarFirst = &varFirst;
-                          if (V_VT(pvarFirst) ==  VT_BSTR)
+								{
+									VARIANT& varFirst = vals[ 0 ];
+									VARIANTARG* pvarFirst = &varFirst;
+									if( V_VT( pvarFirst ) == VT_BSTR )
+
 //------------------------->
-                            {
-                              VARIANT &varSecond = vals[1];
-                              VARIANTARG *pvarSecond = &varSecond;
-                              if (V_ISARRAY(pvarSecond))
+									{
+										VARIANT& varSecond = vals[ 1 ];
+										VARIANTARG* pvarSecond = &varSecond;
+										if( V_ISARRAY( pvarSecond ) )
+
 //--------------------------->
-                              {
-                                if (V_ISBYREF(pvarSecond))
-                                  {
-                                    VARTYPE vatype2 = (V_VT(pvarSecond) & ~(VT_ARRAY | VT_BYREF));
-                                    if (vatype2 == VT_UI1)
-                                      {
-                                        SAFEARRAY *psax = *V_ARRAYREF(pvarSecond);
-                                        int ndim2 = SafeArrayGetDim(psax);
-                                        if (ndim2 != 1)
-                                        {
-                                          ThrowPerformException(exception,MagickLib::ErrorException,
-                                            "Perform","Input blob support requires a 1d array (1)");
-                                        }
-                                        CW2T str(pvarFirst->bstrVal);
-                                        wsprintf(sz, _T("xtrnarray:0x%lx,%s"),
-                                          (unsigned long)(psax),(LPCTSTR)str);
-                                        hr = AddArgs(sz);
-                                      }
-                                  }
-                                else
-                                  {
-                                    VARTYPE vatype2 = (V_VT(pvarSecond) & ~(VT_ARRAY));
-                                    if (vatype2 == VT_UI1)
-                                      {
-                                        SAFEARRAY *psax = V_ARRAY(pvarSecond);
-                                        int ndim2 = SafeArrayGetDim(psax);
-                                        if (ndim2 != 1)
-                                        {
-                                          ThrowPerformException(exception,MagickLib::ErrorException,
-                                            "Perform","Input blob support requires a 1d array (2)");
-                                        }
-                                        else
-                                        {
-                                          LPCWSTR pReturnBuffer = NULL;
-                                          long size = SafeArraySize(psax);
-                                          hr = SafeArrayAccessData(psax, (void**)&pReturnBuffer);
-	                                        if(SUCCEEDED(hr))
-                                            hr = SafeArrayUnaccessData(psax);
-                                        }
-                                        CW2T str(pvarFirst->bstrVal);
-                                        wsprintf(sz, _T("xtrnarray:0x%lx,%s"),
-                                          (unsigned long)(psax),(LPCTSTR)str);
-                                        hr = AddArgs(sz);
-                                      }
-                                  }
+										{
+											if( V_ISBYREF( pvarSecond ) )
+											{
+												VARTYPE vatype2 = ( V_VT( pvarSecond ) & ~(VT_ARRAY | VT_BYREF) );
+												if( vatype2 == VT_UI1 )
+												{
+													SAFEARRAY* psax = *V_ARRAYREF( pvarSecond );
+													int ndim2 = SafeArrayGetDim( psax );
+													if( ndim2 != 1 )
+													{
+														ThrowPerformException( exception, MagickLib::ErrorException,
+															"Perform", "Input blob support requires a 1d array (1)" );
+													}
+
+													GetXtrnArrayStr( sArg, psax, pvarFirst->bstrVal );
+													hr = AddArgs( sArg );
+												}
+											}
+											else
+											{
+												VARTYPE vatype2 = ( V_VT( pvarSecond ) & ~(VT_ARRAY) );
+												if( vatype2 == VT_UI1 )
+												{
+													SAFEARRAY* psax = V_ARRAY( pvarSecond );
+													int ndim2 = SafeArrayGetDim( psax );
+													if( ndim2 != 1 )
+													{
+														ThrowPerformException( exception, MagickLib::ErrorException,
+															"Perform", "Input blob support requires a 1d array (2)" );
+													}
+													else
+													{
+														LPCWSTR pReturnBuffer = NULL;
+														long size = SafeArraySize( psax );
+														hr = SafeArrayAccessData( psax, (void**)&pReturnBuffer );
+														if( SUCCEEDED( hr ) )
+														{
+															hr = SafeArrayUnaccessData( psax );
+														}
+													}
+
+													GetXtrnArrayStr( sArg, psax, pvarFirst->bstrVal );
+													hr = AddArgs( sArg );
+												}
+											}
+
 //--------------------------->
-                              } // end of V_ISARRAY
+										} // end of V_ISARRAY
+
 //------------------------->
-                            } // end of == VT_BSTR
-                          else
-                            {
-                              wsprintf(sz, _T("xtrnarray:0x%lx,"),(unsigned long)(psa));
-                              hr = AddArgs(sz);
-                            }
-                          //vals.UnaccessData();
-                          vals.Detach();
-                          break;
+									} // end of == VT_BSTR
+									else
+									{
+										GetXtrnArrayStr( sArg, psa );
+										hr = AddArgs( sArg );
+									}
+
+									//vals.UnaccessData();
+									vals.Detach();
+									break;
+
 //--------------------->
-                        } // end of vals not NULL
+								} // end of vals not NULL
+
 //----------------->
-                    } // end of default case
+							} // end of default case
 //--------------->
-                  } // end of the switch
+						} // end of the switch
+
 //------------->
-                }
-              else
-                {
-                  // This is the last thing in the arg list and thus must
-                  // the output array. We check the contents to a string of
-                  // characters that says what format to encode the data in.
-                  if (vatype == VT_UI1)
-                    {
-                      // the output is passed as an array of bytes - this
-                      // is the way that VB does it.
-                      LPCWSTR pReturnBuffer = NULL;
-                      long size = SafeArraySize(psa);
-                      hr = SafeArrayAccessData(psa, (void**)&pReturnBuffer);
-	                    if(SUCCEEDED(hr))
-                        {
-							CStringW ws( pReturnBuffer, size );
-                            hr = SafeArrayUnaccessData(psa);
-                            SafeArrayDestroy(psa);
-							
-                            SAFEARRAY* pSafeArray = SafeArrayCreateVector(VT_UI1,0,0);
-                            wsprintf(sz, _T("xtrnarray:0x%lx,%ws"),
-                                (unsigned long)(pSafeArray),(LPCWSTR)ws);
-                            hr = AddArgs( sz );
-                              if (V_ISBYREF(pvarIndex))
-                                {
-                                  V_VT(pvarIndex) = VT_ARRAY | VT_UI1 | VT_BYREF;		
-                                  *V_ARRAYREF(pvarIndex) = pSafeArray;
-                                }
-                              else
-                                {
-                                  V_VT(pvarIndex) = VT_ARRAY | VT_UI1;		
-                                  V_ARRAY(pvarIndex) = pSafeArray;
-                                }
-                            
-                        }
-                      else
-                      {
-                        ThrowPerformException(exception,MagickLib::ErrorException,
-                          "Perform","Output array for blob must be 1d");
-                      }
-                    }
-                  else
-                    {
-                      // the output is passed as a variant that is a BSTR
-                      // - this is the way that VBSCRIPT and ASP does it.
-                      CComSafeArray<VARIANT> vals(psa);
-                      if (vals)
-                        {
-                          VARIANT &varFirst = vals[0];
-                          VARIANTARG *pvarFirst = &varFirst;
-                          if (V_VT(pvarFirst) ==  VT_BSTR)
-                            {
-                              CW2T str(pvarFirst->bstrVal);
-                              //vals.UnaccessData();
-                              SafeArrayDestroy(psa);
+					}
+					else
+					{
+						// This is the last thing in the arg list and thus must
+						// the output array. We check the contents to a string of
+						// characters that says what format to encode the data in.
+						if( vatype == VT_UI1 )
+						{
+							// the output is passed as an array of bytes - this
+							// is the way that VB does it.
+							LPCWSTR pReturnBuffer = NULL;
+							long size = SafeArraySize( psa );
+							hr = SafeArrayAccessData( psa, (void**)&pReturnBuffer );
+							if( SUCCEEDED( hr ) )
+							{
+								CStringW ws( pReturnBuffer, size );
+								hr = SafeArrayUnaccessData( psa );
+								SafeArrayDestroy( psa );
 
-                              SAFEARRAY* pSafeArray = SafeArrayCreateVector(VT_UI1,0,0);
-                              wsprintf(sz, _T("xtrnarray:0x%lx,%s"),
-                                (unsigned long)(pSafeArray),(LPCTSTR)str);
-                              hr = AddArgs(sz);
-                              if (V_ISBYREF(pvarIndex))
-                                {
-                                  V_VT(pvarIndex) = VT_ARRAY | VT_UI1 | VT_BYREF;		
-                                  *V_ARRAYREF(pvarIndex) = pSafeArray;
-                                }
-                              else
-                                {
-                                  V_VT(pvarIndex) = VT_ARRAY | VT_UI1;		
-                                  V_ARRAY(pvarIndex) = pSafeArray;
-                                }
-                            }
-                        }
-                      else
-                      {
-                        ThrowPerformException(exception,MagickLib::ErrorException,
-                          "Perform","Output array for blob is invalid");
-                      }
-                    }
-                }
-            }
-          else
-          {
+								SAFEARRAY* pSafeArray = SafeArrayCreateVector( VT_UI1, 0, 0 );
+								GetXtrnArrayStr( sArg, pSafeArray, ws );
+								hr = AddArgs( sArg );
+								if( V_ISBYREF( pvarIndex ) )
+								{
+									V_VT( pvarIndex ) = VT_ARRAY | VT_UI1 | VT_BYREF;
+									*V_ARRAYREF( pvarIndex ) = pSafeArray;
+								}
+								else
+								{
+									V_VT( pvarIndex ) = VT_ARRAY | VT_UI1;
+									V_ARRAY( pvarIndex ) = pSafeArray;
+								}
+							}
+							else
+							{
+								ThrowPerformException( exception, MagickLib::ErrorException,
+									"Perform", "Output array for blob must be 1d" );
+							}
+						}
+						else
+						{
+							// the output is passed as a variant that is a BSTR
+							// - this is the way that VBSCRIPT and ASP does it.
+							CComSafeArray<VARIANT>vals( psa );
+							if( vals )
+							{
+								VARIANT& varFirst = vals[ 0 ];
+								VARIANTARG* pvarFirst = &varFirst;
+								if( V_VT( pvarFirst ) == VT_BSTR )
+								{
+									//vals.UnaccessData();
+									SafeArrayDestroy( psa );
+
+									SAFEARRAY* pSafeArray = SafeArrayCreateVector( VT_UI1, 0, 0 );
+									GetXtrnArrayStr( sArg, pSafeArray, pvarFirst->bstrVal );
+									hr = AddArgs( sArg );
+									if( V_ISBYREF( pvarIndex ) )
+									{
+										V_VT( pvarIndex ) = VT_ARRAY | VT_UI1 | VT_BYREF;
+										*V_ARRAYREF( pvarIndex ) = pSafeArray;
+									}
+									else
+									{
+										V_VT( pvarIndex ) = VT_ARRAY | VT_UI1;
+										V_ARRAY( pvarIndex ) = pSafeArray;
+									}
+								}
+							}
+							else
+							{
+								ThrowPerformException( exception, MagickLib::ErrorException,
+									"Perform", "Output array for blob is invalid" );
+							}
+						}
+					}
+				}
+				else
+				{
 //------->
-            ThrowPerformException(exception,MagickLib::ErrorException,
-              "Perform","A passed array is not a valid array");
-          }
-        }
+					ThrowPerformException( exception, MagickLib::ErrorException,
+						"Perform", "A passed array is not a valid array" );
+				}
+			}
+
 //----->
-    }
+		}
 //->  // V_ISARRAY
-    else
-    {
-      switch(vt)
-      {
-        case VT_VARIANT: // invalid, should never happen
-        case VT_EMPTY:
-        case VT_NULL:
-          bFoundOption = false;
-          break;
+		else
+		{
+			switch( vt )
+			{
+				case VT_VARIANT: // invalid, should never happen
+				case VT_EMPTY:
+				case VT_NULL:
+				bFoundOption = false;
+				break;
 
-        case VT_BSTR:
-        case VT_BSTR | VT_BYREF:
-        {
-          LPTSTR lpszVal;
-          LPTSTR lpszNext;
+				case VT_BSTR:
+				case VT_BSTR | VT_BYREF:
+				{
+					LPTSTR lpszVal;
+					LPTSTR lpszNext;
 
-          CW2T str(V_ISBYREF(pvarIndex) ? *V_BSTRREF(pvarIndex) : V_BSTR(pvarIndex));
-          lpszVal = (LPTSTR)str;
-          bFoundOption = false;
-          // is this a command line option argument?
-          if ((*lpszVal == _T('+')) || (*lpszVal == _T('-')))
-          {
-            bFoundOption = true;
-            lpszNext = StrChr(lpszVal, _T('='));
-            if (lpszNext == NULL)
-              hr = AddArgs(V_BSTR(pvarIndex));
-            else
-            {
-              int nLength = lpszNext - lpszVal;
-              if (nLength > 16)
-                hr = AddArgs(V_BSTR(pvarIndex));
-              else
-              {
-                *lpszNext = _T('\0');
-                hr = AddArgs(lpszVal);
-                hr = AddArgs(++lpszNext);
-              }
-              break;
-            }
-          }
-          else
-            hr = AddArgs(lpszVal);
-          break;
-        }
+					CW2T str( V_ISBYREF( pvarIndex ) ? *V_BSTRREF( pvarIndex ) : V_BSTR( pvarIndex ) );
+					lpszVal = (LPTSTR)str;
+					bFoundOption = false;
 
-        case VT_UI1:
-        case VT_UI1 | VT_BYREF:
-        case VT_I2:
-        case VT_I2 | VT_BYREF:
-        case VT_I4:
-        case VT_I4 | VT_BYREF:
-        case VT_R4:
-        case VT_R4 | VT_BYREF:
-        case VT_R8:
-        case VT_R8 | VT_BYREF:
-        case VT_DECIMAL:
-        case VT_DECIMAL | VT_BYREF:
-        {
-          VARIANT variant;
+					// is this a command line option argument?
+					if( ( *lpszVal == _T( '+' ) ) || ( *lpszVal == _T( '-' ) ) )
+					{
+						bFoundOption = true;
+						lpszNext = StrChr( lpszVal, _T( '=' ) );
+						if( lpszNext == NULL )
+						{
+							hr = AddArgs( V_BSTR( pvarIndex ) );
+						}
+						else
+						{
+							int nLength = lpszNext - lpszVal;
+							if( nLength > 16 )
+							{
+								hr = AddArgs( V_BSTR( pvarIndex ) );
+							}
+							else
+							{
+								*lpszNext = _T( '\0' );
+								hr = AddArgs( lpszVal );
+								hr = AddArgs( ++lpszNext );
+							}
 
-          bFoundOption = false;
-          VariantInit(&variant);
-          hr = VariantChangeTypeEx(&variant, pvarIndex, lcidDefault, 0, VT_BSTR);
-          if (SUCCEEDED(hr) && V_VT(&variant) == VT_BSTR)
-          {
-            hr = AddArgs(V_BSTR(&variant));
-          }
-          VariantClear(&variant);
-          break;
-        }
+							break;
+						}
+					}
+					else
+					{
+						hr = AddArgs( lpszVal );
+					}
 
-        default:
-          ThrowPerformException(exception,MagickLib::ErrorException,
-            "Perform","Unsupported argument type");
-      }
-    }
-  }
+					break;
+				}
 
-  LogInformation(methodName,"before execute");
+				case VT_UI1:
+				case VT_UI1 | VT_BYREF:
+				case VT_I2:
+				case VT_I2 | VT_BYREF:
+				case VT_I4:
+				case VT_I4 | VT_BYREF:
+				case VT_R4:
+				case VT_R4 | VT_BYREF:
+				case VT_R8:
+				case VT_R8 | VT_BYREF:
+				case VT_DECIMAL:
+				case VT_DECIMAL | VT_BYREF:
+				{
+					VARIANT variant;
 
-  MagickLib::ImageInfo
-    *image_info;
+					bFoundOption = false;
+					VariantInit( &variant );
+					hr = VariantChangeTypeEx( &variant, pvarIndex, lcidDefault, 0, VT_BSTR );
+					if( SUCCEEDED( hr ) && (V_VT( &variant ) == VT_BSTR) )
+					{
+						hr = AddArgs( V_BSTR( &variant ) );
+					}
 
-  image_info=MagickLib::CloneImageInfo((MagickLib::ImageInfo *) NULL);
+					VariantClear( &variant );
+					break;
+				}
+
+				default:
+				ThrowPerformException( exception, MagickLib::ErrorException,
+					"Perform", "Unsupported argument type" );
+			}
+		}
+	}
+
+	LogInformation( methodName, "before execute" );
+
+	MagickLib::ImageInfo
+	* image_info;
+
+	image_info = MagickLib::CloneImageInfo( (MagickLib::ImageInfo*)NULL );
 #ifdef _DEBUG
-  //DebugBreak();
+
+	//ATLASSERT( FALSE );
 #endif
-  hr = Execute(func,&text,image_info,exception);
-  MagickLib::DestroyImageInfo(image_info);
+	hr = Execute( func, &text, image_info, exception );
+	MagickLib::DestroyImageInfo( image_info );
 
-  LogInformation(methodName,"after execute");
+	LogInformation( methodName, "after execute" );
 
-  if (text != (char *) NULL)
-  {
-    CComVariant var;
-    var = text;
-    var.Detach(pVar);
-    MagickLib::RelinquishMagickMemory(text);
-  }
+	if( text != (char*)NULL )
+	{
+		CComVariant var;
+		var = text;
+		var.Detach( pVar );
+		MagickLib::RelinquishMagickMemory( text );
+	}
 
-  LogInformation(methodName,"return");
-  return hr;
+	LogInformation( methodName, "return" );
+	return hr;
 }
 
-void MagickImage::warninghandler(const MagickLib::ExceptionType warning,const char *message,
-  const char *qualifier)
+void MagickImage::warninghandler(
+	const MagickLib::ExceptionType warning,
+	const char* message,
+	const char* qualifier
+)
 {
-  char warning_text[MaxTextExtent];
+	char warning_text[ MaxTextExtent ];
 
-  if (!message)
-  {
-    LogInformation("warninghandler","called with no message");
-    return;
-  }
-  MagickLib::FormatMagickString(warning_text,MaxTextExtent,
-    "warning %d: %.1024s%s%.1024s%s%s%.64s%s\n",warning,message,
-    qualifier ? " (" : "",qualifier ? qualifier : "",
-    qualifier ? ")" : "",errno ? " [" : "",
-    errno ? strerror(errno) : "",errno ? "]" : "");
-  (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),warning_text);
+	if( !message )
+	{
+		LogInformation( "warninghandler", "called with no message" );
+		return;
+	}
+
+	MagickLib::FormatMagickString( warning_text, MaxTextExtent,
+		"warning %d: %.1024s%s%.1024s%s%s%.64s%s\n", warning, message,
+		qualifier ? " (" : "", qualifier ? qualifier : "",
+		qualifier ? ")" : "", errno ? " [" : "",
+		errno ? strerror( errno ) : "", errno ? "]" : "" );
+	(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(), warning_text );
 }
 
-void MagickImage::errorhandler(const MagickLib::ExceptionType warning,const char *message,
-  const char *qualifier)
+void MagickImage::errorhandler(
+	const MagickLib::ExceptionType warning,
+	const char* message,
+	const char* qualifier
+)
 {
-  char error_text[MaxTextExtent];
+	char error_text[ MaxTextExtent ];
 
-  if (!message)
-  {
-    LogInformation("errorhandler","called with no message");
-    return;
-  }
-  MagickLib::FormatMagickString(error_text,MaxTextExtent,
-    "error %d: %.1024s%s%.1024s%s%s%.64s%s\n",warning,message,
-    qualifier ? " (" : "",qualifier ? qualifier : "",
-    qualifier ? ")" : "",errno ? " [" : "",
-    errno ? strerror(errno) : "",errno ? "]" : "");
-  (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),error_text);
+	if( !message )
+	{
+		LogInformation( "errorhandler", "called with no message" );
+		return;
+	}
+
+	MagickLib::FormatMagickString( error_text, MaxTextExtent,
+		"error %d: %.1024s%s%.1024s%s%s%.64s%s\n", warning, message,
+		qualifier ? " (" : "", qualifier ? qualifier : "",
+		qualifier ? ")" : "", errno ? " [" : "",
+		errno ? strerror( errno ) : "", errno ? "]" : "" );
+	(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(), error_text );
 }
 
-void MagickImage::fatalerrorhandler(const MagickLib::ExceptionType error,const char *message,
-  const char *qualifier)
+void MagickImage::fatalerrorhandler(
+	const MagickLib::ExceptionType error,
+	const char* message,
+	const char* qualifier
+)
 {
-  char fatalerror_text[MaxTextExtent];
+	char fatalerror_text[ MaxTextExtent ];
 
-  if (!message)
-  {
-    LogInformation("fatalhandler","called with no message");
-    return;
-  }
-  MagickLib::FormatMagickString(fatalerror_text,MaxTextExtent,
-    "fatal error %d: %.1024s%s%.1024s%s%s%.64s%s",error,
-    (message ? message : "ERROR"),
-    qualifier ? " (" : "",qualifier ? qualifier : "",qualifier ? ")" : "",
-    errno ? " [" : "",errno ? strerror(errno) : "",errno? "]" : "");
-  (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),fatalerror_text);
-//  DebugBreak();
+	if( !message )
+	{
+		LogInformation( "fatalhandler", "called with no message" );
+		return;
+	}
+
+	MagickLib::FormatMagickString( fatalerror_text, MaxTextExtent,
+		"fatal error %d: %.1024s%s%.1024s%s%s%.64s%s", error,
+		(message ? message : "ERROR"),
+		qualifier ? " (" : "", qualifier ? qualifier : "", qualifier ? ")" : "",
+		errno ? " [" : "", errno ? strerror( errno ) : "", errno ? "]" : "" );
+	(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(), fatalerror_text );
+
+//  ATLASSERT( FALSE );
 }
 
 #define ENABLE_FULL_EXCEPTIONS
 
-void MagickImage::CheckAndReportError(MagickImageError &error, HRESULT &hr, const char *program)
+void MagickImage::CheckAndReportError(
+	MagickImageError& error,
+	HRESULT& hr,
+	const char* program
+)
 {
-  char message_text[MaxTextExtent];
+	char message_text[ MaxTextExtent ];
 
-  if (FAILED(hr))
-  {
-    if (error.fullException)
-    {
-      MagickLib::FormatMagickString(message_text,MaxTextExtent,
-      "%s: 0x%08X: %.1024s", program, error.fullExceptionCode, translate_exception(error.fullExceptionCode));
-    }
-    else
-    {
-      const MagickLib::ExceptionInfo *exceptionlist;
-      MagickLib::ResetLinkedListIterator((MagickLib::LinkedListInfo *) error.exception.exceptions);
-      exceptionlist=(const MagickLib::ExceptionInfo *) MagickLib::GetNextValueInLinkedList((MagickLib::LinkedListInfo *)
-          error.exception.exceptions);
+	if ( FAILED(hr) )
+	{
+		if( error.fullException )
+		{
+			MagickLib::FormatMagickString( message_text, MaxTextExtent,
+				"%s: 0x%08X: %.1024s", program, error.fullExceptionCode, error.translate_exception() );
+		}
+		else
+		{
+			const MagickLib::ExceptionInfo* exceptionlist;
+			MagickLib::ResetLinkedListIterator( (MagickLib::LinkedListInfo*)error.exception.exceptions );
+			exceptionlist = (const MagickLib::ExceptionInfo*)MagickLib::GetNextValueInLinkedList( (MagickLib::LinkedListInfo*)
+				error.exception.exceptions );
 
-      *message_text = 0;
+			*message_text = 0;
 
-      while (exceptionlist != (const MagickLib::ExceptionInfo *) NULL)
-      {
-        int len = strlen(message_text);
-        if (MaxTextExtent - len < 0)
-          break;
-        MagickLib::FormatMagickString(message_text+len,MaxTextExtent - len,
-		  "%s: %d: %.1024s: %.1024s\r\n",
-		  program,
-          exceptionlist->severity, 
-          exceptionlist->reason?exceptionlist->reason:"", 
-          exceptionlist->description?exceptionlist->description:"");
+			while( exceptionlist != (const MagickLib::ExceptionInfo*)NULL )
+			{
+				int len = strlen( message_text );
+				if( MaxTextExtent - len < 0 )
+				{
+					break;
+				}
 
-        exceptionlist=(const MagickLib::ExceptionInfo *) MagickLib::GetNextValueInLinkedList((MagickLib::LinkedListInfo *)
-          error.exception.exceptions);
-      }
-    }
+				MagickLib::FormatMagickString( message_text + len, MaxTextExtent - len,
+					"%s: %d: %.1024s: %.1024s\r\n",
+					program,
+					exceptionlist->severity,
+					exceptionlist->reason ? exceptionlist->reason : "",
+					exceptionlist->description ? exceptionlist->description : "" );
 
-    hr = MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,dwErrorBase+1001);
-#ifdef _DEBUG
-    //DebugBreak();
-#endif
-	CA2WEX<MaxTextExtent> wsMessageText( message_text);
-    Error( wsMessageText, __uuidof(IMagickImage), hr);
-  }
-  MagickLib::DestroyExceptionInfo(&error.exception);
+				exceptionlist = (const MagickLib::ExceptionInfo*)MagickLib::GetNextValueInLinkedList( (MagickLib::LinkedListInfo*)
+					error.exception.exceptions );
+			}
+			hr = MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, dwErrorBase + 1001 );
+
+	#ifdef _DEBUG
+
+			//ATLASSERT( FALSE );
+	#endif
+			CA2WEX<MaxTextExtent>wsMessageText( message_text );
+			Error( wsMessageText, __uuidof( IMagickImage ), hr );
+		}
+	}
+
+	MagickLib::DestroyExceptionInfo( &error.exception );
 }
 
 HRESULT MagickImage::Execute(
-  MagickLib::MagickBooleanType (*func)(MagickLib::ImageInfo *image_info,const int argc,char **argv,
-    char **text,MagickLib::ExceptionInfo *exception),
-      char **s, MagickLib::ImageInfo *image_info, MagickLib::ExceptionInfo *exception)
+	MagickLib::MagickBooleanType (* func)(MagickLib::ImageInfo* image_info, const int argc, char** argv, char** text, MagickLib::ExceptionInfo* exception),
+	char** s,
+	MagickLib::ImageInfo* image_info,
+	MagickLib::ExceptionInfo* exception
+)
 {
-  unsigned int retcode = 0;
+	unsigned int retcode = 0;
 
-  retcode = !(func)(image_info, GetArgc(), GetArgv(), s, exception);
-  if (!retcode)
-    return E_UNEXPECTED;
-  return S_OK;
+	retcode = !(func)( image_info, GetArgc(), GetArgv(), s, exception );
+	if( !retcode )
+	{
+		return E_UNEXPECTED;
+	}
+
+	return S_OK;
 }
 
-HRESULT MagickImage::TestHarness(SAFEARRAY **pArrayVar, VARIANT *pVar)
+HRESULT MagickImage::TestHarness(
+	SAFEARRAY** pArrayVar,
+	VARIANT* pVar
+)
 {
-  HRESULT hr = S_OK;
-  (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-    "TestHarness");
+	HRESULT hr = S_OK;
 
-  MagickLib::ExceptionInfo
-    exception;
+	(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+		"TestHarness" );
 
-  char
-    *reason,
-    *description,
-    message_text[MaxTextExtent];
+	MagickLib::ExceptionInfo exception;
+	char
+	* reason,
+	* description,
+	  message_text[ MaxTextExtent ];
 
-  reason = "unknown";
-  description = "unknown";
-  MagickLib::GetExceptionInfo(&exception);
+	reason = "unknown";
+	description = "unknown";
+	MagickLib::GetExceptionInfo( &exception );
 
-  CComVariant var;
+	CComVariant var;
 
-  if( !pArrayVar ) 
-  {
-    return E_INVALIDARG;
-  }
+	if( !pArrayVar )
+	{
+		return E_INVALIDARG;
+	}
 
-  CComSafeArray<VARIANT> rg(*pArrayVar);
-  if( !rg ) 
-  {
-    return E_INVALIDARG;
-  }
-  if( rg.GetDimensions() != 1 ) 
-  {
-    ThrowPerformException(&exception,MagickLib::ErrorException,
-      "Perform","Multi dimensional array passed");
-  }
-  if( rg.GetType() != VT_VARIANT ) 
-  {
-    ThrowPerformException(&exception,MagickLib::ErrorException,
-      "Perform","Non VARIANT array type passed");
-  }
+	CComSafeArray<VARIANT>rg( *pArrayVar );
+	if( !rg )
+	{
+		return E_INVALIDARG;
+	}
 
-  EmptyArgs();
-  AddArgs(L"-convert");
-  int iLastVal = rg.GetCount();
-  for( int i = 0; i < iLastVal; ++i )
-  {
-    {
-      CComVariant vt(rg[i]);
-      vt.ChangeType(VT_BSTR);
-      CW2T str(vt.bstrVal);
-      (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-        "arg: %s",(LPCTSTR)str);
-      hr = AddArgs(vt.bstrVal);
-    }
-  }
+	if( rg.GetDimensions() != 1 )
+	{
+		ThrowPerformException( &exception, MagickLib::ErrorException,
+			"Perform", "Multi dimensional array passed" );
+	}
 
-  //__try
-  {
-    char *text;
-    MagickLib::ImageInfo *image_info;
-    image_info = MagickLib::CloneImageInfo((MagickLib::ImageInfo *) NULL);
-    text = (char *) NULL;
-    hr = Execute(MagickLib::ConvertImageCommand,&text,image_info,&exception);
-    MagickLib::DestroyImageInfo(image_info);
-    if (text != (char *) NULL)
-    {
-      var = text;
-      var.Detach(pVar);
-      MagickLib::RelinquishMagickMemory(text);
-    }
-    if (FAILED(hr))
-    {
-      if (exception.reason)
-        reason = exception.reason;
-      if (exception.description)
-        description = exception.description;
-    }
-  }
-  //__except(1)
-  //{
-  //  hr = E_UNEXPECTED;
-  //  reason = "exception";
-  //  description = translate_exception(_exception_code());
-  //}
+	if( rg.GetType() != VT_VARIANT )
+	{
+		ThrowPerformException( &exception, MagickLib::ErrorException,
+			"Perform", "Non VARIANT array type passed" );
+	}
 
-  if (FAILED(hr))
-  {
-    hr = MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,dwErrorBase+1001);
-    MagickLib::FormatMagickString(message_text,MaxTextExtent,
-      "convert: %d: %.1024s: %.1024s",exception.severity,reason,description);
-    CA2W str(message_text);
+	EmptyArgs();
+	AddArgs( L"-convert" );
+	int iLastVal = rg.GetCount();
+	for( int i = 0; i < iLastVal; ++i )
+	{
+		{
+			CComVariant vt( rg[ i ] );
+			vt.ChangeType( VT_BSTR );
+			CW2A str( vt.bstrVal );
+			(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+				"arg: %s", (LPCSTR)str );
+			hr = AddArgs( vt.bstrVal );
+		}
+	}
+
+	//__try
+	{
+		char* text;
+		MagickLib::ImageInfo* image_info;
+		image_info = MagickLib::CloneImageInfo( (MagickLib::ImageInfo*)NULL );
+		text = (char*)NULL;
+		hr = Execute( MagickLib::ConvertImageCommand, &text, image_info, &exception );
+		MagickLib::DestroyImageInfo( image_info );
+		if( text != (char*)NULL )
+		{
+			var = text;
+			var.Detach( pVar );
+			MagickLib::RelinquishMagickMemory( text );
+		}
+
+		if( FAILED( hr ) )
+		{
+			if( exception.reason )
+			{
+				reason = exception.reason;
+			}
+
+			if( exception.description )
+			{
+				description = exception.description;
+			}
+		}
+	}
+
+	//__except(1)
+	//{
+	//  hr = E_UNEXPECTED;
+	//  reason = "exception";
+	//  description = translate_exception(_exception_code());
+	//}
+
+	if( FAILED( hr ) )
+	{
+		hr = MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, dwErrorBase + 1001 );
+		MagickLib::FormatMagickString( message_text, MaxTextExtent,
+			"convert: %d: %.1024s: %.1024s", exception.severity, reason, description );
+		CA2WEX<MaxTextExtent> str( message_text );
 #ifdef _DEBUG
-//    DebugBreak();
+
+//    ATLASSERT( FALSE );
 #endif
-    Error(str,__uuidof(IMagickImage),hr);
-  }
+		Error( str, __uuidof( IMagickImage ), hr );
+	}
 
-  MagickLib::DestroyExceptionInfo(&exception);
-  return hr;
+	MagickLib::DestroyExceptionInfo( &exception );
+	return hr;
 }
 
-STDMETHODIMP MagickImage::Compare(SAFEARRAY **pArrayVar, VARIANT *pVar)
+STDMETHODIMP MagickImage::Compare(
+	SAFEARRAY** pArrayVar,
+	VARIANT* pVar
+)
 {
-  HRESULT hr;
-  class MagickImageError error;
+	HRESULT hr;
 
-  //unsigned char
-  //  *leaktest;
+	class MagickImageError error;
 
-  //leaktest=(unsigned char *) MagickLib::AcquireMemory(1024);
+	//unsigned char
+	//  *leaktest;
 
+	//leaktest=(unsigned char *) MagickLib::AcquireMemory(1024);
+
 #ifdef ENABLE_FULL_EXCEPTIONS
-  __try
+	__try
 #endif
-  {
-    EmptyArgs();
-    AddArgs(L"-compare");
-    hr = Perform(MagickLib::CompareImageCommand,pArrayVar,pVar,&error.exception);
-  }
+	{
+		EmptyArgs();
+		AddArgs( L"-compare" );
+		hr = Perform( MagickLib::CompareImageCommand, pArrayVar, pVar, &error.exception );
+	}
 #ifdef ENABLE_FULL_EXCEPTIONS
-  __except(1)
-  {
-    hr = E_UNEXPECTED;
-    error.fullException = TRUE;
-    error.fullExceptionCode = _exception_code();
-  }
+	__except( 1 )
+	{
+		hr = E_UNEXPECTED;
+		error.fullException = TRUE;
+		error.fullExceptionCode = _exception_code();
+	}
 #endif
-  CheckAndReportError(error, hr, "compare");
-  return hr;
+	CheckAndReportError( error, hr, "compare" );
+	return hr;
 }
 
-STDMETHODIMP MagickImage::Composite(SAFEARRAY **pArrayVar, VARIANT *pVar)
+STDMETHODIMP MagickImage::Composite(
+	SAFEARRAY** pArrayVar,
+	VARIANT* pVar
+)
 {
-  HRESULT hr;
-  class MagickImageError error;
+	HRESULT hr;
+	MagickImageError error;
 
-  __try
-  {
-    EmptyArgs();
-    AddArgs(L"-composite");
-    hr = Perform(MagickLib::CompositeImageCommand,pArrayVar,pVar,&error.exception);
-  }
-  __except(1)
-  {
-    hr = E_UNEXPECTED;
-    error.fullException = TRUE;
-    error.fullExceptionCode = _exception_code();
-  }
-  CheckAndReportError(error, hr, "composite");
-  return hr;
+#ifdef ENABLE_FULL_EXCEPTIONS
+	__try
+#endif
+	{
+		EmptyArgs();
+		AddArgs( L"-composite" );
+		hr = Perform( MagickLib::CompositeImageCommand, pArrayVar, pVar, &error.exception );
+	}
+#ifdef ENABLE_FULL_EXCEPTIONS
+	__except( 1 )
+	{
+		hr = E_UNEXPECTED;
+		error.fullException = TRUE;
+		error.fullExceptionCode = _exception_code();
+	}
+#endif
+	CheckAndReportError( error, hr, "composite" );
+	return hr;
 }
 
-STDMETHODIMP MagickImage::Convert(SAFEARRAY **pArrayVar, VARIANT *pVar)
+STDMETHODIMP MagickImage::Convert(
+	SAFEARRAY** pArrayVar,
+	VARIANT* pVar
+)
 {
-  HRESULT hr;
-  class MagickImageError error;
+	HRESULT hr;
+	MagickImageError error;
 
-  //unsigned char
-  //  *leaktest;
+	ATLASSERT( FALSE );
 
-  //leaktest=(unsigned char *) MagickLib::AcquireMemory(1024);
-
 #ifdef ENABLE_FULL_EXCEPTIONS
-  __try
+	__try
 #endif
-  {
-    EmptyArgs();
-    AddArgs(L"-convert");
-    hr = Perform(MagickLib::ConvertImageCommand,pArrayVar,pVar,&error.exception);
-  }
+	{
+		EmptyArgs();
+		AddArgs( L"-convert" );
+		hr = Perform( MagickLib::ConvertImageCommand, pArrayVar, pVar, &error.exception );
+	}
 #ifdef ENABLE_FULL_EXCEPTIONS
-  __except(1)
-  {
-    hr = E_UNEXPECTED;
-    error.fullException = TRUE;
-    error.fullExceptionCode = _exception_code();
-  }
+	__except( 1 )
+	{
+		hr = E_UNEXPECTED;
+		error.fullException = TRUE;
+		error.fullExceptionCode = _exception_code();
+	}
 #endif
-  CheckAndReportError(error, hr, "convert");
-  return hr;
+	CheckAndReportError( error, hr, "convert" );
+	return hr;
 }
 
-HRESULT MagickImage::Identify(SAFEARRAY **pArrayVar, VARIANT *pVar)
+HRESULT MagickImage::Identify(
+	SAFEARRAY** pArrayVar,
+	VARIANT* pVar
+)
 {
-  HRESULT hr;
-  class MagickImageError error;
+	HRESULT hr;
+	MagickImageError error;
 
-  __try
-  {
-    EmptyArgs();
-    AddArgs(L"-identify");
-    hr = Perform(MagickLib::IdentifyImageCommand,pArrayVar,pVar,&error.exception);
-  }
-  __except(1)
-  {
-    hr = E_UNEXPECTED;
-    error.fullException = TRUE;
-    error.fullExceptionCode = _exception_code();
-  }
-  CheckAndReportError(error, hr, "identity");
-  return hr;
+#ifdef ENABLE_FULL_EXCEPTIONS
+	__try
+#endif
+	{
+		EmptyArgs();
+		AddArgs( L"-identify" );
+		hr = Perform( MagickLib::IdentifyImageCommand, pArrayVar, pVar, &error.exception );
+	}
+#ifdef ENABLE_FULL_EXCEPTIONS
+	__except( 1 )
+	{
+		hr = E_UNEXPECTED;
+		error.fullException = TRUE;
+		error.fullExceptionCode = _exception_code();
+	}
+#endif
+	CheckAndReportError( error, hr, "identity" );
+	return hr;
 }
 
-HRESULT MagickImage::Mogrify(SAFEARRAY **pArrayVar, VARIANT *pVar)
+HRESULT MagickImage::Mogrify(
+	SAFEARRAY** pArrayVar,
+	VARIANT* pVar
+)
 {
-  HRESULT hr;
-  class MagickImageError error;
+	HRESULT hr;
+	MagickImageError error;
 
-  __try
-  {
-    EmptyArgs();
-    AddArgs(L"-mogrify");
-    hr = Perform(MagickLib::MogrifyImageCommand,pArrayVar,pVar,&error.exception);
-  }
-  __except(1)
-  {
-    hr = E_UNEXPECTED;
-    error.fullException = TRUE;
-    error.fullExceptionCode = _exception_code();
-  }
-  CheckAndReportError(error, hr, "morgify");
-  return hr;
+#ifdef ENABLE_FULL_EXCEPTIONS
+	__try
+#endif
+	{
+		EmptyArgs();
+		AddArgs( L"-mogrify" );
+		hr = Perform( MagickLib::MogrifyImageCommand, pArrayVar, pVar, &error.exception );
+	}
+#ifdef ENABLE_FULL_EXCEPTIONS
+	__except( 1 )
+	{
+		hr = E_UNEXPECTED;
+		error.fullException = TRUE;
+		error.fullExceptionCode = _exception_code();
+	}
+#endif
+
+	CheckAndReportError( error, hr, "morgify" );
+	return hr;
 }
 
-HRESULT MagickImage::Montage(SAFEARRAY **pArrayVar, VARIANT *pVar)
+HRESULT MagickImage::Montage(
+	SAFEARRAY** pArrayVar,
+	VARIANT* pVar
+)
 {
-  HRESULT hr;
-  class MagickImageError error;
+	HRESULT hr;
+	MagickImageError error;
 
-  __try
-  {
-    EmptyArgs();
-    AddArgs(L"-identify");
-    hr = Perform(MagickLib::MontageImageCommand,pArrayVar,pVar,&error.exception);
-  }
-  __except(1)
-  {
-    hr = E_UNEXPECTED;
-    error.fullException = TRUE;
-    error.fullExceptionCode = _exception_code();
-  }
-  CheckAndReportError(error, hr, "montage");
-  return hr;
+#ifdef ENABLE_FULL_EXCEPTIONS
+	__try
+#endif
+	{
+		EmptyArgs();
+		AddArgs( L"-montage" );
+		hr = Perform( MagickLib::MontageImageCommand, pArrayVar, pVar, &error.exception );
+	}
+#ifdef ENABLE_FULL_EXCEPTIONS
+	__except( 1 )
+	{
+		hr = E_UNEXPECTED;
+		error.fullException = TRUE;
+		error.fullExceptionCode = _exception_code();
+	}
+#endif
+	CheckAndReportError( error, hr, "montage" );
+	return hr;
 }
 
-STDMETHODIMP MagickImage::Stream(SAFEARRAY **pArrayVar, VARIANT *pVar)
+STDMETHODIMP MagickImage::Stream(
+	SAFEARRAY** pArrayVar,
+	VARIANT* pVar
+)
 {
-  HRESULT hr;
-  class MagickImageError error;
+	HRESULT hr;
+	MagickImageError error;
 
-  //unsigned char
-  //  *leaktest;
-
-  //leaktest=(unsigned char *) MagickLib::AcquireMemory(1024);
-
 #ifdef ENABLE_FULL_EXCEPTIONS
-  __try
+	__try
 #endif
-  {
-    EmptyArgs();
-    AddArgs(L"-stream");
-    hr = Perform(MagickLib::StreamImageCommand,pArrayVar,pVar,&error.exception);
-  }
+	{
+		EmptyArgs();
+		AddArgs( L"-stream" );
+		hr = Perform( MagickLib::StreamImageCommand, pArrayVar, pVar, &error.exception );
+	}
 #ifdef ENABLE_FULL_EXCEPTIONS
-  __except(1)
-  {
-    hr = E_UNEXPECTED;
-    error.fullException = TRUE;
-    error.fullExceptionCode = _exception_code();
-  }
+	__except( 1 )
+	{
+		hr = E_UNEXPECTED;
+		error.fullException = TRUE;
+		error.fullExceptionCode = _exception_code();
+	}
 #endif
-  CheckAndReportError(error, hr, "stream");
-  return hr;
+	CheckAndReportError( error, hr, "stream" );
+	return hr;
 }
 
-HRESULT MagickImage::AddArgs(LPCWSTR widestr)
+HRESULT MagickImage::AddArgs(
+	LPCWSTR widestr
+)
 {
-  HRESULT hr = E_OUTOFMEMORY;
+	HRESULT hr = E_OUTOFMEMORY;
 
-  if (m_argvIndex >= m_argc)
-    return hr;
+	if( m_argvIndex >= m_argc )
+	{
+		return hr;
+	}
 
-  hr = S_OK;
+	hr = S_OK;
 
-  CW2A sArgUTF8( widestr, CP_UTF8 );
-  m_argv[m_argvIndex++] = strdup( sArgUTF8 );
+	CW2A sArgUTF8( widestr, CP_UTF8 );
+	m_argv[ m_argvIndex++ ] = strdup( sArgUTF8 );
 
-  CW2A sArgANSI( widestr );
-  (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-    "arg: %s", (LPSTR)sArgANSI );
+	CW2A sArgANSI( widestr );
+	(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+		"arg: %s", (LPSTR)sArgANSI );
 
-  if (m_argvIndex >= m_argc)
-    hr = ReAllocateArgs( nDefaultArgumentSize );
+	if( m_argvIndex >= m_argc )
+	{
+		hr = ReAllocateArgs( nDefaultArgumentSize );
+	}
 
-  return hr;
+	return hr;
 }
 
-HRESULT MagickImage::AddArgs(LPCSTR lpstr)
+HRESULT MagickImage::AddArgs(
+	LPCSTR lpstr
+)
 {
-  HRESULT hr = E_OUTOFMEMORY;
+	HRESULT hr = E_OUTOFMEMORY;
 
-  if (m_argvIndex >= m_argc)
-    return hr;
+	if( m_argvIndex >= m_argc )
+	{
+		return hr;
+	}
 
-  hr = S_OK;
-  
-  CA2W wsArg( lpstr );
-  CW2A sArgUTF8( wsArg, CP_UTF8 );
-  CW2A sArgANSI( wsArg );
-  
-  m_argv[m_argvIndex++] = strdup( sArgUTF8 );
+	hr = S_OK;
 
-  (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-    "arg: %s", (LPSTR)sArgANSI );
+	CA2W wsArg( lpstr );
+	CW2A sArgUTF8( wsArg, CP_UTF8 );
+	CW2A sArgANSI( wsArg );
 
-  if (m_argvIndex >= m_argc)
-    hr = ReAllocateArgs( nDefaultArgumentSize );
+	m_argv[ m_argvIndex++ ] = strdup( sArgUTF8 );
 
-  return hr;
+	(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+		"arg: %s", (LPSTR)sArgANSI );
+
+	if( m_argvIndex >= m_argc )
+	{
+		hr = ReAllocateArgs( nDefaultArgumentSize );
+	}
+
+	return hr;
 }
 
-HRESULT MagickImage::AllocateArgs(int cArgc)
+HRESULT MagickImage::AllocateArgs(
+	int cArgc
+)
 {
-  m_argv = new LPTSTR [cArgc];
+	m_argv = new LPTSTR [ cArgc ];
 
-  if (m_argv == NULL)
-    return E_OUTOFMEMORY;
-    
-  m_argc = cArgc;
-  m_argvIndex = 0;
-  for (int i=0; i<m_argc; i++)
-  {
-    m_argv[i] = NULL;
-  }
-  return S_OK;
+	if( m_argv == NULL )
+	{
+		return E_OUTOFMEMORY;
+	}
+
+	m_argc = cArgc;
+	m_argvIndex = 0;
+	for( int i = 0; i < m_argc; i++ )
+	{
+		m_argv[ i ] = NULL;
+	}
+
+	return S_OK;
 }
 
-HRESULT MagickImage::ReAllocateArgs(int cArgc)
+HRESULT MagickImage::ReAllocateArgs(
+	int cArgc
+)
 {
-  LPTSTR *argv = m_argv;
-  int argc = m_argc + cArgc;
+	LPTSTR* argv = m_argv;
+	int argc = m_argc + cArgc;
 
-  argv = new LPTSTR [argc];
+	argv = new LPTSTR [ argc ];
 
-  if (argv == NULL)
-    return E_OUTOFMEMORY;
+	if( argv == NULL )
+	{
+		return E_OUTOFMEMORY;
+	}
 
-  for (int i=0; i<argc; i++)
-  {
-    if (i < m_argc)
-    {
-      argv[i] = m_argv[i];
-    }
-    else
-    {
-      argv[i] = NULL;
-    }
-  }
-  if (m_argv)
-  {
-    delete m_argv;
-    m_argv = argv;
-  }
-  m_argc = argc;
-  return S_OK;
+	for( int i = 0; i < argc; i++ )
+	{
+		if( i < m_argc )
+		{
+			argv[ i ] = m_argv[ i ];
+		}
+		else
+		{
+			argv[ i ] = NULL;
+		}
+	}
+
+	if( m_argv )
+	{
+		delete m_argv;
+		m_argv = argv;
+	}
+
+	m_argc = argc;
+	return S_OK;
 }
 
 void MagickImage::DeleteArgs()
 {
-  EmptyArgs();
-  if (m_argv)
-    delete m_argv;
+	EmptyArgs();
+	if( m_argv )
+	{
+		delete m_argv;
+	}
 }
 
-char **MagickImage::GetArgv()
+char** MagickImage::GetArgv()
 {
-  return m_argv;
+	return m_argv;
 }
 
 int MagickImage::GetArgc()
 {
-  return m_argvIndex;
+	return m_argvIndex;
 }
 
 void MagickImage::EmptyArgs()
 {
-  for (int i=0; i<m_argc; i++)
-  {
-    free( (void *) (m_argv[i]) );
-    m_argv[i] = NULL;
-  }
-  m_argvIndex = 0;
+	for( int i = 0; i < m_argc; i++ )
+	{
+		free( (void*)(m_argv[ i ]) );
+		m_argv[ i ] = NULL;
+	}
+
+	m_argvIndex = 0;
 }
 
-STDMETHODIMP MagickImage::OnStartPage(IUnknown* pUnk)  
+STDMETHODIMP MagickImage::OnStartPage(
+	IUnknown* pUnk
+)
 {
-  (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-    "OnStartPage");
-  if(!pUnk)
-    return E_POINTER;
+	(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+		"OnStartPage" );
+	if( !pUnk )
+	{
+		return E_POINTER;
+	}
 
-  CComPtr<IScriptingContext> spContext;
-  HRESULT hr;
+	CComPtr<IScriptingContext>spContext;
+	HRESULT hr;
 
-  // Get the IScriptingContext Interface
-  hr = pUnk->QueryInterface(__uuidof(IScriptingContext), (void **)&spContext);
-  if(FAILED(hr))
-    return hr;
+	// Get the IScriptingContext Interface
+	hr = pUnk->QueryInterface( __uuidof( IScriptingContext ), (void**)&spContext );
+	if( FAILED( hr ) )
+	{
+		return hr;
+	}
 
-  // Get Request Object Pointer
-  hr = spContext->get_Request(&m_piRequest);
-  if(FAILED(hr))
-  {
-    (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-      "OnStartPage get Request failed");
-    //spContext.Release();
-    //return hr;
-  }
+	// Get Request Object Pointer
+	hr = spContext->get_Request( &m_piRequest );
+	if( FAILED( hr ) )
+	{
+		(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+			"OnStartPage get Request failed" );
 
-  // Get Response Object Pointer
-  hr = spContext->get_Response(&m_piResponse);
-  if(FAILED(hr))
-  {
-    (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-      "OnStartPage get Response failed");
-    //m_piRequest.Release();
-    //return hr;
-  }
-  
-  // Get Server Object Pointer
-  hr = spContext->get_Server(&m_piServer);
-  if(FAILED(hr))
-  {
-    (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-      "OnStartPage get Server failed");
-    //m_piRequest.Release();
-    //m_piResponse.Release();
-    //return hr;
-  }
-  
-  // Get Session Object Pointer
-  hr = spContext->get_Session(&m_piSession);
-  if(FAILED(hr))
-  {
-    (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-      "OnStartPage get Session failed");
-    //m_piRequest.Release();
-    //m_piResponse.Release();
-    //m_piServer.Release();
-    //return hr;
-  }
+		//spContext.Release();
+		//return hr;
+	}
 
-  // Get Application Object Pointer
-  hr = spContext->get_Application(&m_piApplication);
-  if(FAILED(hr))
-  {
-    (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-      "OnStartPage get Application failed");
-    //m_piRequest.Release();
-    //m_piResponse.Release();
-    //m_piServer.Release();
-    //m_piSession.Release();
-    //return hr;
-  }
-  m_bOnStartPageCalled = TRUE;
+	// Get Response Object Pointer
+	hr = spContext->get_Response( &m_piResponse );
+	if( FAILED( hr ) )
+	{
+		(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+			"OnStartPage get Response failed" );
 
-  {
-    CComPtr<IRequestDictionary>pReadDictionary;
-    CComPtr<IReadCookie>pCookieDictionary;
-        
-    hr=m_piRequest->get_Cookies(&pReadDictionary);
-    if(SUCCEEDED(hr))
-    {
-      CComVariant vtIn(_T("MAGICK_DEBUG"));
-      CComVariant vtKey(_T("level"));
-      CComVariant vtOut;
-      CComVariant vtCookieValue;
+		//m_piRequest.Release();
+		//return hr;
+	}
 
-      hr=pReadDictionary->get_Item(vtIn,&vtOut);
-      if(SUCCEEDED(hr) && (V_VT(&vtOut)==VT_DISPATCH))
-      {
-        pCookieDictionary = (IReadCookie*)(vtOut.pdispVal);
-        hr=pCookieDictionary->get_Item(vtKey,&vtCookieValue);
-        if(SUCCEEDED(hr) && (V_VT(&vtCookieValue)==VT_BSTR))
-        {
-          CW2T str(vtCookieValue.bstrVal);
-          int level = atoi((LPCTSTR)str);
-#if defined(_ENABLE_OLD_LOGGING_SUPPORT_)
-          MagickLib::DebugLevel(level);
+	// Get Server Object Pointer
+	hr = spContext->get_Server( &m_piServer );
+	if( FAILED( hr ) )
+	{
+		(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+			"OnStartPage get Server failed" );
+
+		//m_piRequest.Release();
+		//m_piResponse.Release();
+		//return hr;
+	}
+
+	// Get Session Object Pointer
+	hr = spContext->get_Session( &m_piSession );
+	if( FAILED( hr ) )
+	{
+		(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+			"OnStartPage get Session failed" );
+
+		//m_piRequest.Release();
+		//m_piResponse.Release();
+		//m_piServer.Release();
+		//return hr;
+	}
+
+	// Get Application Object Pointer
+	hr = spContext->get_Application( &m_piApplication );
+	if( FAILED( hr ) )
+	{
+		(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+			"OnStartPage get Application failed" );
+
+		//m_piRequest.Release();
+		//m_piResponse.Release();
+		//m_piServer.Release();
+		//m_piSession.Release();
+		//return hr;
+	}
+
+	m_bOnStartPageCalled = TRUE;
+
+	{
+		CComPtr<IRequestDictionary>pReadDictionary;
+		CComPtr<IReadCookie>pCookieDictionary;
+
+		hr = m_piRequest->get_Cookies( &pReadDictionary );
+		if( SUCCEEDED( hr ) )
+		{
+			CComVariant vtIn( _T( "MAGICK_DEBUG" ) );
+			CComVariant vtKey( _T( "level" ) );
+			CComVariant vtOut;
+			CComVariant vtCookieValue;
+
+			hr = pReadDictionary->get_Item( vtIn, &vtOut );
+			if( SUCCEEDED( hr ) && (V_VT( &vtOut ) == VT_DISPATCH) )
+			{
+				pCookieDictionary = (IReadCookie*)(vtOut.pdispVal);
+				hr = pCookieDictionary->get_Item( vtKey, &vtCookieValue );
+				if( SUCCEEDED( hr ) && (V_VT( &vtCookieValue ) == VT_BSTR) )
+				{
+					CW2T str( vtCookieValue.bstrVal );
+					int level = _ttoi( str );
+#if defined (_ENABLE_OLD_LOGGING_SUPPORT_)
+					MagickLib::DebugLevel( level );
 #endif
-          (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-            "OnStartPage debug level: %d",level);
-        }
-        else
-          (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-            "OnStartPage - parse error");
-      }
-      else
-        (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-          "OnStartPage - no MAGICK_DEBUG");
-    }
-    else
-      (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-        "OnStartPage - no cookies");
-  }
-  return S_OK;
+					(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+						"OnStartPage debug level: %d", level );
+				}
+				else
+				{
+					(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+						"OnStartPage - parse error" );
+				}
+			}
+			else
+			{
+				(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+					"OnStartPage - no MAGICK_DEBUG" );
+			}
+		}
+		else
+		{
+			(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+				"OnStartPage - no cookies" );
+		}
+	}
+	return S_OK;
 }
 
-STDMETHODIMP MagickImage::OnEndPage ()  
+STDMETHODIMP MagickImage::OnEndPage()
 {
-  (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-    "OnEndPage");
-  m_bOnStartPageCalled = FALSE;
-  // Release all interfaces
-  if (m_piRequest)
-    m_piRequest.Release();
-  if (m_piResponse)
-    m_piResponse.Release();
-  if (m_piServer)
-    m_piServer.Release();
-  if (m_piSession)
-    m_piSession.Release();
-  if (m_piApplication)
-    m_piApplication.Release();
-  return S_OK;
+	(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+		"OnEndPage" );
+	m_bOnStartPageCalled = FALSE;
+
+	// Release all interfaces
+	if( m_piRequest )
+	{
+		m_piRequest.Release();
+	}
+
+	if( m_piResponse )
+	{
+		m_piResponse.Release();
+	}
+
+	if( m_piServer )
+	{
+		m_piServer.Release();
+	}
+
+	if( m_piSession )
+	{
+		m_piSession.Release();
+	}
+
+	if( m_piApplication )
+	{
+		m_piApplication.Release();
+	}
+
+	return S_OK;
 }
 
 HRESULT MagickImage::Activate()
 {
-  (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-    "Activate");
-  HRESULT hr = GetObjectContext(&m_spObjectContext);
-  if (SUCCEEDED(hr))
-    return S_OK;
-  return hr;
-} 
+	(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+		"Activate" );
+	HRESULT hr = GetObjectContext( &m_spObjectContext );
+	if( SUCCEEDED( hr ) )
+	{
+		return S_OK;
+	}
 
+	return hr;
+}
+
 BOOL MagickImage::CanBePooled()
 {
-  (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-    "CanBePooled");
-  return FALSE;
-} 
+	(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+		"CanBePooled" );
+	return FALSE;
+}
 
 void MagickImage::Deactivate()
 {
-  (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-    "Deactivate");
-  m_spObjectContext.Release();
-} 
+	(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+		"Deactivate" );
+	m_spObjectContext.Release();
+}
 
-typedef CAtlArray<CStringA> CStringArray;
+typedef CAtlArray<CStringA>CStringArray;
 
-static void LocalTokenize( const CString& s, LPCSTR sz, CStringArray& asToken )
+static void LocalTokenize(
+	const CString& s,
+	LPCSTR sz,
+	CStringArray& asToken
+)
 {
 	int nPos = 0;
 	CStringA sToken;
-	
+
 	asToken.RemoveAll();
 	sToken = s.Tokenize( sz, nPos );
 	while( !sToken.IsEmpty() )
 	{
 		asToken.Add( sToken );
 	}
-	
-	if ( asToken.GetCount() == 0 )
+
+	if( asToken.GetCount() == 0 )
 	{
 		asToken.Add( s );
 	}
 }
 
-HRESULT MagickImage::Construct(IDispatch * pCtorObj)
+HRESULT MagickImage::Construct(
+	IDispatch* pCtorObj
+)
 {
-  (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-    "Construct");
-  CComPtr<IObjectConstructString> spObjectConstructString;
-  HRESULT hr = pCtorObj->QueryInterface(&spObjectConstructString);
-  if (SUCCEEDED(hr))
-  {
-    CComBSTR bstrConstruct;
-    hr = spObjectConstructString->get_ConstructString(&bstrConstruct);
-    if (SUCCEEDED(hr))
-    {
-      CStringA sOptions( bstrConstruct );
-      int nPos = 0;
-      CStringA sToken;
-      CStringArray asToken;
-      
-      (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-        "Construct data: %s", (LPCSTR)sOptions );
-        
-      sToken = sOptions.Tokenize( ".", nPos );
-      while( !sToken.IsEmpty() )
-      {
-		LocalTokenize( sToken, "=", asToken );
-		if ( asToken.GetCount() == 2 )
+	(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+		"Construct" );
+	CComPtr<IObjectConstructString>spObjectConstructString;
+	HRESULT hr = pCtorObj->QueryInterface( &spObjectConstructString );
+	if( SUCCEEDED( hr ) )
+	{
+		CComBSTR bstrConstruct;
+		hr = spObjectConstructString->get_ConstructString( &bstrConstruct );
+		if( SUCCEEDED( hr ) )
 		{
-			const CStringA& sName = asToken[0];
-			const CStringA& sValue = asToken[1];
-			
-          (void) MagickLib::LogMagickEvent(MagickLib::ResourceEvent,GetMagickModule(),
-            "Construct name: %s value: %s",
-              (LPCSTR)sName,(LPCSTR)sValue);
-              
-#if defined(_ENABLE_OLD_LOGGING_SUPPORT_)
-          if (sName.Compare("MAGICK_DEBUG_LEVEL") == 0)
-          {
-            MagickLib::DebugLevel( atoi(sValue) );
-          }
-          
-          if (sName.Compare("MAGICK_DEBUG_PATH") == 0)
-          {
-            MagickLib::DebugFilePath(sValue);           
-          }
-          
-          if (sName.Compare("MAGICK_LOG_EVENTMASK") == 0)
-          {
-            MagickLib::SetLogEventMask(sValue);
-          }
+			CStringA sOptions( bstrConstruct );
+			int nPos = 0;
+			CStringA sToken;
+			CStringArray asToken;
+
+			(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+				"Construct data: %s", (LPCSTR)sOptions );
+
+			sToken = sOptions.Tokenize( ".", nPos );
+			while( !sToken.IsEmpty() )
+			{
+				LocalTokenize( sToken, "=", asToken );
+				if( asToken.GetCount() == 2 )
+				{
+					const CStringA& sName = asToken[ 0 ];
+					const CStringA& sValue = asToken[ 1 ];
+
+					(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
+						"Construct name: %s value: %s",
+						(LPCSTR)sName, (LPCSTR)sValue );
+
+#if defined (_ENABLE_OLD_LOGGING_SUPPORT_)
+					if( sName.Compare( "MAGICK_DEBUG_LEVEL" ) == 0 )
+					{
+						MagickLib::DebugLevel( atoi( sValue ) );
+					}
+
+					if( sName.Compare( "MAGICK_DEBUG_PATH" ) == 0 )
+					{
+						MagickLib::DebugFilePath( sValue );
+					}
+
+					if( sName.Compare( "MAGICK_LOG_EVENTMASK" ) == 0 )
+					{
+						MagickLib::SetLogEventMask( sValue );
+					}
+
 #endif
+				} // if
+
+			} // while
+
 		} // if
-      } // while
-    } // if
-   }
-  return hr;
+
+	}
+
+	return hr;
 }

Property changes on: ImageMagickObject.cpp
___________________________________________________________________
Added: svn:eol-style
   + native

Index: ImageMagickObject_.h
===================================================================
--- ImageMagickObject_.h	(revision 14093)
+++ ImageMagickObject_.h	(working copy)
@@ -1,3 +1,7 @@
+/*
+	ImageMagickObject_.h
+*/
+
 #pragma once
 #ifndef STRICT
 #define STRICT
@@ -52,9 +56,5 @@
 #undef class
 }
 
-
-const DWORD dwErrorBase = 5000;
-const int nDefaultArgumentSize = 128;
-const LCID lcidDefault = 0;
-
-#define _DbgBreak() __asm { int 3 }
+// do not use _DbgBreak()
+// use ATLASSERT( FALSE ) instead

Property changes on: ImageMagickObject_.h
___________________________________________________________________
Added: svn:eol-style
   + native

Re: ImageMagicObject - non-ASCII characters

Posted: 2009-02-20T08:47:45-07:00
by magick
We will get your patch into the Subversion trunk and test it over the next few days. As always, thanks for the improvements to ImageMagickObject. The ImageMagick developers have a limited knowledge of Windows and depend on users like yourselves for these sorts of improvements.

Re: ImageMagicObject - non-ASCII characters

Posted: 2009-02-21T01:04:55-07:00
by roed
There are problems with ArrayTest.vbs sample.
The output file bill_meets_gorilla_screen_iptc.jpg is empty.
For now I don't understand why this file isn't created properly. Something goes wrong in APP1 writer or maybe before.
As I understand code there's nothing wrong when saving blob data to VB arrays.
I am still working on this problem but this requires knowledge of ImageMagick library internals so it may take some time.

Please change definition of DEF_DEBUG_MODE at the beginning of ImageMagickObject.cpp to

Code: Select all

static const int DEF_DEBUG_MODE = _CRTDBG_MODE_DEBUG;
for better debugging (no message box).
In the Convert (in the same file) method you may also remove:

Code: Select all

ATLASSERT( FALSE )
macro.

Re: ImageMagicObject - non-ASCII characters

Posted: 2009-02-21T06:17:12-07:00
by magick
Ok, patch applied. Thanks.

Re: ImageMagicObject - non-ASCII characters

Posted: 2009-02-23T13:31:15-07:00
by roed
ArrayTest.vbs doesn't generate bill_meets_gorilla_screen_iptc.jpg even using orginal ImageMagickObject.dll (ImageMagick-6.4.9-Q16) file. So this is not a bug generated by my modifications. Additionally two empty (probably temporary) magick-* are created.

For now new patch:
  • New VC++ 2005 (and 2008 aftter importing) projects and solution for ImageMagicObject and MagickCMD.
  • Removing obsolete files: ImageMagickObject.def and ImageMagickObject.dsp.
  • ImageMagickObject.cpp - now Unicode configuration compiles without problems.
  • MagickCMD.cpp: Using TCHAR-related macros and functions. Errors are displayed to stderr instead of stdout. Removing line using namespace std; - standard C++ library is not used.
Please try new VC++ solution ImageMagickObject.sln and report me about any problems you find.
Binaries are generated in bin subdirectory.

Code: Select all

Index: ImageMagickObject.cpp
===================================================================
--- ImageMagickObject.cpp	(revision 7)
+++ ImageMagickObject.cpp	(working copy)
@@ -8,7 +8,6 @@
 static const int nDefaultArgumentSize = 128;
 static const LCID lcidDefault = 0;
 
-//static const int DEF_DEBUG_MODE = _CRTDBG_MODE_WNDW;
 static const int DEF_DEBUG_MODE = _CRTDBG_MODE_DEBUG;
 
 // for logging
@@ -33,9 +32,7 @@
 			LPVOID lpReserved
 		)
 		{
-#ifdef _DEBUG
 			//ATLASSERT( FALSE );
-#endif
 			if( dwReason == DLL_PROCESS_ATTACH )
 			{
 				MagickLib::ExceptionInfo
@@ -73,15 +70,16 @@
 				/* Next we use a back door to init the path to US so that the logging
 				   system can find its configuration file log.gk and load it
 				 */
-				(void)MagickLib::SetClientPath( m_szAppPath );
+				 CT2AEX<MAX_PATH> app_path( m_szAppPath );
+				(void)MagickLib::SetClientPath( app_path );
 
 				//(void) MagickLib::SetLogEventMask("All");
 				(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
-					"DLL Attach -  path: %s", m_szAppPath );
+					"DLL Attach -  path: %s", app_path );
 
 				// MagickLib::InitializeTracingCriticalSection();
 				// MagickLib::DebugString("DLL Attach -  path: %s\n",m_szAppPath);
-				MagickLib::InitializeMagick( m_szAppPath );
+				MagickLib::InitializeMagick( app_path );
 				MagickLib::RegisterStaticModules();
 				MagickLib::GetExceptionInfo( &exception );
 				(void)MagickLib::GetMagicInfo( (unsigned char*)NULL, 0, &exception );
@@ -90,8 +88,9 @@
 			}
 			else if( dwReason == DLL_PROCESS_DETACH )
 			{
+				CT2AEX<MAX_PATH> app_path( m_szAppPath );
 				(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(),
-					"DLL Detach -  path: %s", m_szAppPath );
+					"DLL Detach -  path: %s", app_path );
 				MagickLib::DestroyMagick();
 #ifdef _DEBUG
 				if( _CrtDumpMemoryLeaks() )
@@ -156,7 +155,7 @@
 		}
 
 		static LPCSTR translate_exception( DWORD );
-		LPCTSTR translate_exception() const
+		LPCSTR translate_exception() const
 		{
 			return translate_exception( fullExceptionCode );
 		}
@@ -254,7 +253,7 @@
 
 	private:
 
-		char** m_argv;
+		LPSTR* m_argv;
 		int m_argc;
 		int m_argvIndex;
 
@@ -536,7 +535,7 @@
 			long id;
 			LPSTR lpszNext;
 
-			lpszNext = StrChr( szVal, '.' );
+			lpszNext = StrChrA( szVal, '.' );
 			if( lpszNext == NULL )
 			{
 				lpszNext = "%w,%h,%m";
@@ -652,8 +651,6 @@
 				CW2A szVal( V_BSTR( pvarIndex ) );
 				if( szVal )
 				{
-					MagickLib::Image* image;
-
 					if( MagickLib::DeleteImageRegistry( szVal ) )
 					{
 						hr = S_OK;
@@ -668,7 +665,7 @@
 }
 
 HRESULT MagickImage::Perform(
-	MagickLib::MagickBooleanType (* func)(MagickLib::ImageInfo* image_info,const int argc, LPTSTR* argv, LPTSTR* text, MagickLib::ExceptionInfo* exception),
+	MagickLib::MagickBooleanType (* func)(MagickLib::ImageInfo* image_info,const int argc, char** argv, char** text, MagickLib::ExceptionInfo* exception),
 	SAFEARRAY** pArrayVar,
 	VARIANT* pVar,
 	MagickLib::ExceptionInfo* exception
@@ -1043,6 +1040,7 @@
 
 	image_info = MagickLib::CloneImageInfo( (MagickLib::ImageInfo*)NULL );
 #ifdef _DEBUG
+
 	//ATLASSERT( FALSE );
 #endif
 	hr = Execute( func, &text, image_info, exception );
@@ -1127,9 +1125,7 @@
 		errno ? " [" : "", errno ? strerror( errno ) : "", errno ? "]" : "" );
 	(void)MagickLib::LogMagickEvent( MagickLib::ResourceEvent, GetMagickModule(), fatalerror_text );
 
-#ifdef _DEBUG
-	//ATLASSERT( FALSE );
-#endif
+//  ATLASSERT( FALSE );
 }
 
 #define ENABLE_FULL_EXCEPTIONS
@@ -1179,6 +1175,7 @@
 			hr = MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, dwErrorBase + 1001 );
 
 	#ifdef _DEBUG
+
 			//ATLASSERT( FALSE );
 	#endif
 			CA2WEX<MaxTextExtent>wsMessageText( message_text );
@@ -1310,6 +1307,7 @@
 			"convert: %d: %.1024s: %.1024s", exception.severity, reason, description );
 		CA2WEX<MaxTextExtent> str( message_text );
 #ifdef _DEBUG
+
 //    ATLASSERT( FALSE );
 #endif
 		Error( str, __uuidof( IMagickImage ), hr );
@@ -1389,9 +1387,7 @@
 	HRESULT hr;
 	MagickImageError error;
 
-#ifdef _DEBUG
-	//ATLASSERT( FALSE );
-#endif
+	ATLASSERT( FALSE );
 
 #ifdef ENABLE_FULL_EXCEPTIONS
 	__try
@@ -1588,7 +1584,7 @@
 	int cArgc
 )
 {
-	m_argv = new LPTSTR [ cArgc ];
+	m_argv = new LPSTR [ cArgc ];
 
 	if( m_argv == NULL )
 	{
@@ -1609,10 +1605,10 @@
 	int cArgc
 )
 {
-	LPTSTR* argv = m_argv;
+	LPSTR* argv = m_argv;
 	int argc = m_argc + cArgc;
 
-	argv = new LPTSTR [ argc ];
+	argv = new LPSTR [ argc ];
 
 	if( argv == NULL )
 	{
@@ -1868,7 +1864,7 @@
 typedef CAtlArray<CStringA>CStringArray;
 
 static void LocalTokenize(
-	const CString& s,
+	const CStringA& s,
 	LPCSTR sz,
 	CStringArray& asToken
 )
Index: ImageMagickObject.def
===================================================================
--- ImageMagickObject.def	(revision 7)
+++ ImageMagickObject.def	(working copy)
@@ -1,18 +0,0 @@
-LIBRARY ImageMagickObject
-EXPORTS
-MagickCommand @6
-SetClientName @7
-GetExceptionInfo @8
-CloneImageInfo @9
-CatchException @10
-DestroyImageInfo @11
-DestroyExceptionInfo @12
-InitializeMagick @13
-DestroyMagick @14
-GetMagickCopyright @15
-GetMagickVersion @16
-Exit @17
-GetClientName @18
-DefineClientName @19
-LocaleCompare @20
-GetPathComponent @21
Index: ImageMagickObject.dsp
===================================================================
--- ImageMagickObject.dsp	(revision 7)
+++ ImageMagickObject.dsp	(working copy)
@@ -1,345 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ImageMagickObject" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=ImageMagickObject - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "ImageMagickObject.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "ImageMagickObject.mak" CFG="ImageMagickObject - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "ImageMagickObject - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ImageMagickObject - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ImageMagickObject - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ImageMagickObject - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ImageMagickObject - Win32 Unicode Release MinSize" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ImageMagickObject - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""$/ImageMagickObject", YKCAAAAA"
-# PROP Scc_LocalPath "."
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "ImageMagickObject - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-LIB32=link.exe -lib
-# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /Gf /Gy /I "..\..\..\.." /I "..\..\..\..\magick" /I "..\..\..\..\xlib" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "_VISUALC_" /D "NeedFunctionPrototypes" /D "_ATL_DLL" /D "_LIB" /Yu"stdafx.h" /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 CORE_DB_bzlib_.lib CORE_DB_fpx_.lib CORE_DB_jbig_.lib CORE_DB_jpeg_.lib CORE_DB_lcms_.lib CORE_DB_libxml_.lib CORE_DB_magick_.lib CORE_DB_Magick++_.lib CORE_DB_png_.lib CORE_DB_tiff_.lib CORE_DB_ttf_.lib CORE_DB_xlib_.lib CORE_DB_zlib_.lib CORE_DB_jp2_.lib CORE_DB_wmf_.lib IM_MOD_DB_art_.lib IM_MOD_DB_avi_.lib IM_MOD_DB_avs_.lib IM_MOD_DB_bmp_.lib IM_MOD_DB_caption_.lib IM_MOD_DB_clipboard_.lib IM_MOD_DB_cmyk_.lib IM_MOD_DB_cut_.lib IM_MOD_DB_dcm_.lib IM_MOD_DB_dib_.lib IM_MOD_DB_dps_.lib IM_MOD_DB_dpx_.lib IM_MOD_DB_emf_.lib IM_MOD_DB_ept_.lib IM_MOD_DB_fax_.lib IM_MOD_DB_fits_.lib IM_MOD_DB_fpx_.lib IM_MOD_DB_gif_.lib IM_MOD_DB_gradient_.lib IM_MOD_DB_gray_.lib IM_MOD_DB_hdf_.lib IM_MOD_DB_histogram_.lib IM_MOD_DB_html_.lib IM_MOD_DB_icon_.lib IM_MOD_DB_jbig_.lib IM_MOD_DB_jp2_.lib IM_MOD_DB_jpeg_.lib IM_MOD_DB_label_.lib IM_MOD_DB_locale_.lib IM_MOD_DB_logo_.lib IM_MOD_DB_map_.lib IM_MOD_DB_mat_.lib IM_MOD_DB_matte_.lib IM_MOD_DB_meta_.lib IM_MOD_DB_miff_.lib IM_MOD_DB_mono_.lib IM_MOD_DB_mpc_.lib IM_MOD_DB_mpeg_.lib IM_MOD_DB_mpr_.lib IM_MOD_DB_msl_.lib IM_MOD_DB_mtv_.lib IM_MOD_DB_mvg_.lib IM_MOD_DB_null_.lib IM_MOD_DB_otb_.lib IM_MOD_DB_palm_.lib IM_MOD_DB_pcd_.lib IM_MOD_DB_pcl_.lib IM_MOD_DB_pcx_.lib IM_MOD_DB_pdb_.lib IM_MOD_DB_pdf_.lib IM_MOD_DB_pict_.lib IM_MOD_DB_pix_.lib IM_MOD_DB_plasma_.lib IM_MOD_DB_png_.lib IM_MOD_DB_pnm_.lib IM_MOD_DB_preview_.lib IM_MOD_DB_ps_.lib IM_MOD_DB_ps2_.lib IM_MOD_DB_ps3_.lib IM_MOD_DB_psd_.lib IM_MOD_DB_pwp_.lib IM_MOD_DB_rgb_.lib IM_MOD_DB_rla_.lib IM_MOD_DB_rle_.lib IM_MOD_DB_sct_.lib IM_MOD_DB_sfw_.lib IM_MOD_DB_sgi_.lib IM_MOD_DB_stegano_.lib IM_MOD_DB_sun_.lib IM_MOD_DB_svg_.lib IM_MOD_DB_tga_.lib IM_MOD_DB_tiff_.lib IM_MOD_DB_tile_.lib IM_MOD_DB_tim_.lib IM_MOD_DB_ttf_.lib IM_MOD_DB_txt_.lib IM_MOD_DB_uil_.lib IM_MOD_DB_url_.lib IM_MOD_DB_uyvy_.lib IM_MOD_DB_vicar_.lib IM_MOD_DB_vid_.lib IM_MOD_DB_viff_.lib IM_MOD_DB_wbmp_.lib IM_MOD_DB_wmf_.lib IM_MOD_DB_wpg_.lib IM_MOD_DB_x_.lib IM_MOD_DB_xbm_.lib IM_MOD_DB_xc_.lib IM_MOD_DB_xcf_.lib IM_MOD_DB_xpm_.lib IM_MOD_DB_xwd_.lib IM_MOD_DB_yuv_.lib IM_MOD_DB_xtrn_.lib kernel32.lib user32.lib gdi32.lib odbc32.lib odbccp32.lib ole32.lib oleaut32.lib winmm.lib dxguid.lib wsock32.lib advapi32.lib /nologo /subsystem:windows /dll /pdb:"..\bin\ImageMagickObject.pdb" /debug /machine:I386 /libpath:"..\..\..\..\VisualMagick\lib"
-# SUBTRACT LINK32 /pdb:none
-# Begin Custom Build - Performing registration
-OutDir=.\Debug
-TargetPath=.\Debug\ImageMagickObject.dll
-InputPath=.\Debug\ImageMagickObject.dll
-SOURCE="$(InputPath)"
-
-"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	regsvr32 /s /c "$(TargetPath)" 
-	echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" 
-	
-# End Custom Build
-
-!ELSEIF  "$(CFG)" == "ImageMagickObject - Win32 Unicode Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "DebugU"
-# PROP BASE Intermediate_Dir "DebugU"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "DebugU"
-# PROP Intermediate_Dir "DebugU"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-LIB32=link.exe -lib
-# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\.." /I "..\..\..\..\magick" /I "..\..\..\..\xlib" /D "_DEBUG" /D "_UNICODE" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "_VISUALC_" /D "NeedFunctionPrototypes" /D "_ATL_DLL" /D "_LIB" /Yu"stdafx.h" /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 CORE_RL_bzlib_.lib CORE_RL_fpx_.lib CORE_RL_jbig_.lib CORE_RL_jpeg_.lib CORE_RL_lcms_.lib CORE_RL_libxml_.lib CORE_RL_magick_.lib CORE_RL_Magick++_.lib CORE_RL_png_.lib CORE_RL_tiff_.lib CORE_RL_ttf_.lib CORE_RL_xlib_.lib CORE_RL_zlib_.lib CORE_RL_jp2_.lib CORE_RL_wmf_.lib IM_MOD_RL_art_.lib IM_MOD_RL_avi_.lib IM_MOD_RL_avs_.lib IM_MOD_RL_bmp_.lib IM_MOD_RL_caption_.lib IM_MOD_RL_clipboard_.lib IM_MOD_RL_cmyk_.lib IM_MOD_RL_cut_.lib IM_MOD_RL_dcm_.lib IM_MOD_RL_dib_.lib IM_MOD_RL_dps_.lib IM_MOD_RL_dpx_.lib IM_MOD_RL_emf_.lib IM_MOD_RL_ept_.lib IM_MOD_RL_fax_.lib IM_MOD_RL_fits_.lib IM_MOD_RL_fpx_.lib IM_MOD_RL_gif_.lib IM_MOD_RL_gradient_.lib IM_MOD_RL_gray_.lib IM_MOD_RL_hdf_.lib IM_MOD_RL_histogram_.lib IM_MOD_RL_html_.lib IM_MOD_RL_icon_.lib IM_MOD_RL_jbig_.lib IM_MOD_RL_jp2_.lib IM_MOD_RL_jpeg_.lib IM_MOD_RL_label_.lib IM_MOD_RL_locale_.lib IM_MOD_RL_logo_.lib IM_MOD_RL_map_.lib IM_MOD_RL_mat_.lib IM_MOD_RL_matte_.lib IM_MOD_RL_meta_.lib IM_MOD_RL_miff_.lib IM_MOD_RL_mono_.lib IM_MOD_RL_mpc_.lib IM_MOD_RL_mpeg_.lib IM_MOD_RL_mpr_.lib IM_MOD_RL_msl_.lib IM_MOD_RL_mtv_.lib IM_MOD_RL_mvg_.lib IM_MOD_RL_null_.lib IM_MOD_RL_otb_.lib IM_MOD_RL_palm_.lib IM_MOD_RL_pcd_.lib IM_MOD_RL_pcl_.lib IM_MOD_RL_pcx_.lib IM_MOD_RL_pdb_.lib IM_MOD_RL_pdf_.lib IM_MOD_RL_pict_.lib IM_MOD_RL_pix_.lib IM_MOD_RL_plasma_.lib IM_MOD_RL_png_.lib IM_MOD_RL_pnm_.lib IM_MOD_RL_preview_.lib IM_MOD_RL_ps_.lib IM_MOD_RL_ps2_.lib IM_MOD_RL_ps3_.lib IM_MOD_RL_psd_.lib IM_MOD_RL_pwp_.lib IM_MOD_RL_rgb_.lib IM_MOD_RL_rla_.lib IM_MOD_RL_rle_.lib IM_MOD_RL_sct_.lib IM_MOD_RL_sfw_.lib IM_MOD_RL_sgi_.lib IM_MOD_RL_stegano_.lib IM_MOD_RL_sun_.lib IM_MOD_RL_svg_.lib IM_MOD_RL_tga_.lib IM_MOD_RL_tiff_.lib IM_MOD_RL_tile_.lib IM_MOD_RL_tim_.lib IM_MOD_RL_ttf_.lib IM_MOD_RL_txt_.lib IM_MOD_RL_uil_.lib IM_MOD_RL_url_.lib IM_MOD_RL_uyvy_.lib IM_MOD_RL_vicar_.lib IM_MOD_RL_vid_.lib IM_MOD_RL_viff_.lib IM_MOD_RL_wbmp_.lib IM_MOD_RL_wmf_.lib IM_MOD_RL_wpg_.lib IM_MOD_RL_x_.lib IM_MOD_RL_xbm_.lib IM_MOD_RL_xc_.lib IM_MOD_RL_xcf_.lib IM_MOD_RL_xpm_.lib IM_MOD_RL_xwd_.lib IM_MOD_RL_yuv_.lib IM_MOD_RL_xtrn_.lib kernel32.lib user32.lib gdi32.lib odbc32.lib odbccp32.lib ole32.lib oleaut32.lib winmm.lib dxguid.lib wsock32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\VisualMagick\lib"
-# SUBTRACT LINK32 /pdb:none
-# Begin Custom Build - Performing registration
-OutDir=.\DebugU
-TargetPath=.\DebugU\ImageMagickObject.dll
-InputPath=.\DebugU\ImageMagickObject.dll
-SOURCE="$(InputPath)"
-
-"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	if "%OS%"=="" goto NOTNT 
-	if not "%OS%"=="Windows_NT" goto NOTNT 
-	regsvr32 /s /c "$(TargetPath)" 
-	echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" 
-	goto end 
-	:NOTNT 
-	echo Warning : Cannot register Unicode DLL on Windows 95 
-	:end 
-	
-# End Custom Build
-
-!ELSEIF  "$(CFG)" == "ImageMagickObject - Win32 Release MinSize"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "ReleaseMinSize"
-# PROP BASE Intermediate_Dir "ReleaseMinSize"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "ReleaseMinSize"
-# PROP Intermediate_Dir "ReleaseMinSize"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-LIB32=link.exe -lib
-# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O1 /I "..\..\..\.." /I "..\..\..\..\magick" /I "..\..\..\..\xlib" /D "NDEBUG" /D "_MBCS" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "_VISUALC_" /D "NeedFunctionPrototypes" /D "_LIB" /Yu"stdafx.h" /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 CORE_RL_bzlib_.lib CORE_RL_fpx_.lib CORE_RL_jbig_.lib CORE_RL_jpeg_.lib CORE_RL_lcms_.lib CORE_RL_libxml_.lib CORE_RL_magick_.lib CORE_RL_Magick++_.lib CORE_RL_png_.lib CORE_RL_tiff_.lib CORE_RL_ttf_.lib CORE_RL_xlib_.lib CORE_RL_zlib_.lib CORE_RL_jp2_.lib CORE_RL_wmf_.lib IM_MOD_RL_art_.lib IM_MOD_RL_avi_.lib IM_MOD_RL_avs_.lib IM_MOD_RL_bmp_.lib IM_MOD_RL_caption_.lib IM_MOD_RL_clipboard_.lib IM_MOD_RL_cmyk_.lib IM_MOD_RL_cut_.lib IM_MOD_RL_dcm_.lib IM_MOD_RL_dib_.lib IM_MOD_RL_dps_.lib IM_MOD_RL_dpx_.lib IM_MOD_RL_emf_.lib IM_MOD_RL_ept_.lib IM_MOD_RL_fax_.lib IM_MOD_RL_fits_.lib IM_MOD_RL_fpx_.lib IM_MOD_RL_gif_.lib IM_MOD_RL_gradient_.lib IM_MOD_RL_gray_.lib IM_MOD_RL_hdf_.lib IM_MOD_RL_histogram_.lib IM_MOD_RL_html_.lib IM_MOD_RL_icon_.lib IM_MOD_RL_jbig_.lib IM_MOD_RL_jp2_.lib IM_MOD_RL_jpeg_.lib IM_MOD_RL_label_.lib IM_MOD_RL_locale_.lib IM_MOD_RL_logo_.lib IM_MOD_RL_map_.lib IM_MOD_RL_mat_.lib IM_MOD_RL_matte_.lib IM_MOD_RL_meta_.lib IM_MOD_RL_miff_.lib IM_MOD_RL_mono_.lib IM_MOD_RL_mpc_.lib IM_MOD_RL_mpeg_.lib IM_MOD_RL_mpr_.lib IM_MOD_RL_msl_.lib IM_MOD_RL_mtv_.lib IM_MOD_RL_mvg_.lib IM_MOD_RL_null_.lib IM_MOD_RL_otb_.lib IM_MOD_RL_palm_.lib IM_MOD_RL_pcd_.lib IM_MOD_RL_pcl_.lib IM_MOD_RL_pcx_.lib IM_MOD_RL_pdb_.lib IM_MOD_RL_pdf_.lib IM_MOD_RL_pict_.lib IM_MOD_RL_pix_.lib IM_MOD_RL_plasma_.lib IM_MOD_RL_png_.lib IM_MOD_RL_pnm_.lib IM_MOD_RL_preview_.lib IM_MOD_RL_ps_.lib IM_MOD_RL_ps2_.lib IM_MOD_RL_ps3_.lib IM_MOD_RL_psd_.lib IM_MOD_RL_pwp_.lib IM_MOD_RL_rgb_.lib IM_MOD_RL_rla_.lib IM_MOD_RL_rle_.lib IM_MOD_RL_sct_.lib IM_MOD_RL_sfw_.lib IM_MOD_RL_sgi_.lib IM_MOD_RL_stegano_.lib IM_MOD_RL_sun_.lib IM_MOD_RL_svg_.lib IM_MOD_RL_tga_.lib IM_MOD_RL_tiff_.lib IM_MOD_RL_tile_.lib IM_MOD_RL_tim_.lib IM_MOD_RL_ttf_.lib IM_MOD_RL_txt_.lib IM_MOD_RL_uil_.lib IM_MOD_RL_url_.lib IM_MOD_RL_uyvy_.lib IM_MOD_RL_vicar_.lib IM_MOD_RL_vid_.lib IM_MOD_RL_viff_.lib IM_MOD_RL_wbmp_.lib IM_MOD_RL_wmf_.lib IM_MOD_RL_wpg_.lib IM_MOD_RL_x_.lib IM_MOD_RL_xbm_.lib IM_MOD_RL_xc_.lib IM_MOD_RL_xcf_.lib IM_MOD_RL_xpm_.lib IM_MOD_RL_xwd_.lib IM_MOD_RL_yuv_.lib IM_MOD_RL_xtrn_.lib kernel32.lib user32.lib gdi32.lib odbc32.lib odbccp32.lib ole32.lib oleaut32.lib winmm.lib dxguid.lib wsock32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:IX86 /libpath:"..\..\..\..\VisualMagick\lib"
-# SUBTRACT LINK32 /pdb:none
-# Begin Custom Build - Performing registration
-OutDir=.\ReleaseMinSize
-TargetPath=.\ReleaseMinSize\ImageMagickObject.dll
-InputPath=.\ReleaseMinSize\ImageMagickObject.dll
-SOURCE="$(InputPath)"
-
-"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	regsvr32 /s /c "$(TargetPath)" 
-	echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" 
-	
-# End Custom Build
-
-!ELSEIF  "$(CFG)" == "ImageMagickObject - Win32 Release MinDependency"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "ReleaseMinDependency"
-# PROP BASE Intermediate_Dir "ReleaseMinDependency"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "ReleaseMinDependency"
-# PROP Intermediate_Dir "ReleaseMinDependency"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-LIB32=link.exe -lib
-# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\.." /I "..\..\..\..\magick" /I "..\..\..\..\xlib" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "_VISUALC_" /D "NeedFunctionPrototypes" /D "_ATL_DLL" /D "_LIB" /Yu"stdafx.h" /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 CORE_RL_bzlib_.lib CORE_RL_fpx_.lib CORE_RL_jbig_.lib CORE_RL_jpeg_.lib CORE_RL_lcms_.lib CORE_RL_libxml_.lib CORE_RL_magick_.lib CORE_RL_Magick++_.lib CORE_RL_png_.lib CORE_RL_tiff_.lib CORE_RL_ttf_.lib CORE_RL_xlib_.lib CORE_RL_zlib_.lib CORE_RL_jp2_.lib CORE_RL_wmf_.lib IM_MOD_RL_art_.lib IM_MOD_RL_avi_.lib IM_MOD_RL_avs_.lib IM_MOD_RL_bmp_.lib IM_MOD_RL_caption_.lib IM_MOD_RL_clipboard_.lib IM_MOD_RL_cmyk_.lib IM_MOD_RL_cut_.lib IM_MOD_RL_dcm_.lib IM_MOD_RL_dib_.lib IM_MOD_RL_dps_.lib IM_MOD_RL_dpx_.lib IM_MOD_RL_emf_.lib IM_MOD_RL_ept_.lib IM_MOD_RL_fax_.lib IM_MOD_RL_fits_.lib IM_MOD_RL_fpx_.lib IM_MOD_RL_gif_.lib IM_MOD_RL_gradient_.lib IM_MOD_RL_gray_.lib IM_MOD_RL_hdf_.lib IM_MOD_RL_histogram_.lib IM_MOD_RL_html_.lib IM_MOD_RL_icon_.lib IM_MOD_RL_jbig_.lib IM_MOD_RL_jp2_.lib IM_MOD_RL_jpeg_.lib IM_MOD_RL_label_.lib IM_MOD_RL_locale_.lib IM_MOD_RL_logo_.lib IM_MOD_RL_map_.lib IM_MOD_RL_mat_.lib IM_MOD_RL_matte_.lib IM_MOD_RL_meta_.lib IM_MOD_RL_miff_.lib IM_MOD_RL_mono_.lib IM_MOD_RL_mpc_.lib IM_MOD_RL_mpeg_.lib IM_MOD_RL_mpr_.lib IM_MOD_RL_msl_.lib IM_MOD_RL_mtv_.lib IM_MOD_RL_mvg_.lib IM_MOD_RL_null_.lib IM_MOD_RL_otb_.lib IM_MOD_RL_palm_.lib IM_MOD_RL_pcd_.lib IM_MOD_RL_pcl_.lib IM_MOD_RL_pcx_.lib IM_MOD_RL_pdb_.lib IM_MOD_RL_pdf_.lib IM_MOD_RL_pict_.lib IM_MOD_RL_pix_.lib IM_MOD_RL_plasma_.lib IM_MOD_RL_png_.lib IM_MOD_RL_pnm_.lib IM_MOD_RL_preview_.lib IM_MOD_RL_ps_.lib IM_MOD_RL_ps2_.lib IM_MOD_RL_ps3_.lib IM_MOD_RL_psd_.lib IM_MOD_RL_pwp_.lib IM_MOD_RL_rgb_.lib IM_MOD_RL_rla_.lib IM_MOD_RL_rle_.lib IM_MOD_RL_sct_.lib IM_MOD_RL_sfw_.lib IM_MOD_RL_sgi_.lib IM_MOD_RL_stegano_.lib IM_MOD_RL_sun_.lib IM_MOD_RL_svg_.lib IM_MOD_RL_tga_.lib IM_MOD_RL_tiff_.lib IM_MOD_RL_tile_.lib IM_MOD_RL_tim_.lib IM_MOD_RL_ttf_.lib IM_MOD_RL_txt_.lib IM_MOD_RL_uil_.lib IM_MOD_RL_url_.lib IM_MOD_RL_uyvy_.lib IM_MOD_RL_vicar_.lib IM_MOD_RL_vid_.lib IM_MOD_RL_viff_.lib IM_MOD_RL_wbmp_.lib IM_MOD_RL_wmf_.lib IM_MOD_RL_wpg_.lib IM_MOD_RL_x_.lib IM_MOD_RL_xbm_.lib IM_MOD_RL_xc_.lib IM_MOD_RL_xcf_.lib IM_MOD_RL_xpm_.lib IM_MOD_RL_xwd_.lib IM_MOD_RL_yuv_.lib IM_MOD_RL_xtrn_.lib winmm.lib dxguid.lib wsock32.lib kernel32.lib user32.lib gdi32.lib odbc32.lib odbccp32.lib ole32.lib oleaut32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:IX86 /libpath:"..\..\..\..\VisualMagick\lib"
-# SUBTRACT LINK32 /pdb:none
-# Begin Custom Build - Performing registration
-OutDir=.\ReleaseMinDependency
-TargetPath=.\ReleaseMinDependency\ImageMagickObject.dll
-InputPath=.\ReleaseMinDependency\ImageMagickObject.dll
-SOURCE="$(InputPath)"
-
-"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	regsvr32 /s /c "$(TargetPath)" 
-	echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" 
-	
-# End Custom Build
-
-!ELSEIF  "$(CFG)" == "ImageMagickObject - Win32 Unicode Release MinSize"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "ReleaseUMinSize"
-# PROP BASE Intermediate_Dir "ReleaseUMinSize"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "ReleaseUMinSize"
-# PROP Intermediate_Dir "ReleaseUMinSize"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-LIB32=link.exe -lib
-# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O1 /I "..\..\..\.." /I "..\..\..\..\magick" /I "..\..\..\..\xlib" /D "NDEBUG" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "_VISUALC_" /D "NeedFunctionPrototypes" /D "_LIB" /Yu"stdafx.h" /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 CORE_RL_bzlib_.lib CORE_RL_fpx_.lib CORE_RL_jbig_.lib CORE_RL_jpeg_.lib CORE_RL_lcms_.lib CORE_RL_libxml_.lib CORE_RL_magick_.lib CORE_RL_Magick++_.lib CORE_RL_png_.lib CORE_RL_tiff_.lib CORE_RL_ttf_.lib CORE_RL_xlib_.lib CORE_RL_zlib_.lib CORE_RL_jp2_.lib CORE_RL_wmf_.lib IM_MOD_RL_art_.lib IM_MOD_RL_avi_.lib IM_MOD_RL_avs_.lib IM_MOD_RL_bmp_.lib IM_MOD_RL_caption_.lib IM_MOD_RL_clipboard_.lib IM_MOD_RL_cmyk_.lib IM_MOD_RL_cut_.lib IM_MOD_RL_dcm_.lib IM_MOD_RL_dib_.lib IM_MOD_RL_dps_.lib IM_MOD_RL_dpx_.lib IM_MOD_RL_emf_.lib IM_MOD_RL_ept_.lib IM_MOD_RL_fax_.lib IM_MOD_RL_fits_.lib IM_MOD_RL_fpx_.lib IM_MOD_RL_gif_.lib IM_MOD_RL_gradient_.lib IM_MOD_RL_gray_.lib IM_MOD_RL_hdf_.lib IM_MOD_RL_histogram_.lib IM_MOD_RL_html_.lib IM_MOD_RL_icon_.lib IM_MOD_RL_jbig_.lib IM_MOD_RL_jp2_.lib IM_MOD_RL_jpeg_.lib IM_MOD_RL_label_.lib IM_MOD_RL_locale_.lib IM_MOD_RL_logo_.lib IM_MOD_RL_map_.lib IM_MOD_RL_mat_.lib IM_MOD_RL_matte_.lib IM_MOD_RL_meta_.lib IM_MOD_RL_miff_.lib IM_MOD_RL_mono_.lib IM_MOD_RL_mpc_.lib IM_MOD_RL_mpeg_.lib IM_MOD_RL_mpr_.lib IM_MOD_RL_msl_.lib IM_MOD_RL_mtv_.lib IM_MOD_RL_mvg_.lib IM_MOD_RL_null_.lib IM_MOD_RL_otb_.lib IM_MOD_RL_palm_.lib IM_MOD_RL_pcd_.lib IM_MOD_RL_pcl_.lib IM_MOD_RL_pcx_.lib IM_MOD_RL_pdb_.lib IM_MOD_RL_pdf_.lib IM_MOD_RL_pict_.lib IM_MOD_RL_pix_.lib IM_MOD_RL_plasma_.lib IM_MOD_RL_png_.lib IM_MOD_RL_pnm_.lib IM_MOD_RL_preview_.lib IM_MOD_RL_ps_.lib IM_MOD_RL_ps2_.lib IM_MOD_RL_ps3_.lib IM_MOD_RL_psd_.lib IM_MOD_RL_pwp_.lib IM_MOD_RL_rgb_.lib IM_MOD_RL_rla_.lib IM_MOD_RL_rle_.lib IM_MOD_RL_sct_.lib IM_MOD_RL_sfw_.lib IM_MOD_RL_sgi_.lib IM_MOD_RL_stegano_.lib IM_MOD_RL_sun_.lib IM_MOD_RL_svg_.lib IM_MOD_RL_tga_.lib IM_MOD_RL_tiff_.lib IM_MOD_RL_tile_.lib IM_MOD_RL_tim_.lib IM_MOD_RL_ttf_.lib IM_MOD_RL_txt_.lib IM_MOD_RL_uil_.lib IM_MOD_RL_url_.lib IM_MOD_RL_uyvy_.lib IM_MOD_RL_vicar_.lib IM_MOD_RL_vid_.lib IM_MOD_RL_viff_.lib IM_MOD_RL_wbmp_.lib IM_MOD_RL_wmf_.lib IM_MOD_RL_wpg_.lib IM_MOD_RL_x_.lib IM_MOD_RL_xbm_.lib IM_MOD_RL_xc_.lib IM_MOD_RL_xcf_.lib IM_MOD_RL_xpm_.lib IM_MOD_RL_xwd_.lib IM_MOD_RL_yuv_.lib IM_MOD_RL_xtrn_.lib kernel32.lib user32.lib gdi32.lib odbc32.lib odbccp32.lib ole32.lib oleaut32.lib winmm.lib dxguid.lib wsock32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"..\..\..\..\VisualMagick\lib"
-# SUBTRACT LINK32 /pdb:none
-# Begin Custom Build - Performing registration
-OutDir=.\ReleaseUMinSize
-TargetPath=.\ReleaseUMinSize\ImageMagickObject.dll
-InputPath=.\ReleaseUMinSize\ImageMagickObject.dll
-SOURCE="$(InputPath)"
-
-"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	if "%OS%"=="" goto NOTNT 
-	if not "%OS%"=="Windows_NT" goto NOTNT 
-	regsvr32 /s /c "$(TargetPath)" 
-	echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" 
-	goto end 
-	:NOTNT 
-	echo Warning : Cannot register Unicode DLL on Windows 95 
-	:end 
-	
-# End Custom Build
-
-!ELSEIF  "$(CFG)" == "ImageMagickObject - Win32 Unicode Release MinDependency"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "ReleaseUMinDependency"
-# PROP BASE Intermediate_Dir "ReleaseUMinDependency"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "ReleaseUMinDependency"
-# PROP Intermediate_Dir "ReleaseUMinDependency"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-LIB32=link.exe -lib
-# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O1 /I "..\..\..\.." /I "..\..\..\..\magick" /I "..\..\..\..\xlib" /D "NDEBUG" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "_VISUALC_" /D "NeedFunctionPrototypes" /D "_ATL_DLL" /D "_LIB" /Yu"stdafx.h" /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 CORE_RL_bzlib_.lib CORE_RL_fpx_.lib CORE_RL_jbig_.lib CORE_RL_jpeg_.lib CORE_RL_lcms_.lib CORE_RL_libxml_.lib CORE_RL_magick_.lib CORE_RL_Magick++_.lib CORE_RL_png_.lib CORE_RL_tiff_.lib CORE_RL_ttf_.lib CORE_RL_xlib_.lib CORE_RL_zlib_.lib CORE_RL_jp2_.lib CORE_RL_wmf_.lib IM_MOD_RL_art_.lib IM_MOD_RL_avi_.lib IM_MOD_RL_avs_.lib IM_MOD_RL_bmp_.lib IM_MOD_RL_caption_.lib IM_MOD_RL_clipboard_.lib IM_MOD_RL_cmyk_.lib IM_MOD_RL_cut_.lib IM_MOD_RL_dcm_.lib IM_MOD_RL_dib_.lib IM_MOD_RL_dps_.lib IM_MOD_RL_dpx_.lib IM_MOD_RL_emf_.lib IM_MOD_RL_ept_.lib IM_MOD_RL_fax_.lib IM_MOD_RL_fits_.lib IM_MOD_RL_fpx_.lib IM_MOD_RL_gif_.lib IM_MOD_RL_gradient_.lib IM_MOD_RL_gray_.lib IM_MOD_RL_hdf_.lib IM_MOD_RL_histogram_.lib IM_MOD_RL_html_.lib IM_MOD_RL_icon_.lib IM_MOD_RL_jbig_.lib IM_MOD_RL_jp2_.lib IM_MOD_RL_jpeg_.lib IM_MOD_RL_label_.lib IM_MOD_RL_locale_.lib IM_MOD_RL_logo_.lib IM_MOD_RL_map_.lib IM_MOD_RL_mat_.lib IM_MOD_RL_matte_.lib IM_MOD_RL_meta_.lib IM_MOD_RL_miff_.lib IM_MOD_RL_mono_.lib IM_MOD_RL_mpc_.lib IM_MOD_RL_mpeg_.lib IM_MOD_RL_mpr_.lib IM_MOD_RL_msl_.lib IM_MOD_RL_mtv_.lib IM_MOD_RL_mvg_.lib IM_MOD_RL_null_.lib IM_MOD_RL_otb_.lib IM_MOD_RL_palm_.lib IM_MOD_RL_pcd_.lib IM_MOD_RL_pcl_.lib IM_MOD_RL_pcx_.lib IM_MOD_RL_pdb_.lib IM_MOD_RL_pdf_.lib IM_MOD_RL_pict_.lib IM_MOD_RL_pix_.lib IM_MOD_RL_plasma_.lib IM_MOD_RL_png_.lib IM_MOD_RL_pnm_.lib IM_MOD_RL_preview_.lib IM_MOD_RL_ps_.lib IM_MOD_RL_ps2_.lib IM_MOD_RL_ps3_.lib IM_MOD_RL_psd_.lib IM_MOD_RL_pwp_.lib IM_MOD_RL_rgb_.lib IM_MOD_RL_rla_.lib IM_MOD_RL_rle_.lib IM_MOD_RL_sct_.lib IM_MOD_RL_sfw_.lib IM_MOD_RL_sgi_.lib IM_MOD_RL_stegano_.lib IM_MOD_RL_sun_.lib IM_MOD_RL_svg_.lib IM_MOD_RL_tga_.lib IM_MOD_RL_tiff_.lib IM_MOD_RL_tile_.lib IM_MOD_RL_tim_.lib IM_MOD_RL_ttf_.lib IM_MOD_RL_txt_.lib IM_MOD_RL_uil_.lib IM_MOD_RL_url_.lib IM_MOD_RL_uyvy_.lib IM_MOD_RL_vicar_.lib IM_MOD_RL_vid_.lib IM_MOD_RL_viff_.lib IM_MOD_RL_wbmp_.lib IM_MOD_RL_wmf_.lib IM_MOD_RL_wpg_.lib IM_MOD_RL_x_.lib IM_MOD_RL_xbm_.lib IM_MOD_RL_xc_.lib IM_MOD_RL_xcf_.lib IM_MOD_RL_xpm_.lib IM_MOD_RL_xwd_.lib IM_MOD_RL_yuv_.lib IM_MOD_RL_xtrn_.lib kernel32.lib user32.lib gdi32.lib odbc32.lib odbccp32.lib ole32.lib oleaut32.lib winmm.lib dxguid.lib wsock32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"..\..\..\..\VisualMagick\lib"
-# SUBTRACT LINK32 /pdb:none
-# Begin Custom Build - Performing registration
-OutDir=.\ReleaseUMinDependency
-TargetPath=.\ReleaseUMinDependency\ImageMagickObject.dll
-InputPath=.\ReleaseUMinDependency\ImageMagickObject.dll
-SOURCE="$(InputPath)"
-
-"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	if "%OS%"=="" goto NOTNT 
-	if not "%OS%"=="Windows_NT" goto NOTNT 
-	regsvr32 /s /c "$(TargetPath)" 
-	echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" 
-	goto end 
-	:NOTNT 
-	echo Warning : Cannot register Unicode DLL on Windows 95 
-	:end 
-	
-# End Custom Build
-
-!ENDIF 
-
-# Begin Target
-
-# Name "ImageMagickObject - Win32 Debug"
-# Name "ImageMagickObject - Win32 Unicode Debug"
-# Name "ImageMagickObject - Win32 Release MinSize"
-# Name "ImageMagickObject - Win32 Release MinDependency"
-# Name "ImageMagickObject - Win32 Unicode Release MinSize"
-# Name "ImageMagickObject - Win32 Unicode Release MinDependency"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\ImageMagickObject.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\ImageMagickObject.def
-# End Source File
-# Begin Source File
-
-SOURCE=.\ImageMagickObject.idl
-# ADD MTL /tlb ".\ImageMagickObject.tlb" /h "ImageMagickObject.h" /iid "ImageMagickObject_i.c" /Oicf
-# End Source File
-# Begin Source File
-
-SOURCE=.\ImageMagickObject.rc
-# End Source File
-# Begin Source File
-
-SOURCE=.\MagickImage.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.cpp
-# ADD CPP /Yc"stdafx.h"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\MagickImage.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\Resource.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# Begin Source File
-
-SOURCE=.\MagickImage.rgs
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=..\..\..\..\config\colors.xml
-# End Source File
-# End Target
-# End Project
Index: ImageMagickObject.sln
===================================================================
--- ImageMagickObject.sln	(revision 0)
+++ ImageMagickObject.sln	(revision 0)
@@ -0,0 +1,39 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageMagickObject", "ImageMagickObject.vcproj", "{DBE97348-A3A9-44CA-B3BE-44F8A4D479DD}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MagickCMD", "MagickCMD.vcproj", "{54639816-FC30-4351-BE6C-794ADD3C04DC}"
+	ProjectSection(ProjectDependencies) = postProject
+		{DBE97348-A3A9-44CA-B3BE-44F8A4D479DD} = {DBE97348-A3A9-44CA-B3BE-44F8A4D479DD}
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+		Unicode Debug|Win32 = Unicode Debug|Win32
+		Unicode Release|Win32 = Unicode Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{DBE97348-A3A9-44CA-B3BE-44F8A4D479DD}.Debug|Win32.ActiveCfg = Debug|Win32
+		{DBE97348-A3A9-44CA-B3BE-44F8A4D479DD}.Debug|Win32.Build.0 = Debug|Win32
+		{DBE97348-A3A9-44CA-B3BE-44F8A4D479DD}.Release|Win32.ActiveCfg = Release|Win32
+		{DBE97348-A3A9-44CA-B3BE-44F8A4D479DD}.Release|Win32.Build.0 = Release|Win32
+		{DBE97348-A3A9-44CA-B3BE-44F8A4D479DD}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32
+		{DBE97348-A3A9-44CA-B3BE-44F8A4D479DD}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32
+		{DBE97348-A3A9-44CA-B3BE-44F8A4D479DD}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32
+		{DBE97348-A3A9-44CA-B3BE-44F8A4D479DD}.Unicode Release|Win32.Build.0 = Unicode Release|Win32
+		{54639816-FC30-4351-BE6C-794ADD3C04DC}.Debug|Win32.ActiveCfg = Debug|Win32
+		{54639816-FC30-4351-BE6C-794ADD3C04DC}.Debug|Win32.Build.0 = Debug|Win32
+		{54639816-FC30-4351-BE6C-794ADD3C04DC}.Release|Win32.ActiveCfg = Release|Win32
+		{54639816-FC30-4351-BE6C-794ADD3C04DC}.Release|Win32.Build.0 = Release|Win32
+		{54639816-FC30-4351-BE6C-794ADD3C04DC}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32
+		{54639816-FC30-4351-BE6C-794ADD3C04DC}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32
+		{54639816-FC30-4351-BE6C-794ADD3C04DC}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32
+		{54639816-FC30-4351-BE6C-794ADD3C04DC}.Unicode Release|Win32.Build.0 = Unicode Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
Index: ImageMagickObject.vcproj
===================================================================
--- ImageMagickObject.vcproj	(revision 0)
+++ ImageMagickObject.vcproj	(revision 0)
@@ -0,0 +1,571 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8,00"
+	Name="ImageMagickObject"
+	ProjectGUID="{DBE97348-A3A9-44CA-B3BE-44F8A4D479DD}"
+	RootNamespace="ImageMagickObject"
+	Keyword="AtlProj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)bin\$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)\$(ProjectName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			UseOfATL="2"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				Description=""
+				CommandLine=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName=".\Debug/ImageMagickObject.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\..,..\..\..\..\magick,..\..\..\..\xlib"
+				PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;_VISUALC_;NeedFunctionPrototypes;_LIB"
+				StringPooling="true"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderThrough=""
+				PrecompiledHeaderFile=""
+				AssemblerListingLocation=""
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\vc80.pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RegisterOutput="true"
+				AdditionalDependencies="..\..\..\..\VisualMagick\lib\CORE_DB_*.lib ..\..\..\..\VisualMagick\lib\IM_MOD_DB_*.lib odbc32.lib odbccp32.lib winmm.lib wsock32.lib comsvcs.lib"
+				OutputFile="$(OutDir)/ImageMagickObject.dll"
+				LinkIncremental="2"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories="..\..\..\..\VisualMagick\lib"
+				ModuleDefinitionFile=""
+				MergedIDLBaseFileName="$(IntDir)\ImageMagickObject.idl"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/ImageMagickObject.pdb"
+				SubSystem="2"
+				ImportLibrary="$(OutDir)/ImageMagickObject.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Debug/ImageMagickObject.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)bin\$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)\$(ProjectName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			UseOfATL="1"
+			ATLMinimizesCRunTimeLibraryUsage="true"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				Description=""
+				CommandLine=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName=".\ReleaseMinDependency/ImageMagickObject.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="2"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\..,..\..\..\..\magick,..\..\..\..\xlib"
+				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;_VISUALC_;NeedFunctionPrototypes;_LIB"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderThrough=""
+				PrecompiledHeaderFile=""
+				AssemblerListingLocation=""
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\vc80.pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RegisterOutput="true"
+				AdditionalDependencies="..\..\..\..\VisualMagick\lib\CORE_DB_*.lib ..\..\..\..\VisualMagick\lib\IM_MOD_DB_*.lib odbc32.lib odbccp32.lib winmm.lib wsock32.lib comsvcs.lib"
+				OutputFile="$(OutDir)/ImageMagickObject.dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories="..\..\..\..\VisualMagick\lib"
+				ModuleDefinitionFile=""
+				MergedIDLBaseFileName="$(IntDir)\ImageMagickObject.idl"
+				ProgramDatabaseFile="$(OutDir)/ImageMagickObject.pdb"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				SetChecksum="true"
+				ImportLibrary="$(OutDir)/ImageMagickObject.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\ReleaseMinDependency/ImageMagickObject.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Unicode Debug|Win32"
+			OutputDirectory="$(SolutionDir)bin\$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)\$(ProjectName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			UseOfATL="2"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				Description=""
+				CommandLine=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName=".\DebugU/ImageMagickObject.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\..,..\..\..\..\magick,..\..\..\..\xlib"
+				PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;_VISUALC_;NeedFunctionPrototypes;_LIB"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderThrough=""
+				PrecompiledHeaderFile=""
+				AssemblerListingLocation=""
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\vc80.pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RegisterOutput="true"
+				AdditionalDependencies="..\..\..\..\VisualMagick\lib\CORE_DB_*.lib ..\..\..\..\VisualMagick\lib\IM_MOD_DB_*.lib odbc32.lib odbccp32.lib winmm.lib wsock32.lib comsvcs.lib"
+				OutputFile="$(OutDir)/ImageMagickObject.dll"
+				LinkIncremental="2"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories="..\..\..\..\VisualMagick\lib"
+				ModuleDefinitionFile=""
+				MergedIDLBaseFileName="$(IntDir)\ImageMagickObject.idl"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/ImageMagickObject.pdb"
+				SubSystem="2"
+				ImportLibrary="$(OutDir)/ImageMagickObject.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\DebugU/ImageMagickObject.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Unicode Release|Win32"
+			OutputDirectory="$(SolutionDir)bin\$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)\$(ProjectName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			UseOfATL="1"
+			ATLMinimizesCRunTimeLibraryUsage="true"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				Description=""
+				CommandLine=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName=".\ReleaseUMinDependency/ImageMagickObject.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="2"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\..,..\..\..\..\magick,..\..\..\..\xlib"
+				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;_VISUALC_;NeedFunctionPrototypes;_ATL_DLL;_LIB"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderThrough=""
+				PrecompiledHeaderFile=""
+				AssemblerListingLocation=""
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\vc80.pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RegisterOutput="true"
+				AdditionalDependencies="..\..\..\..\VisualMagick\lib\CORE_DB_*.lib ..\..\..\..\VisualMagick\lib\IM_MOD_DB_*.lib odbc32.lib odbccp32.lib winmm.lib wsock32.lib comsvcs.lib"
+				OutputFile="$(OutDir)/ImageMagickObject.dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories="..\..\..\..\VisualMagick\lib"
+				ModuleDefinitionFile=""
+				MergedIDLBaseFileName="$(IntDir)\ImageMagickObject.idl"
+				ProgramDatabaseFile="$(OutDir)/ImageMagickObject.pdb"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				SetChecksum="true"
+				ImportLibrary="$(OutDir)/ImageMagickObject.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\ReleaseUMinDependency/ImageMagickObject.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+			>
+			<File
+				RelativePath="ImageMagickObject.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Unicode Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Unicode Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions="_ATL_MIN_CRT"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="ImageMagickObject.rc"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCResourceCompilerTool"
+						PreprocessorDefinitions=""
+						AdditionalIncludeDirectories="$(OUTDIR)"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCResourceCompilerTool"
+						PreprocessorDefinitions=""
+						AdditionalIncludeDirectories="$(OUTDIR)"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Unicode Debug|Win32"
+					>
+					<Tool
+						Name="VCResourceCompilerTool"
+						PreprocessorDefinitions=""
+						AdditionalIncludeDirectories="$(OUTDIR)"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Unicode Release|Win32"
+					>
+					<Tool
+						Name="VCResourceCompilerTool"
+						PreprocessorDefinitions=""
+						AdditionalIncludeDirectories="$(OUTDIR)"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Generated files"
+			>
+			<File
+				RelativePath=".\ImageMagickObject.idl"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCMIDLTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCMIDLTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Unicode Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCMIDLTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Unicode Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCMIDLTool"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
Index: MagickCMD.cpp
===================================================================
--- MagickCMD.cpp	(revision 7)
+++ MagickCMD.cpp	(working copy)
@@ -1,3 +1,7 @@
+/*
+	MagickCMD.cpp
+*/
+
 #include <iostream>
 #include <atlbase.h>
 #include <atlsafe.h>
@@ -2,3 +6,2 @@
 #import "ImageMagickObject.tlb" no_namespace
-using namespace std;
 
@@ -19,31 +22,28 @@
 static struct
   Commands
   {
-    char
-      *name;
-
-    CommandType
-      code;
+    LPCTSTR name;
+    CommandType code;
   } Commands[] =
   {
-    { "",          cmdUnknown   },
-    { "compare",   cmdCompare   },
-    { "composite", cmdComposite },
-    { "convert",   cmdConvert   },
-    { "identify",  cmdIdentify  },
-    { "mogrify",   cmdMogrify   },
-    { "montage",   cmdMontage   },
-    { "stream",    cmdStream   }
+    { _T(""),          cmdUnknown   },
+    { _T("compare"),   cmdCompare   },
+    { _T("composite"), cmdComposite },
+    { _T("convert"),   cmdConvert   },
+    { _T("identify"),  cmdIdentify  },
+    { _T("mogrify"),   cmdMogrify   },
+    { _T("montage"),   cmdMontage   },
+    { _T("stream"),    cmdStream   }
   };
 
-int main(int argc, char* argv[])
+int _tmain(int argc, TCHAR* argv[])
 {
   int
     index,
     status = 0;
 
-  char
-    *name;
+  LPCTSTR
+    name;
 
   CommandType
     code = cmdUnknown;
@@ -55,7 +55,7 @@
   index = 1;
   while ((name = Commands[index].name))
   {
-    if (stricmp(name,argv[1]) == 0)
+    if (_tcsicmp(name,argv[1]) == 0)
     {
       code = Commands[index].code;
       break;
@@ -77,7 +77,9 @@
 
     IMagickImagePtr pImageProc(__uuidof(MagickImage));
     if (pImageProc == NULL)
+    {
       status = 1;
+    }
     else
     {
       {
@@ -95,6 +97,7 @@
             CComVariant vt(argv[index]);
             HRESULT hr = vt.Detach(&args[index-2]);
           }
+          
           switch(code)
           {
             case cmdCompare:
@@ -126,13 +129,9 @@
   }
   catch(_com_error ex)
   {
-    HRESULT
-      res = ex.Error();  
-
-    _bstr_t
-      desc = ex.Description();  
-
-    printf("Error %s (0x%08x)\n",(char *)desc,res);
+    HRESULT res = ex.Error();  
+    _bstr_t desc = ex.Description();  
+    _ftprintf( stderr, _T("Error %ws (0x%08x)\n"), (wchar_t*)desc , res );
     status = 4;
   }
 
Index: MagickCMD.vcproj
===================================================================
--- MagickCMD.vcproj	(revision 0)
+++ MagickCMD.vcproj	(revision 0)
@@ -0,0 +1,345 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8,00"
+	Name="MagickCMD"
+	ProjectGUID="{54639816-FC30-4351-BE6C-794ADD3C04DC}"
+	RootNamespace="MagickCMD"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)bin\$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)\$(ProjectName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)bin\$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)\$(ProjectName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="2"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="0"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="false"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				SetChecksum="true"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Unicode Debug|Win32"
+			OutputDirectory="$(SolutionDir)bin\$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)\$(ProjectName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Unicode Release|Win32"
+			OutputDirectory="$(SolutionDir)bin\$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)\$(ProjectName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="2"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="0"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="false"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				SetChecksum="true"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\MagickCMD.cpp"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Re: ImageMagicObject - non-ASCII characters

Posted: 2009-02-23T16:07:38-07:00
by magick
We added your patch to the Subversion repository. We will report any compile / use problems in the next few days.