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

Don't know how to call MSI API


2 replies to this topic

Stefan Secker

Stefan Secker
  • Members
  • 46 posts

Posted 04 June 2002 - 12:42

Hi there,

my problem is that i try to hide & deselect a feature
from the custom setup dialog depending on a user
input.

As i didn't find a way to do this in a different way (we are
after CostFinalize so no feature conditioning will not work)
i wanted to call the MSI API function MsiSetComponentState via a CA.

I use a basic MSI without InstallScript use (and want to
keep it that way) so i tried to call the function from the
DLL but all tries failed.

Can someone tell me how to call installer DLL functions
without using InstallScript? Or is this just impossible?

Cheers
    Stefan

luke_s

luke_s
  • Full Members
  • 532 posts

Posted 06 June 2002 - 08:05

You will need to create a DLL which is added to the binary table and you can call your custom action from there.
I am pretty sure that you cannnot call any API function from install script anyway?

anthonyh

anthonyh
  • Full Members
  • 93 posts

Posted 10 June 2002 - 14:54

I'm creating my install the same way, staying away from InstallScript.  For any of the MSI Api's that I need to call, I've written a C++ dll that I use for the custom actions.

Here is one of my simpler functions:

//************************************************
DWORD __stdcall SetDatabaseIDProperty( MSIHANDLE hInstall )
{
  char szSetupIni[MAX_PATH] = "";
  DWORD dwSize = sizeof( szSetupIni );
  MsiGetProperty( hInstall, "SOURCEDIR", szSetupIni, &dwSize );
  strcat( szSetupIni, "setup.ini" );

  char szDatabaseID[32] = "";
  dwSize = sizeof( szDatabaseID );
  if ( GetPrivateProfileString( "Database", "DatabaseID", "", szDatabaseID, sizeof( szDatabaseID ), szSetupIni ) <= 0 )
  {
     CMessage::display( hInstall, INSTALLMESSAGE_ERROR, "Unable to determine Database ID from setup.ini file." );
     return ERROR_INSTALL_FAILURE;
  }

  MsiSetProperty( hInstall, "DATABASEID", szDatabaseID );

  return ERROR_SUCCESS;
}
//************************************************



Anthony
Product Availability Developer
Avantis
Invensys Process Systems

Using InstallShield Developer 7.04 - Basic Project