Important: The information in this document is obsolete and should not be used for new development.
ShutDwnInstall
You can use theShutDwnInstall
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
TheShutDwnInstall
procedure installs the custom shutdown procedure pointed to by theshutDownProc
parameter. You can install more than one custom procedure; simply callShutDwnInstall
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 processShutDwnPower
orShutDwnStart
executes your shutdown procedure. The following constants serve as masks for setting the bits in theflags
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 whenShutDwnPower
orShutDwnStart
executes your procedure and summarizes the known state of the computer at the point specified by each constant:
Constant Description
You can also combine these constants in the following ways:
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.
Expression Description
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
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. ·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 theShutDwnInstall
procedure are
Trap macro Selector _Shutdown $0003