[File] [PATCH] of Magdir/ole2compounddocs for SoftMaker documents

Jörg Jenderek joerg.jen.der.ek at gmx.net
Thu Mar 26 03:10:30 UTC 2020


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,
some months ago i send patches to handle OLE 2 Compound Document.
Some days ago i used SoftMaker Office. That suite can read/read
Microsoft Office and OpenDocument files. It also has it own native
formats. Some are based on OLE 2 Compound Document format.
When running file command version 5.38 on such documents with -e cdf
option i get an output like:

planmaker-pmd-2010.pmd:            OLE 2 Compound Document, v3.62,
	SecID 0x13 : UNKNOWN,
	clsid 0x9174088a6452d41195f600a0cc3cca14
planmaker-pmd-2012.pmd:            OLE 2 Compound Document, v3.62,
	SecID 0x12 : UNKNOWN,
	clsid 0x9174088a6452d41195f600a0cc3cca14
planmaker-pmv.pmv:                 OLE 2 Compound Document, v3.62,
	SecID 0x12 : UNKNOWN,
	clsid 0x9174088a6452d41195f600a0cc3cca14
sm-presentation-pot.pot:           OLE 2 Compound Document,
	v3.62, SecID 0x2b : UNKNOWN
sm-presentation-pps.pps:           OLE 2 Compound Document,
	v3.62, SecID 0x2b : UNKNOWN
sm-presentation-ppt-2000-2003.ppt: OLE 2 Compound Document,
	v3.62, SecID 0x2b : UNKNOWN
sm-presentation-ppt-97.ppt:        OLE 2 Compound Document,
	v3.62, SecID 0x2b : UNKNOWN
sm-presentation-prd.prd:           OLE 2 Compound Document,
	v3.62, SecID 0x29 : UNKNOWN

Some information about Planmaker is found on Wikipedia. So i
add to Magdir/ole2compounddocs a comment line like:
 # URL:	https://en.wikipedia.org/wiki/PlanMaker

For UNKNOWN examples where clsid is shown adding is easy. Because
the clsid is a unique identifier, then in sub routine
ole2-directory inside Magdir/ole2compounddocs lines must be added
to check for specific id at offset 80 of directory stream and then
print file description. This additional lines look like:
 >>88 	ubequad	0x95f600a0cc3cca14	: PlanMaker
 >>>80 	ubequad	0x9174088a6452d411	document or template
Afterwards show mime type and file name extension for document or
templates by lines like
 !:mime	application/vnd.softmaker.planmaker
 !:ext	pmd/pmv

For the other unknown files made by spreadsheet or presentation
module of Softmaker Office suite clsid is zero. Some information
about that office suite is found on Wikipedia. So i add a comment
line to  Magdir/ole2compounddocs at the right position like:
 # URL:	https://en.wikipedia.org/wiki/PlanMaker
So i look at directory name entries, which seem to have specific
names (PowerPoint,SMNativeObjData,Current User), but i am not sure
about this assumption. Especially the Microsoft PowerPoint
generated format (PPT) samples look nearly the same as Softmaker
own Presentations format (PRD) examples.

In the end i add magic lines like:
 >>>>128   lestring16 Current\ User	: SoftMaker
 >>>>>256  lestring16 SMNativeObjData
 >>>>>>512 lestring16 PowerPoint PowerPoint presentation or template
 !:mime	application/vnd.ms-powerpoint
 !:ext	ppt/pps/pot
 >>>>>384  lestring16 PowerPoint	Presentations or template
 !:mime	application/vnd.softmaker.presentations
 !:ext	prd/prv
 >>>>256   lestring16 Current\ User	: SoftMaker
 >>>>>512  lestring16 PowerPoint	Presentations or template
 !:mime	application/vnd.softmaker.presentations
 !:ext	prd/prv

Because i am still not able to recognize small StarOffice Gallery
views (*.sdv), i also display additional information from header
after SecID if values are unusual. This now looks like:

 >>>32	uleshort !6		\b, exponent of short stream %u
 >>>44	ulelong  >1		\b, %u FAT sectors
 >>>60	ulelong  !0xffFFffFE	\b, Mini FAT start sector 0x%x
 >>>64	ulelong  !0		\b, %u Mini FAT sector
 >>>>64	ulelong  >1		\bs
 >>>68	ulelong  !0xffFFffFE	\b, DIFAT start sector 0x%x
 >>>72	ulelong  >0		\b, %u DIFAT sectors

After applying the above mentioned modifications by patch
file-5.38-ole2compounddocs-softmaker.diff then the above mentioned
Softmaker examples are now identified like:

planmaker-pmd-2010.pmd:            OLE 2 Compound Document, v3.62,
	SecID 0x13, Mini FAT start sector 0x12 :
	PlanMaker document or template
planmaker-pmd-2012.pmd:            OLE 2 Compound Document, v3.62,
	SecID 0x12, Mini FAT start sector 0x11 :
	PlanMaker document or template
planmaker-pmv.pmv:                 OLE 2 Compound Document, v3.62,
	SecID 0x12, Mini FAT start sector 0x11 :
	PlanMaker document or template
sm-presentation-pot.pot:           OLE 2 Compound Document, v3.62,
	SecID 0x2b, Mini FAT start sector 0x2a :
	SoftMaker PowerPoint presentation or template
sm-presentation-pps.pps:           OLE 2 Compound Document, v3.62,
	SecID 0x2b, Mini FAT start sector 0x2a :
	SoftMaker PowerPoint presentation or template
