• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

Resource Fork - Manual Parsing

Dennis Nedry

Well-known member
I'm working on figuring out how resource forks are parsed, somewhat for curiosity and also maybe for some use to somebody. I've made some progress, could anybody fill in some more info? I can't seem to find this online anywhere.

HEADER

0000 : 0003 Resource Raw Data Stating Location (= length of header)

0004 : 0007 Footer Starting Location

0008 : 000B Resource Raw Data Length

000C : 000F Resource Footer Length

RESOURCE DATA

Loop

4 bytes Length of resource data (x)

x bytes Resource data

End Loop

RESOURCE FOOTER

0x10 bytes Repeat of header data 0000:000F

0x0C bytes unknown

0x02 bytes 0-based count of resource types

loop

0x04 bytes 32-bit ASCII resource type

0x02 bytes 0-based quantity of this resource type (?)

0x02 bytes unknown (?)

end loop

loop

0x02 bytes resource ID number (16-bit)

0x02 bytes attributes (?)

0x04 bytes Offset to this specific resource data from raw data starting location

0x04 bytes attributes (?)

end loop

loop

0x01 byte resource name length (x)

x bytes ASCII resource name

end loop

 

dougg3

Well-known member
I'm pretty sure this is what you're looking for, courtesy of Inside Macintosh: Volume I:

I-128.JPG

I-129.JPG

I-130.JPG

I-131.JPG

Sorry about the flash lightening parts of the images!

 

basalgangster

Well-known member
Here is a little summary of information on page 128-131 of Volume 1 IM.

------- resource header ------

4 bytes Offset to Resource Data

4 bytes Offset to Resource Map

4 bytes Length of Resource Data

4 bytes Length of Resource Map

112 bytes - reserved

128 bytes - available for application-specific data

--------- start of resource data ------

----- for each resource -----------

4 bytes Length of Data

variable - actual data

---------- start of Resource Map ------

16 bytes copy of resource header

4 bytes Handle to next resource map

2 bytes File reference number

2 bytes Resource file attributes

2 bytes Offset to Type list (from beginning of resource map in bytes)

2 bytes Offset to Name List (as above)

------------- Type List --------

2 bytes Number of types -1

----- for each type there will be one of these ------

4 bytes Resource Type

2 bytes Number of this type -1

2 bytes Offset to Reference List for Type

Resource attributes:

bit 7 (reserved)

bit 6 resSysHeap

bit5 resPurgeable

bit 4 resLocked

bit 3 resProtected

bit 2 resPreload

bit 1 resChanged

bit 0 (reserved)

 
Top