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

Failed to extract file 'x.dll' from binary table


11 replies to this topic

Dave I

Dave I
  • Members
  • 195 posts

Posted 24 April 2001 - 14:51

Windows Installer 2.03, VC++ dll.

I have placed a Dll in the Binary table and have streamed it out successfully with the StreamFileFromBinary function in the Onbegin event handler.

I have a CA of  type 132096 which calls a function in the dll which IS in the temp directory as expected.   The deferred CA fails with "Failed to extract file 'x.dll' from binary table.

The dll contains sensitive content so installing it with the rest of the files then deleting it is not feasible.

Any ideas how to call a function in a dll streamed from the binary table.  The dll dependancies are correct as the same set of files where used in Setup Files in an InstallShield 5.5 Installation.

Thank you in advance.


Dave I

Dave I
  • Members
  • 195 posts

Posted 24 April 2001 - 16:32

Futhermore:  I have just come across the following in the MSI help "A dynamic-link library (DLL) custom action requires a handle to the installation session."

Now the function I am calling in the DLL does not require any install information it just sets a property in an encoded file, so why would it require a handle to the installation.  As mentioned previously I have used this Dll in IS5.5 and the function name exports are correct (.def) file.  

Arrgggg,  please help.


schonning

schonning
  • Members
  • 6 posts

Posted 24 April 2001 - 16:54

I have a CA that is called with a DoAction when user presses the NEXT button. Then, in the CA:s Target line, the CA calls the function in the DLL.

Joe Fegan

Joe Fegan
  • Members
  • 38 posts

Posted 25 April 2001 - 15:24

I'm confused. Your original post talks about a "StreamFileFromBinary" function and streaming the DLL to a temporary directory. You don't need to do anything like this yourself. The Windows Installer will do it all for you. Maybe it's something an old version of InstallShield needed? I don't know. Also I can't figure out from the Windows Installer help what a custom action of type 132096 means. What I think you want is a custom action of base type 1 (DLL in the Binary table).

Maybe an example would help. You have a function called MyFunction in a DLL called MyDll.dll and you want to call it at a certain point during the installation. You don't want to install MyDll.dll with the product because you don't want it left lying around afterwards. Here's what I would do.

Create a new row in the Binary table and import the contents of MyDll.dll into it.

   Name: bMyDll
   Data: <contents of MyDll.dll>

Create a new custom action of base type 1 that calls the function MyFunction in this DLL. If you want to defer the action then add the appropriate flags to the base type.

   Action: caCallDllFunction
   Type: 1
   Source: bMyDll
   Target: MyFunction

Add the custom action caCallDllFunction to the InstallExecuteSequence table at the appropriate point. That's all you need to do.

The function will be called with a handle to the current installer session. This is in case it needs to interact with the session e.g. read or change property values. If it doesn't want to do anything like this then it should simply ignore the handle. You can't stop the Installer from passing it though so your function will have to be declared to take one argument whether it uses it or not.

Hope this helps.


Dave I

Dave I
  • Members
  • 195 posts

Posted 27 April 2001 - 10:00

Joe, Thanks for your help, you have cleared a few things up but I am still struggling in a few areas.  

As you rightly describe, an immediate type 1 CA  just requires a dll in the binary table and a call to the function in a custom action.  No problems, this works fine.

The same CA with the deferred flag is also sucessfull if I use the "Destination Search Path" option in the CA wizard so that the file is on my hard drive, but my problem seems to be when I use a deferred CA to call a function in a dll located in the binary table.  I am still presented with the "Failed to extact dll from binary table"

Can the dll still be extracted from the binary table even if the database is not available?

What is the StreamFileFromBinaryTable for?  Is this just to call dll functions from the script?

Can someone else please try and call a function in a dll located in the binary table with a deferred type 1 CA just to check I a not going mad?

Thanks in Advance,  I am getting desperate, its taking me 3 days to call a function in a dll...oh dear.


Joe Fegan

Joe Fegan
  • Members
  • 38 posts

Posted 27 April 2001 - 12:47

I've just tried creating a DLL in the Binary table containing a single function "Whatever" that is called by a custom action. It seems to work OK both as type 1 and as various deferred types. I tried 1025, 3073 and 3137. Here's as much detail as I can give in case it helps.

Binary table:
   Name: bMsiCaDll
   Data: <the DLL itself>

Custom Action table:
   Action: caCallDll
   Type: 1025
   Source: bMsiCaDll
   Target: Whatever

InstallExecuteSequence table:
   Action: caCallDll
   Condition:
   Sequence: 6450

Contents of the C++ source file:

#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#include <time.h>
#include <msi.h>

UINT __stdcall Whatever(MSIHANDLE hInstall)
{
   FILE * f;
   char dbuffer [9];
   char tbuffer [9];

   _strdate(dbuffer);
   _strtime(tbuffer);

   f = fopen("C:\\MsiCA.txt","w");
   fprintf(f, "Custom action ran at %s %s ",
                     tbuffer, dbuffer);
   fclose(f);

   return ERROR_SUCCESS;
}

Contents of the DEF file:

LIBRARY MsiCA
DESCRIPTION  'Test MSI custom action'
EXPORTS
Whatever


SteveP

SteveP
  • Members
  • 126 posts

Posted 27 April 2001 - 18:19

Dave,

A quick question ... where does your CA fall in the execution sequence?  Remember that deferred action CA's can be scheduled only between InstallInitialize and InstallFinalize, as those are the limits of the 'scripted' sequence.  Deferred CA's scheduled outside those boundaries fail in a number of different ways, and the error messages often do not reveal the actual source of the problem.


Dave I

Dave I
  • Members
  • 195 posts

Posted 30 April 2001 - 11:00

Sorry to hassle you again guys I am probably geting on your nerves now...

Joe - All the Custom Action Types you listed are of type "Call a function in a Windows Installer dynamic-link library."  I too can get this to work.  I am having problems with:

Type:                   Call a function in a Standard DLL
Location:              Stored In the Binary Table
Return Process:    Wait for the action to finish    = TRUE
                            Ignore Custom Action Return = FALSE
InScript Exec:       Deferred Execution
Execute Sched:    Always Execute
CA Type:             132224

I am putting the the Deferred CA between InstallInitialise And InstallFinalise.

I know its cheeky but If I put a tiny test project together with the error could someone please have a look at it.

Thanks Again,
Dave.



Joe Fegan

Joe Fegan
  • Members
  • 38 posts

Posted 01 May 2001 - 17:09

OK. I don't think I can help you any further with this. I don't know what the action type "Call a function in a Standard DLL" is and can't find anything in the Windows Installer help about it. Maybe it's specific to InstallShield? I would look at your test project but I don't think there's any point.

SteveP

SteveP
  • Members
  • 126 posts

Posted 01 May 2001 - 18:39

Dave,

Feel free to email me your project.  I will take a look at it as time permits (which probably means a day or two).


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 01 May 2001 - 22:10

The "standard DLL" is a special CA type fropm InstallShield. They use a DLL to convert the parameters to properties.

Did you follow the steps described here:
http://www.installsi...buggingIPWI.htm