sm-presentation-ppt-2000-2003.ppt: OLE 2 Compound Document, v3.62,
	SecID 0x2b, Mini FAT start sector 0x2a :
	SoftMaker PowerPoint presentation or template
sm-presentation-ppt-97.ppt:        OLE 2 Compound Document, v3.62,
	SecID 0x2b, Mini FAT start sector 0x2a :
	SoftMaker PowerPoint presentation or template
sm-presentation-prd.prd:           OLE 2 Compound Document, v3.62,
	SecID 0x29, Mini FAT start sector 0x28 :
	SoftMaker Presentations or template
sm-presentation-prv.prv:           OLE 2 Compound Document, v3.62,
	SecID 0x29, Mini FAT start sector 0x28 :
	SoftMaker Presentations or template

I hope that 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+v8rHJQhrU1gUCXnwc5AAKCRCv8rHJQhrU
1lPWAJsHqhGJc6NSCSsPMSHjIroqqu3bHgCgmtpYFMYd7f0cOAp2SA1G/ImJrc8=
=3n6t
-----END PGP SIGNATURE-----
-------------- next part --------------
--- file-5.38/magic/Magdir/ole2compounddocs.old	2019-08-02 19:08:18 +0000
+++ file-5.38/magic/Magdir/ole2compounddocs	2020-03-26 02:48:00 +0000
@@ -28,4 +28,23 @@
 # SecID of first sector of the directory stream is often 1 but high like 3144h
 >>>48	ulelong			x			\b, SecID 0x%x
+# Sector Shift Exponent in short-stream container stream: 6~64 bytes
+>>>32	uleshort		!6			\b, exponent of short stream %u
+# total number of sectors used for the FAT
+>>>44	ulelong			>1			\b, %u FAT sectors
+# SecID of first sector of the short-sector allocation table (Mini FAT)
+# or -2 (End Of ChainSecID) if not extant
+>>>60	ulelong			!0xffFFffFE		\b, Mini FAT start sector 0x%x
+# total number of sectors used for the short-sector allocation table
+>>>64	ulelong			!1			\b, %u Mini FAT sector
+# plural s
+>>>>64	ulelong			>1			\bs
+# SecID of first sector of the master sector allocation table (DIFAT)
+# or -2 (End Of Chain SecID) if no additional sectors used
+>>>68	ulelong			!0xffFFffFE		\b, DIFAT start sector 0x%x
+# total number of sectors used for the master sector allocation table (DIFAT)
+>>>72	ulelong			>0			\b, %u DIFAT sectors
+# First part of the master sector allocation table (DIFAT) containing 109 SecIDs
+#>>>76 	ubequad			x			\b, DIFAT=0x%16.16llx
+#>>>84 	ubequad			x			\b%16.16llx...
 # pointer to root entry only works with standard configuration for SecID ~< 800h
 # Red-Carpet-presentation-1.0-1.sdd sg10.sdv 2000_GA_Annual_Review_Data.xls
@@ -52,5 +71,5 @@
 # node colour of the entry: 00H ~ Red 01H ~ Black
 #>67 	ubyte		x			\b, color %x
-# the DirIDs of the child nodes. Should both be –1 in the root storage entry
+# the DirIDs of the child nodes. Should both be -1 in the root storage entry
 #>68 	bequad		!0xffffffffffffffff	\b, DirIDs %llx
 # second directory entry name like VisioDocument Control000 
@@ -208,4 +227,27 @@
 !:mime	application/x-star-sdv
 !:ext	sdv
+# URL:	https://en.wikipedia.org/wiki/SoftMaker_Office
+# second directory entry name Current User
+>>>>128 	lestring16	Current\ User		: SoftMaker
+# third directory entry name SMNativeObjData
+>>>>>256	lestring16	SMNativeObjData		
+# 5th directory entry nane PowerPoint
+>>>>>>512	lestring16	PowerPoint		PowerPoint presentation or template
+!:mime	application/vnd.ms-powerpoint
+!:ext	ppt/pps/pot
+# 4th directory entry name PowerPoint
+>>>>>384	lestring16	PowerPoint		Presentations or template
+# http://extension.nirsoft.net/prv
+!:mime	application/vnd.softmaker.presentations
+!:ext	prd/prv
+# third directory entry name like Current User
+>>>>256 	lestring16	Current\ User		: SoftMaker
+# 5th directory entry name PowerPoint
+>>>>>512	lestring16	PowerPoint		Presentations or template
+# http://extension.nirsoft.net/prd
+!:mime	application/vnd.softmaker.presentations
+!:ext	prd/prv
+# 2nd directory entry name Pictures
+>>>>>>128 	lestring16	Pictures		with pictures
 #	remaining null clsid
 >>>>128 	default		x			: UNKNOWN
@@ -464,4 +506,10 @@
 !:apple	????FPix
 !:ext	fpx
+# URL:	https://en.wikipedia.org/wiki/SoftMaker_Office
+>>88 	ubequad		0x95f600a0cc3cca14	: PlanMaker
+>>>80 	ubequad		0x9174088a6452d411	document or template
+!:mime	application/vnd.softmaker.planmaker
+# pmv for template	https://www.file-extensions.org/pmv-file-extension
+!:ext	pmd/pmv
 # remaining non null clsid
 >>88 	default		x			: UNKNOWN
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.38-ole2compounddocs-softmaker.diff.sig
Type: application/octet-stream
Size: 95 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20200326/87cf428d/attachment.obj>


More information about the File mailing list