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


SGetTypeSRsrc

You can use the SGetTypeSRsrc function to step through sResources of one type, including disabled ones.

FUNCTION SGetTypeSRsrc (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.
-->spTBMaskSignedByteThe type bit mask for sRsrcType fields.
<-->spSlotSignedByteThe slot number.
<-->spIdSignedByteThe sResource ID.
<-->spExtDevSignedByteThe external device identifier.
<--spHWDevSignedByteThe hardware device identifier.

DESCRIPTION
The SGetTypeSRsrc function allows you to find the next sResource of a certain type, as does the SNextTypeSRsrc function, but the SGetTypeSRsrc function also allows you to find disabled sResources and to limit searching to a single slot.

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 you specify the type of the sResource with the spCategory, spCType, spDrvrSW, and spDrvrHW fields. You must also use the spTBMask field to specify which of these sRsrcType fields should not be included in the search:

You must also set the fAll flag of the spParamData field (bit 0) to search both enabled and disabled sResources or clear this flag to search only enabled ones. Set the fOneSlot flag (bit 1) to search only the specified slot, or clear this flag to search all slots. The SGetTypeSRsrc function does not use the fNext flag (bit 2) because it always searches for the next sResource of the given type.

The SGetTypeSRsrc function returns values in the spSlot, spID, and spExtDev fields corresponding to the sResource that it found, and it returns 0 in the spParamData field if that sResource is enabled or 1 if it is disabled.

The SGetTypeSRsrc 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 SGetTypeSRsrc 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 SGetTypeSRsrc function are
Trap macroSelector
_SlotManager$000C

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

RESULT CODES
noErr0No error
smNoMoresRsrcs-344Requested sResource not found
SEE ALSO
For information on enabling and disabling sResources, see "Enabling and Disabling sResources" on page 2-18 and the description of the SetSRsrcState function in the next section.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996