|
|
1.1 ! root 1: /* ! 2: * libhfs - library for reading and writing Macintosh HFS volumes ! 3: * Copyright (C) 1996-1998 Robert Leslie ! 4: * ! 5: * This program is free software; you can redistribute it and/or modify ! 6: * it under the terms of the GNU General Public License as published by ! 7: * the Free Software Foundation; either version 2 of the License, or ! 8: * (at your option) any later version. ! 9: * ! 10: * This program is distributed in the hope that it will be useful, ! 11: * but WITHOUT ANY WARRANTY; without even the implied warranty of ! 12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! 13: * GNU General Public License for more details. ! 14: * ! 15: * You should have received a copy of the GNU General Public License ! 16: * along with this program; if not, write to the Free Software ! 17: * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, ! 18: * MA 02110-1301, USA. ! 19: * ! 20: * $Id: apple.h,v 1.1 1998/04/11 08:27:11 rob Exp $ ! 21: */ ! 22: ! 23: typedef signed char Char; ! 24: typedef unsigned char UChar; ! 25: typedef signed char SignedByte; ! 26: typedef signed short Integer; ! 27: typedef unsigned short UInteger; ! 28: typedef signed long LongInt; ! 29: typedef unsigned long ULongInt; ! 30: typedef char Str15[16]; ! 31: typedef char Str31[32]; ! 32: typedef long OSType; ! 33: ! 34: typedef struct { ! 35: Integer sbSig; /* device signature (should be 0x4552) */ ! 36: Integer sbBlkSize; /* block size of the device (in bytes) */ ! 37: LongInt sbBlkCount; /* number of blocks on the device */ ! 38: Integer sbDevType; /* reserved */ ! 39: Integer sbDevId; /* reserved */ ! 40: LongInt sbData; /* reserved */ ! 41: Integer sbDrvrCount; /* number of driver descriptor entries */ ! 42: LongInt ddBlock; /* first driver's starting block */ ! 43: Integer ddSize; /* size of the driver, in 512-byte blocks */ ! 44: Integer ddType; /* driver operating system type (MacOS = 1) */ ! 45: Integer ddPad[243]; /* additional drivers, if any */ ! 46: } Block0; ! 47: ! 48: typedef struct { ! 49: Integer pmSig; /* partition signature (0x504d or 0x5453) */ ! 50: Integer pmSigPad; /* reserved */ ! 51: LongInt pmMapBlkCnt; /* number of blocks in partition map */ ! 52: LongInt pmPyPartStart; /* first physical block of partition */ ! 53: LongInt pmPartBlkCnt; /* number of blocks in partition */ ! 54: Char pmPartName[33]; /* partition name */ ! 55: Char pmParType[33]; /* partition type */ ! 56: LongInt pmLgDataStart; /* first logical block of data area */ ! 57: LongInt pmDataCnt; /* number of blocks in data area */ ! 58: LongInt pmPartStatus; /* partition status information */ ! 59: LongInt pmLgBootStart; /* first logical block of boot code */ ! 60: LongInt pmBootSize; /* size of boot code, in bytes */ ! 61: LongInt pmBootAddr; /* boot code load address */ ! 62: LongInt pmBootAddr2; /* reserved */ ! 63: LongInt pmBootEntry; /* boot code entry point */ ! 64: LongInt pmBootEntry2; /* reserved */ ! 65: LongInt pmBootCksum; /* boot code checksum */ ! 66: Char pmProcessor[17];/* processor type */ ! 67: Integer pmPad[188]; /* reserved */ ! 68: } Partition; ! 69: ! 70: typedef struct { ! 71: Integer bbID; /* boot blocks signature */ ! 72: LongInt bbEntry; /* entry point to boot code */ ! 73: Integer bbVersion; /* boot blocks version number */ ! 74: Integer bbPageFlags; /* used internally */ ! 75: Str15 bbSysName; /* System filename */ ! 76: Str15 bbShellName; /* Finder filename */ ! 77: Str15 bbDbg1Name; /* debugger filename */ ! 78: Str15 bbDbg2Name; /* debugger filename */ ! 79: Str15 bbScreenName; /* name of startup screen */ ! 80: Str15 bbHelloName; /* name of startup program */ ! 81: Str15 bbScrapName; /* name of system scrap file */ ! 82: Integer bbCntFCBs; /* number of FCBs to allocate */ ! 83: Integer bbCntEvts; /* number of event queue elements */ ! 84: LongInt bb128KSHeap; /* system heap size on 128K Mac */ ! 85: LongInt bb256KSHeap; /* used internally */ ! 86: LongInt bbSysHeapSize; /* system heap size on all machines */ ! 87: Integer filler; /* reserved */ ! 88: LongInt bbSysHeapExtra; /* additional system heap space */ ! 89: LongInt bbSysHeapFract; /* fraction of RAM for system heap */ ! 90: } BootBlkHdr; ! 91: ! 92: typedef struct { ! 93: UInteger xdrStABN; /* first allocation block */ ! 94: UInteger xdrNumABlks; /* number of allocation blocks */ ! 95: } ExtDescriptor; ! 96: ! 97: typedef ExtDescriptor ExtDataRec[3]; ! 98: ! 99: typedef struct { ! 100: SignedByte xkrKeyLen; /* key length */ ! 101: SignedByte xkrFkType; /* fork type (0x00/0xff == data/resource */ ! 102: ULongInt xkrFNum; /* file number */ ! 103: UInteger xkrFABN; /* starting file allocation block */ ! 104: } ExtKeyRec; ! 105: ! 106: typedef struct { ! 107: SignedByte ckrKeyLen; /* key length */ ! 108: SignedByte ckrResrv1; /* reserved */ ! 109: ULongInt ckrParID; /* parent directory ID */ ! 110: Str31 ckrCName; /* catalog node name */ ! 111: } CatKeyRec; ! 112: ! 113: typedef struct { ! 114: Integer v; /* vertical coordinate */ ! 115: Integer h; /* horizontal coordinate */ ! 116: } Point; ! 117: ! 118: typedef struct { ! 119: Integer top; /* top edge of rectangle */ ! 120: Integer left; /* left edge */ ! 121: Integer bottom; /* bottom edge */ ! 122: Integer right; /* right edge */ ! 123: } Rect; ! 124: ! 125: typedef struct { ! 126: Rect frRect; /* folder's rectangle */ ! 127: Integer frFlags; /* flags */ ! 128: Point frLocation; /* folder's location */ ! 129: Integer frView; /* folder's view */ ! 130: } DInfo; ! 131: ! 132: typedef struct { ! 133: Point frScroll; /* scroll position */ ! 134: LongInt frOpenChain; /* directory ID chain of open folders */ ! 135: Integer frUnused; /* reserved */ ! 136: Integer frComment; /* comment ID */ ! 137: LongInt frPutAway; /* directory ID */ ! 138: } DXInfo; ! 139: ! 140: typedef struct { ! 141: OSType fdType; /* file type */ ! 142: OSType fdCreator; /* file's creator */ ! 143: Integer fdFlags; /* flags */ ! 144: Point fdLocation; /* file's location */ ! 145: Integer fdFldr; /* file's window */ ! 146: } FInfo; ! 147: ! 148: typedef struct { ! 149: Integer fdIconID; /* icon ID */ ! 150: Integer fdUnused[4]; /* reserved */ ! 151: Integer fdComment; /* comment ID */ ! 152: LongInt fdPutAway; /* home directory ID */ ! 153: } FXInfo; ! 154: ! 155: typedef struct { ! 156: Integer drSigWord; /* volume signature (0x4244 for HFS) */ ! 157: LongInt drCrDate; /* date and time of volume creation */ ! 158: LongInt drLsMod; /* date and time of last modification */ ! 159: Integer drAtrb; /* volume attributes */ ! 160: UInteger drNmFls; /* number of files in root directory */ ! 161: UInteger drVBMSt; /* first block of volume bit map (always 3) */ ! 162: UInteger drAllocPtr; /* start of next allocation search */ ! 163: UInteger drNmAlBlks; /* number of allocation blocks in volume */ ! 164: ULongInt drAlBlkSiz; /* size (in bytes) of allocation blocks */ ! 165: ULongInt drClpSiz; /* default clump size */ ! 166: UInteger drAlBlSt; /* first allocation block in volume */ ! 167: LongInt drNxtCNID; /* next unused catalog node ID (dir/file ID) */ ! 168: UInteger drFreeBks; /* number of unused allocation blocks */ ! 169: char drVN[28]; /* volume name (1-27 chars) */ ! 170: LongInt drVolBkUp; /* date and time of last backup */ ! 171: Integer drVSeqNum; /* volume backup sequence number */ ! 172: ULongInt drWrCnt; /* volume write count */ ! 173: ULongInt drXTClpSiz; /* clump size for extents overflow file */ ! 174: ULongInt drCTClpSiz; /* clump size for catalog file */ ! 175: UInteger drNmRtDirs; /* number of directories in root directory */ ! 176: ULongInt drFilCnt; /* number of files in volume */ ! 177: ULongInt drDirCnt; /* number of directories in volume */ ! 178: LongInt drFndrInfo[8]; /* information used by the Finder */ ! 179: UInteger drEmbedSigWord; /* type of embedded volume */ ! 180: ExtDescriptor drEmbedExtent; /* location of embedded volume */ ! 181: ULongInt drXTFlSize; /* size (in bytes) of extents overflow file */ ! 182: ExtDataRec drXTExtRec; /* first extent record for extents file */ ! 183: ULongInt drCTFlSize; /* size (in bytes) of catalog file */ ! 184: ExtDataRec drCTExtRec; /* first extent record for catalog file */ ! 185: } MDB; ! 186: ! 187: typedef enum { ! 188: cdrDirRec = 1, ! 189: cdrFilRec = 2, ! 190: cdrThdRec = 3, ! 191: cdrFThdRec = 4 ! 192: } CatDataType; ! 193: ! 194: typedef struct { ! 195: SignedByte cdrType; /* record type */ ! 196: SignedByte cdrResrv2; /* reserved */ ! 197: union { ! 198: struct { /* cdrDirRec */ ! 199: Integer dirFlags; /* directory flags */ ! 200: UInteger dirVal; /* directory valence */ ! 201: ULongInt dirDirID; /* directory ID */ ! 202: LongInt dirCrDat; /* date and time of creation */ ! 203: LongInt dirMdDat; /* date and time of last modification */ ! 204: LongInt dirBkDat; /* date and time of last backup */ ! 205: DInfo dirUsrInfo; /* Finder information */ ! 206: DXInfo dirFndrInfo; /* additional Finder information */ ! 207: LongInt dirResrv[4]; /* reserved */ ! 208: } dir; ! 209: struct { /* cdrFilRec */ ! 210: SignedByte ! 211: filFlags; /* file flags */ ! 212: SignedByte ! 213: filTyp; /* file type */ ! 214: FInfo filUsrWds; /* Finder information */ ! 215: ULongInt filFlNum; /* file ID */ ! 216: UInteger filStBlk; /* first alloc block of data fork */ ! 217: ULongInt filLgLen; /* logical EOF of data fork */ ! 218: ULongInt filPyLen; /* physical EOF of data fork */ ! 219: UInteger filRStBlk; /* first alloc block of resource fork */ ! 220: ULongInt filRLgLen; /* logical EOF of resource fork */ ! 221: ULongInt filRPyLen; /* physical EOF of resource fork */ ! 222: LongInt filCrDat; /* date and time of creation */ ! 223: LongInt filMdDat; /* date and time of last modification */ ! 224: LongInt filBkDat; /* date and time of last backup */ ! 225: FXInfo filFndrInfo; /* additional Finder information */ ! 226: UInteger filClpSize; /* file clump size */ ! 227: ExtDataRec ! 228: filExtRec; /* first data fork extent record */ ! 229: ExtDataRec ! 230: filRExtRec; /* first resource fork extent record */ ! 231: LongInt filResrv; /* reserved */ ! 232: } fil; ! 233: struct { /* cdrThdRec */ ! 234: LongInt thdResrv[2]; /* reserved */ ! 235: ULongInt thdParID; /* parent ID for this directory */ ! 236: Str31 thdCName; /* name of this directory */ ! 237: } dthd; ! 238: struct { /* cdrFThdRec */ ! 239: LongInt fthdResrv[2]; /* reserved */ ! 240: ULongInt fthdParID; /* parent ID for this file */ ! 241: Str31 fthdCName; /* name of this file */ ! 242: } fthd; ! 243: } u; ! 244: } CatDataRec; ! 245: ! 246: typedef struct { ! 247: ULongInt ndFLink; /* forward link */ ! 248: ULongInt ndBLink; /* backward link */ ! 249: SignedByte ndType; /* node type */ ! 250: SignedByte ndNHeight; /* node level */ ! 251: UInteger ndNRecs; /* number of records in node */ ! 252: Integer ndResv2; /* reserved */ ! 253: } NodeDescriptor; ! 254: ! 255: enum { ! 256: ndIndxNode = (SignedByte) 0x00, ! 257: ndHdrNode = (SignedByte) 0x01, ! 258: ndMapNode = (SignedByte) 0x02, ! 259: ndLeafNode = (SignedByte) 0xff ! 260: }; ! 261: ! 262: typedef struct { ! 263: UInteger bthDepth; /* current depth of tree */ ! 264: ULongInt bthRoot; /* number of root node */ ! 265: ULongInt bthNRecs; /* number of leaf records in tree */ ! 266: ULongInt bthFNode; /* number of first leaf node */ ! 267: ULongInt bthLNode; /* number of last leaf node */ ! 268: UInteger bthNodeSize; /* size of a node */ ! 269: UInteger bthKeyLen; /* maximum length of a key */ ! 270: ULongInt bthNNodes; /* total number of nodes in tree */ ! 271: ULongInt bthFree; /* number of free nodes */ ! 272: SignedByte bthResv[76]; /* reserved */ ! 273: } BTHdrRec;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.