[File] [PATCH] Magdir/wordprocessors for WordPerfect Unknown filetype 42 *.IRS+36 *.VRS+21 *.FIL+41 *.INS

Jörg Jenderek joerg.jen.der.ek at gmx.net
Tue Aug 30 15:18:51 UTC 2022


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

Hello,

some days ago i send patch for Word Perfect CBT samples. These are
found in sub directory WritingTools inside Word Perfect program
directory "c:\Program Files (x86)\Corel\WordPerfect Office 2021".

For control reason i look for other Word Perfect files there and in
near directories. These often start with 2 letter phrase WP. That
apparently is the abbreviation for WordPerfect. The last capitals
often correspond to used language. For Germany DE is used and for
English En is used.

When running file command (version 5.42) on such examples i get an
output like:

BUTTRFLY.WPG:     WordPerfect graphic image, v1.0
FOOTEND.WPM:      WordPerfect macro, v1.1
HP4L593.ALL:      WordPerfect printer data, v3.3
SHORTCUT.WPK:     WordPerfect keyboard file, v1.1
STANDARD.IRS:     Corel WordPerfect: Unknown filetype 42, v5.0
STANDARD.VRS:     Corel WordPerfect: Unknown filetype 36, v5.0
WORDPFCT.WPD:     WordPerfect document, v2.1
WORKBOOK.PRS:     WordPerfect printer data, v3.2
WP.FIL:           Corel WordPerfect: Unknown filetype 21, v3.0
WP.MRS:           WordPerfect macro resource data, v1.1
WP3.wpd:          WordPerfect 3.5 document, v2.2
WP51.INS:         Corel WordPerfect: Unknown filetype 41, v1.0
WPHELP.FIL:       WordPerfect help file, v5.0
WPSMALL.DRS:      WordPerfect driver resource data, v3.3
test-vax-kbd.bin: Corel WordPerfect: Unknown filetype 4, v7.9
wpen.qrs:         WordPerfect equation resource data, v1.0

With --extension option only ??? is displayed. Furthermore with -i
option for my samples only generic application/octet-stream is shown.

