SAMPLE: Rebooting an MSSetup Script on User RequestLast reviewed: February 15, 1996Article ID: Q103399 |
The information in this article applies to:
SUMMARYThe MSSetup Toolkit does not provide a way for the user to arbitrarily and cleanly reboot the computer without having the RestartListEmpty function return 0 (zero). The NSETUP sample provides a work around for this situation by providing a mechanism for the user to communicate with the MSSetup dynamic-link libraries (DLLs) to cleanly reboot the computer without having a system file on the RestartList. Download NSETUP.EXE, a self-extracting file, from the Microsoft Software Library (MSL) on the following services:
MORE INFORMATIONThe MSSetup Toolkit occupies a relatively small footprint in memory while providing much of the functionality needed to author a full-featured installation program. MSSetup accomplishes this low memory requirement by having a small fixed code stub program (SETUP.EXE) copy over the larger DLLs to a temporary directory on the user's hard disk. When the script exits, this small fixed code stub cleans up after the installation script by deleting the DLLs from the user's temporary directory. Another feature built into the MSSetup Toolkit is the ability to let the user install system level DLLs while they are loaded in memory at the time of installation. MSSetup accomplishes this by maintaining a list of files that need to be installed while Windows is rebooted. The MSSetup script author accomplishes this by calling the MSSetup functions RestartListEmpty and ExitExecRestart. There is no functionality built into the MSSetup Toolkit, however, to allow the user to arbitrarily reboot Windows. A cursory examination of this situation might yield a workaround involving the call to Windows-based application programming interface (API) ExitWindows or ExitWindowsExec via the MSSetup script. However, there is a problem with this approach. Upon rebooting the system, the user will find all the MSSetup DLLs still present in the temporary directory. Because Windows exits more or less immediately upon the call to ExitWindows or ExitWindowsExec, the Setup stub program (SETUP.EXE) never has a chance to perform its cleanup (see paragraph above). To expect the installation script to provide this type of functionality further complicates the situation. Another approach to the situation is to let MSSetup handle the cleanup as it would normally. NSETUP launches SETUP.EXE and waits for it to clean up and terminate. In this manner, NSETUP relies on SETUP.EXE's behavior to delete the files in the temporary directory. The sample also demonstrates a technique for communicating between the MSSetup script and the NSETUP program via the Windows function RegisterWindowMessage. In many ways, the NSETUP sample is similar to SETUP.EXE; it is a fixed code stub program, which WinExecs SETUP.EXE and then waits in the background for the program to finish. When SETUP.EXE finishes, NSETUP consults a reboot flag set via a message sent from the MSSetup script. If the user has chosen to reboot, NSETUP makes a call to ExitWindows.
|
Additional reference words: 3.10 MSSetup tool kit softlib NSETUP.EXE
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |