Writing properties #3 – Which properties are writable?

While we don’t have a table of properties and filetypes that are writable, there is a programmatic method to determine if a given property can be written to a given property handler.  Here’s how it works: First, properties can be designated innate.  This means they are supposed to be read-only system-wide regardless of filetype.  To check…

3

Writing properties #2 – Filetype support?

The first question people ask at this point is “What properties can I write to what filetypes?”.  They usually expect a concise answer at this point, too. The short answer is that “It depends on the filetype.”  Not all filetypes support writing properties. The real answer is that we haven’t compiled a table with this information…

1

Writing properties #1 – Simple beginnings

I’m going to be talking about writable properties over the next few days.  I know that some of you are itching to try this out yourselves, so here is an overly simplistic program that will write a single property to a file.  I have omitted a lot of diagnostic code, so this will not work…

2

Gotcha: You must release property stores quickly

The general rule is that you should minimize the length of time you have a property store open.  It is best to acquire the data you need and then release the store. Read-only property stores lock files for reading using a filesystem oplock.  An oplock does more than just lock a file — it blocks writers until…

0

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 SDKPart 1 – Binding to an itemPart 2 – Printing the IPropertyStorePart 3…

2

Properties coding expedition #6 – Developer friendly output

Using the tool I developed in this series, I know that my test photo has “Rating: 5 Stars“.  But how is this value actually represented in the JPG itself?  Let’s answer that by adding some developer friendly output.  Here’s what I did: First, I need a developer-friendly label. I can get the canonical name using PSGetNameFromPropertyKey….

1

Properties coding expedition #5 – Stripping characters

In Part 4, I discovered that WideCharToMultiByte converts certain invisible non-spacing Unicode characters to ?.  This makes the output look really silly in a command line application.  I want to keep this as a command line application, so I need to strip these characters away.  A simple helper solves this rather neatly: void _StripCharacters(__inout PWSTR…

1

Save the World… of Warcraft

Yup, I’m one of “those” people.  I play World of Warcraft to pass the time if I don’t have anything else scheduled to do.  It’s the only game I play right now, so it weighed heavily in my decision to upgrade to Vista.  At the time, I was very happy to find that it ran…

2

Properties coding expedition #4 – The output

The program itself is provided in parts 1, 2, and 3.  So I compiled my program and ran it from the command line.  Here’s a snippet of what I got back: Properties for ‘scan0010.jpg’Folder name: propshowType: JPEG ImageName: scan0010.jpgSize: 638 KBAttributes: ADate modified: ?9/?29/?2006 ??10:12 PMDate created: ?9/?30/?2006 ??8:00 AMDate accessed: ?9/?30/?2006 ??8:00 AMTitle: Mountain goatAuthors: Ben…

1

Properties coding expedition #3 – Printing a value

In parts one and two, I started writing a program to print out the properties on an item.  But I saved the best for last — printing a value.   Discussion follows the code.HRESULT _PrintPropertyValue(__in REFPROPERTYKEY key, __in REFPROPVARIANT propvar) { IPropertyDescription *ppropdesc; HRESULT hr = PSGetPropertyDescription(key, IID_PPV_ARGS(&ppropdesc)); if (SUCCEEDED(hr)) { PWSTR pszLabel; hr = ppropdesc->GetDisplayName(&pszLabel);…

1