[File] [PATCH] of Magdir/images for Windows 3.x bitmap (*.bmp *.rle *.sys)

Christos Zoulas christos at zoulas.com
Sat Jul 6 19:49:20 UTC 2019


Applied, thanks!

christos

> On Jul 3, 2019, at 8:06 PM, Jörg Jenderek <joerg.jen.der.ek at gmx.net> wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hello,
> some days ago i handle some Windows 3.x bitmap variant. When i run
> file command version 5.37 for these examples and other test files i
> get an output like:
> 
> 98SE2ME3.BMP:                 PC bitmap, Windows 3.x format,
> 	320 x 400 x 8
> badplanes.bmp:                PC bitmap, Windows 3.x format,
> 	127 x 64 x 1
> EGALOGO.RLE:                  PC bitmap, Windows 3.x format,
> 	640 x 350 x 4
> fmt-116-signature-id-118.dib: PC bitmap, Windows 3.x format,
> 	-1414812757 x -1414812757 x 1
> fmt-117-signature-id-119.dib: PC bitmap, Windows 3.x format,
> 	-1414812757 x -1414812757 x 16
> HERCLOGO.RLE:                 PC bitmap, Windows 3.x format,
> 	720 x 348 x 4
> logo.sys:                     PC bitmap, Windows 3.x format,
> 	320 x 400 x 8
> logos.sys:                    PC bitmap, Windows 3.x format,
> 	320 x 400 x 8
> logow.sys:                    PC bitmap, Windows 3.x format,
> 	320 x 400 x 8
> NASABALL.BMP:                 PC bitmap, Windows 3.x format,
> 	800 x 600 x 4
> pal1wb.bmp:                   PC bitmap, Windows 3.x format,
> 	127 x 64 x 1
> pal2color.bmp:                PC bitmap, Windows 3.x format,
> 	127 x 64 x 2
> rgb16-880.bmp:                PC bitmap, Windows 3.x format,
> 	127 x 64 x 16
> rgb24largepal.bmp:            PC bitmap, Windows 3.x format,
> 	127 x 64 x 24
> rgba32abf.bmp:                PC bitmap, Windows 3.x format,
> 	127 x 64 x 32
> rletopdown.bmp:               PC bitmap, Windows 3.x format,
> 	127 x -64 x 8
> 
> Unfortunately test lines are not unique enough. Droid test skeletons
> like fmt-116-signature-id-118.dib and fmt-117-signature-id-119.dib
> are misidentified. So addtional test lines are needed.
> 
> Furthermore with --extension option ??? is displayed. And with
> - --apple option UNKNUNKN is shown. With -i option deprecated
> "image/x-ms-bmp" mime type is shown.
> 
> So i add/change lines in Magdir/images. I also add more lines to
> display more details like the variable offBits by line
>>>> 10	ulelong			x	\b, bits offset %u
> That is the offset to bitmap data with value like 36h 76h BEh 236h
> 406h 436h 4E6h for  Windows 3.x bitmap. At first glance this is not
> so interesting for users, but so i see that this value is relative
> low. This is no explicitly mentioned in the documentation and this
> information can be used as additional test.
> 
> I also show variable cbSize by line
>>>> 2	ulelong		x		\b, cbSize %u
> For  Windows 3.x bitmap this is often the file size, but in rare
> cases this value is lower. So in the end i use this information as
> additional test by jumping 4 bytes before end of file/header and
> check for accessing these 4 bytes by line
>>> (2.l-4)	ulong	x		PC bitmap, Windows 3.x format
> So bad examples like fmt-116-signature-id-118.dib are skipped.
> Now afterward show new mime type and apple id by lines
> !:mime		image/bmp
> !:apple	????BMPp
> 
> According to https://en.wikipedia.org/wiki/LOGO.SYS the described
> bitmap format is also used for Windows 9M boot and shutdown logos,
> which have "sys" filename extension instead of usual "bmp". Such
> logos have a dimension of 320 x 400. So test for these dimensions
> and then show 2 possibles file name extensions by lines
>>>> 18	ulequad		=0x0000019000000140	x
> !:ext	bmp/sys
> 
> The other examples are matched by branch starting with line
>>>> 18	ulequad		!0x0000019000000140
> 
> Later i also show stored compression method as numeric by line
>>>> 30	ulelong		>0		\b, %u compression
> Value 1 means "RLE 8-bit/pixel" compression. 2 means "RLE
> 4-bit/pixel" compression. 3 means Huffman 1D compression.
> Some times instead bmp file name extension rle is used for run
> length encoding compressed bitmaps. I found examples like
> EGALOGO.RLE with compression method 2 value. This is now described
> in second branch by lines
>>>>> 30	ulelong		2		x
> !:ext	bmp/rle
>>>>> 30	default		x		x
> !:ext	bmp
> 
> After applying the above mentioned modifications by patch
> file-5.37-images-bmp_rle.diff then observed misidentification
> vanish and more details are displayed like
> 
> 98SE2ME3.BMP:                 PC bitmap, Windows 3.x format,
> 	320 x 400 x 8, image size 128000,
> 	236 important colors,
> 	cbSize 129082, bits offset 1078
> badplanes.bmp:                PC bitmap, Windows 3.x format,
> 	127 x 64 x 1, image size 1024,
> 	resolution 2835 x 2835 px/m,
> 	cbSize 1086, bits offset 62
> EGALOGO.RLE:                  PC bitmap, Windows 3.x format,
> 	640 x 350 x 4, 2 compression, image size 17240,
> 	16 important colors,
> 	cbSize 17358, bits offset 118
> fmt-116-signature-id-118.dib: data
> fmt-117-signature-id-119.dib: data
> HERCLOGO.RLE:                 PC bitmap, Windows 3.x format,
> 	720 x 348 x 4, 2 compression, image size 15950,
> 	16 important colors,
> 	cbSize 16068, bits offset 118
> logo.sys:                     PC bitmap, Windows 3.x format,
> 	320 x 400 x 8, image size 128000,
> 	236 important colors,
> 	cbSize 129082, bits offset 1078
> logos.sys:                    PC bitmap, Windows 3.x format,
> 	320 x 400 x 8,
> 	cbSize 129078, bits offset 1078
> logow.sys:                    PC bitmap, Windows 3.x format,
> 	320 x 400 x 8,
> 	cbSize 129078, bits offset 1078
> NASABALL.BMP:                 PC bitmap, Windows 3.x format,
> 	800 x 600 x 4, 2 compression, image size 53450,
> 	16 important colors,
> 	cbSize 53568, bits offset 118
> pal1wb.bmp:                   PC bitmap, Windows 3.x format,
> 	127 x 64 x 1, image size 1024,
> 	resolution 2835 x 2835 px/m,
> 	cbSize 1086, bits offset 62
> pal2color.bmp:                PC bitmap, Windows 3.x format,
> 	127 x 64 x 2, image size 2048,
> 	resolution 2835 x 2835 px/m,
> 	cbSize 2118, bits offset 70
> rgb16-880.bmp:                PC bitmap, Windows 3.x format,
> 	127 x 64 x 16, 3 compression, image size 16384,
> 	resolution 2835 x 2835 px/m,
> 	cbSize 16450, bits offset 66
> rgb24largepal.bmp:            PC bitmap, Windows 3.x format,
> 	127 x 64 x 24, image size 24576,
> 	resolution 2835 x 2835 px/m,
> 	cbSize 25830, bits offset 1254
> rgba32abf.bmp:                PC bitmap, Windows 3.x format,
> 	127 x 64 x 32, 6 compression, image size 32512,
> 	resolution 2835 x 2835 px/m,
> 	cbSize 32582, bits offset 70
> rletopdown.bmp:               PC bitmap, Windows 3.x format,
> 	127 x -64 x 8, 1 compression, image size 7726,
> 	resolution 2835 x 2835 px/m,
> 	cbSize 8788, bits offset 1062
> 
> I hope my diff file can be applied in future version of
> file utility.
> 
> With best wishes
> Jörg Jenderek
> - --
> Jörg Jenderek
> 
> 
> -----BEGIN PGP SIGNATURE-----
> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
> 
> iF0EARECAB0WIQS5/qNWKD4ASGOJGL+v8rHJQhrU1gUCXR1C7QAKCRCv8rHJQhrU
> 1qRvAKCU2oQSs025KPsKSNJM2n8q/Zwn+QCeK33bjZd5ZEH3v2NP71lZq9qconI=
> =jjE3
> -----END PGP SIGNATURE-----
> <file-5_37-images-bmp_rle_diff.DEFANGED-24><file-5_37-images-bmp_rle_diff_sig.DEFANGED-25>-- 
> File mailing list
> File at astron.com
> https://mailman.astron.com/mailman/listinfo/file
> <sanitizer.log>



More information about the File mailing list