fuzziqersoftware / resource_dasm

Classic Mac OS resource fork and application disassembler, with reverse-engineering tools for specific applications
MIT License
108 stars 12 forks source link

Regression or a request to add a --relaxed flag #80

Closed Sembiance closed 2 months ago

Sembiance commented 2 months ago

Attached is a mac .rsrc file (Appearance Extension.rsrc.zip) file that resource_dasm (compiled with latest code as of today) is not able to parse:

$ resource_dasm --data-fork Appearance\ Extension.rsrc out
>>> Appearance Extension.rsrc
failed on Appearance Extension.rsrc: corrupt resource index

However, at some point in the past, probably in early to mid 2022, resource_dasm was able to process it. The results of this processing can be seen here: http://discmaster.textfiles.com/browse/639/Ducks%20Unlimited%20Ducks%20&%20Dogs%20Screen%20Saver%20&%20Wallpaper.iso/mac/Ducks%20and%20Dogs%20Installer/Ducks%20and%20Dogs%20Installer/Appearance%20Extension.rsrc

Thus this is technically a regression, as resource_dasm used to be able to extract 700+ things from this file, and now is unable to extract anything.

If this isn't a bug, my guess is in the past 2 years, resource_dasm must have gotten more strict about what it would and wouldn't parse and now rejects this file as invalid?

If that's the case would it possible to add a --relaxed flag that would allow resource_dasm to extract as much as it 'can' from a mac .rsrc file, even if it's not formed perfectly?

Sembiance commented 2 months ago

Here are some additional .rsrc files that used to work in older resource_dasm versions:

http://discmaster.textfiles.com/browse/639/Ducks%20Unlimited%20Ducks%20&%20Dogs%20Screen%20Saver%20&%20Wallpaper.iso/mac/Ducks%20and%20Dogs%20Installer/Ducks%20and%20Dogs%20Installer/SoftStuff%20Registration.rsrc

http://discmaster.textfiles.com/browse/723/Master_Hacker_Internet_and_Computer_Security_and_Terrorism_Core_Publishing_Group_2001.iso/phreaking/phreaking-mac/cell%20stack%202.0.sit/Cellular%20Stack%202.0.rsrc

https://discmaster.textfiles.com/browse/20613/apple-mac-advocate-ii-fall-1997.iso/mac/Claris%20Demos/Claris/Claris%20Emailer%20Accessories/CoolCards/CoolCards%20Light%20Installer/CoolCards%20Light%20Installer/CoolCards%20Help.rsrc

fuzziqersoftware commented 2 months ago

These files are AppleDouble encoded. resource_dasm used to handle this automatically but it now requires the index format to be explicitly set, since a valid AppleSingle/AppleDouble header could technically also be a valid resource fork header, so it doesn't suffice to just check the first couple of fields for signature values. You can extract resources from these files with the option --index-format=as/ad. I'm not opposed to adding an option that tries to automatically detect the index format, which would make the behavior more like it used to be; I'll do this if you think it's worth it.

Sembiance commented 2 months ago

Ahhh, that totally makes sense. Thanks for letting me know about that flag. I'll modify my side to send the appropriate index-format flag.

Thanks again for creating resource_dasm, it's awesome :)