cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jstuardo
Level 4

Problem calling a DLL function in InstallScript

Hello...

I have placed the following code in OnFirstUIAfter function:


UseDLL( SUPPORTDIR ^ "InstallHelper.dll" );
bResult = InstallHelper.SaveDbConnection( ISMSI_HANDLE );
UnUseDLL( SUPPORTDIR ^ "InstallHelper.dll" );


The prototype is as follows:


prototype stdcall NUMBER InstallHelper.SaveDbConnection( HWND );


And the C++ function has this signature:


UINT __stdcall SaveDbConnection(MSIHANDLE hInstall)


I have added the InstallHelper dll in Support Files / Bilboards.

When above code is run, an error teling that the function cannot be located is displayed.

What am I missing?

Thanks a lot in advance
Jaime
Labels (1)
0 Kudos
(4) Replies
dscore
Level 3

Maybe an unresolve reference while loading. You could use filemon/process explorer in order to see if the file is accessed correctly in your temp folder.
0 Kudos
RobertDickau
Flexera Alumni

You might also use Dependency Walker or dumpbin /exports to see if your function is being exported. Did you create a .def file in your DLL project?

It also appears your DLL function has the correct signature to be called directly from an MSI DLL custom action, without needing to go through the script. Is that an option?

P.S. This ancient newsletter tip (PDF) goes over that kind of thing: http://www.flexerasoftware.com/webdocuments/PDF/dlls-for-ipwi.pdf.
0 Kudos
jstuardo
Level 4

Thanks... I have uses Dependency Walker and see that the exported function was decorated. I have created a DEF file and now the function is not decorated. I cannot test it right now as I have to solve the other problem before.

But one question regarding this.

According to the PDF you pointed me to, I have to create a custom action and insert it into a sequence, but I have read in IS documentation that for InstallScript project, sequence is not taken into account, and in fact, the sequences view shows a lot of thinks that are not actually displayed when running the installation. That s why I am calling the DLL directly in the script.

I think with the change I have made, it will work, but please explain me what I wrote in the paragraph above.

Thanks
Jaime


RobertDickau wrote:
You might also use Dependency Walker or dumpbin /exports to see if your function is being exported. Did you create a .def file in your DLL project?

It also appears your DLL function has the correct signature to be called directly from an MSI DLL custom action, without needing to go through the script. Is that an option?

P.S. This ancient newsletter tip (PDF) goes over that kind of thing: http://www.flexerasoftware.com/webdocuments/PDF/dlls-for-ipwi.pdf.
0 Kudos
jstuardo
Level 4

Thanks... I have tested it and it worked.

Now I need to find the solution for the other errors I encountered.

Regards,
Jaime

RobertDickau wrote:
You might also use Dependency Walker or dumpbin /exports to see if your function is being exported. Did you create a .def file in your DLL project?

It also appears your DLL function has the correct signature to be called directly from an MSI DLL custom action, without needing to go through the script. Is that an option?

P.S. This ancient newsletter tip (PDF) goes over that kind of thing: http://www.flexerasoftware.com/webdocuments/PDF/dlls-for-ipwi.pdf.
0 Kudos