Important: The information in this document is obsolete and should not be used for new development.
CloseDriver
You can use theCloseDriver
function to close an open device driver.
pascal OSErr CloseDriver(short refNum);
refNum
- The driver reference number returned by the driver-opening function.
DESCRIPTION
TheCloseDriver
function closes the device driver indicated by therefNum
parameter. The Device Manager waits until the driver is inactive before calling the driver's close routine. When the driver indicates it has processed the close request, the Device Manager unlocks the driver resource if thedRAMBased
flag is set, and unlocks the device control entry if thedNeedLock
flag is not set. The Device Manager does not dispose of the device control entry or remove it from the unit table.This function is a high-level version of the low-level
PBClose
function. Use thePBClose
function when you want to specify a completion routine.
- WARNING
- You should not close drivers that other applications may be using, such as a disk driver, the AppleTalk drivers, and so on.
SPECIAL CONSIDERATIONS
The Device Manager does not queue close requests.
- WARNING
- Do not call the
CloseDriver
function at interrupt time because if the driver was processing a request when the interrupt occurred the Device Manager may loop indefinitely, waiting for the driver to complete the request.RESULT CODES
noErr 0 No error badUnitErr -21 Driver reference number does not match unit table unitEmptyErr -22 Driver reference number specifies a nil
handle in unit tableclosErr -24 Driver unable to complete close request dRemovErr -25 Attempt to remove an open driver SEE ALSO
For information about the low-level function for closing device drivers, see the next section, which describes thePBClose
function.