Summary
This article will explain how to detect if a reboot is necessary.
Synopsis
This article will explain how to detect if a reboot is necessary.
Discussion
As an InstallShield developer, you will come across cases where it is necessary to install a portion of an application by using a third-party installation program. If you install the third-party program in silent mode and suppress any reboot prompts, it is possible to determine if that installation program needed to reboot the computer when it finished. In some cases, the third-party installation program might return a special value to indicate that a reboot is required, but more than likely, the third-party setup gives no indication about whether a reboot is necessary. It was for the latter situation that the function ISC_bRebootPending was developed, which examines the computer and returns TRUE if a reboot is necessary.
To understand ISC_bRebootPending, it is necessary to understand why reboots are needed in the first place. After all, good installation programs try to avoid reboots at all costs. Installation programs frequently need to update existing files on the computer to ensure that the applications they install are able to run. If any of those existing files happens to be open and, therefore, not writable, the installation program needs to queue the file for replacement immediately after the computer reboots, before the operating system or any other program can open the file again. Therefore, to determine if a reboot is required after another installation program runs, check the appropriate file-renaming queue.
Another indication of whether a reboot is required is the presence of a value in the RunOnce key in the Registry. Windows executes commands stored in the RunOnce key just after a user logs into the computer, and then Windows removes the commands from the RunOnce key. Installation programs like mdac_typ.exe and others often put commands into the RunOnce key to complete configuration of a computer after rebooting. Therefore, a complete determination of whether a reboot is required must look for values in the RunOnce key.
Returning to the issue of locked files, the queues of file replacement operations exist as lists of file rename operations, which the operating system loader performs just before Windows starts. Windows 95-style operating systems and Windows NT-style operating systems use different methods to store the names of files to rename at reboot. Windows 95 puts all of its rename operations into the file Wininit.ini. Windows NT puts the rename operations into a Registry value named "PendingFileRenameOperations". The rule is that if any file rename operations are listed in either Wininit.ini on Windows 95 or in PendingFileRenameOperations on Windows NT, a reboot is required to complete the installation or removal of some files.
ISC_bRebootPending relies on the rules above to make its assessment of the computer. ISC_bRebootPending first flushes the Registry to ensure that any subsequent reads of the Registry do not miss information that has not been written to disk, and then it determines the type of operating system: Windows 9x or Windows NT, which includes Windows 2000 and Windows XP. In the case of Windows 9x, ISC_bRebootPending looks for the file Wininit.ini and tries to read all of the values under the [rename] heading. For Windows NT, ISC_bRebootPending looks for the PendingFileRenameOperations value. In either case, if any data are found, a reboot is pending, and ISC_bRebootPending returns TRUE. If no rename operations are found, ISC_bRebootPending returns FALSE.
As a final check, ISC_bRebootPending examines the RunOnce key, and if it finds any values under that key, ISC_bRebootPending returns TRUE to indicate that a reboot is necessary.
Now that you know how ISC_bRebootPending works, you can use it to make your setup programs more robust. In addition to checking the value returned from ISC_bRebootPending after launching a third-party installation program, it's recommend to check its return value right at the beginning of a setup, to ensure that the system is in a stable state before attempting to make any changes. After all, to make sure that your setup program is successful, you should try to make sure that you are starting from a known state on the system.
|
Source code for the function ISC_bRebootPending
Sample code to call ISC_bRebootPending function
|
Related KB Articles
Checking If a Reboot Will Occur
Additional Information
Related Articles
Basic MSI Project: Launch Executable .exe File If the .exe File Is Found Using a System Search and Force a Reboot 8Number of Views Is it Necessary to set The DNS Server or Hosts File Properly to Have Name Resolution Available on The Client Side for Chec… 9Number of Views Font Uninstall Triggers a Reboot Prompt if Font is Not Installed in FontsFolder 5Number of Views Checking If a Reboot Will Occur 3Number of Views Behavior Tab Setting of the InstallShield Prerequisite Editor - If the Prerequisite Appears To Need a Reboot 4Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Case id: 00001065
Activity: Status change: 2 hours ago