Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Devices /
Chapter 2 - Slot Manager / Slot Manager Reference
Slot Manager Routines / Loading Drivers and Executing Code From sResources


SGetDriver

You can use the SGetDriver function to load an sResource's device driver.

FUNCTION SGetDriver (spBlkPtr: SpBlockPtr): OSErr;
spBlkPtr
A pointer to a Slot Manager parameter block.
<--spResultHandleA handle to the device driver.
-->spsExecPBlkPtrA pointer to the SEBlock.
-->spSlotSignedByteThe slot number.
-->spIDSignedByteThe sResource ID.
-->spExtDevSignedByteThe external device ID.
XspSizeSignedByte 
XspFlagsSignedByte 

DESCRIPTION
The SGetDriver function loads a device driver from an sResource into a relocatable block in the system heap.

You specify an sResource with the spSlot, spID, and spExtDev fields of the Slot Manager parameter block you point to in the spBlkPtr parameter, and provide a pointer to a slot execution parameter block in the spsExecPBlk field.

The SGetDriver function searches the sResource for an sRsrcLoadRec entry. If it finds one, it loads the sLoadDriver record and executes it. If no sRsrcLoadRec entry exists, the SGetDriver function looks for an sRsrcDrvrDir entry. If it finds one, it loads the driver into memory.

The SGetDriver function returns a handle to the driver in the spResult field of the parameter block.

SPECIAL CONSIDERATIONS
The SGetDriver function allocates memory; your application should not call this function at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the SGetDriver function are
Trap macroSelector
_SlotManager$002D

You must set up register D0 with the routine selector and register A0 with the address of the Slot Manager parameter block. When _SlotManager returns, register A0 contains a handle to the loaded driver, and register D0 contains the result code.
Registers on entry
A0Address of the parameter block
D0$002D
Registers on exit
A0Handle to loaded driver
D0Result code

RESULT CODES
noErr0No error
smNoMoresRsrcs-344Requested sResource not found
SEE ALSO
For more information about sResources, including the sRsrcDrvrDir and sRsrcLoadRec entry types, see Designing Cards and Drivers for the Macintosh Family, third edition.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996