The Great Flying Tortoise

A hard-boiled look at Win32 C++ programming and the property system

Property System

Blog - About

About The Great Flying Tortoise

Ben Karas has been a developer working at Microsoft since 2003.  He hopes to write useful tidbits concerning the property system, Win32 C++ programming, and living in the Seattle area. 

I'll keep the rules simple:
 1. Use good judgement.
 2. See rule #1

All postings are provided "AS IS" with no warranties and confer no rights. Opinions expressed are those of the respective authors. More legal stuff here.

  • The Great Flying Tortoise

    Coding to the Windows SDK

    • 3 Comments
    In the near future I'll be posting code examples that compile and run. In case you'd like to follow along, here's my personal setup. My code should compile on RC1 also, so go ahead and use RC1 if that's what you can get a hold of. Windows Vista...
  • The Great Flying Tortoise

    Properties coding expedition #1 - Binding to an item

    • 3 Comments
    The goal of this first expedition is to print lists of properties from items. This will give insight into the origins and capabilities of these different properties. Feel free to follow along and try out different things. There's a lot to explore. ...
  • The Great Flying Tortoise

    Writing properties #9 - Summary

    • 0 Comments
    Coding to the Windows SDK Reading properties #7 - Summary Writing properties #1 - Simple beginnings Writing properties #2 - Filetype support? Writing properties #3 - Which properties are writable? Writing properties #4 - Which properties are writable...
  • The Great Flying Tortoise

    Introducing the PROPVARIANT

    • 0 Comments
    Values in the property system are stored in PROPVARIANT structures. Originally constructed for use in OLE structured storage, the property system reuses this structure to hold its data. As the name suggests, a PROPVARIANT can hold a variety of data...
  • The Great Flying Tortoise

    Choosing your property API

    • 0 Comments
    It is time that I talk a little about what to do if you want your application to run on XP. There are three sets of APIs, each with subtle differences and caveats, and ultimately your choice requires deciding what platform your application must run on...
  • The Great Flying Tortoise

    Properties coding expedition #7 - The final output

    • 2 Comments
    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 ...
  • The Great Flying Tortoise

    Writing properties #1 - Simple beginnings

    • 2 Comments
    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...
  • The Great Flying Tortoise

    Writing properties #5 - Property lists

    • 1 Comments
    So if a property handler doesn't enumerate which properties it supports writing , then how does the explorer pick which properties to show? Well, the shell namespace extension containing the item specifies the list of properties it wants to show in a...
  • The Great Flying Tortoise

    Code for Previous Blog Posts

    • 0 Comments
    Someone asked if I had a copy of the code I've been using in my blog so far. Well, I didn't as of 5pm today, so I went back and collected the code into 3 projects: propreader.exe <file> - Prints a list of all properties we know about the file...
  • The Great Flying Tortoise

    PROPVARIANT helpers #1 - Initialization

    • 2 Comments
    PROPVARIANTs are easy to misuse . Because the data members are so cryptic, it is easy to get confused or to overlook errors. To help alleviate these and other problems (including readability), we provide a series of PROPVARIANT helpers for common uses...
  • The Great Flying Tortoise

    Property System Layers and Extensibility Points

    • 4 Comments
    It's easy to get confused about what points of extensibility exist and what layer provide what services. This isn't helped by the fact that we've lumped a bunch of things into the property system, but I'll try to diagram this out here and in future posts...
  • The Great Flying Tortoise

    Writing properties #8 - Canonical Values

    • 0 Comments
    There's one last topic I want to touch on before I close this series: Canonical values. So far I've talked about how to determine when the property itself is writable. But once you decide to write a property, how do you figure out what type the value...
  • The Great Flying Tortoise

    What is a PROPERTYKEY?

    • 0 Comments
    So what's this PROPERTYKEY that the property system uses? Where do I get them? Well, property keys identify the particular property you are interested in. You can find a bunch of system-provided definitions in the Windows Vista Platform SDK in propkey...
  • The Great Flying Tortoise

    Property consumerism

    • 2 Comments
    Reading properties is rather simple. First, bind to the item. SHCreateItemFromIDList and SHCreateItemFromParsingName are appropriate for this. Then read your properties. Be sure to clean up after yourself. IShellItem2 *psi; if (SUCCEEDED(SHCreateItemFromParsingName...
  • The Great Flying Tortoise

    The source of property types

    • 1 Comments
    I mentioned that one of the property system layers coerces values to be of the correct type. But how does the system know the expected type? The property system maintains a data structure describing each property on the machine. Each property description...
  • The Great Flying Tortoise

    The deal with IPropertyStoreCapabilities

    • 0 Comments
    Have you ever felt this before? It's the day after you send your product to manufacturing . You step back, look at the big picture, and start to see minor flaws. A dread sinks in when you realize you just blogged about it too! That was Monday morning...
  • The Great Flying Tortoise

    Writing properties #4 - Which properties are writeable?

    • 0 Comments
    I'm going to make a first stab at printing out a list of properties that are writable for a given file. I'll spoil the fun and let you know that my attempt today will not fully succeed. I'll explain later. For now, let's see some code! You'll recall...
  • The Great Flying Tortoise

    Properties coding expedition #2 - printing the IPropertyStore

    • 1 Comments
    Last time we saw how to bind to a shell item and get its property store. Today, we loop through the store printing out known properties. HRESULT _PrintPropertyStore(IPropertyStore *pps) { DWORD cProps; HRESULT hr = pps-> GetCount (&cProps...
  • The Great Flying Tortoise

    Writing properties #6 - GPS_READWRITE omits read-only data sources

    • 1 Comments
    You'll recall that there are multiple layers in the property system . In particular, the GPS_DEFAULT property system stack for files in the filesystem namespace looks like this: [ Application using GPS_DEFAULT ] [ Coercion Layer ] [ Shell Item Layer...
  • The Great Flying Tortoise

    Gotcha: You must release property stores quickly

    • 0 Comments
    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...
  • The Great Flying Tortoise

    PROPVARIANT Helpers #4 - Vector Helpers

    • 1 Comments
    One of the more prominent properties is PKEY_Keywords , e.g. "Tags". This is a vector property, and so it usually comes packaged in a PROPVARIANT with VT_VECTOR|VT_LPWSTR . If you deal with properties such as this, you may find the following helpers useful...
  • The Great Flying Tortoise

    Why use IShellItem2::GetPropertyStore?

    • 0 Comments
    I often get this question: "How can I read properties directly from a property handler?" (Remember that the property handler is the file system namespace's extensibility point.) Usually, the person just wants to read one or more properties and doesn...
  • The Great Flying Tortoise

    What is the Property System? - in normal language

    • 2 Comments
    In my first post , I described what the property system provides from an API perspective. But I used all these techno-wiggle-waggle-jibber-jabber that my friends couldn't follow. Ich. What feedback for a first post! So here it is minus the 133t-speak...
  • The Great Flying Tortoise

    PROPVARIANT Helpers #2 - Reading single values

    • 0 Comments
    Reading a PROPVARIANT seems innocuous, but it suffers from many of the same dangers as does initializating one of these structures . I highly recommend that you instead use the following helpers to aid your code's readability and reduce your error rate...
  • The Great Flying Tortoise

    What is the property system?

    • 1 Comments
    The property system is a new set of APIs for Microsoft Windows Vista that provides a general way to access metadata about files and items accessible through the shell namespace. This means you can ask for the dimensions of an image, or the size of a file...
Page 1 of 2 (36 items) 12