Previous Book Contents Book Index Next

Inside Macintosh: Devices /
Chapter 2 - Slot Manager / Slot Manager Reference
Slot Manager Routines / Getting Information From sResources


You can use the SReadStruct function to obtain a copy of any data structure pointed to by an sResource entry. You might want to use this function, for example, when the data structure type is defined by the card designer.

FUNCTION SReadStruct (spBlkPtr: SpBlockPtr): OSErr;
A pointer to a Slot Manager parameter block.
-->spResultPtrA pointer to a memory block.
-->spsPointerPtrA pointer to the structure.
-->spSizeLongIntThe length in bytes of the structure.

The SReadStruct function copies any arbitrary data structure from the declaration ROM of an expansion card into memory.

You provide a pointer to the structure in the spsPointer field and specify the size of the structure in the spSize field. You must also allocate a memory block for the result and send a pointer to it in the spResult field.

The SReadStruct function copies the data structure into the memory block pointed to by the spResult field.

This function may alter the value of the spByteLanes field of the parameter block. Your application should not depend on the value returned in this field.

The trap macro and routine selector for the SReadStruct function are
Trap macroSelector

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
Registers on exit
D0Result code

noErr0No error
smNoMoresRsrcs-344Requested sResource not found
For information about obtaining a pointer to a data structure pointed to by the offset field of an sResource entry, rather than a copy of the data structure, see the description of the SFindStruct function on page 2-48.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996