SAMPLE: Rebooting an MSSetup Script on User Request

Last reviewed: February 15, 1996
Article ID: Q103399
The information in this article applies to:
  • Microsoft Windows Software Development Kit (SDK) for Windows, version 3.1

SUMMARY

The 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:

  • Microsoft Download Service (MSDL)

          Dial (206) 936-6735 to connect to MSDL
          Download NSETUP.EXE (size: 23867 bytes) 
    
  • Internet (anonymous FTP)

          ftp ftp.microsoft.com
          Change to the \SOFTLIB\MSLFILES directory
          Get NSETUP.EXE (size: 23867 bytes) 
    

MORE INFORMATION

The 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
KBCategory: kbtool kbfile
KBSubcategory: TlsMss


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 15, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.