Monday, September 19, 2005 6:43 PM
by
marcmill
Custom Schema on the PDC05 Handout Build
The API for adding custom schema isn't supported yet on the builds handed out at the PDC. So, how was I able to demonstrate custom schemas in my PRS310 talk? I've had a request to make public how I was able to go about doing this in lieu of the schema installation API.
Warning: The techniques I describe below are just temporary stopgaps and are not supported by Microsoft and will not work in future builds of Windows Vista or any other operating system. Also, I'm typing this from memory, so I apologize if there are inaccuracies:
- Write a property description file describing your new properties, the one I used for recipe files is available here.
- Exit Explorer; ctrl+shift+right-click on the background of the start menu, and choose "exit explorer".
- Create a directory inside CSIDL_LOCAL_APPDATA called "Property Descriptions": mkdir "%LOCALAPPDATA%\Property Descriptions" should do the trick.
- Put the propdesc file into that new directory, and then start up Explorer (use taskmgr). You will now be able to call the SHGetPropertyDescriptionXXX APIs to access your new properties. That means you can do what I did in PRS310 and add the canonical names for your properties to the infotip and preview pane property lists for your file types.
For example, here's the registry settings that I used for my recipe file: [HKEY_CLASSES_ROOT\.recipe]
@="Recipe File"
"InfoTip"="prop:System.CanonicalType;System.Author;System.Rating;\
>> MyCompany.Recipe.Difficulty;MyCompany.Recipe.Yield;\
>> System.Comment"
"BestOf"="prop:System.DateChanged;System.Author;System.Keywords;\
>> MyCompany.Recipe.Difficulty;MyCompany.Recipe.Yield;\
>> MyCompany.Recipe.PreparationTime;MyCompany.Recipe.CookTime;\
>> System.Rating;System.Comment;System.Size;System.DisplayFolder;\
>> System.DateCreated"
"Title"="prop:System.Title;System.CanonicalType"
- Note that the new schema will not be available in the column chooser. Of course, there's a hack here too: I hear that you can modify the AllFolderProperties registry value in HKCR\Folder. Again, you won't need todo this in Windows Vista Beta 2, with the schema installation API this will just happen as part of install.
- Explorer will have access to your new properties, but they will not be accessible by search unless you install that new schema into the search index as well. There are a set of hacks for doing this as well, which involve changing the indexer's internal schema config files and then rebuilding the indexer. But these weren't part of my PDC talk PRS310.
There will be an API which will accomplish all these steps PLUS add the new schema to the search index available in Windows Vista Beta 2.