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


SExec

You can use the SExec function to execute code stored in an sExecBlock data structure.

FUNCTION SExec (spBlkPtr: SpBlockPtr): OSErr;
spBlkPtr
A pointer to a Slot Manager parameter block.
-->spsPointerPtrA pointer to an sResource (described in "The sResource," beginning on page 2-7).
-->spsExecPBlkPtrA pointer to the SEBlock.
-->spIDSignedByteThe ID of the sExecBlock entry in the sResource.
XspResultLongInt 

DESCRIPTION
The SExec function loads sExecBlock code from an sResource into the current heap zone, checks its revision level, and executes the code.

You specify the sExecBlock by providing a pointer to the sResource in the spsPointer field and the ID of the sExecBlock entry in the spID field. You must also provide in the spsExecPBlk field a pointer to a slot execution parameter block. The SEBlock structure allows you to provide information about the execution of the sExecBlock code.

The SExec function passes the sExecBlock code a pointer to the SEBlock structure in register A0.

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

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the SExec function are
Trap macroSelector
_SlotManager$0023

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 D0 contains the result code.
Registers on entry
A0Address of the parameter block
D0$0023
Registers on exit
D0Result code

RESULT CODES
noErr0No error
smCodeRevErr-333The revision of the code to be executed by sExec was wrong
smCPUErr-334The CPU field of the code to be executed by sExec was wrong
smNoMoresRsrcs-344Requested sResource not found
SEE ALSO
For more information about the sExecBlock data structure, see page 2-9.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996