views:

1021

answers:

2

Hi,

I would like to embed some meta data in a windows file.

I came across the concept of extended file attributes, which I believe are used for this very purpose. For example, camera name in jpgs, episode name in avis.

Apart from some very obscure non-documented kernel APIs, I cannot find how to do this in c/c++ using the win32 api.

Has anybody ever done this?

Thanks in advance.

+2  A: 

Extended Attributes are a property of the filesystem, i.e. NTFS. The tags associated with jpegs and AVIs are stored within the file itself. The Win32 API's will only provide you with the EA's from the filesystem, not the ones embedded within the files. You'll have to look into third-party libraries to retrieve the embedded attributes.

Joel Lucsy
A: 

In the general case, metadata can be formatted in any way that is easy for your application to access. The RDF specification was created to provide a standard set of metadata capabilities that cover most of the generally useful kinds of information.

However, the problem is always finding a way to store it alongside the real data in a way that doesn't disturb applications that think they know how to handle the format. This can be particularly tricky for well-known formats.

Adobe has done a lot of research on this problem, and is backing a technology they call XMP to achieve a good result. XMP includes metadata in a style closely related to RDF, along with conventions for packing it inside many other file formats, or in side-car files for those cases where there just is no portable way to fit the data inside.

On a Windows system with all files stored on NTFS volumes, it is conceivable that extended attributes and alternate data streams could be used to store metadata. The big issue with this is one of portability. The alternate streams will be lost if the file is copied to media that does not support them, such as any flavor of FAT as well as the file systems used on CDs and DVDs.

This is a serious defect that makes keeping a valid and complete backup of such a file more difficult than is practical for most users.

There are applications that use alternate data streams, but they do so knowing that the value they add can be lost when the file is copied.

RBerteig