2

I'm trying to implement an icon-based property in Windows File Explorer, and my understanding from this post is that it requires returning a property store binary file from the property handler. Does anyone know how to create a property store binary file? After searching, I've come across some documentation on the specification, but I don't see any examples of how to create one. Thank you very much.

1 Answers1

0

You don't need any binary file, you just need an implementation of IPropertyStore. You can create one using the PSCreateMemoryPropertyStore method.

IPropertyStore *ps;
if (SUCCEEDED(PSCreateMemoryPropertyStore(IID_PPV_ARGS(&ps))))
{
    // do your work
    ps->Release();
}
Simon Mourier
  • 132,049
  • 21
  • 248
  • 298
  • Thanks. Can you elaborate on how I'd use this in connection with the linked post about the property icons? https://stackoverflow.com/questions/47803994/how-to-create-an-iconlist-property-in-the-windows-property-system/47804200#47804200 Thanks again. –  Jun 23 '19 at 13:23
  • @amt528 - this is a different question. Anyway, everything is more or less explained in Denis' answer. This page also explains it from a high level C# view but it should help you connecting the dots: https://www.shellboost.com/Doc/Developer-s-Guide/Item-properties-folder-columns (in the "Item icon properties" chapter). Disclaimer : this is a commercial product my company sells – Simon Mourier Jun 23 '19 at 14:05
  • I'm not sure I understand. I'm implementing `IPropertyStore` in my property handler, including the `GetValue()` method. So the way I understand it, when the shell asks to get the value for the icon-related property key, the `GetValue()` method is supposed to return a propery store binary file. But I don't understand how to do that. Any assistance would be greatly appreciated! –  Jun 23 '19 at 16:05
  • 1) register your two custom properties (1 blob + 1 enum) at install time using a .propdesc and proper rights, and 2) your IPropertyStore must provide a value for the blob property ("IconUIProperty" in my doc link) which is itself an IPropertyStore implementation (MemoryPropertyStore in my doc link, which can use PSCreateMemoryPropertyStore) that has 3properties. ("StatusIcons", "StatusIconsDisplayFlag" and "IconProperty" in my doc link). Read the links we provide carefully, everything is there (and only there I believe... as this is not officially documented) – Simon Mourier Jun 23 '19 at 16:16
  • @amt528 - Property store is available since Windows Vista, but I don't know for the blog + enum properties. Many stuff were added for Windows 7 too. Just try it. – Simon Mourier Jul 04 '19 at 21:17
  • I can tell you it works perfectly w/o any "file" (or understand a stream and a file are quite the same thing). You don't have to understand the format at all nor read that spec (beyond knowledge), just let the property store implementation provided by Microsoft serialize itself (using IPersistStream). – Simon Mourier Jul 05 '19 at 21:13
  • I sell a product with that code inside... But you believe what you want. – Simon Mourier Jul 05 '19 at 21:39