Resource forks

Marcus Better
Mon, 29 Jul 1996 23:55:15 +0000


my name is Marcus Better, and I am working on an HFS driver for OS/2. I
have run into a problem with resource forks.

I want my driver to access the resource forks of files and extract
resources such as icons. It would then convert the icons to an extended
attribute which OS/2 understands. Since there is a description of the
layout of resource forks in "Inside Macintosh", it should be
straightforward to read the resources of a file.

However, having looked at several resource forks, it seems to me that
they don't quite follow the layout in "Inside Macintosh". According to
the specification, the header of a resource fork contains an offset to
the beginning of a resource map, but in all resource forks I've
examined, the resource map start a few bytes beyond that offset. The
difference ranges from one byte to perhaps 80 bytes or so, but I still
haven't found a single file where the offset was correct. There seems to
be no way to predict where the resource map really starts. Although it
is easy to find it by hand with some educated guesses, I wouldn't like
to write any code based on guesswork.

I think the resource map begins right after the data area (although I'm
not entirely sure), but the data area is simply a few bytes longer than
the header indicates.

Has anybody had any experience with manipulating resource forks? I would
appreciate any clue you might have on this.

By the way, the driver is available at
Source code is included. It's an early experimental version but seems to
be stable on the whole, although I have fixed a few bugs since it was