Summary of the File Manager
C Summary
Constants
/*Gestalt constants*/
#define gestaltFSAttr 'fs ' /*file system attributes selector*/
#define gestaltFullExtFSDispatching 0 /*exports HFSDispatch traps*/
#define gestaltHasFSSpecCalls 1 /*supports FSSpec records*/
/*directory IDs*/
enum {
fsRtParID = 1, /*directory ID of root directory's parent*/
fsRtDirID = 2}; /*directory ID of volume's root directory*/
/*values for requesting file read/write permissions*/
enum {
fsCurPerm = 0, /*whatever permission is allowed*/
fsRdPerm = 1, /*read permission*/
fsWrPerm = 2, /*write permission*/
fsRdWrPerm = 3, /*exclusive read/write permission*/
fsRdWrShPerm = 4}; /*shared read/write permission*/
/*file mark positioning modes*/
enum {
fsAtMark = 0, /*at current mark}
fsFromStart = 1, /*set mark relative to beginning of file*/
fsFromLEOF = 2, /*set mark relative to logical end-of-file*/
fsFromMark = 3, /*set mark relative to current mark*/
rdVerify = 64}; /*add to above for read-verify*/
/*values for ioSearchBits in PBCatSearch parameter block*/
enum {
fsSBPartialName = 1, /*substring of name*/
fsSBFullName = 2, /*full name*/
fsSBFlAttrib = 4, /*directory flag; software lock flag*/
fsSBNegate = 16384}; /*reverse match status*/
/*for files only*/
enum {
fsSBFlFndrInfo = 8, /*Finder file info*/
fsSBFlLgLen = 32, /*logical length of data fork*/
fsSBFlPyLen = 64, /*physical length of data fork*/
fsSBFlRLgLen = 128, /*logical length of resource fork*/
fsSBFlRPyLen = 256, /*physical length of resource fork*/
fsSBFlCrDat = 512, /*file creation date*/
fsSBFlMdDat = 1024, /*file modification date*/
fsSBFlBkDat = 2048, /*file backup date*/
fsSBFlXFndrInfo = 4096, /*more Finder file info*/
fsSBFlParID = 8192}; /*file's parent ID*/
/*for directories only*/
enum {
fsSBDrUsrWds = 8, /*Finder directory info*/
fsSBDrNmFls = 16, /*number of files in directory*/
fsSBDrCrDat = 512, /*directory creation date*/
fsSBDrMdDat = 1024, /*directory modification date*/
fsSBDrBkDat = 2048, /*directory backup date*/
fsSBDrFndrInfo = 4096, /*more Finder directory info*/
fsSBDrParID = 8192}; /*directory's parent ID*/
/*value of vMForeignPrivID in file attributes buffer*/
enum {fsUnixPriv = 1}; /*A/UX privilege model*/
/*bit positions in vMAttrib field of GetVolParmsInfoBuffer*/
enum {
bHasBlankAccessPrivileges
= 4, /*volume supports inherited privileges*/
bHasBTreeMgr = 5, /*reserved*/
bHasFileIDs = 6, /*volume supports file ID functions*/
bHasCatSearch = 7, /*volume supports PBCatSearch*/
bHasUserGroupList = 8, /*volume supports AFP privileges*/
bHasPersonalAccessPrivileges
= 9, /*local file sharing is enabled*/
bHasFolderLock = 10, /*volume supports locking of folders*/
bHasShortName = 11, /*volume supports shorter volume name*/
bHasDesktopMgr = 12, /*volume supports Desktop Manager*/
bHasMoveRename = 13, /*volume supports _MoveRename*/
bHasCopyFile = 14, /*volume supports _CopyFile*/
bHasOpenDeny = 15, /*volume supports shared access modes*/
bHasExtFSVol = 16, /*volume is external file system volume*/
bNoSysDir = 17, /*volume has no system directory*/
bAccessCntl = 18, /*volume supports AFP access control*/
bNoBootBlks = 19, /*volume is not a startup volume*/
bNoDeskItems = 20, /*do not place objects on the desktop*/
bNoSwitchTo = 25, /*do not switch launch to applications*/
bTrshOffLine = 26, /*zoom volume when it is unmounted*/
bNoLclSync = 27, /*don't let Finder change mod. date*/
bNoVNEdit = 28, /*lock volume name*/
bNoMiniFndr = 29, /*reserved; always 1*/
bLocalWList = 30, /*use shared volume handle for window */
/* list*/
bLimitFCBs = 31}; /*limit file control blocks*/
/*media type in remote mounting information/*
enum {AppleShareMediaType
= 'afpm'}; /*an AppleShare volume*/
/*user authentication methods in AFP remote mounting information*/
enum {
kNoUserAuthentication = 1, /*guest status; no password needed*/
kPassword = 2, /*8-byte password*/
kEncryptPassword = 3, /*encrypted 8-byte password*/
kTwoWayEncryptPassword = 6}; /*two-way random encryption; */
/* authenticate both user and server*/
Data Types
File System Specification Record
struct FSSpec { /*file system specification*/
short vRefNum; /*volume reference number*/
long parID; /*directory ID of parent directory*/
Str63 name; /*filename or directory name*/
};
typedef struct FSSpec FSSpec;
typedef FSSpec *FSSpecPtr;
typedef FSSpecPtr *FSSpecHandle;
File and Directory Parameter Blocks
union ParamBlockRec {
IOParam ioParam;
FileParam fileParam;
VolumeParam volumeParam;
CntrlParam cntrlParam;
SlotDevParam slotDevParam;
MultiDevParam multiDevParam;
};
typedef union ParamBlockRec ParamBlockRec;
typedef ParamBlockRec *ParmBlkPtr;
#define ParamBlockHeader \
QElemPtr qLink; /*next queue entry*/\
short qType; /*queue type*/\
short ioTrap; /*routine trap*/\
Ptr ioCmdAddr; /*routine address*/\
ProcPtr ioCompletion; /*completion routine*/\
OSErr ioResult; /*result code*/\
StringPtr ioNamePtr; /*pointer to pathname*/\
short ioVRefNum; /*volume specification*/
struct IOParam {
ParamBlockHeader
short ioRefNum; /*file reference number*/
char ioVersNum; /*version number*/
char ioPermssn; /*read/write permission*/
Ptr ioMisc; /*miscellaneous*/
Ptr ioBuffer; /*data buffer*/
long ioReqCount; /*requested number of bytes*/
long ioActCount; /*actual number of bytes*/
short ioPosMode; /*positioning mode and newline char.*/
long ioPosOffset; /*positioning offset*/
};
typedef struct IOParam IOParam;
struct FileParam {
ParamBlockHeader
short ioFRefNum; /*file reference number*/
char ioFVersNum; /*file version number (unused)*/
char filler1; /*reserved*/
short ioFDirIndex; /*directory index*/
unsigned char ioFlAttrib; /*file attributes*/
unsigned char ioFlVersNum; /*file version number (unused)*/
FInfo ioFlFndrInfo; /*information used by the Finder*/
unsigned long ioFlNum; /*File ID*/
unsigned short ioFlStBlk; /*first alloc. blk. of data fork*/
long ioFlLgLen; /*logical EOF of data fork*/
long ioFlPyLen; /*physical EOF of data fork*/
unsigned short ioFlRStBlk; /*first alloc. blk. of resource fork*/
long ioFlRLgLen; /*logical EOF of resource fork*/
long ioFlRPyLen; /*physical EOF of resource fork*/
unsigned long ioFlCrDat; /*date and time of creation*/
unsigned long ioFlMdDat; /*date and time of last modification*/
};
typedef struct FileParam FileParam;
struct VolumeParam {
ParamBlockHeader
long filler2; /*reserved*/
short ioVolIndex; /*volume index*/
unsigned long ioVCrDate; /*date and time of initialization*/
unsigned long ioVLsBkUp; /*date and time of last modification*/
unsigned short ioVAtrb; /*volume attributes*/
unsigned short ioVNmFls; /*number of files in root directory*/
unsigned short ioVDirSt; /*first block of directory*/
short ioVBlLn; /*length of directory in blocks*/
unsigned short ioVNmAlBlks; /*number of allocation blocks*/
long ioVAlBlkSiz; /*size of allocation blocks*/
long ioVClpSiz; /*number of bytes to allocate*/
unsigned short ioAlBlSt; /*first block in block map*/
unsigned long ioVNxtFNum; /*next unused file ID*/
unsigned short ioVFrBlk; /*number of unused allocation blocks*/
};
typedef struct VolumeParam VolumeParam;
union HParamBlockRec { /*HFS parameter block*/
HIOParam ioParam;
HFileParam fileParam;
HVolumeParam volumeParam;
AccessParam accessParam;
ObjParam objParam;
CopyParam copyParam;
WDParam wdParam;
FIDParam fidParam;
CSParam csParam;
ForeignPrivParam foreignPrivParam;
};
typedef union HParamBlockRec HParamBlockRec;
typedef HParamBlockRec *HParmBlkPtr;
struct HIOParam {
ParamBlockHeader
short ioRefNum; /*file reference number*/
char ioVersNum; /*version number*/
char ioPermssn; /*read/write permission*/
Ptr ioMisc; /*miscellaneous*/
Ptr ioBuffer; /*data buffer*/
long ioReqCount; /*requested number of bytes*/
long ioActCount; /*actual number of bytes*/
short ioPosMode; /*positioning mode and newline char.*/
long ioPosOffset; /*positioning offset*/
};
typedef struct HIOParam HIOParam;
struct HFileParam {
ParamBlockHeader
short ioFRefNum; /*file reference number*/
char ioFVersNum; /*file version number (unused)*/
char filler1; /*reserved*/
short ioFDirIndex; /*directory index*/
char ioFlAttrib; /*file attributes*/
char ioFlVersNum; /*file version number (unused)*/
FInfo ioFlFndrInfo; /*information used by the Finder*/
long ioDirID; /*directory ID or file ID*/
unsigned short ioFlStBlk; /*first alloc. blk. of data fork*/
long ioFlLgLen; /*logical EOF of data fork*/
long ioFlPyLen; /*physical EOF of data fork*/
unsigned short ioFlRStBlk; /*first alloc. blk. of resource fork*/
long ioFlRLgLen; /*logical EOF of resource fork*/
long ioFlRPyLen; /*physical EOF of resource fork*/
unsigned long ioFlCrDat; /*date and time of creation*/
unsigned long ioFlMdDat; /*date and time of last modification*/
};
typedef struct HFileParam HFileParam;
struct HVolumeParam {
ParamBlockHeader
long filler2; /*reserved*/
short ioVolIndex; /*volume index*/
unsigned long ioVCrDate; /*date and time of initialization*/
unsigned long ioVLsMod; /*date and time of last modification*/
short ioVAtrb; /*volume attributes*/
unsigned short ioVNmFls; /*number of files in root directory*/
short ioVBitMap; /*first block of volume bitmap*/
short ioAllocPtr; /*first block of next new file*/
unsigned short ioVNmAlBlks; /*number of allocation blocks*/
long ioVAlBlkSiz; /*size of allocation blocks*/
long ioVClpSiz; /*default clump size*/
short ioAlBlSt; /*first block in volume map*/
long ioVNxtCNID; /*next unused node ID*/
unsigned short ioVFrBlk; /*number of unused allocation blocks*/
unsigned short ioVSigWord; /*volume signature*/
short ioVDrvInfo; /*drive number*/
short ioVDRefNum; /*driver reference number*/
short ioVFSID; /*file-system identifier*/
unsigned long ioVBkUp; /*date and time of last backup*/
unsigned short ioVSeqNum; /*used internally*/
long ioVWrCnt; /*volume write count*/
long ioVFilCnt; /*number of files on volume*/
long ioVDirCnt; /*number of directories on volume*/
long ioVFndrInfo[8];/*information used by the Finder*/
};
typedef struct HVolumeParam HVolumeParam;
struct AccessParam {
ParamBlockHeader
short filler3; /*reserved*/
short ioDenyModes; /*access mode information*/
short filler4; /*reserved*/
char filler5; /*reserved*/
char ioACUser; /*user access rights*/
long filler6; /*reserved*/
long ioACOwnerID; /*owner ID*/
long ioACGroupID; /*group ID*/
long ioACAccess; /*directory access rights*/
};
typedef struct AccessParam AccessParam;
struct ObjParam {
ParamBlockHeader
short filler7; /*reserved*/
short ioObjType; /*function code*/
StringPtr ioObjNamePtr; /*ptr to returned creator/group name*/
long ioObjID; /*creator/group ID*/
long ioReqCount; /*size of buffer area*/
long ioActCount; /*length of data*/
};
typedef struct ObjParam ObjParam;
struct CopyParam {
ParamBlockHeader
short ioDstVRefNum; /*destination volume identifier*/
short filler8; /*reserved*/
StringPtr ioNewName; /*pointer to destination pathname*/
StringPtr ioCopyName; /*pointer to optional name*/
long ioNewDirID; /*destination directory ID*/
long filler14; /*reserved*/
long filler15; /*reserved*/
long ioDirID; /*directory ID or file ID*/
};
typedef struct CopyParam CopyParam;
struct WDParam {
ParamBlockHeader
short filler9; /*reserved*/
short ioWDIndex; /*working directory index*/
long ioWDProcID; /*working directory user identifier*/
short ioWDVRefNum; /*working directory's vol. ref. num.*/
short filler10; /*reserved*/
long filler11; /*reserved*/
long filler12; /*reserved*/
long filler13; /*reserved*/
long ioWDDirID; /*working directory's directory ID*/
};
typedef struct WDParam WDParam;
struct FIDParam {
ParamBlockHeader
long filler1; /*reserved*/
StringPtr ioDestNamePtr; /*pointer to destination filename*/
long filler2; /*reserved*/
long ioDestDirID; /*destination parent directory ID*/
long filler3; /*reserved*/
long filler4; /*reserved*/
long ioSrcDirID; /*source parent directory ID*/
short filler5; /*reserved*/
long ioFileID; /*file ID*/
};
typedef struct FIDParam FIDParam;
struct CSParam {
ParamBlockHeader
FSSpecPtr ioMatchPtr; /*pointer to array of matches*/
long ioReqMatchCount; /*max number of matches to return*/
long ioActMatchCount; /*actual number of matches*/
long ioSearchBits; /*enable bits for matching rules*/
CInfoPBPtr ioSearchInfo1; /*pointer to values and lower */
/* bounds*/
CInfoPBPtr ioSearchInfo2; /*pointer to masks and upper */
/* bounds*/
long ioSearchTime; /*maximum time to search*/
CatPositionRec ioCatPosition; /*current catalog position*/
Ptr ioOptBuffer; /*pointer to optional read buffer*/
long ioOptBufSize; /*length of optional read buffer*/
};
typedef struct CSParam CSParam;
struct ForeignPrivParam {
ParamBlockHeader
long filler1; /*reserved*/
long filler2; /*reserved*/
Ptr ioForeignPrivBuffer; /*privileges data buffer*/
long ioForeignPrivReqCount; /*size of buffer*/
long ioForeignPrivActCount; /*amount of buffer used*/
long filler3; /*reserved*/
long ioForeignPrivDirID; /*parent directory ID of foreign */
/* file or directory*/
long ioForeignPrivInfo1; /*privileges data*/
long ioForeignPrivInfo2; /*privileges data*/
long ioForeignPrivInfo3; /*privileges data*/
long ioForeignPrivInfo4; /*privileges data*/
};
typedef struct ForeignPrivParam ForeignPrivParam;
typedef ForeignPrivParam *ForeignPrivParamPtr;
Catalog Information Parameter Blocks
enum {hFileInfo, dirInfo};
typedef unsigned char CInfoType;
union CInfoPBRec { /*catalog information parameter block*/
HFileInfo hFileInfo;
DirInfo dirInfo;
};
typedef union CInfoPBRec CInfoPBRec;
typedef CInfoPBRec *CInfoPBPtr;
struct HFileInfo {
ParamBlockHeader
short ioFRefNum; /*file reference number*/
char ioFVersNum; /*version number*/
char filler1; /*reserved*/
short ioFDirIndex; /*file index*/
char ioFlAttrib; /*file attributes*/
char ioACUser; /*directory access rights*/
FInfo ioFlFndrInfo; /*information used by the Finder*/
long ioDirID; /*directory ID or file ID*/
unsigned short ioFlStBlk; /*first alloc. blk. of data fork*/
long ioFlLgLen; /*logical EOF of data fork*/
long ioFlPyLen; /*physical EOF of data fork*/
unsigned short ioFlRStBlk; /*first alloc. blk. of resource fork*/
long ioFlRLgLen; /*logical EOF of resource fork*/
long ioFlRPyLen; /*physical EOF of resource fork*/
unsigned long ioFlCrDat; /*date and time of creation*/
unsigned long ioFlMdDat; /*date and time of last modification*/
unsigned long ioFlBkDat; /*date and time of last backup*/
FXInfo ioFlXFndrInfo; /*additional Finder information*/
long ioFlParID; /*file parent directory ID (integer)*/
long ioFlClpSiz; /*file's clump size*/
};
typedef struct HFileInfo HFileInfo;
struct DirInfo {
ParamBlockHeader
short ioFRefNum; /*file reference number*/
short filler1; /*reserved*/
short ioFDirIndex; /*directory index*/
char ioFlAttrib; /*directory attributes*/
char filler2; /*reserved*/
DInfo ioDrUsrWds; /*information used by the Finder*/
long ioDrDirID; /*directory ID*/
unsigned short ioDrNmFls; /*number of files in directory*/
short filler3[9]; /*reserved*/
unsigned long ioDrCrDat; /*date and time of creation*/
unsigned long ioDrMdDat; /*date and time of last modification*/
unsigned long ioDrBkDat; /*date and time of last backup*/
DXInfo ioDrFndrInfo; /*additional Finder information*/
long ioDrParID; /*directory's parent directory ID*/
};
typedef struct DirInfo DirInfo;
Catalog Position Record
struct CatPositionRec { /*catalog position record*/
long initialize; /*starting point*/
short priv[6]; /*private data*/
};
typedef struct CatPositionRec CatPositionRec;
Catalog Move Parameter Block
struct CMovePBRec { /*catalog move parameter block*/
QElemPtr qLink; /*next queue entry*/
short qType; /*queue type*/
short ioTrap; /*routine trap*/
Ptr ioCmdAddr; /*routine address*/
ProcPtr ioCompletion; /*completion routine*/
OSErr ioResult; /*result code*/
StringPtr ioNamePtr; /*pointer to pathname*/
short ioVRefNum; /*volume specification*/
long filler1; /*reserved*/
StringPtr ioNewName; /*name of new directory*/
long filler2; /*reserved*/
long ioNewDirID; /*directory ID of new directory*/
long filler3[2]; /*reserved*/
long ioDirID; /*directory ID of current directory*/
};
typedef struct CMovePBRec CMovePBRec;
typedef CMovePBRec *CMovePBPtr;
Working Directory Parameter Block
struct WDPBRec { /*working directory parameter block*/
QElemPtr qLink; /*next queue entry*/
short qType; /*queue type*/
short ioTrap; /*routine trap*/
Ptr ioCmdAddr; /*routine address*/
ProcPtr ioCompletion; /*completion routine*/
OSErr ioResult; /*result code*/
StringPtr ioNamePtr; /*pointer to pathname*/
short ioVRefNum; /*volume specification*/
short filler1; /*reserved*/
short ioWDIndex; /*working directory index*/
long ioWDProcID; /*working directory user identifier*/
short ioWDVRefNum; /*working directory's vol. ref. num.*/
short filler2[7]; /*reserved*/
long ioWDDirID; /*working directory's directory ID*/
};
typedef struct WDPBRec WDPBRec;
typedef WDPBRec *WDPBPtr;
File Control Block Parameter Block
struct FCBPBRec { /*file control block parameter block*/
QElemPtr qLink; /*next queue entry*/
short qType; /*queue type*/
short ioTrap; /*routine trap*/
Ptr ioCmdAddr; /*routine address*/
ProcPtr ioCompletion; /*completion routine*/
OSErr ioResult; /*result code*/
StringPtr ioNamePtr; /*pointer to pathname*/
short ioVRefNum; /*volume specification*/
short ioRefNum; /*file reference number*/
short filler; /*reserved*/
short ioFCBIndx; /*FCB index*/
short filler1; /*reserved*/
long ioFCBFlNm; /*file ID*/
short ioFCBFlags; /*flags*/
unsigned short ioFCBStBlk; /*first allocation block of file*/
long ioFCBEOF; /*logical end-of-file*/
long ioFCBPLen; /*physical end-of-file*/
long ioFCBCrPs; /*position of the file mark*/
short ioFCBVRefNum; /*volume reference number*/
long ioFCBClpSiz; /*file's clump size*/
long ioFCBParID; /*parent directory ID*/
};
typedef struct FCBPBRec FCBPBRec;
typedef FCBPBRec *FCBPBPtr;
Volume Attributes Buffer
struct GetVolParmsInfoBuffer {
short vMVersion; /*version number*/
long vMAttrib; /*volume attributes*/
Handle vMLocalHand; /*reserved*/
long vMServerAdr; /*network server address*/
long vMVolumeGrade; /*relative speed rating*/
short vMForeignPrivID; /*foreign privilege model*/
};
typedef struct GetVolParmsInfoBuffer GetVolParmsInfoBuffer;
Volume Mounting Information Records
struct VolMountInfoHeader{ /*volume mounting information*/
short length; /*length of mounting information*/
VolumeType media; /*type of volume*/
};
typedef struct VolMountInfoHeader VolMountInfoHeader;
typedef VolMountInfoHeader *VolMountInfoPtr;
struct AFPVolMountInfo{ /*AFP volume mounting information*/
short length; /*length of mounting information*/
VolumeType media; /*type of volume*/
short flags; /*reserved; must be set to 0*/
char nbpInterval; /*NBP retry interval*/
char nbpCount; /*NBP retry count*/
short uamType; /*user authentication method*/
short zoneNameOffset; /*offset to zone name*/
short serverNameOffset; /*offset server name*/
short volNameOffset; /*offset to volume name*/
short userNameOffset; /*offset to user name*/
short userPasswordOffset; /*offset to user password*/
short volPasswordOffset; /*offset to volume password*/
char AFPData[144]; /*standard AFP mounting info*/
};
typedef struct AFPVolMountInfo AFPVolMountInfo;
typedef AFPVolMountInfo *AFPVolMountInfoPtr;
Internal Data Types
Volume and File Control Blocks
struct VCB { /*volume control block*/
QElemPtr qLink; /*next queue entry*/
short qType; /*queue type*/
short vcbFlags; /*volume flags (bit 15 = 1 if dirty)*/
unsigned short vcbSigWord; /*volume signature*/
unsigned long vcbCrDate; /*date and time of volume creation*/
unsigned long vcbLsMod; /*date and time of last modification*/
short vcbAtrb; /*volume attributes*/
unsigned short vcbNmFls; /*number of files in root directory*/
short vcbVBMSt; /*first block of volume bitmap*/
short vcbAllocPtr; /*start of next allocation search*/
unsigned short vcbNmAlBlks; /*number of allocation blocks in */
/* volume*/
long vcbAlBlkSiz; /*size (in bytes) of allocation */
/* blocks*/
long vcbClpSiz; /*default clump size*/
short vcbAlBlSt; /*first allocation block in volume*/
long vcbNxtCNID; /*next unused catalog node ID*/
unsigned short vcbFreeBks; /*number of unused allocation blocks*/
Str27 vcbVN; /*volume name*/
short vcbDrvNum; /*drive number*/
short vcbDRefNum; /*driver reference number*/
short vcbFSID; /*file-system identifier*/
short vcbVRefNum; /*volume reference number*/
Ptr vcbMAdr; /*used internally*/
Ptr vcbBufAdr; /*used internally*/
short vcbMLen; /*used internally*/
short vcbDirIndex; /*used internally*/
short vcbDirBlk; /*used internally*/
unsigned long vcbVolBkUp; /*date and time of last backup*/
unsigned short vcbVSeqNum; /*volume backup sequence number*/
long vcbWrCnt; /*volume write count*/
long vcbXTClpSiz; /*clump size for extents overflow */
/* file*/
long vcbCTClpSiz; /*clump size for catalog file*/
unsigned short vcbNmRtDirs; /*number of directories in root dir.*/
long vcbFilCnt; /*number of files in volume*/
long vcbDirCnt; /*number of directories in volume*/
long vcbFndrInfo[8];/*information used by the Finder*/
unsigned short vcbVCSize; /*used internally*/
unsigned short vcbVBMCSiz; /*used internally*/
unsigned short vcbCtlCSiz; /*used internally*/
unsigned short vcbXTAlBlks; /*size of extents overflow file*/
unsigned short vcbCTAlBlks; /*size of catalog file*/
short vcbXTRef; /*ref. num. for extents overflow */
/* file*/
short vcbCTRef; /*ref. num. for catalog file*/
Ptr vcbCtlBuf; /*ptr. to extents and catalog caches*/
long vcbDirIDM; /*directory last searched*/
short vcbOffsM; /*offspring index at last search*/
};
typedef struct VCB VCB;
struct FCB { /*file control block*/
long fcbFlNum; /*file ID*/
short fcbFlags; /*file flags*/
short fcbSBlk; /*first allocation block of file*/
long fcbEOF; /*logical end-of-file*/
long fcbPLen; /*physical end-of-file*/
long fcbCrPs; /*current file mark position*/
Ptr fcbVPtr; /*pointer to volume control block*/
Ptr fcbBfAdr; /*pointer to access path buffer*/
short fcbFlPos; /*unused*/
long fcbClmpSize; /*file clump size*/
Ptr fcbBTCBPtr; /*pointer to B*-tree control block*/
ExtDataRec fcbExtRec; /*first three file extents*/
long fcbFType; /*file's four Finder type bytes*/
long fcbCatPos; /*catalog hint for use on Close*/
long fcbDirID; /*file's parent directory ID*/
Str31 fcbCName; /*name of file*/
};
typedef struct FCB FCB;
Drive Queue Elements
struct DrvQEl { /*drive queue element*/
QElemPtr qLink; /*next queue entry*/
short qType; /*flag for dQDrvSz and dQDrvSz2*/
short dQDrive; /*drive number*/
short dQRefNum; /*driver reference number*/
short dQFSID; /*file-system identifier*/
unsigned short dQDrvSz; /*number of logical blocks on drive*/
unsigned short dQDrvSz2; /*additional field for large drives*/
};
typedef struct DrvQEl DrvQEl;
High-Level File Access Routines
Reading, Writing, and Closing Files
pascal OSErr FSRead (short refNum, long *count, Ptr buffPtr);
pascal OSErr FSWrite (short refNum, long *count, Ptr buffPtr);
pascal OSErr FSClose (short refNum);
Manipulating the File Mark
pascal OSErr GetFPos (short refNum, long *filePos);
pascal OSErr SetFPos (short refNum, short posMode, long posOff);
Manipulating the End-of-File
pascal OSErr GetEOF (short refNum, long *logEOF);
pascal OSErr SetEOF (short refNum, long logEOF);
Allocating File Blocks
pascal OSErr Allocate (short refNum, long *count);
pascal OSErr AllocContig(short refNum, long *count);
Low-Level File Access Routines
Reading, Writing, and Closing Files
pascal OSErr PBRead (ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBReadSync (ParmBlkPtr paramBlock);
pascal OSErr PBReadAsync (ParmBlkPtr paramBlock);
pascal OSErr PBWrite (ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBWriteSync (ParmBlkPtr paramBlock);
pascal OSErr PBWriteAsync (ParmBlkPtr paramBlock);
pascal OSErr PBClose (ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBCloseSync (ParmBlkPtr paramBlock);
pascal OSErr PBCloseAsync (ParmBlkPtr paramBlock);
Manipulating the File Mark
pascal OSErr PBGetFPos (ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBGetFPosSync (ParmBlkPtr paramBlock);
pascal OSErr PBGetFPosAsync (ParmBlkPtr paramBlock);
pascal OSErr PBSetFPos (ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBSetFPosSync (ParmBlkPtr paramBlock);
pascal OSErr PBSetFPosAsync (ParmBlkPtr paramBlock);
Manipulating the End-of-File
pascal OSErr PBGetEOF (ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBGetEOFSync (ParmBlkPtr paramBlock);
pascal OSErr PBGetEOFAsync (ParmBlkPtr paramBlock);
pascal OSErr PBSetEOF (ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBSetEOFSync (ParmBlkPtr paramBlock);
pascal OSErr PBSetEOFAsync (ParmBlkPtr paramBlock);
Allocating File Blocks
pascal OSErr PBAllocate (ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBAllocateSync (ParmBlkPtr paramBlock);
pascal OSErr PBAllocateAsync (ParmBlkPtr paramBlock);
pascal OSErr PBAllocContig (ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBAllocContigSync
(ParmBlkPtr paramBlock);
pascal OSErr PBAllocContigAsync
(ParmBlkPtr paramBlock);
Updating Files
pascal OSErr PBFlushFile (ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBFlushFileSync (ParmBlkPtr paramBlock);
pascal OSErr PBFlushFileAsync
(ParmBlkPtr paramBlock);
High-Level Volume Access Routines
Unmounting Volumes
pascal OSErr UnmountVol (StringPtr volName, short vRefNum);
pascal OSErr Eject (StringPtr volName, short vRefNum);
Updating Volumes
pascal OSErr FlushVol (StringPtr volName, short vRefNum);
Manipulating the Default Volume
pascal OSErr GetVol (StringPtr volName, short *vRefNum);
pascal OSErr SetVol (StringPtr volName, short vRefNum);
pascal OSErr HGetVol (StringPtr volName, short *vRefNum,
long *dirID);
pascal OSErr HSetVol (StringPtr volName, short vRefNum, long dirID);
Obtaining Volume Information
pascal OSErr GetVInfo (short drvNum, StringPtr volName,
short *vRefNum, long *freeBytes);
pascal OSErr GetVRefNum (short refNum, short *vRefNum);
Low-Level Volume Access Routines
Mounting and Unmounting Volumes
pascal OSErr PBMountVol (ParmBlkPtr paramBlock);
pascal OSErr PBUnmountVol (ParmBlkPtr paramBlock);
pascal OSErr PBEject (ParmBlkPtr paramBlock);
pascal OSErr PBOffLine (ParmBlkPtr paramBlock);
Updating Volumes
pascal OSErr PBFlushVol (ParmBlkPtr paramBlock; Boolean async);
pascal OSErr PBFlushVolSync (ParmBlkPtr paramBlock);
pascal OSErr PBFlushVolAsync (ParmBlkPtr paramBlock);
Obtaining Volume Information
pascal OSErr PBHGetVInfo (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHGetVInfoSync (HParmBlkPtr paramBlock);
pascal OSErr PBHGetVInfoAsync
(HParmBlkPtr paramBlock);
pascal OSErr PBSetVInfo (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBSetVInfoSync (HParmBlkPtr paramBlock);
pascal OSErr PBSetVInfoAsync (HParmBlkPtr paramBlock);
pascal OSErr PBHGetVolParms (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHGetVolParmsSync
(HParmBlkPtr paramBlock);
pascal OSErr PBHGetVolParmsAsync
(HParmBlkPtr paramBlock);
Manipulating the Default Volume
pascal OSErr PBGetVol (ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBGetVolSync (ParmBlkPtr paramBlock);
pascal OSErr PBGetVolAsync (ParmBlkPtr paramBlock);
pascal OSErr PBSetVol (ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBSetVolSync (ParmBlkPtr paramBlock);
pascal OSErr PBSetVolAsync (ParmBlkPtr paramBlock);
pascal OSErr PBHGetVol (WDPBPtr paramBlock, Boolean async);
pascal OSErr PBHGetVolSync (WDPBPtr paramBlock);
pascal OSErr PBHGetVolAsync (WDPBPtr paramBlock);
pascal OSErr PBHSetVol (WDPBPtr paramBlock, Boolean async);
pascal OSErr PBHSetVolSync (WDPBPtr paramBlock);
pascal OSErr PBHSetVolAsync (WDPBPtr paramBlock);
File System Specification Routines
Opening Files
pascal OSErr FSpOpenDF (const FSSpec *spec, char permission,
short *refNum);
pascal OSErr FSpOpenRF (const FSSpec *spec, char permission,
short *refNum);
Creating and Deleting Files and Directories
pascal OSErr FSpCreate (const FSSpec *spec, OSType creator,
OSType fileType, ScriptCode scriptTag);
pascal OSErr FSpDirCreate (const FSSpec *spec, ScriptCode scriptTag,
long *createdDirID);
pascal OSErr FSpDelete (const FSSpec *spec);
Accessing Information About Files and Directories
pascal OSErr FSpGetFInfo (const FSSpec *spec, FInfo *fndrInfo);
pascal OSErr FSpSetFInfo (const FSSpec *spec, const FInfo *fndrInfo);
pascal OSErr FSpSetFLock (const FSSpec *spec);
pascal OSErr FSpRstFLock (const FSSpec *spec);
pascal OSErr FSpRename (const FSSpec *spec, ConstStr255Param newName);
Moving Files or Directories
pascal OSErr FSpCatMove (const FSSpec *source, const FSSpec *dest);
Exchanging the Data in Two Files
pascal OSErr FSpExchangeFiles
(const FSSpec *source, const FSSpec *dest);
Creating File System Specifications
pascal OSErr FSMakeFSSpec (short vRefNum, long dirID,
ConstStr255Param fileName, FSSpecPtr spec);
pascal OSErr PBMakeFSSpec (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBMakeFSSpecSync
(HParmBlkPtr paramBlock);
pascal OSErr PBMakeFSSpecAsync
(HParmBlkPtr paramBlock);
High-Level HFS Routines
Opening Files
pascal OSErr HOpenDF (short vRefNum, long dirID,
const Str255 fileName, char permission,
short *refNum);
pascal OSErr HOpenRF (short vRefNum, long dirID,
const Str255 fileName, char permission,
short *refNum);
pascal OSErr HOpen (short vRefNum, long dirID,
const Str255 fileName, char permission,
short *refNum);
Creating and Deleting Files and Directories
pascal OSErr HCreate (short vRefNum, long dirID,
const Str255 fileName, OSType creator,
OSType fileType);
pascal OSErr DirCreate (short vRefNum, long parentDirID,
const Str255 directoryName,
long *createdDirID);
pascal OSErr HDelete (short vRefNum, long dirID,
const Str255 fileName);
Accessing Information About Files and Directories
pascal OSErr HGetFInfo (short vRefNum, long dirID,
const Str255 fileName, FInfo *fndrInfo);
pascal OSErr HSetFInfo (short vRefNum, long dirID,
const Str255 fileName, const FInfo *fndrInfo);
pascal OSErr HSetFLock (short vRefNum, long dirID,
const Str255 fileName);
pascal OSErr HRstFLock (short vRefNum, long dirID,
const Str255 fileName);
pascal OSErr HRename (short vRefNum, long dirID,
const Str255 oldName, const Str255 newName);
Moving Files or Directories
pascal OSErr CatMove (short vRefNum, long dirID,
const Str255 oldName, long newDirID,
const Str255 newName);
Maintaining Working Directories
pascal OSErr OpenWD (short vRefNum, long dirID, long procID,
short *wdRefNum);
pascal OSErr CloseWD (short wdRefNum);
pascal OSErr GetWDInfo (short wdRefNum, short *vRefNum, long *dirID,
long *procID);
Low-Level HFS Routines
Opening Files
pascal OSErr PBHOpenDF (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHOpenDFSync (HParmBlkPtr paramBlock);
pascal OSErr PBHOpenDFAsync (HParmBlkPtr paramBlock);
pascal OSErr PBHOpenRF (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHOpenRFSync (HParmBlkPtr paramBlock);
pascal OSErr PBHOpenRFAsync (HParmBlkPtr paramBlock);
pascal OSErr PBHOpen (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHOpenSync (HParmBlkPtr paramBlock);
pascal OSErr PBHOpenAsync (HParmBlkPtr paramBlock);
Creating and Deleting Files and Directories
pascal OSErr PBHCreate (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHCreateSync (HParmBlkPtr paramBlock);
pascal OSErr PBHCreateAsync (HParmBlkPtr paramBlock);
pascal OSErr PBDirCreate (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBDirCreateSync (HParmBlkPtr paramBlock);
pascal OSErr PBDirCreateAsync
(HParmBlkPtr paramBlock);
pascal OSErr PBHDelete (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHDeleteSync (HParmBlkPtr paramBlock);
pascal OSErr PBHDeleteAsync (HParmBlkPtr paramBlock);
Accessing Information About Files and Directories
pascal OSErr PBGetCatInfo (CInfoPBPtr paramBlock, Boolean async);
pascal OSErr PBGetCatInfoSync
(CInfoPBPtr paramBlock, Boolean async);
pascal OSErr PBGetCatInfoAsync
(CInfoPBPtr paramBlock);
pascal OSErr PBSetCatInfo (CInfoPBPtr paramBlock, Boolean async);
pascal OSErr PBSetCatInfoSync
(CInfoPBPtr paramBlock);
pascal OSErr PBSetCatInfoAsync
(CInfoPBPtr paramBlock);
pascal OSErr PBHGetFInfo (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHGetFInfoSync (HParmBlkPtr paramBlock);
pascal OSErr PBHGetFInfoAsync
(HParmBlkPtr paramBlock);
pascal OSErr PBHSetFInfo (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHSetFInfoSync (HParmBlkPtr paramBlock);
pascal OSErr PBHSetFInfoAsync
(HParmBlkPtr paramBlock);
pascal OSErr PBHSetFLock (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHSetFLockSync (HParmBlkPtr paramBlock);
pascal OSErr PBHSetFLockAsync
(HParmBlkPtr paramBlock);
pascal OSErr PBHRstFLock (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHRstFLockSync (HParmBlkPtr paramBlock);
pascal OSErr PBHRstFLockAsync
(HParmBlkPtr paramBlock);
pascal OSErr PBHRename (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHRenameSync (HParmBlkPtr paramBlock);
pascal OSErr PBHRenameAsync (HParmBlkPtr paramBlock);
Moving Files or Directories
pascal OSErr PBCatMove (CMovePBPtr paramBlock, Boolean async);
pascal OSErr PBCatMoveSync (CMovePBPtr paramBlock);
pascal OSErr PBCatMoveAsync (CMovePBPtr paramBlock);
Maintaining Working Directories
pascal OSErr PBOpenWD (WDPBPtr paramBlock, Boolean async);
pascal OSErr PBOpenWDSync (WDPBPtr paramBlock);
pascal OSErr PBOpenWDAsync (WDPBPtr paramBlock);
pascal OSErr PBCloseWD (WDPBPtr paramBlock, Boolean async);
pascal OSErr PBCloseWDSync (WDPBPtr paramBlock);
pascal OSErr PBCloseWDAsync (WDPBPtr paramBlock);
pascal OSErr PBGetWDInfo (WDPBPtr paramBlock, Boolean async);
pascal OSErr PBGetWDInfoSync (WDPBPtr paramBlock);
pascal OSErr PBGetWDInfoAsync
(WDPBPtr paramBlock);
Searching a Catalog
pascal OSErr PBCatSearch (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBCatSearchSync (HParmBlkPtr paramBlock);
pascal OSErr PBCatSearchAsync
(HParmBlkPtr paramBlock);
Exchanging the Data in Two Files
pascal OSErr PBExchangeFiles (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBExchangeFilesSync
(HParmBlkPtr paramBlock);
pascal OSErr PBExchangeFilesAsync
(HParmBlkPtr paramBlock);
Shared Environment Routines
Opening Files While Denying Access
pascal OSErr PBHOpenDeny (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHOpenDenySync (HParmBlkPtr paramBlock);
pascal OSErr PBHOpenDenyAsync
(HParmBlkPtr paramBlock);
pascal OSErr PBHOpenRFDeny (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHOpenRFDenySync
(HParmBlkPtr paramBlock);
pascal OSErr PBHOpenRFDenyAsync
(HParmBlkPtr paramBlock);
Locking and Unlocking File Ranges
pascal OSErr PBLockRange (ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBLockRangeSync (ParmBlkPtr paramBlock);
pascal OSErr PBLockRangeAsync
(ParmBlkPtr paramBlock);
pascal OSErr PBUnlockRange (ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBUnlockRangeSync
(ParmBlkPtr paramBlock);
pascal OSErr PBUnlockRangeAsync
(ParmBlkPtr paramBlock);
Manipulating Share Points
pascal OSErr PBShare (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBShareSync (HParmBlkPtr paramBlock);
pascal OSErr PBShareAsync (HParmBlkPtr paramBlock);
pascal OSErr PBUnshare (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBUnshareSync (HParmBlkPtr paramBlock);
pascal OSErr PBUnshareAsync (HParmBlkPtr paramBlock);
pascal OSErr PBGetUGEntry (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBGetUGEntrySync
(HParmBlkPtr paramBlock);
pascal OSErr PBGetUGEntryAsync
(HParmBlkPtr paramBlock);
Controlling Directory Access
pascal OSErr PBHGetDirAccess (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHGetDirAccessSync
(HParmBlkPtr paramBlock);
pascal OSErr PBHGetDirAccessAsync
(HParmBlkPtr paramBlock);
pascal OSErr PBHSetDirAccess (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHSetDirAccessSync
(HParmBlkPtr paramBlock);
pascal OSErr PBHSetDirAccessAsync
(HParmBlkPtr paramBlock);
Mounting Volumes
pascal OSErr PBGetVolMountInfoSize
(ParmBlkPtr paramBlock);
pascal OSErr PBGetVolMountInfo
(ParmBlkPtr paramBlock);
pascal OSErr PBVolumeMount (ParmBlkPtr paramBlock);
Controlling Login Access
pascal OSErr PBHGetLogInInfo (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHGetLogInInfoSync
(HParmBlkPtr paramBlock);
pascal OSErr PBHGetLogInInfoAsync
(HParmBlkPtr paramBlock);
pascal OSErr PBHMapID (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHMapIDSync (HParmBlkPtr paramBlock);
pascal OSErr PBHMapIDAsync (HParmBlkPtr paramBlock);
pascal OSErr PBHMapName (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHMapNameSync (HParmBlkPtr paramBlock);
pascal OSErr PBHMapNameAsync (HParmBlkPtr paramBlock);
Copying and Moving Files
pascal OSErr PBHCopyFile (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHCopyFileSync (HParmBlkPtr paramBlock);
pascal OSErr PBHCopyFileAsync
(HParmBlkPtr paramBlock);
pascal OSErr PBHMoveRename (HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHMoveRenameSync
(HParmBlkPtr paramBlock);
pascal OSErr PBHMoveRenameAsync
(HParmBlkPtr paramBlock);
File ID Routines
Resolving File ID References
pascal OSErr PBResolveFileIDRef
(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBResolveFileIDRefSync
(HParmBlkPtr paramBlock);
pascal OSErr PBResolveFileIDRefAsync
(HParmBlkPtr paramBlock);
Creating and Deleting File ID References
pascal OSErr PBCreateFileIDRef
(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBCreateFileIDRefSync
(HParmBlkPtr paramBlock);
pascal OSErr PBCreateFileIDRefAsync
(HParmBlkPtr paramBlock);
pascal OSErr PBDeleteFileIDRef
(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBDeleteFileIDRefSync
(HParmBlkPtr paramBlock);
pascal OSErr PBDeleteFileIDRefAsync
(HParmBlkPtr paramBlock);
Foreign File System Routines
Accessing Privilege Information in Foreign File Systems
pascal OSErr PBGetForeignPrivs
(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBGetForeignPrivsSync
(HParmBlkPtr paramBlock);
pascal OSErr PBGetForeignPrivsAsync
(HParmBlkPtr paramBlock);
pascal OSErr PBSetForeignPrivs
(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBSetForeignPrivsSync
(HParmBlkPtr paramBlock);
pascal OSErr PBSetForeignPrivsAsync
(HParmBlkPtr paramBlock);
Utility Routines
Obtaining Queue Headers
#define GetFSQHdr() (QHdrPtr);
#define GetVCBQHdr() (QHdrPtr);
#define GetDrvQHdr() (QHdrPtr);
Adding a Drive
pascal void AddDrive (short drvrRefNum, short drvNum, DrvQElPtr qEl);
Obtaining File Control Block Information
pascal OSErr PBGetFCBInfo (FCBPBPtr paramBlock, Boolean async);
pascal OSErr PBGetFCBInfoSync
(FCBPBPtr paramBlock);
pascal OSErr PBGetFCBInfoAsync
(FCBPBPtr paramBlock);
Application-Defined Routine
Completion Routines
pascal void MyCompletionProc(void);
Assembly-Language Summary
Constants
;flags in trap words
hfsBit EQU 9 ;set for an HFS call
asyncTrpBit EQU 10 ;set for an asynchronous call
;masks for flags in trap words
newHFS EQU $200 ;make an HFS call
ASYNC EQU $400 ;make an asynchronous call
Data Structures
File System Specification Record
0
| vRefNum | word | volume reference number |
2
| parID | long | parent directory ID |
6
| name | 64 bytes | filename or directory name |
HFS Parameter Block Common Fields
0 | qLink | long | next queue entry |
4 | qType | word | queue type |
6 | ioTrap | word | routine trap |
8 | ioCmdAddr | long | routine address |
12 | ioCompletion | long | address of completion routine |
16 | ioResult | word | result code |
18 | ioNamePtr | long | pointer to pathname |
22 | ioVRefNum | word | volume specification |
I/O Parameter Variant
24 | ioRefNum | word | file reference number |
26 | ioVersNum | byte | version number |
27 | ioPermssn | byte | read/write permission |
28 | ioMisc | long | miscellaneous |
32 | ioBuffer | long | data buffer |
36 | ioReqCount | long | requested number of bytes |
40 | ioActCount | long | actual number of bytes |
44 | ioPosMode | word | positioning mode and newline character |
46 | ioPosOffset | long | positioning offset |
File Parameter Variant
24 | ioFRefNum | word | file reference number |
26 | ioFVersNum | byte | file version number (unused) |
27 | filler1 | byte | reserved |
28 | ioFDirIndex | word | directory index |
30 | ioFlAttrib | byte | file attributes |
31 | ioFlVersNum | byte | file version number (unused) |
32 | ioFlFndrInfo | 16 bytes | information used by the Finder |
48 | ioDirID | long | directory ID or file ID |
52 | ioFlStBlk | word | first allocation block of data fork |
54 | ioFlLgLen | long | logical end-of-file of data fork |
58 | ioFlPyLen | long | physical end-of-file of data fork |
62 | ioFlRStBlk | word | first allocation block of resource fork |
64 | ioFlRLgLen | long | logical end-of-file of resource fork |
68 | ioFlRPyLen | long | physical end-of-file of resource fork |
72 | ioFlCrDat | long | date and time of creation |
76 | ioFlMdDat | long | date and time of last modification |
Volume Parameter Variant
24 | filler2 | long | reserved |
28 | ioVolIndex | word | volume index |
30 | ioVCrDate | long | date and time of initialization |
34 | ioVLsMod | long | date and time of last modification |
38 | ioVAtrb | word | volume attributes |
40 | ioVNmFls | word | number of files in root directory |
42 | ioVBitMap | word | first block of volume bitmap |
44 | ioAllocPtr | word | first block of next new file |
46 | ioVNmAlBlks | word | number of allocation blocks |
48 | ioVAlBlkSiz | long | size of allocation blocks |
50 | ioVClpSiz | long | default clump size |
54 | ioAlBlSt | word | first block in volume map |
56 | ioVNxtCNID | long | next unused node ID |
60 | ioVFrBlk | word | number of unused allocation blocks |
62 | ioVSigWord | word | volume signature |
64 | ioVDrvInfo | word | drive number |
66 | ioVDRefNum | word | driver reference number |
68 | ioVFSID | word | file-system identifier |
70 | ioVBkUp | long | date and time of last backup |
74 | ioVSeqNum | word | used internally |
76 | ioVWrCnt | long | volume write count |
80 | ioVFilCnt | long | number of files on volume |
84 | ioVDirCnt | long | number of directories on volume |
88 | ioVFndrInfo | 32 bytes | information used by the Finder |
Access Variant
24 | filler3 | word | reserved |
26 | ioDenyModes | word | access mode information |
28 | filler4 | word | reserved |
30 | filler5 | byte | reserved |
31 | ioACUser | byte | user access rights |
32 | filler6 | long | reserved |
36 | ioACOwnerID | long | owner ID |
40 | ioACGroupID | long | group ID |
44 | ioACAccess | long | directory access rights |
Object Variant
24 | filler7 | word | reserved |
26 | ioObjType | word | function code |
28 | ioObjNamePtr | long | pointer to returned creator/group name |
32 | ioObjID | long | creator/group ID |
Copy Variant
24 | ioDstVRefNum | word | destination volume identifier |
26 | filler8 | word | reserved |
28 | ioNewName | long | pointer to destination pathname |
32 | ioCopyName | long | pointer to optional name |
36 | ioNewDirID | long | directory ID of destination directory |
Working Directory Variant
24 | filler9 | word | reserved |
26 | ioWDIndex | word | working directory's index |
28 | ioWDProcID | long | working directory's user identifier |
32 | ioWDVRefNum | word | working directory's volume reference number |
34 | filler10 | word | reserved |
36 | filler11 | long | reserved |
40 | filler12 | long | reserved |
44 | filler13 | long | reserved |
48 | ioWDDirID | long | working directory's directory ID |
File ID Variant
24 | filler14 | long | reserved |
28 | ioDestNamePtr | long | pointer to destination filename |
32 | filler15 | long | reserved |
36 | ioDestDirID | long | destination parent directory ID |
40 | filler16 | long | reserved |
44 | filler17 | long | reserved |
48 | ioSrcDirID | long | source parent directory ID |
52 | filler18 | word | reserved |
54 | ioFileID | long | file ID |
Catalog Search Variant
24 | ioMatchPtr | long | pointer to array of matches |
28 | ioReqMatchCount | long | maximum match count |
32 | ioActMatchCount | long | actual match count |
36 | ioSearchBits | long | search criteria selector |
40 | ioSearchInfo1 | long | pointer to values and lower bounds |
44 | ioSearchInfo2 | long | pointer to masks and upper bounds |
48 | ioSearchTime | long | time limit on search |
52 | ioCatPosition | 16 bytes | catalog position record |
68 | ioOptBuffer | long | pointer to optional read buffer |
72 | ioOptBufSize | long | length of optional read buffer |
Foreign Privileges Variant
24 | filler21 | long | reserved |
28 | filler22 | long | reserved |
32 | ioForeignPrivBuffer | long | pointer to privileges data buffer |
36 | ioForeignPrivReqCount | long | size allocated for buffer |
40 | ioForeignPrivActCount | long | amount of buffer used |
44 | filler23 | long | reserved |
48 | ioForeignPrivDirID | long | parent directory ID of target |
52 | ioForeignPrivInfo1 | long | privileges data |
56 | ioForeignPrivInfo2 | long | privileges data |
60 | ioForeignPrivInfo3 | long | privileges data |
64 | ioForeignPrivInfo4 | long | privileges data |
Catalog Information Parameter Block (Files Variant)
24 | ioFRefNum | word | file reference number |
26 | ioFVersNum | byte | version number |
27 | filler1 | byte | reserved |
28 | ioFDirIndex | word | directory index |
30 | ioFlAttrib | byte | file attributes |
31 | ioACUser | byte | directory access rights |
32 | ioFlUsrWds | 16 bytes | information used by the Finder |
48 | ioFlNum | long | file ID |
52 | ioFlStBlk | word | first allocation block of data fork |
54 | ioFlLgLen | long | logical end-of-file of data fork |
58 | ioFlPyLen | long | physical end-of-file of data fork |
62 | ioFlRStBlk | word | first allocation block of resource fork |
64 | ioFlRLgLen | long | logical end-of-file of resource fork |
68 | ioFlRPyLen | long | physical end-of-file of resource fork |
72 | ioFlCrDat | long | date and time of creation |
76 | ioFlMdDat | long | date and time of last modification |
80 | ioFlBkDat | long | date and time of last backup |
84 | ioFlXFndrInfo | 16 bytes | additional information used by the Finder |
100 | ioFlParID | long | file parent directory ID |
104 | ioFlClpSiz | long | file's clump size |
Catalog Information Parameter Block (Directories Variant)
24 | ioFRefNum | word | file reference number |
26 | ioFVersNum | byte | version number |
27 | filler1 | byte | reserved |
28 | ioFDirIndex | word | directory index |
30 | ioFlAttrib | byte | directory attributes |
31 | ioACUser | byte | directory access rights |
32 | ioDrUsrWds | 16 bytes | information used by the Finder |
48 | ioDrDirID | long | directory ID |
52 | ioDrNmFls | word | number of files in directory |
54 | filler3 | 18 bytes | reserved |
72 | ioDrCrDat | long | date and time of creation |
76 | ioDrMdDat | long | date and time of last modification |
80 | ioDrBkDat | long | date and time of last backup |
84 | ioDrFndrInfo | 16 bytes | additional information used by the Finder |
100 | ioDrParID | long | directory's parent directory ID |
Catalog Position Record
0 | initialize | long | starting place for next search |
4 | priv | 12 bytes | private data |
Catalog Move Parameter Block
24 | filler1 | long | reserved |
28 | ioNewName | long | pointer to name of new directory |
32 | filler2 | long | reserved |
36 | ioNewDirID | long | directory ID of new directory |
40 | filler3 | 8 bytes | reserved |
48 | ioDirID | long | directory ID of current directory |
Working Directory Parameter Block
24 | filler1 | word | reserved |
26 | ioWDIndex | word | working directory's index |
28 | ioWDProcID | long | working directory's user identifier |
32 | ioWDVRefNum | word | working directory's volume reference number |
34 | filler2 | 14 bytes | reserved |
48 | ioWDDirID | long | working directory's directory ID |
File Control Block Parameter Block
24 | ioRefNum | word | file reference number |
26 | filler | word | reserved |
28 | ioFCBIndx | word | FCB index |
30 | ioFCBfiller1 | word | reserved |
32 | ioFCBFlNm | long | file ID |
36 | ioFCBFlags | word | flags |
38 | ioFCBStBlk | word | first allocation block of file |
40 | ioFCBEOF | long | logical end-of-file |
44 | ioFCBPLen | long | physical end-of-file |
48 | ioFCBCrPs | long | position of the file mark |
52 | ioFCBVRefNum | word | volume reference number |
54 | ioFCBClpSiz | long | file's clump size |
58 | ioFCBParID | long | parent directory ID |
Volume Attributes Buffer
0 | vMVersion | word | version number |
2 | vMAttrib | long | volume attributes |
6 | vMLocalHand | long | reserved |
10 | vMServerAdr | long | network server address |
14 | vMVolumeGrade | long | relative speed rating |
18 | vMForeignPrivID | word | foreign privilege model |
Volume Mounting Information Record
0 | length | word | length of record |
2 | media | 4 bytes | type of volume |
AFP Mounting Information Record
0 | length | word | length of record |
2 | media | 4 bytes | type of volume |
6 | flags | word | reserved; must be 0 |
8 | nbpInterval | byte | NBP retry interval |
9 | nbpCount | byte | NBP retry count |
10 | uamType | word | user authentication method |
12 | zoneNameOffset | word | offset to zone name |
14 | serverNameOffset | word | offset to server name |
16 | volNameOffset | word | offset to volume name |
18 | userNameOffset | word | offset to user name |
20 | userPasswordOffset | word | offset to user password |
22 | volPasswordOffset | word | offset to volume password |
24 | AFPData | 144 bytes | mounting data |
Volume Control Block Data Structure (Internal)
0 | qLink | long | next queue entry |
4 | qType | word | queue type |
6 | vcbFlags | word | volume flags |
8 | vcbSigWord | word | volume signature |
10 | vcbCrDate | long | date and time of initialization |
14 | vcbLsMod | long | date and time of last modification |
18 | vcbAtrb | word | volume attributes |
20 | vcbNmFls | word | number of files in root directory |
22 | vcbVBMSt | word | first block of volume bitmap |
24 | vcbAllocPtr | word | start of next allocation search |
26 | vcbNmAlBlks | word | number of allocation blocks in volume |
28 | vcbAlBlkSiz | long | size (in bytes) of allocation block |
32 | vcbClpSiz | long | default clump size |
36 | vcbAlBlSt | word | first allocation block in volume |
38 | vcbNxtCNID | long | next unused catalog node ID |
42 | vcbFreeBks | word | number of unused allocation blocks |
44 | vcbVN | 28 bytes | volume name preceded by length byte |
72 | vcbDrvNum | word | drive number |
74 | vcbDRefNum | word | driver reference number |
76 | vcbFSID | word | file-system identifier |
78 | vcbVRefNum | word | volume reference number |
80 | vcbMAdr | long | pointer to block map |
84 | vcbBufAdr | long | pointer to volume buffer |
88 | vcbMLen | word | number of bytes in block map |
90 | vcbDirIndex | word | reserved |
92 | vcbDirBlk | word | reserved |
94 | vcbVolBkUp | long | date and time of last backup |
98 | vcbVSeqNum | word | volume backup sequence number |
100 | vcbWrCnt | long | volume write count |
104 | vcbXTClpSiz | long | clump size for extents overflow file |
108 | vcbCTClpSiz | long | clump size for catalog file |
112 | vcbNmRtDirs | word | number of directories in root directory |
114 | vcbFilCnt | long | number of files in volume |
118 | vcbDirCnt | long | number of directories in volume |
122 | vcbFndrInfo | 32 bytes | information used by the Finder |
154 | vcbVCSize | word | reserved |
156 | vcbVBMCSiz | word | reserved |
158 | vcbCtlCSiz | word | reserved |
160 | vcbXTAlBks | word | size in blocks of extents overflow file |
162 | vcbCTAlBks | word | size in blocks of catalog file |
164 | vcbXTRef | word | file reference number for extents overflow file |
166 | vcbCTRef | word | file reference number for catalog file |
168 | vcbCtlBuf | long | pointer to extents and catalog tree caches |
172 | vcbDirIDM | long | directory last searched |
176 | vcbOffsM | word | offspring index at last search |
File Control Block Data Structure (Internal)
0 | fcbFlNum | long | file ID |
4 | fcbFlags | word | file flags |
6 | fcbSBlk | word | first allocation block of file |
8 | fcbEOF | long | logical end-of-file |
12 | fcbPLen | long | physical end-of-file |
16 | fcbCrPs | long | current file mark position |
20 | fcbVPtr | long | pointer to volume control block |
24 | fcbBfAdr | long | pointer to access path buffer |
28 | fcbFlPos | word | reserved |
30 | fcbClmpSize | long | file's clump size |
34 | fcbBTCBPtr | long | pointer to B*-tree control block |
38 | fcbExtRec | 12 bytes | first three file extents |
50 | fcbFType | long | file's four Finder type bytes |
54 | fcbCatPos | long | catalog hint for use on close |
58 | fcbDirID | long | file's parent directory ID |
62 | fcbCName | 32 bytes | name of open file, preceded by length byte |
Drive Queue Elements
0 | qLink | long | next queue entry |
4 | qType | word | flag for dQDrvSz and dQDrvSz2 fields |
6 | dQDrive | word | drive number |
8 | dQRefNum | word | driver reference number |
10 | dQFSID | word | file-system identifier |
12 | dQDrvSz | word | number of logical blocks on drive |
14 | dQDrvSz2 | word | additional field for large drives |
Trap Macros
Trap Macro Names
Pascal name | Trap macro name |
PBAllocate | _Allocate |
PBAllocContig | _AllocContig |
PBClose | _Close |
PBDirCreate | _DirCreate |
PBEject | _Eject |
PBFlushFile | _FlushFile |
PBFlushVol | _FlushVol |
PBGetEOF | _GetEOF |
PBGetFPos | _GetFPos |
PBGetVol | _GetVol |
PBHCreate | _HCreate |
PBHDelete | _HDelete |
PBHGetFInfo | _HGetFileInfo |
PBHGetVInfo | _HGetVolInfo |
PBHGetVol | _HGetVol |
PBHGetVolParms | _GetVolParms |
PBHOpen | _HOpen |
PBHOpenRF | _HOpenRF |
PBHRename | _HRename |
PBHRstFLock | _HRstFLock |
PBHSetFInfo | _HSetFileInfo |
PBHSetFLock | _HSetFLock |
PBHSetVol | _HSetVol |
PBMountVol | _MountVol |
PBOffLine | _OffLine |
PBRead | _Read |
PBSetEOF | _SetEOF |
PBSetFPos | _SetFPos |
PBSetVInfo | _SetVolInfo |
PBSetVol | _SetVol |
PBUnmountVol | _UnmountVol |
PBWrite | _Write |
Trap Macros Requiring Routine Selectors
_HFSDispatch
Selector | Routine |
$0001 | PBOpenWD |
$0002 | PBCloseWD |
$0005 | PBCatMove |
$0006 | PBDirCreate |
$0007 | PBGetWDInfo |
$0008 | PBGetFCBInfo |
$0009 | PBGetCatInfo |
$000A | PBSetCatInfo |
$000B | PBSetVInfo |
$0010 | PBLockRange |
$0011 | PBUnlockRange |
$0014 | PBCreateFileIDRef |
$0015 | PBDeleteFileIDRef |
$0016 | PBResolveFileIDRef |
$0017 | PBExchangeFiles |
$0018 | PBCatSearch |
$001A | PBHOpenDF |
$001B | PBMakeFSSpec |
$0030 | PBHGetVolParms |
$0031 | PBHGetLogInInfo |
$0032 | PBHGetDirAccess |
$0033 | PBHSetDirAccess |
$0034 | PBHMapID |
$0035 | PBHMapName |
$0036 | PBHCopyFile |
$0037 | PBHMoveRename |
$0038 | PBHOpenDeny |
$0039 | PBHOpenRFDeny |
$003F | PBGetVolMountInfoSize |
$0040 | PBGetVolMountInfo |
$0041 | PBVolumeMount |
$0042 | PBShare |
$0043 | PBUnshare |
$0044 | PBGetUGEntry |
$0060 | PBGetForeignPrivs |
$0061 | PBSetForeignPrivs |
_HighLevelFSDispatch
Selector | Routine |
$0001 | FSMakeFSSpec |
$0002 | FSpOpenDF |
$0003 | FSpOpenRF |
$0004 | FSpCreate |
$0005 | FSpDirCreate |
$0006 | FSpDelete |
$0007 | FSpGetFInfo |
$0008 | FSpSetFInfo |
$0009 | FSpSetFLock |
$000A | FSpRstFLock |
$000B | FSpRename |
$000C | FSpCatMove |
$000D | FSpOpenResFile |
$000E | FSpCreateResFile |
$000F | FSpExchangeFiles |
Global Variables
BootDrive | word | Working directory reference number for startup volume. |
DefVCBPtr | long | Pointer to default volume control block. |
DrvQHdr | 10 bytes | Drive queue header. |
FSFCBLen | word | Size of a file control block. |
FSQHdr | 10 bytes | File I/O queue header. |
ToExtFS | long | Pointer to external file system. |
VCBQHdr | 10 bytes | Volume control block queue header. |
Result Codes
noErr | 0 | No error |
notOpenErr | -28 | AppleTalk is not open |
dirFulErr | -33 | File directory full |
dskFulErr | -34 | All allocation blocks on the volume are full |
nsvErr | -35 | Volume not found |
ioErr | -36 | I/O error |
bdNamErr | -37 | Bad filename or volume name |
fnOpnErr | -38 | File not open |
eofErr | -39 | Logical end-of-file reached |
posErr | -40 | Attempt to position mark before start of file |
tmfoErr | -42 | Too many files open |
fnfErr | -43 | File not found |
wPrErr | -44 | Hardware volume lock |
fLckdErr | -45 | File is locked |
vLckdErr | -46 | Software volume lock |
fBsyErr | -47 | File is busy; one or more files are open; directory not empty or working directory control block is open |
dupFNErr | -48 | A file with the specified name already exists |
opWrErr | -49 | File already open for writing |
paramErr | -50 | Parameter error |
rfNumErr | -51 | Reference number specifies nonexistent access path; bad working directory reference number |
gfpErr | -52 | Error during GetFPos |
volOfflinErr | -53 | Volume is offline |
permErr | -54 | Attempt to open locked file for writing |
volOnLinErr | -55 | Specified volume is already mounted and online |
nsDrvErr | -56 | Specified drive number doesn't match any number in the drive queue |
noMacDskErr | -57 | Volume lacks Macintosh-format directory |
extFSErr | -58 | External file system |
fsRnErr | -59 | Problem during rename |
badMDBErr | -60 | Bad master directory block |
wrPermErr | -61 | Read/write permission doesn't allow writing |
memFullErr | -108 | Insufficient memory available |
dirNFErr | -120 | Directory not found |
tmwdoErr | -121 | Too many working directories open |
badMovErr | -122 | Attempted to move into offspring |
wrgVolTypErr | -123 | Not an HFS volume |
volGoneErr | -124 | Server volume has been disconnected |
fsDSIntErr | -127 | Internal file system error |
fidNotFoundErr | -1300 | File ID not found |
fidExists | -1301 | File ID already exists |
notAFileErr | -1302 | Specified file is a directory |
diffVolErr | -1303 | Files are on different volumes |
catChangedErr | -1304 | Catalog has changed and catalog position record may be invalid |
sameFileErr | -1306 | Files are the same |
afpAccessDenied | -5000 | The operation has failed because the user does not have the correct access to the file or folder |
afpBadUAM | -5002 | User authentication method is unknown |
afpBadVersNum | -5003 | Workstation is using an AFP version that the server doesn't recognize |
afpDenyConflict | -5006 | The operation has failed because the permission or deny mode conflicts with the mode in which the fork has already been opened |
afpNoMoreLocks | -5015 | Byte range locking has failed because the server cannot lock any additional ranges |
afpNoServer | -5016 | Server is not responding |
afpRangeNotLocked | -5020 | User has attempted to unlock a range that was not locked by that user |
afpRangeOverlap | -5021 | User attempted to lock some or all of a range that is already locked |
afpUserNotAuth | -5023 | User authentication failed (usually, password is not correct) |
afpObjectTypeErr | -5025 | Object was a file, not a directory; or, this directory is not a share point |
afpContainsSharedErr | -5033 | The directory contains a share point |
afpIDNotFound | -5034 | File ID not found |
afpIDExists | -5035 | File ID already exists |
afpCatalogChanged | -5037 | Catalog has changed and search cannot be resumed |
afpSameObjectErr | -5038 | Source and destination are the same |
afpBadIDErr | -5039 | Bad file ID |
afpPwdExpired | -5042 | Password has expired on server |
afpInsideSharedErr | -5043 | The directory is inside a shared directory |
afpBadDirIDType | -5060 | Not a fixed directory ID volume |
afpCantMountMoreSrvrs | -5061 | Maximum number of volumes have been mounted |
afpAlreadyMounted | -5062 | Volume already mounted |
afpSameNodeErr | -5063 | Attempt to log on to a server running on the same machine |