For comparison reason i run the file format identification utility
TrID ( See https://mark0.net/soft-trid-e.html). This identifies all
such examples with low rate as "WordPerfect (generic)" by
wp-generic.trid.xml. Examples like BUTTRFLY.WPG are described with
higher rate as "WordPerfect Graphics bitmap" by bitmap-wpg.trid.xml.
Some examples like FOOTEND.WPM are described as "WordPerfect Macro"
by wpm-macro.trid.xml and some examples like WORDPFCT.WPD are
described as "WordPerfect Document (generic)" by wpd-doc-gen.trid.xml
(See appended trid-v-wordperfect.txt.gz ). TrID often list the used
file name extension and the related URL pointing to some
information with -v option.

The description happens inside Magdir/wordprocessors by starting like
:
 0	string	\xffWPC
So we see that the first 4 bytes are the generic magic for all
WordPerfect samples. By bytes at offset 8 and 9 sub classification is
done.

For QRS samples (like WQ.QRS wpDE.qrs wpen.qrs) this is done by lines
like:
 >8	byte	1
 >>9	byte	30	WordPerfect equation resource data
After i add new lines like:
 !:mime		application/x-wordperfect-qrs
 !:ext		qrs
 >>>(4.l)	ubyte	x
 >>>>&1		string	>A	(...%-.19s...)
 >>>4		ulelong	x	\b, at %#x document area
Instead of generic application/octet-stream i show an user defined
one. At offset 4 a pointer to document area is stored as 4 byte
little endian integer. So also show this information (like 17C4h).
So jump here to that area and show stored equation information ( like
"Fraction:  x OVER y").

If sub class is not known as last step the sub class for every
thing else is shown by lines like:
 >>9	default x
 >>>9	byte	x	Corel WordPerfect: Unknown filetype %d

So for unknown VRS i insert lines. In the unofficial documentation
WPFF_DocumentStructure.htm that i mentioned in older patches VRS
files are listed. There for VRS file like STANDARD.VRS type 26 is
listed and for 36 WPD is listed. Oh, this this seems to be a
changing accident. Furthermore i looked how other call VRS samples.
I found something like "Corel WordPerfect video resource device
driver" or "Video Resource e.g. video device driver - WordPerfect".
So i choose what seems to fit best the file name suffix.  When
looking inside sample near the beginning i found string like "IBM
CGA (& compatibles)". So i know that this classification is
alright. So i express this by lines like:
 >>9	byte	36	WordPerfect Video Resource
 !:mime		application/x-wordperfect-vrs
 !:ext		vrs
 >>>0x20		string	>A	"%.23s"

After "bad" experience with unofficial WP documentation i changed my
doing in adding new types like following. There are still more
unknown file types listed. If i myself found no sample i add the
file type tests just as comment lines like:
# External spell code module (WP5.1)
#>>9	byte	46	WordPerfect external spell
# external spell dictionary .LEX
#>>9	byte	47	WordPerfect external spell dictionary
# Macintosh SOFT graphics file (SOFT (Sequential Object Format)
#>>9	byte	48	WordPerfect SOFT graphics
#>>9	byte	49	reserved
#>>9	byte	50	reserved
# WPWin 5.1 Application Resource Library added for WPWin 5.1
#>>9	byte	51	WordPerfect application resource library

For unknown file types where i found samples i add lines. So after
VRS samples i add lines for cases like:
 >>9	byte	4	WordPerfect VAX keyboard definition
 >>9	byte	21	WordPerfect Overlay file
 >>9	byte	41	WordPerfect Install options
 >>9	byte	42	WordPerfect Resource

After applying the above mentioned modifications by patch
file-5.42-wordprocessors-wordperfect.diff then i get a more precise
output and many unknown file types are now recognised like:

BUTTRFLY.WPG:     WordPerfect graphic image
		  , at 0x10 document area, v1.0
FOOTEND.WPM:      WordPerfect macro, v1.1
HP4L593.ALL:      WordPerfect printer data, v3.3
SHORTCUT.WPK:     WordPerfect keyboard file
		  , 23381 bytes, v1.1
STANDARD.IRS:     WordPerfect Resource
		  "Mouse Driver (MOUSE.COM)", v5.0
STANDARD.VRS:     WordPerfect Video Resource
		  "IBM CGA (& compatibles)", v5.0
WORDPFCT.WPD:     WordPerfect document, v2.1
WORKBOOK.PRS:     WordPerfect printer data
		  "Workbook Printer", v3.2
WP.FIL:           WordPerfect Overlay file, v3.0
WP.MRS:           WordPerfect macro resource data, v1.1
WP3.wpd:          WordPerfect 3.5 document, v2.2
WP51.INS:         WordPerfect Install options
		  "C:\WP51\", v1.0
WPHELP.FIL:       WordPerfect help file, v5.0
WPSMALL.DRS:      WordPerfect driver resource data, v3.3
test-vax-kbd.bin: WordPerfect VAX keyboard definition, v7.9
wpen.qrs:         WordPerfect equation resource data
		  (...Fraction:  x OVER y...),
		  at 0x17c4 document area, v1.0

And with --extension option i get in many cases the correct suffix
like:
BUTTRFLY.WPG:     wpg
FOOTEND.WPM:      wpm
HP4L593.ALL:      all
SHORTCUT.WPK:     wpk
STANDARD.IRS:     irs
STANDARD.VRS:     vrs
WORDPFCT.WPD:     wpd/wpt/wkb/icr/tut/sty/tst/crs
WORKBOOK.PRS:     prs
WP.FIL:           fil
WP.MRS:           mrs
WP3.wpd:          wpd
WP51.INS:         ins
WPHELP.FIL:       fil
WPSMALL.DRS:      drs
test-vax-kbd.bin: ???
wpen.qrs:         qrs

I hope my diff file can be applied in future version of
file utility.

Unfortunately for WordPerfect document ( file type 10) i found many
different extensions ( like wpd/wpt/wkb/icr/tut/sty/tst/crs). I do
not know how to distinguish these different suffix.

Furthermore the DROID x-fmt-395-signature-id-132.wpg example is
misidentified as WPG. So additional test ( like check for existing
document area) for that case must be added. But for that a "complete"
rewrite of the magic lines must be done.

With best wishes
Jörg Jenderek
- --
Jörg Jenderek
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iF0EARECAB0WIQS5/qNWKD4ASGOJGL+v8rHJQhrU1gUCYw4qSgAKCRCv8rHJQhrU
1jY6AJ4ps4OUSnjoKNRkUaNcD0+LQx4LTgCgsJLxw7Ny2JWI8WO3N1eGs2/l5kQ=
=Svfi
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trid-v-wordperfect.txt.gz
Type: application/x-gzip
Size: 926 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20220830/73c7fd8b/attachment.bin>
-------------- next part --------------
--- file-5.42/magic/Magdir/wordprocessors.old	2021-12-06 16:25:22.000000000 +0100
+++ file-5.42/magic/Magdir/wordprocessors	2022-08-29 23:38:05.869899900 +0200
@@ -33,6 +33,35 @@
 >8	byte	1
+# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/w/wpm-macro.trid.xml
+# Note:		there exist other macro variants
 >>9	byte	1	WordPerfect macro
+#!:mime		application/octet-stream
+!:mime		application/x-wordperfect-wpm
+# like: ALTD.WPM ENDFOOT.WPM FOOTEND.WPM LABELS.WPM REVEALTX.WPM
+!:ext		wpm
+# Note:		used in WordPerfect 5.1; there exist other FIL variants
 >>9	byte	2	WordPerfect help file
+#!:mime		application/octet-stream
+!:mime		application/x-wordperfect-help
+# like: WPHELP.FIL
+!:ext		fil
+# pointer to document area like: 10h
+>>>4		ulelong	!0x10	\b, at %#x document area
 >>9	byte	3	WordPerfect keyboard file
+#!:mime		application/octet-stream
+!:mime		application/x-wordperfect-keyboard
+!:ext		wpk
+# no document area, so point to end of file; so this is file size like: 23381 2978 32835 3355 3775 919
+>>>4		ulelong	x	\b, %u bytes
+>>9	byte	4	WordPerfect VAX keyboard definition
+#!:mime	application/octet-stream
+!:mime	application/x-wordperfect-keyboard
+#!:ext	foo
+# URL:		http://fileformats.archiveteam.org/wiki/WordPerfect
+# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/w/wpd-doc-gen.trid.xml
 >>9	byte	10	WordPerfect document
+# https://www.iana.org/assignments/media-types/application/vnd.wordperfect
+!:mime		application/vnd.wordperfect
+#!:apple		????WPC2
+# TODO: distinguish different suffix
+!:ext		wpd/wpt/wkb/icr/tut/sty/tst/crs
 >>9	byte	11	WordPerfect dictionary
@@ -43,5 +72,44 @@
 >>9	byte	16	WordPerfect printer data
+#!:mime		application/octet-stream
+!:mime		application/x-wordperfect-prs
+# like: STANDARD.PRS WORKBOOK.PRS
+!:ext		prs
+# like: "Standard Printer" "Workbook Printer"
+>>>0x64		pstring/B	>A	"%s"
+#>>9	byte	18	WordPerfect Prefix information file
+# printer resource .ALL
 >>9	byte	19	WordPerfect printer data
+#!:mime		application/octet-stream
+!:mime		application/x-wordperfect-all
+!:ext		all
+# display Resource
 >>9	byte	20	WordPerfect driver resource data
+#!:mime		application/octet-stream
+!:mime		application/x-wordperfect-drs
+# like: WPSMALL.DRS
+!:ext		drs
+# pointer to index area with string "smalldrs" like: 46h
+>>>4		uleshort	!0x46	\b, at %#x index area
+>>9	byte	21	WordPerfect Overlay file
+#!:mime		application/octet-stream
+!:mime		application/x-wordperfect-fil
+# like: WP.FIL
+!:ext		fil
+# URL:		http://fileformats.archiveteam.org/wiki/WordPerfect_Graphics
+# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-wpg.trid.xml
+# Note:		called "WordPerfect Graphics bitmap" by TrID and
+#		"WordPerfect Graphics Metafile" by DROID via x-fmt/395 fmt/1042
+#		"WPG (Word Perfect Graphics)" by ImageMagick `identify -verbose BUTTRFLY.WPG`
 >>9	byte	22	WordPerfect graphic image
+# TODO: skip DROID x-fmt-395-signature-id-132.wpg by check for existing document area
+#>>>4		ulelong	>15	WordPerfect_graphic_OK
+#!:mime		application/octet-stream
+# http://extension.nirsoft.net/wpg
+!:mime		image/x-wordperfect-graphics
+# https://reposcope.com/mimetype/application/x-wpg
+#!:mime		application/x-wpg
+# like: BUTTRFLY.WPG STAR-5.WPG input.wpg WORDPFCT.WPG
+!:ext		wpg
+# pointer to document area like: 10h 1Ah
+>>>4		ulelong		!0x1A	\b, at %#x document area
 >>9	byte	23	WordPerfect hyphenation code
@@ -49,2 +117,6 @@
 >>9	byte	25	WordPerfect macro resource data
+#!:mime		application/octet-stream
+!:mime		application/x-wordperfect-mrs
+# like: WP.MRS
+!:ext		mrs
 >>9	byte	27	WordPerfect hyphenation lex
@@ -52,8 +124,61 @@
 >>9	byte	30	WordPerfect equation resource data
+#!:mime		application/octet-stream
+!:mime		application/x-wordperfect-qrs
+# like: WQ.QRS wpDE.qrs wpen.qrs
+!:ext		qrs
+# jump to document area with some marker and equation
+>>>(4.l)	ubyte	x
+# equation like: "Fraction:  x OVER y"
+>>>>&1		string	>A	(...%-.19s...)
+# pointer to document area like: 17C4h
+>>>4		ulelong	x	\b, at %#x document area
+#>>9	byte	31	reserved
+#>>9	byte	32	WordPerfect VAX .SET
 >>9	byte	33	WordPerfect spell rules
 >>9	byte	34	WordPerfect dictionary rules
+#>>9	byte	35	reserved
+# video resource device driver
+# Note:		 filetype 26 for VRS and filetype 36 for WPD apparently is wrong
+>>9	byte	36	WordPerfect Video Resource
+#!:mime		application/octet-stream
+!:mime		application/x-wordperfect-vrs
+# like: STANDARD.VRS
+!:ext		vrs
+# like: "IBM CGA (& compatibles)"
+>>>0x20		string	>A	"%.23s"
 >>9	byte	39	WordPerfect spell rules (Microlytics)
+#>>9	byte	40	reserved
+>>9	byte	41	WordPerfect Install options
+#!:mime		application/octet-stream
+!:mime		application/x-wordperfect-ins
+# like: WP51.INS
+!:ext		ins
+# probably default directory name like: "C:\WP51\"
+>>>0x12		string	>A	"%.8s"
+# maybe mouse driver for WP5.1
+>>9	byte	42	WordPerfect Resource
+#!:mime		application/octet-stream
+!:mime		application/x-wordperfect-irs
+# like: STANDARD.IRS
+!:ext		irs
+# like: "Mouse Driver (MOUSE.COM)"
+>>>0x28		string	>A	"%.24s"
 >>9	byte	43	WordPerfect settings file
+# maybe Macintosh WP2.0 document
 >>9	byte	44	WordPerfect 3.5 document
+!:mime		application/vnd.wordperfect
+!:apple		????WPD3
+# like: WP3.wpd
+!:ext		wpd
 >>9	byte	45	WordPerfect 4.2 document
+# External spell code module (WP5.1)
+#>>9	byte	46	WordPerfect external spell 
+# external spell dictionary .LEX
+#>>9	byte	47	WordPerfect external spell dictionary
+# Macintosh SOFT graphics file (SOFT (Sequential Object Format)
+#>>9	byte	48	WordPerfect SOFT graphics
+#>>9	byte	49	reserved
+#>>9	byte	50	reserved
+# WPWin 5.1 Application Resource Library added for WPWin 5.1
+#>>9	byte	51	WordPerfect application resource library
 >>9	byte	69	WordPerfect dialog file
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.42-wordprocessors-wordperfect.diff.sig
Type: application/octet-stream
Size: 2143 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20220830/73c7fd8b/attachment.obj>


More information about the File mailing list