Why do some installers need to restart the compute

2019-04-26 20:49发布

问题:

I'm fairly new to deploying desktop applications, so this is the first time I'm building an installer for my software. Currently, the first time I run my software after installing it, it crashes. After that, it runs fine. I'm still in the process of debugging this issue, but I've noticed that a reboot immediately after installing and before running the software seems to fix this crash.

What are common reasons that some installers ask you to reboot before running the software?

Also, why do some installers need to restart before finishing the installation?

Thanks in advance!

回答1:

Generally, reboots between install and running are because you're replacing system DLLs that are locked. The installer sets up a run-once registry entry that copies the DLLs during boot before they're locked by Windows, and then your application can use the new DLL that you laid down.

In general, this is highly discouraged. There should be no reason anymore for anyone other than Windows itself to need to reboot after install anymore.

I'd suggest going back into a debugger to find out more details about why your application is crashing. Hopefully you have enough tracing available in your code to allow that type of debugging.



回答2:

In general, a reboot is only required if the installer needs to replace files that are currently in use (and locked) by the OS. Sometimes installers will err on the side of reboot-just-in-case, but this is rarer than it used to be.



回答3:

We've got a case with an installer I maintain where we need to force a reboot for vista only due to UAC and privilege elevation. Once the setup is complete we need to trigger a program as the current user context, not the elevated Vista context.

In your case, I suspect that some files haven't been correctly registered and you just need to stick with the debugging ;)