Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Chained dll


10 replies to this topic

Thomas Eskesen

Thomas Eskesen
  • Members
  • 86 posts

Posted 25 September 2003 - 14:36

Hi

Anyone know how to call a dll from a CA dll?
In InstallShield Windows Installer 2.03!

I have a CA in a DLL in the binary table, that needs to call some functions in another dll.
I can not just put the other dll in the binary table!

Thanking you in anticipation
Regards,
Thomas Eskesen

Edited by Thomas Eskesen, 25 September 2003 - 14:37.


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 25 September 2003 - 15:38

Why can't you put the other DLL in the binary table? I don't understand what your problem is.

Thomas Eskesen

Thomas Eskesen
  • Members
  • 86 posts

Posted 25 September 2003 - 15:59

Hi

I have tried - with no luck!
Any idear...?!??!

Regards,
Thomas


Thomas Eskesen

Thomas Eskesen
  • Members
  • 86 posts

Posted 25 September 2003 - 16:02

Hi

Read another post "Chained DLL, how to call a DLL that calls another one" - where there is the same problem - but here is the solution some hardcore api code.
I dont know how to do this in InstallShield 2.03!

Regards,
Thomas


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 25 September 2003 - 16:14

Are you saying your binary table can hold only 1 dll? What is the behaviuor you see? Do you get any error messages?

Thomas Eskesen

Thomas Eskesen
  • Members
  • 86 posts

Posted 25 September 2003 - 16:32

Hi

No - I all ready have 2 dll's in the binary table.
This is the 3.

When installing I get an error like "can find file dwndsinst.dll in the path...."

- and my dll (dwndsinst.dll) is not in the temp dir. Only the dll thats supposed to call dwndsinst.dll.


Reards,
Thomas

Edited by Thomas Eskesen, 25 September 2003 - 16:33.


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 25 September 2003 - 17:33

Okay, that makes sense now smile.gif
The DLL will not be extracted from binary table automatically. You will have to do this from your first DLL. A code sample (written in InstallScript but you can do the same in C) can be found here on InstallSite.

The alternatives:
- leave the DLL uncompressed on your source media
- use an authoting tool that will do it for you, e.g. InstallShield has the concept of "support files" which it will extract automatically for you

Thomas Eskesen

Thomas Eskesen
  • Members
  • 86 posts

Posted 26 September 2003 - 08:20

Hi

Thanx.... but:

I dont think I can use the MsiXxxx calls from my DLL (it requires windows ME, 2k or XP) - and I need to be able to run on all Windows Versions.....

Can I make the code in the InstallScript in 2.03? And call this Action in the beginning of my installation?
If yes: do you have an example? I dont know how to make types like MSIHANDLE, DWORD, stream, malloc etc. in the script!

What do you mean by "Support files" - is there another way to get the dll to the temp dir? I dont understand?!?!?

Regards,
Thomas


Thomas Eskesen

Thomas Eskesen
  • Members
  • 86 posts

Posted 26 September 2003 - 11:01

Hi

I'm now trying with script code - se below
And then load the dll dynamically from my other dll!!
Hopefully this works.

Regards,
Thomas



function ExtractDLLfromWI(hMSI)
.....
begin
hDB = MsiGetActiveDatabase(hMSI);
rc = MsiDatabaseOpenView( hDB, "Select * FROM `Binary` WHERE `Name`='xxxxx'", hView);
rc = MsiViewExecute( hView, NULL);

if (MsiViewFetch( hView, hRec ) == ERROR_SUCCESS)
then
OpenFileMode (FILE_MODE_BINARY);

nStopInstall = CreateFile (nvFileHandle, pathName, "dwndsinst.dll");
nBuffer = 1023;
nTotal = 0;
while (nBuffer > 0)
MsiRecordReadStream(hRec, 2, pBinary, nBuffer);
if(nBuffer > 0)then
nTotal = nTotal + nBuffer;
WriteBytes(nvFileHandle, pBinary, 0, nBuffer);
endif;
endwhile;

CloseFile (nvFileHandle);
endif;
MsiCloseHandle(hView);
MsiCloseHandle(hRec);
end;

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 26 September 2003 - 11:44

QUOTE (Thomas Eskesen @ 2003-09-26 09:20)
I dont think I can use the MsiXxxx calls from my DLL (it requires windows ME, 2k or XP) - and I need to be able to run on all Windows Versions.....

Where does it say you can't call MSI APIs on 95/98 and NT4?

Thomas Eskesen

Thomas Eskesen
  • Members
  • 86 posts

Posted 27 September 2003 - 15:16

Hi

I misunderstood my msdn. Sorry!

Regards,
Thomas