Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Processes
Chapter 8 - Shutdown Manager / Shutdown Manager Reference
Shutdown Manager Routines / Installing or Removing a Shutdown Procedure


ShutDwnInstall

You can use the ShutDwnInstall procedure to install a custom shutdown procedure that performs a certain task before the computer shuts down or restarts.

PROCEDURE ShutDwnInstall (shutDownProc: ProcPtr; flags: Integer);
shutDownProc

A pointer to your shutdown procedure.
flags
An integer that indicates when during the shutdown process to execute your shutdown procedure.
DESCRIPTION
The ShutDwnInstall procedure installs the custom shutdown procedure pointed to by the shutDownProc parameter. You can install more than one custom procedure; simply call ShutDwnInstall for each one. For complete information on using a shutdown procedure, see "Installing a Custom Shutdown Procedure" on page 8-9.

The flags parameter indicates when during the shutdown process ShutDwnPower or ShutDwnStart executes your shutdown procedure. The following constants serve as masks for setting the bits in the flags parameter. Set the appropriate bits to have your procedure executed at different points during shutdown.

CONST
   sdOnPowerOff      = 1;  {call procedure before power off}
   sdOnRestart       = 2;  {call procedure before restart}
   sdRestartOrPower  = 3;  {call procedure before power off }
                           { or restart}
   sdOnUnmount       = 4;  {call procedure before unmounting }
                           { volumes}
   sdOnDrivers       = 8;  {call procedure before checking for }
                           { open drivers}
The following list indicates when ShutDwnPower or ShutDwnStart executes your procedure and summarizes the known state of the computer at the point specified by each constant:

Constant	Description

sdOnDrivers
The Shutdown Manager executes your procedure before checking the Device Manager's unit table for open drivers. All Toolbox and Operating System managers are available. The system heap is available. It is safe to open files, display dialog boxes, play sounds, or perform similar tasks.
sdOnUnmount
The Shutdown Manager executes your procedure before unmounting volumes. All Toolbox and Operating System managers are available. The system heap is available. It is safe to open files, display dialog boxes, play sounds, or perform similar tasks.
sdOnRestart
The Shutdown Manager executes your procedure before restarting the computer. The system heap is still available. However, in other respects, the state of the computer is indeterminate.
sdOnPowerOff
The Shutdown Manager executes your procedure before switching off the power supply or displaying the shutdown alert box. The system heap is still available. However, in other respects, the state of the computer is indeterminate.
sdRestartOrPower

The Shutdown Manager executes your procedure before restarting the computer or before switching off the power supply or displaying the shutdown alert box. The system heap is still available. However, in other respects, the state of the computer is indeterminate.
You can also combine these constants in the following ways:

Expression	Description

sdOnPowerOff + sdOnDrivers

When the computer is shutting down, ShutDwnPower calls your shutdown procedure before checking for open drivers.
sdOnPowerOff + sdOnUnmount

When the computer is shutting down, ShutDwnPower calls your shutdown procedure before unmounting volumes.
sdOnRestart + sdOnDrivers

When the computer is to be restarted, ShutDwnStart calls your shutdown procedure before checking for open drivers.
sdOnRestart + sdOnUnmount

When the computer is to be restarted, ShutDwnStart calls your shutdown procedure before unmounting volumes.
Note
These combinations of constants are recognized by the Shutdown Manager only in system software versions 7.0 and later. ·
The Shutdown Manager executes a custom shutdown procedure just once. As soon as a custom procedure returns, the Shutdown Manager removes the address and flag entries for that procedure from its shutdown queue. As a result, the combination sdOnDrivers + sdOnUnmount does not work.

If your driver or system extension remains resident in memory after the boot process, be sure to load your shutdown procedure into the system heap because the Process Manager frees all application and other temporary heaps before calling the Shutdown Manager.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the ShutDwnInstall procedure are
Trap macroSelector
_Shutdown $0003


Previous Book Contents Book Index Next

© Apple Computer, Inc.
17 JUN 1996