darlinghq / darling-dmg

FUSE module for .dmg files (containing an HFS+ filesystem)
http://www.darlinghq.org
GNU General Public License v3.0
273 stars 45 forks source link

Read dmg files without unmount. #56

Open iradization opened 6 years ago

iradization commented 6 years ago

Hi,

I'm working on a file scanner that also support macOS archive files (that runs under linux) and was wondering if there's any way to use darling-dmg to extract dmg file contexts (by merely parsing/decompressing the dmg file) without the need to mount its contents on filesystem.

thanks

LubosD commented 6 years ago

Sure, check main-fuse.cpp to see how to use the internal API.

iradization commented 6 years ago

Thanks a lot, I'll try it. BTW, does darling-dmg create dmg format by itself ? I actually tried to mount empty hfs+ filesystem once on top of dmg file, and it seems like apple doesn't publish api on that, but force the user to use external binaries like newfs_hfs, mount_hfs and hdiutil that format the hfs+ structure in the dmg file... I wonder if it's optional to format it without these executables...

LubosD commented 6 years ago

No, darling-dmg can't create DMG files.

The HFS+ filesystem is pretty well documented and I think you can find the sources for newfs_hfs on http://opensource.apple.com. That's not the case of DMG though.

iradization commented 6 years ago

I've further investigated the project, and saw that in file "main-test-hfs+.cpp", the source file is expected to be from pure disk image format (without dmg header). and the test read the file "/Squiggle.app/Contents/Info.plist" directly from the dmg without mount, by merely parsing the partition hfs structure. The sample deals with AppleDisk format though, but it should work if I replace it to GPT format, right ?

LubosD commented 6 years ago

That's why I suggested that you read main-fuse.cpp, because there it also deals with DMG etc.