2

DSOFile.OleDocumentProperties.Save modifies metadata associated to a file on NTFS.

Does it modify the file itself, meaning that the checksum will change?
Or does it only modify some NTFS metadata about the file, but the checksum will remain the same?

More about DSOFile: KB, Technet

Credit: It was actually a self-interrogation by Ilmo within this question.

Community
  • 1
  • 1
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373

1 Answers1

5

It depends on the file format and the file system where the file is located.

If the file is an OLE format, the file itself will be modified since the properties are contained in the file. This will cause the file data to be modified and its size may change. Any file hash generator (such as CRC, MD5, SHA1, etc.) would produce different result, before and after one of the property is changed.

If the file is not an OLE format, all properties will be saved in one or more NTFS file streams, which are physically separate from the file data. This will cause a change on the file's last modification time, but it will not cause the file data to be modified nor changed in size. File hash generator would produce the same result, before and after one of the property is changed, assuming that the program does not take the file's last modification time and its file streams into account. In case of non NTFS file system, OLE document properties is not applicable on all files.

Jay
  • 4,627
  • 1
  • 21
  • 30
  • Extremely interesting! Any reference for this would be greatly appreciated, even though I guess documentation is scarce... – Nicolas Raoul Nov 06 '12 at 04:42
  • That Microsoft KB actually already has a brief explanation in section *Use the DsoFile component from your custom application*, but no technical details, though. It does explain when it's applicable and when it's not. NTFS file stream is decribed in general in MSDN, but the internal details of NTFS structure and workings won't be found in Microsoft site. This can be found elsewhere. – Jay Nov 06 '12 at 21:06
  • By that token (sorry I know this is an old answer) should adding a custom property manually to an OLE document and then removing it, therefore then not result in the same MD5 checksum... I am of course asking because it doesn't. I see properties being removed succesfully and file looks exactly the same properties wise (except for last modified) and file size in bytes is the same. I wonder if that last modified date, since it is stored in the file as you describe impacts the MD5 checksum. – Tommy G. May 16 '13 at 23:22