Problem in calling other DLLs from my DLL using CA
Posted 21 November 2003 - 13:25
I am using installshield developer 8.0 (no service pack) and I want to use a custom action to call some APIs from a DLL (developed using VC++ 6.0). This DLL in turn calls a lot of other DLLs to get the functionality correct.
1. I tried to remove the other DLLs and put just one Messagebox in my DLL. When I have just this DLL, which doesn't call any other DLLs; I am able to see the messagebox during custom action. So that settles the custom action's functionality testing.
2. Now, I need to use the functionality of other DLLs and hence I make the calls to those DLLs from my own DLL. And now when I try to run the MSI package this time, I get Error 1723, which states that "there is a problem with this MSI package and a DLL required for this install to complete could not be run." Could anyone help me with it?
3. When I try to write an executable (developed using VC++ 6.0) to make calls to my own DLL (which in turn is referencing the other DLLs), I am able to see the correct results without any problems.
I can send you the DLLs, code for my own DLL, and my executable if that helps.
In the meantime, please indicate the right direction.
Regards
Vivek Chopra
vivek.chopra@hp.com
Posted 21 November 2003 - 17:21
In your main DLL, use MsiDoAction to call your Custom Action.
Posted 21 November 2003 - 19:28
How does A.DLL locate and load B.dll? Is B.dll in the right place when you call your custom action? You may need to call StreamFileFromBinary on B.dll.
Stefan Krüger
InstallSite.org twitter facebook
Posted 21 November 2003 - 19:53
I have the DLLs along with the lib file and header file, and I am calling the exported functions of those DLLs.
It works if I call my own DLL from an executable (written by me) even if my DLL references those other DLLs.
To make them custom actions, I would need to have MSIHandle as a function parameter, but as I said I dont have the code for those DLLs.
Is there any other way to do it?
Thanks
Vivek Chopra
vivek.chopra@hp.com
Posted 21 November 2003 - 20:00
Your description of problem is correct. I tried with LoadLibrary for B.dll but the custom action can't even load A.dll so I am unable to debug as to where it went wrong. But the moment I remove the code in A.dll which calls functions of B.dll, it seems to work fine.
The files are copied before I execute the custom action. I am not explicitly loading the DLL as I explained above.
I could try StreamFileFromBinary for B.dll, but would this method work if I were to call another DLL (say C.dll) from B.dll ? So the chain would be something like
Custom Action -> A.dll -> B.dll -> C.dll
Regards
Vivek Chopra
Posted 22 November 2003 - 15:05
QUOTE (vichop @ 2003-11-21 20:00) |
The files are copied before I execute the custom action. I am not explicitly loading the DLL as I explained above. |
Did you verify this (e.g. insert a message box before you load the dll)?
Where in the sequence is your custom action (which sequence, before or after InstallInitialize, InstallFinalize). What execution type (immediate or deferred)?
Stefan Krüger
InstallSite.org twitter facebook
Posted 22 November 2003 - 16:34
I am not loading the B.dll explicitly, so I am not sure where you are asking me to put the messagebox.
I am calling the custom action in execute sequence, using immediate execution and calling it after installfinalize.
I can send you the DLLs and the installshield project if that helps.
Regards
Vivek Chopra
Posted 22 November 2003 - 16:59
You may need to load the DLL using LoadLibrary instead of linking statically.
Stefan Krüger
InstallSite.org twitter facebook
Posted 22 November 2003 - 19:25
Thanks a lot. It seems to be working by putting the files in windows folder as you suggested. Thank you
Actually, I am trying an application for system configuration and I am using the installshield as a wizard (dialog-based) and add the configuration functionality based on user's input in the dialogs. What I am trying to say here is that I dont need to copy the files on the system and hoping if it could be run from the source CD itself.
I want these files not to be installed but to be run from the source, because the files are required for configuration and required once only for some settings on the system, which could be done from the CD itself. Once the configuration is done, I dont need these files on the system. Whats the best way to achieve that?
If I copy the files, then there would be some delay before a user can use the application for configuration.
Is there a way out ?
Thanks for your help.
Regards
Vivek Chopra
Posted 22 November 2003 - 21:30
Stefan Krüger
InstallSite.org twitter facebook
Posted 23 November 2003 - 10:54
Do you mean to say that I would need to use LoadLibrary? When I copied the files to windows folder, I was not using LoadLibrary function. But I think you are suggesting me to use LoadLibrary function.
Could you tell me one more thing, how do I get the SourceDir path? I tried to use it in my A.dll but it showed as empty. The A.dll is called by the custom action in execute sequence and it is executed after InstallFinalize.
Then I tried to add another test custom action (called testCA) and it was written as VB Script as a part of the Custom Action itself and it was called just after costfinalize and it worked.
Do I need to do anything else to get the SourceDir path in my A.dll which is currently called after InstallFinalize?
One more thing I would like to understand from you, how should I design the solution? Since I am not looking at installing the files, do I still need to call my CAs after InstallFinalize?
Regards
Vivek Chopra
vivek.chopra@hp.com
Posted 25 November 2003 - 10:12
If you copy the DLLs that you wish to use in your custom action, the actions should be after InstallFinalize, or between InstallFiles and InstallFinalize with the "deferred execution" flag set.
Actually I don't think that a Windows Installer setup is the best solution if you don't really want to install anything, but all you want is a few wizard dialogs.
Stefan Krüger
InstallSite.org twitter facebook