Mark0's software support board
December 13, 2017, 07:40:05 pm *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to the new forum! Guests can posts without registration.
   Home   Help Search Login Register  
Pages: [1]
Author Topic: 3 replacement macbin-?.trid.xml for MacBinary and 2 variants  (Read 24 times)
Posts: 43

« on: December 11, 2017, 06:46:35 pm »

when i run TrID on examples often files are misidentified as "MacBinary 2
header" or similar (see appended bad/output/trid-old.txt).

The file(1) command does not classify that examples as MacBinary (see
appended bad/output/file.txt)

Because the 3 trid definitions concerning MacBinary are not full fitted i
replace them. So macbinary-2.trid.xml is replaced by macbin-2.trid.xml etc.

The current definitions contain a line like:

That would mean that MacBinary have no file name extension. That is
wrong. According to Wikipedia page
"bin" extension is used. This is what i also see for most examples.

Following links on website also extension "macbin" is used. This would now be
expressed by line:


For further inspection i look at MacBinary II Specification found for
example at .
According to that document MacBinary contain some 3 zero fill bytes. This is
expressed by XML construct:


Trid definition macbinary-2.trid.xml contains no more patterns. Because these
null bytes also occur in master boot record and CD images without boot
loader. So such files like Samsung5_Z-pt.vmdk and MSDOS8.iso are always
misidentified as "MacBinary 2 header".

At offset 122 version is stored. For oldest this byte is null and for the
newer versions value begins at 129. Luckily there exist only 3 main major
versions (1/II/III). So add for MacBinary 2 to trid definition also


At offset 123 minimum version needed to read this file is stored.
Theoretically 6 version combination may exist. But in real world i only
found 3 combinations (0, 8181h and 8281h). So if further distinguishing is
needed create branches like definition for "MacBinary III with II
to read" with construct like:

Not mentioned in specifications but always found "mBiN" string for MacBinary 3.
This was already expressed by construct:

   <ASCII> m B I N</ASCII>

At offset 99 length of Get Info comment is stored. According to docs no
program apparently has implemented this feature. That means length is
null. So add for MacBinary 2 and 3 additional expression like:


For MacBinary 1 most variables at the end of header are not defined.

According to specs any bytes in the header not defined should be set to
zero. This was expressed correctly for MacBinary 1 by construct like:


Undefined bytes are now expressed for MacBinary 2 by additional construct:


At offset 83 data fork length is stored as long big endian and at 87
resource fork length. In documentation there exist a sentence which i
finally interpreted that the length of the forks should be in the range of
0-007FFFFFh for MacBinary 1. That would mean a 8 MB size limit for embedded
forks. Or in trid scenario upper byte is null which match all forks with
size below 16 MB. So add/change for MacBinary 1 two additional XML
constructs like:


With macstream (version 2.0b3 22Oct1992 and part of macutils package on
Linux) and -d option (files assumed to be plain text) create from big sized
(29096865 bytes) input a MacBinary 1 example (
see output of patched file command 1/output/file-new.txt). This example is
then not recognized as pure MacBinary 1 by new trid definition any
more. At first glance size limitation seems to be wrong.

But when looking at Wikipedia we see MacBinary 1 was released in 1985 and
updated to MacBinary 2 in 1987. I am no Mac expert, but in that time area
values like 8 MB are the size range of the whole PC RAM. So 8 MB or bigger
sized MacBinary 1 can not occur in real word examples at that time. So in
real world examples size with only some hundreds KB occur (See 215500 bytes
for MacGzip-1.1.3.sea.bin in 1/output/file-new.txt). So i keep that size
limitations in trid definition for MacBinary 1.

With replacement macbin-1.trid.xml all DOS 2.0-3.2 backup part like
ATIH_255.EXE are not misidentified any more (see bad/output/trid-new.txt).

But still many examples are misidentified whereas patched file command
identifies correctly. So i look what file command does. It also check if
length of filename is in the range 1-63 and if file name starts with
printable characters. So i add this information to remark line.

All misidentification for MacBinary 2 vanish by macbin-2.trid.xml ( see

For MacBinary 3 identification by macbin-3.trid.xml is the same as by old
macbinary-3.trid.xml, but recognition rate has changed a little bit ( see

Another approach to overcame the week pattern especially for MacBinary 1 is
to look for apple type (normally expressed as four characters) stored at
offset 65 and/or apple file creator stored at offset 69 by trid definition
of form macbin-gen-*.trid.xml.

So example like gnupg-logo-eps.macbin is also identified as "Macintosh
Encapsulated Postscript (MacBinary)" by macbin-gen-eps.trid.xml which
contains additional XMl construct:

The used reference link in such trid definition is now dead:
The new updated should contain no "3" at the end and look like:

Furthermore such definitions should contain for mime type a line like:

I am no Mac expert. So i am not sure about following fact. According to
macbin-gen-eps.trid.xml the MacBinary have file name extension "eps" by

But i found for example still typical MacBinary "macbin" extension which would
be expressed by line like:

and only the source file has extension "eps" like for my example
gnupg-logo.eps ( see 1/output/file-new.txt). So i leave existing
macbin-gen*.trid.xml definitions untouched.

So i only create 2 additional definitions with apple type for my examples
where missing.

GohuFont.bin is now identified as "Macintosh font suitcase (MacBinary)" (see
3/output/trid-new.txt) by macbin-gen-font.trid.xml by also looking for apple
type FFIL via additional XML construct:


TERM.MAC.bin i now identified as "Macintosh Stuffit Deluxe archive
(MacBinary)" ( see 2/output/trid-new.txt ) by
macbin-gen-stuffitDeluxe.trid.xml by also looking for apple type SITD via
additional XML construct:


TrID definition, some examples and output are stored in archive I hope that my 5 XML files can be used in future version of

With best wishes
Jörg Jenderek

Hero Member
Posts: 1563

« Reply #1 on: December 12, 2017, 03:03:41 pm »

Many thanks Joerg!
Pages: [1]

Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2001-2010, Lewis Media Valid XHTML 1.0! Valid CSS!
Page created in 0.117 seconds with 17 queries.