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

how to reboot from custom action?


9 replies to this topic

SirMorris

SirMorris
  • Members
  • 12 posts

Posted 01 March 2004 - 21:03

Hello world,

I am giving myself an aneurism trying to work out how to signal that a reboot should occur at the end of my install.

It is a question answered many times on this board, and I understand that I must either place a REBOOT property in the msi database or add a ScheduleReboot action to the sequence table.

Having created my installer using a VS.NET setup project I don't want to have to edit the .msi file manually with orca in any way after compilation. However I don't see how I can modify the database tables as part of the setup project.

If there are no project options, then perhaps it can be achieved programatically? I have written a custom action class in c# which takes care of my special requirements post install. Is there a way to flag the need for a reboot from Install(), or possibly at Commit() time?

If anyone can tell me how I can achieve this, I'll be eternally grateful!

Many thanks in advance,
Charlie

luke_s

luke_s
  • Full Members
  • 532 posts

Posted 02 March 2004 - 02:40

Try using the API and use MsiSetMode, or you should be able to pass in REBOOT=FORCE on the command line, or via MsiSetProperty, or a special custom action thats sets properties (type 51)

SirMorris

SirMorris
  • Members
  • 12 posts

Posted 02 March 2004 - 10:57

Thanks Luke,

The installer is for an XP only consumer product and will be distributed as the .msi file only, so commandlines are out.

Could you point me towards more information about type51 cusom actions please?

The MsiXyz... calls are only available to c++ language .dll type cusom actions so I'm thinking that perhaps I might rewrite my CA in this way... watch this space!


Thanks!!


SirMorris

SirMorris
  • Members
  • 12 posts

Posted 02 March 2004 - 17:43

I have re-implimented my CA as a c++ dll and now I'm able to perform the following code when all has gone according to plan:

....

// signal that the installer should reboot at end of install
//
MsiSetMode( hInstall, MSIRUNMODE_REBOOTATEND, TRUE );

return ERROR_SUCCESS;
}


Still no reboot. sad.gif

To recap, my CA is being called after install. Is this too late to be setting the reboot flag?

Confused,

Charlie


luke_s

luke_s
  • Full Members
  • 532 posts

Posted 02 March 2004 - 23:51

Does your project include the ScheduleReboot or ForceReboot action?

I think you will need your custom action before this action.

SirMorris

SirMorris
  • Members
  • 12 posts

Posted 04 March 2004 - 10:14

No it doesn't, the IDE only lets you add user-defined CAs. sad.gif


luke_s

luke_s
  • Full Members
  • 532 posts

Posted 04 March 2004 - 22:50

What IDE are you using?

Maybe you could edit the package with Orca?

Have you tried using code to set - REBOOT=Force?

SirMorris

SirMorris
  • Members
  • 12 posts

Posted 05 March 2004 - 11:19

I am creating the .MSI using a setup project in visual studio.

The buildprocess needs to be a single step, hence I can't edit the .MSI with orca (even if I knew how.. that's some confusing shit!)

I will try setting REBOOT=Force, though I think the reason the MsiSetMode call isn't performing its duty is that the CA is being deferred, instead of immediate.

As far as I can tell, deferred CAs are allowed no interaction with the installer, and this might be the reason, though how I can tell if this is the case is anyone's guess.. There is no obvious way of either choosing nor telling the type of the CA in the VS IDE.

Would examining the CA type in orca tell me?

Thanks,

Charlie

luke_s

luke_s
  • Full Members
  • 532 posts

Posted 08 March 2004 - 23:15

Examining the Custom action in Orca will tell you the type of the custom aciton. You will need to look at the bit mask that it uses. You will then need to consult the Windows Installer SDK. (If you post the custom action type value, i will let you know what type it is)

Maybe you should look at using another type of installation creator (instead of Visual Studio?) since the visual studio one to me looks like it is not meeting your needs.

There are a few 'free' setup creators out there (makemsi) try looking on Install site, or a google search.

SirMorris

SirMorris
  • Members
  • 12 posts

Posted 09 March 2004 - 11:33

Thanks yes I was just about reaching this opinion!!

I'll have a look around thanks.

Charlie