Previous Book Contents Book Index Next

Inside Macintosh: Devices /
Chapter 1 - Device Manager / Device Manager Reference
Device Manager Functions / Writing and Installing Device Drivers


You can use the DriverRemove function to remove a device driver's device control entry from the unit table and release the driver resource.

pascal OSErr DriverRemove(short refNum); 
The driver reference number.
The DriverRemove function removes a device driver's device control entry from the unit table and releases the driver resource. You specify the device driver using the refNum parameter. You must close the device driver before calling DriverRemove.

If the driver is closed, DriverRemove calls the Memory Manager function DisposeHandle to release the device control entry, then sets the corresponding handle in the unit table to nil. If the driver's dRAMBased flag is set, DriverRemove calls the Resource Manager function ReleaseResource to release the driver resource.

The DriverRemove function may move memory; you should not call it at interrupt time.

The trap macro for the DriverRemove function is _DrvrRemove (0xA03E).

You place the driver reference number in register D0. When _DrvrRemove returns, register D0 contains the result code.
Registers on entry
D0The driver reference number
Registers on exit
D0Result code

noErr0No error
dRemovErr-25Attempt to remove an open driver

Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996