Properties coding expedition #7 - The final output

This coding expedition has developed a tool that can dump out all the properties on a file. If you are curious about the property system, I highly recommend you build this tool and run it on various file types. 

Coding to the Windows SDK
Part 1 - Binding to an item
Part 2 - Printing the IPropertyStore
Part 3 - Printing a value
Part 4 - The output
Part 5 - Stripping characters
Part 6 - Developer friendly output

For your pleasure, I ran this tool on a JPG on my system (at right). Here are some highlights:

String properties can be vectors, or single valued. Vectors can have 0, 1 or more values and are formatted with semicolons (;):

System.Author: VT_VECTOR|VT_LPWSTR == Ben Karas
System.Keywords: VT_VECTOR|VT_LPWSTR == Sol Duc Valley; Wildlife
System.ItemNameDisplay: VT_LPWSTR == scan0010.jpg

Numbers are stored in a variety of formats and are sometimes formatted or not. It turns out 5 stars corresponds to a raw value of 99:

System.Image.BitDepth: VT_UI4 == 24
System.Size: VT_UI8: 653729 --> 638 KB
System.Rating: VT_UI4: 99 --> 5 Stars

Raw dates look different than formatted dates. Actually, the raw value is stored in 8 bytes, but PropVariantToString gave us a locale-invariant format:

System.DateImported: VT_FILETIME: 2006/09/30:05:12:06.000 --> 9/29/2006 10:12 PM

Some properties are not meant for display:

System.ParsingBindContext: VT_UNKNOWN: <unprintable raw value> --> <formatfordisplay failed>
System.FindData: VT_VECTOR|VT_UI1: 32; 0; 0; 0; 0; 71; 228; 38; 161; 228; 198; ...

And there is even a property the system doesn't know about!

{9E5E05AC-1936-4A75-94F7-4704B8B01923} 0: VT_BSTR == scan0010.jpg

What I want to impress on you is that the property system supports a rich set of storage formats for values. Property handlers, such as the one for JPGs, are capable of exposing a large amount of information about a file. Finally, the rules about when to display and how to format values are data driven by property schemas.

-Ben Karas