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

Reboot using MsiSetMode not finishing Install


7 replies to this topic

Kelly Russell

Kelly Russell
  • Members
  • 72 posts

Posted 16 August 2001 - 22:29

So I have  a custom action that I call near the end of the execute sequence and in the InstallShield script I check MsiGetMode and if the Install has scheduled a reboot at the end of the install..if so I call MsiSetMode to do the reboot immediately...now I expect after the reboot for the install to finish up and show me the SetupCompleteSuccess dialog but after the reboot the install never continues...anybody know why? Have any suggestions? Thanks

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 17 August 2001 - 09:46

Where in the sequence do you call this custom action? Is it immediate or deferred?

Kelly Russell

Kelly Russell
  • Members
  • 72 posts

Posted 17 August 2001 - 18:19

Immediate....not sure where to put it...I want it just before the install ends...late enough so I know whether the install is going to reboot at the end of installation but early enough so that after reboot I will get the SetupCompleteSuccess dialog. I was trying last Action in execute sequence. Do you have any suggestions or is there addition documentation somewhere on reboot via MSISetMode and MSIGetMode? Thanks

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 17 August 2001 - 19:25

I guess that MsiSetMode with MSIRUNMODE_REBOOTNOW is similar to the ForceReboot standard action. And MSI Help says: "The ForceReboot action must come between InstallInitialize and InstallFinalize in the action sequence of the InstallExecuteSequence table."


IgorS

IgorS
  • Members
  • 38 posts

Posted 10 October 2001 - 13:03

Hi,Stefan.
I have another problem with MsiSetMode function.
May be you know its solution

I wrote custom action
-----------------------------------------------
function RequestReboot(hMSI)
int iRes;
begin                    
iRes = MsiSetMode(hMSI,MSIRUNMODE_REBOOTATEND,TRUE);
if (iRes = ERROR_ACCESS_DENIED) then
MessageBox ("Access denied", INFORMATION);
endif;
if (iRes = ERROR_INVALID_HANDLE) then
MessageBox ("Invalid handle", INFORMATION);
endif;
if (iRes = ERROR_SUCCESS) then
MessageBox ("Request reboot is succesfull.", INFORMATION);
endif;
return ERROR_SUCCESS;
end;
-----------------------------------------------------------------------

I inserted it just before InstallFinalize action in the execute sequence.
When I set this CA as Immidiatly then it works good.
But, when I set this CA as Deferred then MsiSetMode returns ERROR_INVALID_HANDLE.
It seems like Installer handle is not active allready.

Any ideas ?
Than you in advance,

Regards.


hteichert

hteichert
  • Members
  • 158 posts

Posted 23 October 2001 - 08:49

Reading a bit in Windows Installer documentation showed that MsiGetMode (i know, you're talking about MsiSetMode, but wait a moment) in deferred custom actions does only work alright for MSIRUNMODE_SCHEDULED, MSIRUNMODE_COMMIT, or MSIRUNMODE_ROLLBACK. The params MSIRUNMODE_REBOOTATEND at MSIRUNMODE_REBOOTNOW are not listed.
I don't know for sure, but I think that MsiSetMode doesn't allow these params in deferred custom actions, too. There is this sentence in MS docu:
"Functions that do not require a session handle can be accessed from a deferred custom action. " Other way round: Functions requiring a session handle cannot be used :-(


IgorS

IgorS
  • Members
  • 38 posts

Posted 23 October 2001 - 13:40

Hteichert,
It's seems that you are absolutely right.
Functions requiring a session handle cannot be used in the deferred custom actions.