[File] [PATCH] of Magdir/msdos *.devicemetadata-ms described as Microsoft Cabinet *.cab

Jörg Jenderek joerg.jen.der.ek at gmx.net
Thu Dec 15 00:16:19 UTC 2022


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

Hello,

some years ago i migrate a friend's PC from Windows 7 to 10.
Unfortunately the HP printer does not work after that procedure. So
first i look by the useful NirSoft InstalledPackagesView tool at
the list of files belonging to the HP printer MSI package. There
are listed files where main name consist of a GUID and the
extension is devicemetadata-ms. Because i do not know nothing about
such files i look also for such files on my own systems. Often i
found such examples in sub directory DeviceMetadataCache in
c:\ProgramData folder on newer Windows systems.

When running file command version 5.43 on such examples i get an
output like:

3f3ca95b-3978-4168-b47b-5444f42d6c89.devicemetadata-ms:
	Microsoft Cabinet archive data,
	many,
	938 bytes, 5 files, at 0x2c +A
	"PackageInfo.xml" +A
	"DeviceInfo\DeviceInfo.xml", ID 7324, number 1,
	1 datablock, 0x1 compression
458bc0c3-bef6-4c3e-9ab8-066cd0f7c1d5.devicemetadata-ms:
	Microsoft Cabinet archive data,
	many,
	36723 bytes, 8 files, at 0x44 +A
	"PackageInfo.xml" +A
	"packagesign.cat", flags 0x4, number 1,
	extra bytes 20 in head,
	5 datablocks, 0x1203 compression
66bf0457-2497-439a-a7f8-759ba9da5eb5.devicemetadata-ms:
	Microsoft Cabinet archive data,
	many, 831166 bytes, 44 files, at 0x44 +A
	"PackageInfo.xml" +A
	"sign.cat", flags 0x4, number 1,
	extra bytes 20 in head,
	46 datablocks, 0x1203 compression

Furthermore with --extension option wrong file name extension "cab"
is displayed instead of devicemetadata-ms.

For comparison reason i run the file format identification utility
TrID ( See https://mark0.net/soft-trid-e.html). This identifies also
all examples with low priority as "Microsoft Cabinet Archive" by
ark-cab.trid.xml. The samples are described with high rate as
"Windows Device Metadata" with correct suffix by
devicemetadata-ms.trid.xml (See appended
trid-v-devicemetadata-ms.txt.gz).

For comparison reason i also run the file format identification
utility DROID ( See https://sourceforge.net/projects/droid/). This
identifies all samples only generic as "Windows Cabinet File" with
correct mime type by PUID x-fmt/414. So it complains about suffix
devicemetadata-ms instead of CAB.

With the observed knowledge i searched for a web page concerning
that file format. On Microsoft server i found a page about Building
Device Metadata Packages. So i add that page inside Magdir/msdos as
reference by comment lines like:
# URL:		https://docs.microsoft.com/en-us/windows-hardware/
#		drivers/install/building-device-metadata-packages
# Reference:	http://mark0.net/download/triddefs_xml.7z
#		defs/d/devicemetadata-ms.trid.xml

It becomes visible from output that first cabinet member is a file
with name "PackageInfo.xml". This can also be verified by running
7z with list option (see appended 7z-l-devicemetadata-ms.txt.gz).

So i add inside Magdir/msdos in CAB archive section at point where
looking for first cab archive member name additional lines starting
with:
 >>>&-1	string 		PackageInfo.xml	\b, Device Metadata Package
Afterwards display standard CAB mime type and correct file name
extension by lines:
 !:mime	application/vnd.ms-cab-compressed
 !:ext	devicemetadata-ms

After applying the above mentioned modifications by patch
file-5.43-msdos-devicemetadata.diff then i get a more precise
output like:

3f3ca95b-3978-4168-b47b-5444f42d6c89.devicemetadata-ms:
	Microsoft Cabinet archive data,
	Device Metadata Package,
	938 bytes, 5 files, at 0x2c +A
	"PackageInfo.xml" +A
	"DeviceInfo\DeviceInfo.xml", ID 7324, number 1,
	1 datablock, 0x1 compression
458bc0c3-bef6-4c3e-9ab8-066cd0f7c1d5.devicemetadata-ms:
	Microsoft Cabinet archive data,
	Device Metadata Package,
	36723 bytes, 8 files, at 0x44 +A
	"PackageInfo.xml" +A
	"packagesign.cat", flags 0x4, number 1,
	extra bytes 20 in head,
	5 datablocks, 0x1203 compression
66bf0457-2497-439a-a7f8-759ba9da5eb5.devicemetadata-ms:
	Microsoft Cabinet archive data,
	Device Metadata Package,
	831166 bytes, 44 files, at 0x44 +A
	"PackageInfo.xml" +A
	"sign.cat", flags 0x4, number 1,
	extra bytes 20 in head,
	46 datablocks, 0x1203 compression

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

I send the above modifications for file command version 5.38 at
21 Jan 2020 15:35:58, but i get neither a response nor was my patch
supplied. That is bad management. I spent a much amount of time to
improve file command and especially the recognition rate. I have
little income and does this work and get nothing (no money, no
honour, no thanks) and that made me angry.

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

iF0EARECAB0WIQS5/qNWKD4ASGOJGL+v8rHJQhrU1gUCY5pnUwAKCRCv8rHJQhrU
1m0DAJ0VZODP0EiQYXX1I+vv6h+HgF+LFACfX/KKJtjwma3AOv9SSgmCVsLDJ1U=
=bHQr
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trid-v-devicemetadata-ms.txt.gz
Type: application/x-gzip
Size: 617 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20221215/68c749af/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 7z-l-devicemetadata-ms.txt.gz
Type: application/x-gzip
Size: 1522 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20221215/68c749af/attachment-0001.bin>
-------------- next part --------------
--- file-5.43/magic/Magdir/msdos.old	2022-09-13 20:05:40.000000000 +0200
+++ file-5.43/magic/Magdir/msdos	2022-12-15 00:34:19.017082900 +0100
@@ -1575,6 +1575,12 @@
 >0x2c	default		x
 # look for 1st member name
 >>(16.l+16)	ubyte	x
+# From:		Joerg Jenderek
+# URL:		https://docs.microsoft.com/en-us/windows-hardware/drivers/install/building-device-metadata-packages
+# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/d/devicemetadata-ms.trid.xml
+>>>&-1	string 		PackageInfo.xml	\b, Device Metadata Package
+!:mime	application/vnd.ms-cab-compressed
+!:ext	devicemetadata-ms
 # https://en.wikipedia.org/wiki/SNP_file_format
 >>>&-1	string/c 	_accrpt_.snp	\b, Access report snapshot
 !:mime	application/msaccess
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.43-msdos-devicemetadata.diff.sig
Type: application/octet-stream
Size: 632 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20221215/68c749af/attachment.obj>


More information about the File mailing list