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 / Finding sResources


SGetSRsrc

You can use the SGetSRsrc function to find any sResource, even one that has been disabled.

FUNCTION SGetSRsrc (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).
<-->spParamDataLongIntOn input: parameter flags.
On output: 0 if the sResource is enabled or 1 if disabled.
<--spRefNumIntegerThe slot resource table reference number.
<--spCategoryIntegerThe Category field of the sRsrcType entry (described on page 2-10).
<--spCTypeIntegerThe cType field of the sRsrcType entry.
<--spDrvrSWIntegerThe DrSW field of the sRsrcType entry.
<--spDrvrHWIntegerThe DrHW field of the sRsrcType entry.
<-->spSlotSignedByteThe slot number.
<-->spIdSignedByteThe sResource ID.
<-->spExtDevSignedByteThe external device identifier.
<--spHWDevSignedByteThe hardware device identifier.

DESCRIPTION
The SGetSRsrc function allows you to specify whether the function should include disabled sResources, whether it should continue looking for sResources in higher-numbered slots, and whether it should return information about the specified sResource or the one that follows it.

You specify an sResource with the spSlot, spID, and spExtDev fields of the Slot Manager parameter block you point to in the spBlkPtr parameter. You must also include flags in bits 0, 1, and 2 of the spParamData field as follows:

The SGetSRsrc function returns values in the spSlot, spID, and spExtDev fields corresponding to the sResource that it found. If you cleared the fNext flag, these fields retain the values you specified when calling the function. In addition, the function returns 0 in the spParamData field if the sResource is enabled or 1 if it is disabled. If you cleared the fAll bit, the spParamData field always returns the value 0.

The SGetSRsrc function also returns a pointer to the sResource in the spsPointer field and returns other information about the sResource in the spRefNum, spCategory, spCType, spDrvrSW, spDrvrHW, and spHwDev fields.

SPECIAL CONSIDERATIONS
The SGetSRsrc function is available only with version 1 or later of the Slot Manager. You can use the SVersion function, described on page 2-30, to determine whether the Slot Manager is version 1 or later.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the SGetSRsrc function are
Trap macroSelector
_SlotManager$000B

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

RESULT CODES
noErr0No error
smNoMoresRsrcs-344Requested sResource not found
SEE ALSO
For more control in finding sResources, you can also use the SGetTypeSRsrc function, described next.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996