Jump to content
equant

Stuffit Magic Numbers

Recommended Posts

In a different thread (over in software), @Dog Cow mentioned that there are magic numbers which can be used to distinguish which version of the stuffit algorithm was used to compress a file.  Does anyone have more information on this?  I would like to build a utility that can sort *.sit files, or perhaps improve the unix 'file' command to report a bit more than just "StuffIt Archive" when it sees "SIT!".  I believe I can compress the same file with different versions and reverse engineer it, but figured I'd ask in case someone had this info somewhere.

 

Thanks,

Nathan

Share this post


Link to post
Share on other sites

Would it be possible to make an INIT for System 6 and 7 that overrides the System Bundle icons for Stuffit files with one containing a version number?  I could make up a set of icons for it.  Then you could tell right off the bat which version of Stuffit you'd need.

Share this post


Link to post
Share on other sites

That’s a fun idea for a project. It’s not immediately obvious to me how to do that, since the Finder (or more likely a DRVR running in the background, launched by the INIT) would need to actually open the StuffIt archive and read far enough into it to get the magic number (if it’s there) each time it needed to decide what icon to draw. Patch _GetResource, and if the Finder is the foreground app and it’s getting an ICN# resource corresponding to an archive document from StuffIt, look up the file whose icon is being drawn (but how do I know which one that is???) in the precomputed hashtable of known archives and return the appropriate icon you designed ... and if the file hasn’t been seen before, stop and open it up to check the type and populate the hashtable entry? ...... or something. If I didn’t have a newborn, I would try it. Unless someone is super expert at how the Finder draws file icons, it would probably require a long Macsbug session.

Share this post


Link to post
Share on other sites

@PowerPup Thanks for those links.  Looks perfect.  I went ahead and did some tests and here's what I came up with.  Looks like it's easy to tell apart pre 1.5.1, 1.5.1, 3.5 and 5.5.

 

 

Screenshot_2020-01-17_20-08-13.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×