[File] [PATCH] of Magdir/msdos for Device Metadata Package; *.devicemetadata-ms

Jörg Jenderek joerg.jen.der.ek at gmx.net
Tue Jan 21 14:35:58 UTC 2020


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

Hello,

some days 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.

When running file command version 5.38 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.

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 line like:
 # https://docs.microsoft.com/en-us/windows-hardware
 # /drivers/install/building-device-metadata-packages

- From output is visible that first cabinet member is a file with name
"PackageInfo.xml". This can also be verified by running 7z with
list option.

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.38-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.

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

iF0EARECAB0WIQS5/qNWKD4ASGOJGL+v8rHJQhrU1gUCXicMQwAKCRCv8rHJQhrU
1p/mAJ962b9NrP+0QDP4DWAAd37KO/6v+gCbBcRI4Kp7/vqSqvrWm1wupi1pYoQ=
=b0cu
-----END PGP SIGNATURE-----
-------------- next part --------------
--- file-5.38/magic/Magdir/msdos.old	2019-10-18 16:16:18 +0000
+++ file-5.38/magic/Magdir/msdos	2020-01-21 14:00:34 +0000
@@ -1239,6 +1239,10 @@
 >0x2c	default		x
 # look for 1st member name
 >>(16.l+16)	ubyte	x
+# https://docs.microsoft.com/en-us/windows-hardware/drivers/install/building-device-metadata-packages
+>>>&-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.38-msdos-devicemetadata.diff.sig
Type: application/octet-stream
Size: 95 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20200121/3eb10b28/attachment.obj>


More information about the File mailing list