Important: The information in this document is obsolete and should not be used for new development.
PBCatSearch
ThePBCatSearchfunction searches a volume's catalog file using a set of search criteria that you specify. It builds a list of all files or directories that meet your specifications.
FUNCTION PBCatSearch (paramBlock: HParmBlkPtr; async: Boolean): OSErr;
paramBlock- A pointer to a
csParam variant of an HFS parameter block.async- A Boolean value that specifies asynchronous (
TRUE) or synchronous (FALSE) execution.
--> ioCompletionProcPtrA pointer to a completion routine. <-- ioResultOSErrThe result code of the function. --> ioNamePtrStringPtrA pointer to a volume name. --> ioVRefNumIntegerA volume specification. --> ioMatchPtrFSSpecArrayPtrA pointer to an array of matches. --> ioReqMatchCountLongIntThe maximum match count. <-- ioActMatchCountLongIntThe actual match count. --> ioSearchBitsLongIntEnable bits for fields in criteria records. --> ioSearchInfo1CInfoPBPtrThe values and lower bounds. --> ioSearchInfo2CInfoPBPtrThe masks and upper bounds. --> ioSearchTimeLongIntThe maximum allowed search time. <-> ioCatPositionCatPositionRecThe current catalog position. --> ioOptBufferPtrA pointer to optional read buffer. --> ioOptBufSizeLongIntThe length of optional read buffer. DESCRIPTION
ThePBCatSearchfunction searches the volume you specify for files or directories
that match two coordinated sets of selection criteria.PBCatSearchreturns (in theioMatchPtrfield) a pointer to an array ofFSSpecrecords identifying the files and directories that match the criteria.If the catalog file changes between two timed calls to
PBCatSearch(that is, when you are usingioSearchTimeandioCatPositionto search a volume in segments and
the catalog file changes between searches),PBCatSearchreturns a result code ofcatChangedErrand no matches. Depending on what has changed on the volume,ioCatPositionmight be invalid, most likely by a few entries in one direction or another. You can continue the search, but you risk either skipping some entries or reading some twice.When
PBCatSearchhas searched the entire volume, it returnseofErr. If it exits
because it either spends the maximum time allowed byioSearchTimeor finds the maximum number of matches allowed byioReqMatchCount, it returnsnoErr. You
can specify a value of 0 in theioSearchTimefield to indicate that no time limit is to
be enforced.SPECIAL CONSIDERATIONS
Not all volumes support thePBCatSearchfunction. Before you callPBCatSearchto search a particular volume, you should call thePBHGetVolParmsfunction to determine whether that volume supportsPBCatSearch. See page 2-147 for details on callingPBHGetVolParms.Even though AFP volumes support
PBCatSearch, they do not support all of its features that are available on local volumes. These restrictions apply to AFP volumes:
- AFP volumes do not use the
ioSearchTimefield. Current versions of the AppleShare server software search for 1 second or until 4 matches are found. The AppleShare workstation software keeps requesting the appropriate number of matches until the server returns either the number specified in theioReqMatchCountfield or an error.- AFP volumes do not support both logical and physical fork lengths. If you request a search using the length of a fork, the actual minimum length used is the smallest of the values in the logical and physical fields of the
ioSearchInfo1record and the actual maximum length used is the largest of the values in the logical and physical fields of theioSearchInfo2record.- The
fsSBNegatebit of theioSearchBitsfield is ignored during searches of remote volumes that support AFP version 2.1.- If the AFP server returns
afpCatalogChanged, the catalog position record returned to your application (in theioCatPositionfield) is the same one you passed toPBCatSearch. You should clear theinitializefield of that record to restart the search from the beginning.
ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector forPBCatSearchare
Trap macro Selector _HFSDispatch $0018 RESULT CODES
SEE ALSO
See "Searching a Volume" on page 2-38 for a description of how to usePBCatSearch.