Tuesday, October 17, 2023

Building a Classic Mac OS App in Rust

Wesley Moore:

The first challenge was finding a decent specification for the three versions of MacBinary. I was eventually I was able to dig up the following:

I then set about building the parser. I reused the binary parser code from Allsorts since I was already familiar with that code. I hit another roadblock when it came to the CRC in the header. Nothing describes the actual CRC algorithm used. I tried the CRC reversing tool CRC RevEng without success. A lot of existing code seemed to use an implementation that originated in a late 80’s UNIX utility, mcvert, that has unclear licensing. I wanted to use the Rust crc crate instead.


Due to its heritage most of the Mac OS toolbox functions use the Pascal calling convention, which LLVM does not support. To bridge the C (and Rust) world to this Pascal world I had to create trampoline functions in C for each toolbox function that I wanted to call from Rust[…]


I used the “Downloading a URL With HTTP” example from the Networking With Open Transport book as a guide for the functions I needed.


3 Comments RSS · Twitter · Mastodon

The MacBinary II Standard as well as source code to my MacBinary application and documentation on the extension to support folders is all available on my archive site.


Thanks Peter, I think I did stumble upon your site when I was looking for Mac Binary info. I just looked at the notes I took when I was doing it and I do have a link to macbinaryii-standard-info.txt in there. 👍️

Leave a Comment