Important: The information in this document is obsolete and should not be used for new development.
Checking for Open Device DriversAfter locating any custom shutdown procedures,
ShutDwnPowerchecks the Device Manager's unit table to determine whether any device drivers or desk accessories are open. It also inspects the
dNeedGoodByebit in the
drvrFlagsword 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,
ShutDwnPowercalls the driver's
Controlfunction with the
csCodefield set to -1 (the
goodByeglobal 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
ShutDwnInstallto install a simple procedure that informs your driver when the computer is about to shut down. For more information about the
drvrFlagsword and the
Controlfunction, see the chapter "Device Manager" in Inside Macintosh: Devices.
ShutDwnPowerprocedure does not actually close the drivers. They stay open until the power is switched off.