neilharvey / FileSignatures

A small library for detecting the type of a file based on header signature (also known as magic number).
MIT License
250 stars 41 forks source link

XLS file not recognised #12

Closed neilharvey closed 5 years ago

neilharvey commented 5 years ago

The bug-xls-not-recognised branch contains an example XLS file which is not being recognised.

Debugger shows the following values for the CFBF header:

ByteOrder: 65534
DifatSectorCount: 0
DirectorySectorsCount: 0
FatSectorsCount: 1
FirstDifatSectorLocation: -2
FirstDirectorySectorLocation: 12
FirstMiniFatSectorLocation: -2
HeaderCLSID: {byte[16]}
HeaderSignature: {byte[8]}
MajorVersion: 3
MiniFatSectorCount: 0
MiniSectorShift: 6
MiniStreamCutoffSize: 4096
MinorVersion: 62
Reserved: {byte[6]}
SectorShift: 9
TransactionSignatureNumber: 0

Which returns zero for the object type field so the file is not recognised.

neilharvey commented 5 years ago

I've tried two different CFB file inspectors and in both cases the CLSID was detected as zero.

mexvod commented 5 years ago

Hi. I suggest not to use CLSID. I suggest reading the files also as we read open xml format. See merge request. The question remains how to watch msg. https://en.wikipedia.org/wiki/COM_Structured_Storage https://www.mitec.cz/ssv.html https://github.com/ironfede/openmcdf

mexvod commented 5 years ago

https://blogs.msdn.microsoft.com/openspecification/2009/11/06/msg-file-format-part-1/ ?????? __properties_version1.0

neilharvey commented 5 years ago

This has been fixed by https://github.com/neilharvey/FileSignatures/pull/13