Some information about MacOS aliases collected from the web. http://www.geocities.com/xhelmboyx/quicktime/formats/alias-layout.txt ****************************** * Mac OS Alias Record Format * ****************************** - values use big endian (network) byte order - general terms: integer = signed value - general values: byte/char/octet = 8-bit value ; short/word = 16-bit value ; long = 32-bit value - fixed point values: value made up of an integer for whole numbers and an unsigned value for the decimal - binary values: base-2 long unsigned values (values from 0 and 1) - octal values: base-8 long unsigned values (values from 0 through to 7) - decimal values: base-10 long unsigned values (values from 0 through to 9) - hexadecimal (hex) values: base-16 long unsigned values (values from 0 to 9 and A to F) - volume name: the user assigned name of a formated partition in a location determined by the file system - volume signature: two ASCII chars identifying the Mac OS file system type which is the signature of the MDB - volume attributes: 32 bits that flag file system options which is stored in the MDB - Master Directory Block: volume info stored in the third 512 byte block of an HFS formated partition - volume file system ID: two ASCII chars identifying a foreign file system type which is not MFS or HFS - mac os absolute path: syntax is "VolumeName:Directory:File" - mac os relative path: syntax is ":Directory:File" - file url absolute path: syntax is "file://localhost/MountPoint/Directory/File" - file url relative path: syntax is "Directory/File" FILE INFO Suffix = N/A ; Mac OS Application Type = "adrp" ; Mac OS Folder Type = "fdrp" Resource Type = "alis" ; MIME=N/A Mac OS resource fork based binary format that provides a link to files and folders on HFS/HFS+ volumes. Can be used as a self contained file or part of an existing format. ALIAS RECORD STRUCTURE Note: the record is for use with the Apple's Alias File Manager. A basic record is 150 bytes in length excluding extra info. The Mac OS uses colons in file paths instead of forward slashs as used in URLs, so the colon can't be used in file, directory nor volume/partition names. Also directories and files have a Mac OS name limit of 31 characters. Disks/Partitions have a limit of 27 characters. -> 4 bytes user type name/app creator code = long ASCII text string (none = 0) -> 2 bytes record size = short unsigned total length -> 2 bytes record version = short integer version (current version = 2) -> 2 bytes alias kind = short integer value (file = 0 ; directory = 1) -> 1 byte volume name string length = byte unsigned length -> 27 bytes volume name string (used in relative searches) - NOTE: if volume name string < 27 chars then pad with zeros -> 4 bytes volume created mac local date = long unsigned value in seconds since beginning 1904 to 2040 - NOTE: this time value may be set to 0 (used in locating volumes with a name change) -> 2 bytes volume signature = short ASCII string file system type - types are Macintosh File System = 'RW' ; Hierarchical File System = 'BD' - NOTE: this is set to 'BD' for foreign file systems (used in locating volumes with a name change) - EXTRA INFO: RW was named after Randy Wigginton and BD was for Big Disk -> 2 bytes drive type = short integer mac os value - types are Fixed HD = 0 ; Network Disk = 1 ; 400kB FD = 2 - types are 800kB FD = 3 ; 1.4MB FD = 4 ; Other Ejectable Media = 5 -> 4 bytes parent directory ID = short unsigned FS value - NOTE: this ID value may be set to 0 (used in relative searches) -> 1 bytes file name string length = byte unsigned length -> 63 bytes file name string (used in relative searches) - NOTE: if file name string < 63 chars then pad with zeros -> 4 bytes file number = long unsigned FS value - NOTE: this ID value may be set to 0 (used in locating files with a name change) -> 4 bytes file created mac local date = long unsigned value in seconds since beginning 1904 to 2040 - NOTE: this time value may be set to 0 (used in locating files with a name change) -> 4 bytes file type name = long ASCII text string - NOTE: this type string may be set to 0 (used in locating files with a name change) -> 4 bytes file creator name = long ASCII text string - NOTE: this type string may be set to 0 (used in locating files with a name change) -> 2 bytes nlvl From (next level up from alias) = short integer range (used in relative searches) -> 2 bytes nlvl To (next level down to target) = short integer range (used in relative searches) - NOTE: if alias on different volume then set above to -1 - NOTE: if alias and target in same directory then set above to 1 -> 4 bytes volume attributes = long hex flags - some flags are software locked FS = 0x8000 ; copy protected FS = 0x4000 - some flags are FS unmounted cleanly = 0x0100 ; hardware locked FS = 0x0080 - some flags are FS is busy = 0x0040 ; FS fault was found = 0x0007 - NOTE: these flags may be set to 0 (used in locating volumes with a name change) -> 2 bytes volume file system ID = short ASCII string FS value - some types are Red Book Audio = 'JH' ; ISO9660 = 'AG' - some types are MS FAT = 'IS' ; ISO9660 with MS Joliet = 'Jo' - NOTE: this ID value is set to 0 when MFS or HFS (used in locating volumes with a name change) -> 10 bytes reserved = 80-bit value set to zero * 4+ bytes optional extra data strings = short integer type + short unsigned string length - types are Extended Info End = -1 ; Directory Name = 0; Directory IDs = 1 - types are Absolute Path = 2 ; AppleShare Zone Name = 3 ; AppleShare Server Name = 4 - types are AppleShare User Name = 5 ; Driver Name = 6 ; Revised AppleShare info = 9 - types are AppleRemoteAccess dialup info = 10 -> string data = hex dump -> odd lengths have a 1 byte odd string length pad = byte value set to zero - NOTE: the directory name is used in a relative search and the FS directory IDs are used inconjunction with the nlvl's (next level values) ALIAS RECORD STRUCTURE OUTSIDE OF SIZE LENGTH Note: the following is for use with the Apple's Alias Resource Manager. -> 4 bytes resource type name = long ASCII text string -> 2 bytes resource ID = short integer value -> 2 bytes resource end pad = short value set to zero 8<------8<------8<------8<------8<------8<------8<------8<------ http://groups.google.com/groups?hl=fr&lr=&selm=83t955%24q8b%241%40pegasus.csx.cam.ac.uk From: "Al Grant" Subject: Alias resource format? Date: 1999/12/23 Message-ID: <83t955$q8b$1@pegasus.csx.cam.ac.uk>#1/1 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Organization: University of Cambridge, England X-MSMail-Priority: Normal Newsgroups: comp.sys.mac.programmer.misc I am trying to work out the format of alis resources and have got as far as the structure below, can anyone help fill in the rest or correct any errors? How do I tell if there is a full path or not, or find its offset other than by searching? Is target's icon position and finder flags ever included in the alias resource? What is the mysterious 'BD' (X'4244') that appears at offset 2A in all alis resources? // 'alis' resource struct AliasRecord // The following two fields are all that is publicly documented. // The length field is the size of the record as originally constructed // by the alias manager, not including any extra data the application // may have added before storing the alis resource. char userType[4]; // Generally zeroes unsigned short aliasSize; // Length of record constructed by system unsigned short version; // 2? unsigned short flags; // 01 for file (as opposed to folder) alias unsigned char volLength; // 0A: Length of volume name char volName[27]; // Vol name: "Macintosh HD", . unsigned long timeStamp; // 26: Some time stamp unsigned char BD[2]; // 2A: Always 'BD' (database? bundle?) unsigned char _3[2]; // 2C: Flags? unsigned long parentID; // 2E: Parent directory file-ID unsigned char nameLength; // 32: Length of unqualified target name char name[63]; // 33: Unqualified target name unsigned long fileID; // 72: file-ID of target unsigned long timeStamp2; // 76: another timestamp // From here on in, seem to be two possibilities: // (a) OSType fdType; // 7A: OSType fdCreator; // 7E: // (b) // short, short (small numbers) // short, short (larger numbers - coords?) // FFFFFFFF unsigned char _4[0x99-0x82]; // Following field may not be there, or may be something different unsigned char parentLength; // 99: char parentName[1]; // 9A: // Full path is somewhere here, at varying offsets // Also seen: network address of server };