Important: The information in this document is obsolete and should not be used for new development.
PBGetCatInfo
You can use thePBGetCatInfofunction to get information about the files and directories in a file catalog.
FUNCTION PBGetCatInfo (paramBlock: CInfoPBPtr; async: Boolean): OSErr;for files
paramBlock- A pointer to a catalog information 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 pathname. --> ioVRefNumIntegerA volume specification. <-- ioFRefNumIntegerA file reference number. --> ioFDirIndexIntegerAn index. <-- ioFlAttribSignedByteThe file attributes. <-- ioFlFndrInfoFInfoInformation used by the Finder. <-> ioDirIDLongIntOn input, a directory ID. On output, a file ID. <-- ioFlStBlkIntegerThe first allocation block of the
data fork.<-- ioFlLgLenLongIntThe logical end-of-file of the data fork. <-- ioFlPyLenLongIntThe physical end-of-file of the
data fork.<-- ioFlRStBlkIntegerThe first allocation block of the resource fork. <-- ioFlRLgLenLongIntThe logical end-of-file of the
resource fork.<-- ioFlRPyLenLongIntThe physical end-of-file of the
resource fork.<-- ioFlCrDatLongIntThe date and time of creation. <-- ioFlMdDatLongIntThe date and time of the last modification. <-- ioFlBkDatLongIntThe date and time of the last backup. <-- ioFlXFndrInfoFXInfoAdditional information used by
the Finder.<-- ioFlParIDLongIntThe directory ID of the parent directory. <-- ioFlClpSizLongIntThe file's clump size. for directories
--> ioCompletionProcPtrA pointer to a completion routine. <-- ioResultOSErrThe result code of the function. <-> ioNamePtrStringPtrA pointer to a pathname. --> ioVRefNumIntegerA volume specification. --> ioFDirIndexIntegerAn index. <-- ioFlAttribSignedByteThe directory attributes. <-- ioACUserSignedByteThe directory access rights. <-- ioDrUsrWdsDInfoInformation used by the Finder. <-> ioDrDirIDLongIntThe directory ID. <-- ioDrNmFlsIntegerThe number of files in the directory. <-- ioDrCrDatLongIntThe date and time of creation. <-- ioDrMdDatLongIntThe date and time of the last modification. <-- ioDrBkDatLongIntThe date and time of the last backup. <-- ioDrFndrInfoDXInfoAdditional information used by
the Finder.<-- ioDrParIDLongIntThe directory ID of the parent directory. DESCRIPTION
ThePBGetCatInfofunction returns information about a file or directory, depending on the values you specify in theioFDirIndex,ioNamePtr,ioVRefNum, andioDirIDorioDrDirIDfields. If you need to determine whether the information returned is for a file or a directory, you can test bit 4 of theioFlAttribfield; if that bit is set, the information returned describes a directory.The
PBGetCatInfofunction selects a file or directory according to these rules:
With files,
- If the value of
ioFDirIndexis positive,PBGetCatInforeturns information about the file or directory whose directory index isioFDirIndexin the directory specified byioVRefNum(this will be the root directory if a volume reference number is provided).- If the value of
ioFDirIndexis 0,PBGetCatInforeturns information about the file or directory specified byioNamePtrin the directory specified byioVRefNum(again, this will be the root directory if a volume reference number is provided).- If the value of
ioFDirIndexis negative,PBGetCatInfoignoresioNamePtrand returns information about the directory specified byioDrDirID.
PBGetCatInfois similar toPBHGetFInfobut returns some additional information. If the file is open, the reference number of the first access path found is returned inioFRefNum, and the name of the file is returned inioNamePtr(unlessioNamePtrisNIL). The file's attributes are returned in theioFlAttribfield. See
the description of the fields of the CInfoPBRec data type (beginning on page 2-100)
for the meaning of the bits in this field.
With directories,
- Note
- When you get information about a file, the
ioDirIDfield contains the file ID on exit fromPBGetCatInfo. You might need to save the value ofioDirIDbefore callingPBGetCatInfoif you make subsequent calls with the same parameter block.![]()
PBGetCatInforeturns information such as the directory attributes and, for server volumes, the directory access privileges of the user. The directory attributes are encoded by bits in theioFlAttribfield and have these meanings:
Bit Meaning 0 Set if the directory is locked 1 Reserved 2 Set if the directory is within a shared area of the directory hierarchy 3 Set if the directory is a share point that is mounted by some user 4 Set if the item is a directory 5 Set if the directory is a share point 6-7 Reserved
The
- Note
- These bits in the
ioFlAttribfield for directories are read-only.
You cannot alter directory attributes by setting these bits usingPBSetCatInfo. Instead, you can callPBHSetFLockandPBHRstFLockto lock and unlock a directory, andPBShare
andPBUnshareto enable and disable file sharing on local
directories.![]()
PBGetCatInfofunction returns the directory access rights in theioACUser
field only for shared volumes. As a result, you should set this field to 0 before
callingPBGetCatInfo.You can also use
PBGetCatInfoto determine whether a file has a file ID reference.
The value of the file ID is returned in theioDirIDfield. Because that parameter could also represent a directory ID, callPBResolveFileIDRefto see if the value is a real
file ID. If you want to determine whether a file ID reference exists for a file and create one if it doesn't, usePBCreateFileIDRef, which will either create a file ID or
returnfidExists.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector forPBGetCatInfoare
Trap macro Selector _HFSDispatch $0009 RESULT CODES