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

Sheduling a Reboot in a deferred CA


1 reply to this topic

kgiloo

kgiloo
  • Full Members
  • 60 posts

Posted 12 January 2007 - 09:24

In one article of Robert Dickau, I read :
"...During deferred execution, MSI property values are fixed and cannot be changed."

http://www.installsh...mActionData.asp

So how can I schedule a Reboot in my deferred CA?


kgiloo

kgiloo
  • Full Members
  • 60 posts

Posted 12 January 2007 - 10:28

I achieved it following the recommendations in the msi faq:

http://www.microsoft...nt/msi_faq.mspx

" Deferred custom actions cannot call MsiSetMode. A deferred custom action would need to set a value in a location in the registry that an immediate custom action, sequenced after InstallFinalize would read. That immediate custom action could then schedule the reboot using MsiSetMode. If this method is required, a rollback custom action should also be provided that will delete the registry value that triggers the reboot if the installation is cancelled. "

hence in my deferred CA i recorded the reboot to the registry: "RebootIni".
i created a second CA, immediate mode, scheduled after InstallFinalize, which reads the registry and schedule the reboot if needed.

CODE

function ExFn_ScheduleReboot(hMSI)
   string szReboot;
begin
   szReboot = GetInstallerProperty("RebootIni");        
   if (StrCompare(szReboot, "1") = 0) then
       MsiSetMode(hMSI, MSIRUNMODE_REBOOTATEND, TRUE);
   endif;    
   CleanInstallerProperty();
   return ERROR_SUCCESS;
end;


I guess this is the good way(?), tell me if i'm wrong.