Important: The information in this document is obsolete and should not be used for new development.
Checking for Open Device Drivers
After locating any custom shutdown procedures,ShutDwnPower
checks the Device Manager's unit table to determine whether any device drivers or desk accessories are open. It also inspects thedNeedGoodBye
bit in thedrvrFlags
word for each driver. This bit, if set, indicates that the driver requests notification when the application heap is reinitialized or the system shuts down. Accordingly,ShutDwnPower
calls the driver'sControl
function with thecsCode
field set to -1 (thegoodBye
global constant). This notification of impending termination is called a good-bye message.A driver in an application heap also receives a good-bye message every time an application quits. For this reason, the driver cannot always determine whether a good-bye message means that the system is about to shut down. If making this distinction is important, you can call
ShutDwnInstall
to install a simple procedure that informs your driver when the computer is about to shut down. For more information about thedrvrFlags
word and theControl
function, see the chapter "Device Manager" in Inside Macintosh: Devices.The
ShutDwnPower
procedure does not actually close the drivers. They stay open until the power is switched off.