Structure of the Newton package file header documented by Victor Rehorst Version 1 03/12/2001 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All bytes are in big-endian order. 0x00-0x07 = signature ('package0' or 'package1') (byte[8]) 0x08-0x0B = reserved1 (0x00000000) (ULong) 0x0C-0x0F = flags (only the highest (0x0C) byte is actually used) (ULong) 0x10-0x13 = version (ULong) 0x14-0x17 = InfoRef to copyright (may be empty) (Unicode string) 0x18-0x1B = InfoRef to name (Unicode string) 0x1C-0x1F = length of entire package in bytes (ULong) 0x20-0x23 = creationDate (in seconds since 00:00 Jan 4 1904) (Date) 0x24-0x27 = reserved2 (0x00000000) (ULong) 0x28-0x2B = reserved3 (0x00000000) (ULong) 0x2C-0x2F = directory size (total size of package directory including fixed and variable parts) (ULong) 0x30-0x33 = number of parts in package. (ULong) 0x34 (52) bytes total Followed by part entries (offsets are only for the first entry): 0x34-0x37 = offset of part data from beginning of part section. (ULong) 0x38-0x3B = size of the part data (ULong) 0x3C-0x3F = size of the part data, must be same value as previous (ULong) 0x40-0x43 = type of part (ULong, ASCII encoded) 0x44-0x47 = reserved (ULong) 0x48-0x4B = flags (only two lowest bytes are used) 0x4C-0x4F = InfoRef to information (???) 0x50-0x53 = reserved (ULong) 0x54 (84) bytes total (with one part entry) Data Types ~~~~~~~~~~ ULong Unsigned 32-bit integer. UShort Unsigned 16-bit integer. Byte Unsigned byte (or ASCII character). UniChar Two-byte Unicode character. Date Unsigned 32-bit integer representing a date and time as the number of seconds since midnight, January 4, 1904. InfoRef An unsigned 16-bit offset followed by an unsigned 16-bit length. InfoRefs are used to refer to variable-length data items in the variable-length data area of the package directory. The offset is from the beginning of the data area; the length is the number of bytes in the data item. **Strings referred to by InfoRefs are terminated by a Null symbol, usually** Package Flags (0x0C - 0x0F) ~~~~~~~~~~~~~~~~~~~~~~~~~~~ kAutoRemoveFlag: 0x80000000 Parts in the package are to be removed immediately after installation. kCopyProtectFlag: 0x40000000 Marks the package as copy-protected. The Newton OS will refuse to copy or beam a protected package. kNoCompressionFlag: 0x10000000 The OS is not to compress the package upon installation. The default is to compress. kRelocationFlag: 0x04000000 (2.x only) Denotes that the package contains relocation information. Package signature must also be "package1" kUseFasterCompressionFlag: 0x02000000 (2.x only) Package should be compressed using a faster (but less efficient) compression method. Package signature must also be "package1" Part Entry Flags ~~~~~~~~~~~~~~~~ kProtocolFlag: 0x00000000 kNOSPart: 0x00000001 kRawPart: 0x00000002 Specifies whether the part contains a protocol, a region of NOS objects, or raw data. kAutoLoadFlag: 0x00000010 Part should be registered automatically when the package is activated. Only valid for protocol parts. kAutoRemoveFlag: 0x00000020 Part should be unregistered automatically when the package is deactivated. Only valid for protocol parts. kNotifyFlag: 0x00000080 Denotes that the system handler corresponding to the part's type should be notified. kAutoCopyFlag: 0x00000100 Denotes that the part should be moved into permanent resident memory before being activated. Used for parts that cannot tolerate the normal page-faulting mechanism.