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

StreamFileFromBinary not working from CA


1 reply to this topic

dodoSturm

dodoSturm
  • Full Members
  • 14 posts

Posted 15 June 2009 - 11:37

Hi there,

After upgrading 'Basic MSI' project from InstallShield 9 to InstallShield 15 the function StreamFileFromBinary does not work anymore in any CA that is to be executed as "Deferred Execution". In InstallShield 9 everything works OK.

I have an InstallScript function that is doing something like this:

function DoMyDllCall(hMSI)
STRING szKey, szFileName;
NUMBER nResult;
begin
szKey = "MSISUPPORT";
szFileName = SUPPORTDIR ^ "MSISupport.dll";
DeleteFile( szFileName ); // try to delete all previous MSISupport.dll files, ignore the errors because the file may not be there
if ( StreamFileFromBinary(hMSI, szKey, szFileName) == 0 ) then
ChangeDirectory( SUPPORTDIR );
if ( UseDLL(szFileName) == 0 ) then
nResult = MSISupport2.DoFunction( INSTALLDIR, TRUE );
SprintfMsiLog( "CUSTOM ACTION RESULT: DoFunction returned %d", nResult );
UnUseDLL(szFileName);
else
SprintfMsiLog( "CUSTOM ACTION ERROR: could not use MSISupport.dll" );
endif;
ChangeDirectory( WINDIR );
else
SprintfMsiLog( "CUSTOM ACTION ERROR: could not stream out the MSISupport.dll file" );
endif;
end;

When I have the above code in an InstallScript custom action that is executed "Deferred Execution" (action between InstallInitialize and InstallFinalize) then StreamFileFromBinary does not work (in log file I see "CUSTOM ACTION ERROR: could not stream out the MSISupport.dll file"). At the time this custom action is executed the SUPPORTDIR is there and available on the disk.

When I have the above code in an InstallScript custom action that is executed "Immediate Execution" (action after InstallInitialize), then everything is OK (SUPPORTDIR is there, available on disk and of course a new one for each custom action).

In InstallShield9 all is OK. I just converted the .ism project into InstallShield 15 and since then it does not work. I have the same problem in other .ism projects that I converted from InstallShield 9 to InstallShield 15.

Looks like StreamFileFromBinary does not work in InstallShield 15 when called in an InstallScript custom action defined to be executed between InstallInitialize and InstallFinalize.

Any ideas?

Dorel Sturm
Germany




Zweitze

Zweitze
  • Full Members
  • 522 posts

Posted 16 June 2009 - 09:31

During Deferred CAs you can only call a very limited set of MSI functions. See http://msdn.microsof...y/aa370543.aspx

Some versions of InstallShield overcame this limitation by letting that deferred CA communicate with some thread created by an earlier CA, and use the handles retrieved by that CA. Indeed that's a major hack, and I guess that InstallShield removed that because it found a situation where that wouldn't work either.

The easiest way to overcome this situation is to change the type to Immediate and schedule the CA after InstallFinalize.