cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Tonytones
Level 3

Using RestartManager to restart explorer.exe with msi custom action problem

I have an installer that prompts users to restart their computer after an install. I would rather not have the user restart their computer in this case, and have explorer.exe just restart itself using the RestartManager API provided with Windows Vista and up.

I've created a separate executable that gets copied to the local computer during install and runs after that. The separate executable registers explorer.exe, shuts it down, and restarts it based on this code: http://msdn.microsoft.com/en-us/library/aa373681%28v=VS.85%29.aspx. When the executable is run separately from the installer, it works as designed. But when it runs as a custom action as part of an MSI package created with InstallShield, it shuts down explorer.exe but does not restart it.

I always get a 160 error code for RmRestart when it runs with the installer. The docs say it's an error code meaning there were invalid arguments provided. (http://msdn.microsoft.com/en-us/library/aa373665%28v=vs.85%29.aspx). I'm fairly positive that my arguments are not invalid as they work when the executable runs separately from Windows Installer.

I'm stuck at this point and not sure what else to do to get this working. The only thing I'm uncertain of is if "0" can be a proper session handle returned from RmStartSession() with error code of 0 (Success). Assuming this was wrong, I set up my executable to also take in the RmSessionKey that's created by Windows Installer before InstallValidate. And I use that to call my executable as a deferred action. I get an error of 4c3 for RmShutdown in this case, which seems to be an invalid error code.

Cliffs: Have separate .exe that uses RestartManager API to shutdown, restart explorer.exe that works when not run with Windows Installer, but when combined, it breaks. Seeing error code of 160 for RmRestart(). Ran out of ideas to try to get this working. I can provide code snippets if people want...

Thanks for any suggestions/comments.
Labels (1)
0 Kudos

(2) Replies
manomatt
Level 8

Can you tell me why the installer is prompting for a restart after the installation ? find the root cause and we can try to mitigate the issue
0 Kudos
Tonytones
Level 3

mano.n.s75 wrote:
Can you tell me why the installer is prompting for a restart after the installation ? find the root cause and we can try to mitigate the issue


There is a name space extension that gets installed and hooks into explorer. When there is no restart, the extension doesn't work as expected.
0 Kudos