Important: The information in this document is obsolete and should not be used for new development.
SGetSRsrc
You can use theSGetSRsrcfunction to find any sResource, even one that has been disabled.
FUNCTION SGetSRsrc (spBlkPtr: SpBlockPtr): OSErr;
- spBlkPtr
- A pointer to a Slot Manager parameter block.
<-- spsPointerPtr A pointer to an sResource (described in "The sResource," beginning on page 2-7). <--> spParamDataLongInt On input: parameter flags.
On output: 0 if the sResource is enabled or 1 if disabled.<-- spRefNumInteger The slot resource table reference number. <-- spCategoryInteger The Categoryfield of thesRsrcTypeentry (described on page 2-10).<-- spCTypeInteger The cTypefield of thesRsrcTypeentry.<-- spDrvrSWInteger The DrSWfield of thesRsrcTypeentry.<-- spDrvrHWInteger The DrHWfield of thesRsrcTypeentry.<--> spSlotSignedByte The slot number. <--> spIdSignedByte The sResource ID. <--> spExtDevSignedByte The external device identifier. <-- spHWDevSignedByte The hardware device identifier. DESCRIPTION
TheSGetSRsrcfunction 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, andspExtDevfields 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 thespParamDatafield as follows:
The
- Set the
fAllflag (bit 0) to search both enabled and disabled sResources. Clear this flag to search only enabled sResources.- Set the
fOneSlotflag (bit 1) to search only the specified slot. Clear this flag to search all slots.- Set the
fNextflag (bit 2) to return information about the sResource with the next higher sResource ID than the specified sResource (or the first one on the next card if thefAllflag is set). Clear this flag to return data about the specified sResource.
SGetSRsrcfunction returns values in thespSlot,spID, andspExtDevfields corresponding to the sResource that it found. If you cleared thefNextflag, these fields retain the values you specified when calling the function. In addition, the function returns 0 in thespParamDatafield if the sResource is enabled or 1 if it is disabled. If you cleared thefAllbit, thespParamDatafield always returns the value 0.The
SGetSRsrcfunction also returns a pointer to the sResource in thespsPointerfield and returns other information about the sResource in thespRefNum,spCategory,spCType,spDrvrSW,spDrvrHW, andspHwDevfields.SPECIAL CONSIDERATIONS
TheSGetSRsrcfunction is available only with version 1 or later of the Slot Manager. You can use theSVersionfunction, 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 theSGetSRsrcfunction are
Trap macro Selector _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
_SlotManagerreturns, register D0 contains the result code.
Registers on entry A0 Address of the parameter block D0 $000B
Registers on exit D0 Result code RESULT CODES
noErr 0 No error smNoMoresRsrcs -344 Requested sResource not found SEE ALSO
For more control in finding sResources, you can also use theSGetTypeSRsrcfunction, described next.