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,ShutDwnPowerchecks the Device Manager's unit table to determine whether any device drivers or desk accessories are open. It also inspects thedNeedGoodByebit in thedrvrFlagsword 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'sControlfunction with thecsCodefield set to -1 (thegoodByeglobal 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 thedrvrFlagsword and theControlfunction, see the chapter "Device Manager" in Inside Macintosh: Devices.The
ShutDwnPowerprocedure does not actually close the drivers. They stay open until the power is switched off.