InstallDriverForDevice installs the "best" driver for a device. The algorithm for determining the best driver is described in Matching Drivers With Devices.
OSErr InstallDriverForDevice(
RegEntryIDPtr device,
UnitNumber beginningUnit,
UnitNumber endingUnit,
DriverRefNum *refNum);
InstallDriverForDevice finds, loads, and installs the best driver for a device identified by its RegEntryID value. It installs the driver anywhere within the specified unit number range of the unit table and invokes its Initialize command, passing the RegEntryIDPtr value to it. The driver's initialization code must return noErr for InstallDriverForDevice to complete successfully. This function returns the driver's refNum value but it does not open the driver.
If the unit table is filled throughout the range from beginningUnit to the value returned by HighestUnitNumber, and the table has not already grown to its maximum size, it can expand to accept the new driver. To use this feature, set endingUnit larger than HighestUnitNumber().
noErr
|
0 | No error |
badUnitErr
|
-21 | Bad unit number |
unitTblFullErr
|
-29 | Unit table or requested range full |
fnfErr
|
-43 | File not found |
All CFM errors (see Inside Macintosh: PowerPC System Software) |