Page 1 of 1

Win 32 DLL Unload problems - Need call dxFinalizeGDIPlus.

Posted: Sun Jul 08, 2007 4:44 pm
by stevew
HI,
note: This post is not for the timid.

When using the Automation Win32 DLL interface (part of the Admin studio functionality only!) i have always been having with problems with running the build from "C". With InstallAWARE 5 I had finally found a solution that did not cause any crashing of miaauto.dll when my program terminates. I had to use a dynamic dll call (with VC6) like this:

Code: Select all

void BuildNow(HINSTANCE hinstCurrent) {

   HINSTANCE dllHandle = NULL;
   BUILDTYPE BuildFunctionPtr = NULL;
   BOOL freeResult = FALSE;
   BOOL runTimeLinkSuccess = FALSE;
   BOOL retVal;

   //Load the dll and keep the handle to it
   dllHandle = LoadLibrary("miaauto.dll");

   // If the handle is valid, try to get the function address.
   if (NULL != dllHandle) {
      //Get pointer to our function using GetProcAddress:
      BuildFunctionPtr = (BUILDTYPE)GetProcAddress(dllHandle, "miaBuildProjectEx");

      // If the function address is valid, call the function.
      if (runTimeLinkSuccess = (NULL != BuildFunctionPtr)) {
         GetParams();

         retVal = BuildFunctionPtr(g_var->lpProject,
                              g_var->lpOutput,
                              g_var->lpLog,
                              g_var->lpConditionals,
                              g_var->lpLanguage,
                              g_var->lpPassword,
                              g_var->nMode);
         if (retVal == FALSE){
            MessageBox(0, "Build Failed!\\nPlease review the log and correct any errors.", "Build Failed",
                              MB_OK | MB_ICONEXCLAMATION | MB_APPLMODAL);
         }
      }
      //note:  this will cause a crash of the miaauto.dll (ver5) on unload of this program -- so don't call FreeLibrary
      //freeResult = FreeLibrary(dllHandle);
   }

   if(!runTimeLinkSuccess)
      MessageBox(0, "Unable to load miaauto.dll", "File Load Error", MB_OK | MB_ICONEXCLAMATION | MB_APPLMODAL);
}


Now with InstallAWARE version 7 I find this no longer works. I'm torn with keeping the new version because it is not likely that I will be able to comunicate the details of this problem to InstallAWARE as it is too complex. I barely understand it myself. My heart is praying that you will have mercy and spend some time to resolve this problem ...

Anyway, the new error InstallAWARE 7 message from miaauto.dll when unloading is:

Exception Exception in module miaauto.dll at 001A54AB.
Need call dxFinalizeGDIPlus before free library!.


So the other question that i wonder about is that the "Finalize" concepts are usually with dot Net programming. I am using plain old Win32DLL from VC6. This shouldn't be an issue. The other thing is that I have only tested on the Vista O/S so far. I have no reason to think that there won't be a problem on XP/2K as there always was before.

Posted: Mon Jul 09, 2007 3:27 am
by MichaelNesmith
Thanks for this report! I've escalated to R&D - we should see a fix very soon.

Posted: Mon Jul 09, 2007 6:21 am
by MichaelNesmith
Here you go, this is a fixed automation DLL.

File Attached:

miaauto.zip

Posted: Mon Jul 09, 2007 9:32 am
by stevew
Thanks Michael! Outstanding! And I have tested this out and it works great.

Posted: Mon Jul 09, 2007 5:27 pm
by MichaelNesmith
Thanks to R&D for the rapid response :)

Posted: Thu Jul 12, 2007 10:41 pm
by stevew
Hi Michael, I just checked the newer 7.0.1 and the problem is not fixed. I think the fix has not been included in update even though the file date is newer. I'm afraid the fix might have been dropped accidentially?

Posted: Fri Jul 13, 2007 4:35 am
by Gizm0
Did you download and install the Trial and then generate your license, or you just generated your license?

Posted: Fri Jul 13, 2007 9:35 am
by stevew
hi, i generated a new license and downloaded the trial software again. i'm not sure why the license would be an issue. when i generate a license is this process based on what is installed on my PC?