How to read and write advanced Windows file attributes using win32

I would like to add some metadata to a Windows file.

I came across the concept of extended file attributes, which, it seems to me, are used precisely for this purpose. For example, camera name in jpgs, episode name in avis.

Apart from some very obscure undocumented kernel APIs, I cannot find how to do this in c / c ++ using the win32 API.

+2
source share
2 answers

Extended attributes are a property of the file system, i.e. NTFS. Tags associated with jpegs and AVI are stored in the file itself. The Win32 API will only give you EA from the file system, not the ones that are embedded in the files. You will need to examine third-party libraries to extract the built-in attributes.

+5
source

In general, metadata can be formatted in any way available for your application. The RDF specification was created to provide a standard set of metadata capabilities that cover most publicly available types of information.

However, the problem is always to store it together with real data in such a way that it does not interfere with applications that think they know how to handle the format. This can be especially difficult for known formats.

Adobe has done a lot of research on this issue and supports the technology they call XMP to achieve a good result. XMP includes metadata in a style closely associated with RDF, along with conventions for packing it in many other file formats or in third-party car files for cases where there is simply no portable way to insert data inside.

On a Windows system with all files stored on NTFS volumes, it is possible that extended attributes and alternative data streams can be used to store metadata. The big problem is portability. Alternative streams will be lost if the file is copied to media that does not support them, for example, any taste of FAT, as well as file systems used on CDs and DVDs.

This is a serious defect, which makes maintaining a correct and complete backup of such a file more difficult than most users can do.

There are applications that use alternative data streams, but they know that the added value may be lost when copying the file.

0
source

All Articles