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 contains information such as the key, the canonical name, the type, and the label for the property. A collection of property descriptions is called a property schema.
By dealing with properties abstractly, applications can create and register new properties and have them seamlessly work with existing properties. The schema is also what drives the coercion layer. Finally, I personally think it's incredibly neat to have this meta-metadata available programmatically.
Here's a quick example of how to retrieve a type and label for a property:
HRESULT hr = PSGetPropertyDescription(PKEY_Size, IID_PPV_ARGS(&ppropdesc));
hr = ppropdesc->GetPropertyType(&vt);
hr = ppropdesc->GetDisplayName(&pszLabel);
To close, I just wanted to mention that PSGetPropertyDescription and related APIs are very fast. Once the property system has initialized, obtaining the IPropertyDescription interface usually requires zero allocations and is very light weight.