<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>The Great Flying Tortoise</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/benkaras/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/benkaras/feed.xml</link>
    <description>A hard-boiled look at Win32 C++ programming and the property system</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:18:55 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Troubleshooting: Why isn't my property handler getting indexed?</title>
      <link>https://docs.microsoft.com/archive/blogs/benkaras/troubleshooting-why-isnt-my-property-handler-getting-indexed</link>
      <pubDate>Tue, 24 Jul 2007 13:31:00 GMT</pubDate>
      <dc:creator><![CDATA[benkaras]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/benkaras/2007/07/24/troubleshooting-why-isnt-my-property-handler-getting-indexed/</guid>
      <description><![CDATA[Having trouble getting your property handler working with the indexer?&nbsp; Here are some...]]></description>
      <content:encoded><![CDATA[<P><FONT face=georgia,palatino>Having trouble getting your property handler working with the indexer?&nbsp; Here are some troubleshooting tips.</FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 10pt 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpFirst><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">1.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Verify that your propdesc file(s) are in a global location<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">2.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Verify that you registered your propdesc file(s) using absolute paths</FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">3.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Verify that the event log did not record any failures from registering your propdesc file.</FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">4.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Verify that your property description is well formed, accurate, and was registered properly.</FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">5.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Verify that your property descriptions are marked isColumn="true", isViewable="true", and isQueryable="true" as appropriate.<o:p></o:p></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">6.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Verify that your DLL is in a global location (e.g. not under your user profile)<o:p></o:p></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">7.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Verify that your DLL is registered under HKLM\Software\Classes<o:p></o:p></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">8.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Verify that your DLL is registered using full paths (or REG_EXPAND_SZ strings that expand to absolute paths using environment variables known by the System account)<o:p></o:p></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">9.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Verify that your property handler works under explorer<o:p></o:p></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">10.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>We prefer that you use IInitializeWithStream.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>If you must use IInitializeWithFile or IInitializeWithItem, verify that you specify DisableProcessIsolation<o:p></o:p></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">11.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Verify that the "Indexing Options" control panel lists your filetype as an indexed filetype<o:p></o:p></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">12.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Verify that the test file is in an indexed location<o:p></o:p></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpLast><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">13.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Verify that the test file's has been modified since after you installed your property handler<o:p></o:p></FONT></P>
<P style="MARGIN: 10pt 0in" class=MsoNormal><FONT face=georgia,palatino>Common Mistakes:<o:p></o:p></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 10pt 0in 0pt 0.5in; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpFirst><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">1.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Placing propdesc files or DLLs under a user directory<o:p></o:p></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpMiddle><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">2.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Registering things with relative paths<o:p></o:p></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpMiddle><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">3.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Registering things under HKCU instead of HKLM (remember that HKCR shows a merged view of the two hives)<o:p></o:p></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpMiddle><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">4.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Forgetting DisableProcessIsolation for non-stream handlers<o:p></o:p></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpLast><FONT face=georgia,palatino><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">5.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>The test file wasn't modified or wasn't in an indexed location<o:p></o:p></FONT></P>
<P style="MARGIN: 10pt 0in" class=MsoNormal><FONT color=#000000><FONT face=georgia,palatino>If all else fails, you can use Image File Execution Options to attach a debugger to searchindexer.exe and child processes (On Vista, I&nbsp;use "&lt;pathto&gt;\ntsd.exe -server tcp:port=8001,icfenable -gG -o -snul";&nbsp; On Win7, I use: "&lt;pathto&gt;\ntsd.exe -server npipe:pipe=foo -gG -o -snul").<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>Reboot, attach to the debugger, and type "sxeld mypropertyhandler".<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>The debugger will break when your DLL gets loaded.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Use of debuggers is an advanced topic that I won't get into right now.</FONT></FONT></P>]]></content:encoded>
    </item>
    <item>
      <title>Property handlers and .NET</title>
      <link>https://docs.microsoft.com/archive/blogs/benkaras/property-handlers-and-net</link>
      <pubDate>Wed, 02 May 2007 16:06:00 GMT</pubDate>
      <dc:creator><![CDATA[benkaras]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/benkaras/2007/05/02/property-handlers-and-net/</guid>
      <description><![CDATA[A reader asked:

I've been reading up the issues with using .NET for property handlers. I know you...]]></description>
      <content:encoded><![CDATA[<P>A reader asked:</P>
<BLOCKQUOTE>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><FONT size=3><FONT face=Consolas>I've been reading up the issues with using .NET for property handlers. I know you can't using .NET Interop to create a property handler without getting into issues with the version of the .NET framework. I discovered though that .NET Assemblies can be registered and used as COM objects. Could one implement the required functions of IPropertyStore in c++ and then inside those functions make calls to a COM object that does all the real work?<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><o:p><FONT face=Consolas size=3>&nbsp;</FONT></o:p></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><FONT size=3><FONT face=Consolas>I know you said that you feel property handlers should be written in c/c++ for performance reasons but would this get around the issue of the framework version issue?<o:p></o:p></FONT></FONT></P></BLOCKQUOTE>
<P>This is a very&nbsp;good question, but the answer is "probably not".&nbsp; </P>
<P>The reason is that property handlers cannot cause .NET code to get loaded in the caller's process which is not supported.&nbsp; It has nothing to do with performance.&nbsp; So you cannot get around the issue by writing a C++ stub that calls a .NET COM object in the <STRONG>same</STRONG> process.</P>
<P>The only thing that works is to write a C++ stub that calls a .NET class running in a <STRONG>different</STRONG> process altogether.&nbsp; But that's a lot more work, introduces a lot of failure paths, may introduce subtle interactions, etc.</P>
<P>Raymond Chen digs into the reasons with this post:&nbsp; <SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"><A href="http://blogs.msdn.com/1317290.aspx" mce_href="http://blogs.msdn.com/1317290.aspx">http://blogs.msdn.com/1317290.aspx</A> </SPAN></P>
<P><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">&nbsp;[Update 2007-06-04: I found another article (from 2006) which repeats this warning:&nbsp; <A href="http://msdn.microsoft.com/msdnmag/issues/04/01/WindowsShell/default.aspx">http://msdn.microsoft.com/msdnmag/issues/04/01/WindowsShell/default.aspx</A>]</SPAN></P>]]></content:encoded>
    </item>
    <item>
      <title>Property Handler Decisions and Preparation</title>
      <link>https://docs.microsoft.com/archive/blogs/benkaras/property-handler-decisions-and-preparation</link>
      <pubDate>Tue, 30 Jan 2007 01:47:00 GMT</pubDate>
      <dc:creator><![CDATA[benkaras]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/benkaras/2007/01/30/property-handler-decisions-and-preparation/</guid>
      <description><![CDATA[Viewed as a data flow component, a property handler has a single file stream input and outputs a one...]]></description>
      <content:encoded><![CDATA[<P>Viewed as a <A class="" href="http://blogs.msdn.com/benkaras/archive/2007/01/28/understanding-the-role-of-property-handlers.aspx" mce_href="http://blogs.msdn.com/benkaras/archive/2007/01/28/understanding-the-role-of-property-handlers.aspx">data flow component</A>, a property handler has a single file stream input and outputs a one or more properties.&nbsp; Unfortunately, writing one requires making many decisions before you even set eyes on the code.&nbsp; Let's look at a few of these preparations.</P>
<P>First, pick a file type.&nbsp; You'll be writing a property handler for this file type.</P>
<P>Now decide which properties you want to store.&nbsp; Properties generally fall into a few categories.&nbsp; Take a moment to consider which of the following you want to support:</P>
<UL>
<LI>System defined properties (e.g. System.Author)</LI>
<LI>Properties you define for your filetype (e.g. MyCompany.MyApp.MyProperty)</LI>
<LI>Properties other people define and want to set on your file (e.g. SomeoneElse.Other.Property, aka "open metadata")</LI></UL>
<P>Next, decide where in the file you'll be storing the properties.&nbsp; Hopefully the file's format allows for this already.&nbsp; If it doesn't, you'll have to collaborate with other users of this file format to accomodate these properties.&nbsp; Here are a few storage&nbsp;options:</P>
<UL>
<LI>Compute the property from other data in the file (e.g. System.Document.WordCount)</LI>
<LI>Read the property from a specific location in the file (e.g. the EXIF header in certain image formats)</LI>
<LI>Read the property from a dynamic storage structure (e.g. suitable for storing SomeoneElse.Other.Property)</LI></UL>
<P>And let's not forget deciding which of your properties will be <A href="http://msdn2.microsoft.com/en-us/library/ms630273.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms630273.aspx">viewable</A>, <A href="http://msdn2.microsoft.com/en-us/library/ms630282.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms630282.aspx">editable</A>, <A href="http://msdn2.microsoft.com/en-us/library/ms630280.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms630280.aspx">searchable</A>, <A href="http://msdn2.microsoft.com/en-us/library/bb267290.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb267290.aspx">etc</A>.&nbsp; Better start taking notes if you haven't already!</P>
<P>Once you know where to place your properties, you get to decide how to format them in your file.&nbsp; Will you turn them into strings?&nbsp; Or would a binary format be better?&nbsp; Maybe you'll want to store some properties directly in the file format and others into a special dumping ground for open metadata.</P>
<P>Also quite important is choosing which API you will use to write to the file format.&nbsp; Hopefully it supports stream inputs.&nbsp; If it doesn't you'll have to flag your handler as "legacy".&nbsp; Typically you'll end up writing a small layer mapping propert keys and values to whatever the format-specific API uses.</P>
<P>There is one easy decision in this mix.&nbsp; Choose your programming language from the following list: C++, C.&nbsp; Regrettably, <A href="http://blogs.msdn.com/oldnewthing/archive/2006/12/18/1317290.aspx" mce_href="http://blogs.msdn.com/oldnewthing/archive/2006/12/18/1317290.aspx">shell extensions cannot use the CLR</A>, so you may not use C# or any other .NET language.</P>
<P>As you can see, there are a lot of little decisions you get to make when writing a property handler.&nbsp; There are undoubtedly more that I've missed, but you'll stumble upon those as you prepare your handler.&nbsp; Additionally, there are many little options and flags you can use to tweak the way your property handler works and to accomplish more advanced tasks.&nbsp; I am skipping those for now in favor of presenting them as a list later.</P>
<P>-Ben Karas</P>]]></content:encoded>
    </item>
    <item>
      <title>Understanding the Role of Property Handlers</title>
      <link>https://docs.microsoft.com/archive/blogs/benkaras/understanding-the-role-of-property-handlers</link>
      <pubDate>Sun, 28 Jan 2007 22:26:17 GMT</pubDate>
      <dc:creator><![CDATA[benkaras]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/benkaras/2007/01/28/understanding-the-role-of-property-handlers/</guid>
      <description><![CDATA[Knowing what you are trying to accomplish is the first step to using the property system.&nbsp;...]]></description>
      <content:encoded><![CDATA[<p></p> <p>Knowing what you are trying to accomplish is the first step to using the property system.&nbsp; Property handlers provide a specific set of services which&nbsp;support specific behaviors in the Windows shell.&nbsp; So let's delve into the role of a property handler and how it relates to other components.</p> <p>As a data flow diagram, a property handler is pretty simple:</p> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/benkaras/WindowsLiveWriter/UnderstandingtheRoleofPropertyHandlers_13D97/image03.png" original-url="http://blogs.msdn.com/blogfiles/benkaras/WindowsLiveWriter/UnderstandingtheRoleofPropertyHandlers_13D97/image03.png" atomicselection="true"></a><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/benkaras/WindowsLiveWriter/UnderstandingtheRoleofPropertyHandlers_13D97/image07.png" original-url="http://blogs.msdn.com/blogfiles/benkaras/WindowsLiveWriter/UnderstandingtheRoleofPropertyHandlers_13D97/image07.png" atomicselection="true"></a><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/benkaras/WindowsLiveWriter/UnderstandingtheRoleofPropertyHandlers_13D97/image011.png" original-url="http://blogs.msdn.com/blogfiles/benkaras/WindowsLiveWriter/UnderstandingtheRoleofPropertyHandlers_13D97/image011.png" atomicselection="true"><img height="55" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/benkaras/WindowsLiveWriter/UnderstandingtheRoleofPropertyHandlers_13D97/image0_thumb5.png" original-url="http://blogs.msdn.com/blogfiles/benkaras/WindowsLiveWriter/UnderstandingtheRoleofPropertyHandlers_13D97/image0_thumb5.png" width="393"></a> </p> <p>The input is a file stream.&nbsp; The output is a set of properties.&nbsp; Yup, that simple.&nbsp; </p> <p>Notice that although property handlers interpret files, they don't open the files themselves.&nbsp; The layer above it does!&nbsp; There are good reasons for this which I'll discuss another time.&nbsp; To prepare the property handler, the file system namespace creates&nbsp;the file stream, creates&nbsp;the property handler, and passes the stream to the property handler via the IInitializeWithStream interface.&nbsp; Once the property stack is completed, the application is free to read and write properties through the stack.&nbsp; If the layers above the property handler don't answer a question, they'll pass it down to the property handler.</p> <p>It is also very important to understand what property handlers do not do.&nbsp; Applying a bit of logic, we can reason out much of the role a property handler plays:</p> <ul> <li>A&nbsp;single property handler gets created per file.&nbsp; Thus... <ul> <li>A&nbsp;property handler must be the authority on the layout of the file stream it is handed.&nbsp;  <li>It is not possible to "augment" the set of properties on a file.</li></ul> <li>The property handler must glean its properties from the file stream&nbsp;itself.&nbsp; Thus... <ul> <li>The property system, in general, cannot store properties on every file.&nbsp; Not all files allow storing properties inside them.  <li><a href="http://blogs.msdn.com/benkaras/archive/2006/10/17/writing-properties-2-filetype-support.aspx">Not all properties can get written to all file types</a>.&nbsp; Bummer.</li></ul> <li>The caller is not guaranteed to ask the property handler for properties.&nbsp; This means...  <ul> <li>To be considerate, the property handler should intialize quickly, delaying heavy work until it is actually needed.</li></ul> <li>The property handler is dealing with files.&nbsp; This means...  <ul> <li>For large files, if you have control over the file layout, consider making it stream-friendly.&nbsp;  <ul> <li>Reserve extra space in the property section.  <li>Clump things together so that the handler doesn't have to read the whole disk to piece together data.</li></ul></li></ul> <li>Property handlers are an extensibility point of the file system namespace.&nbsp; Thus...  <ul> <li>Other namespaces may have different extensibility mechanisms (or none at all).  <li>Other namespaces may be able to delegate to the file system namespace when it comes to properties.&nbsp; (The search results do this)  <li>Other namespaces may choose to reuse the same extensibility mechanism.&nbsp; (ZIP folders do this).</li></ul> <li>Property handlers just provide values.&nbsp; Thus...  <ul> <li>Although they provide the data, the windows shell controls the way it gets displayed.  <li>It is not directly possible to customize the way the data is visualized(1)  <li>When I say "property handlers" make the shell do this or that, I really mean that the shell will do "this or that" in the presense of a property handler that provides the right set of data.</li></ul></li></ul> <p>Ok, so that's a big dose of reality for one post.&nbsp; Despite our best wishes, property handlers are not magic.&nbsp; They provide specific functionality to enable specific behaviors.&nbsp; As a reminder, the upside of the role of a property handler is that it <a href="http://blogs.msdn.com/benkaras/archive/2007/01/21/what-do-property-handlers-accomplish.aspx">enables the great integration with the Windows user interface</a>.</p> <p>-Ben Karas</p> <p>(1) Property descriptions contain hints about how to display a value (e.g. using a stars or a text box).&nbsp; Property descriptions are system-wide and therefore a handler only can set the hints for properties it introduced to the system.</p>]]></content:encoded>
    </item>
    <item>
      <title>Property Handler Terminology</title>
      <link>https://docs.microsoft.com/archive/blogs/benkaras/property-handler-terminology</link>
      <pubDate>Thu, 25 Jan 2007 01:35:00 GMT</pubDate>
      <dc:creator><![CDATA[benkaras]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/benkaras/2007/01/25/property-handler-terminology/</guid>
      <description><![CDATA[In this series, I will be presenting Windows Vista functionality with a focus on the the file...]]></description>
      <content:encoded><![CDATA[<p></p> <p>In this series, I will be presenting Windows Vista functionality with a focus on the the file system&nbsp;namespace.&nbsp; Feel free to ask questions, especially if you want to know how things work on XP or in other namespaces, since I'll otherwise ignore those topics for now.</p> <p>But first, let's get some terminology out of the way.&nbsp; </p> <p>The <strong>Windows Shell</strong> includes the Windows user interface and also reusable bits such as the save-as and folder browser dialogs.&nbsp; The shell includes things like the start menu, task bar, desktop, folder views, details pane, properties dialog, and the search UI.&nbsp; </p> <p>The <strong>Indexer</strong> is a service that gathers properties and full text from files and items and answers search queries.</p> <p>There are also various <strong>other applications</strong> that choose to use the property system to read or write properties to files.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/benkaras/WindowsLiveWriter/698e6f2213fb_F0CE/image%7B0%7D%5B3%5D.png" original-url="http://blogs.msdn.com/blogfiles/benkaras/WindowsLiveWriter/698e6f2213fb_F0CE/image%7B0%7D%5B3%5D.png" atomicselection="true"><img height="158" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/benkaras/WindowsLiveWriter/698e6f2213fb_F0CE/image%7B0%7D_thumb%5B1%5D.png" original-url="http://blogs.msdn.com/blogfiles/benkaras/WindowsLiveWriter/698e6f2213fb_F0CE/image%7B0%7D_thumb%5B1%5D.png" width="492"></a> </p> <p>All these applications connect to the property system via <a href="http://blogs.msdn.com/benkaras/archive/2006/08/29/730098.aspx">IShellItem2::GetPropertyStore</a>.&nbsp; This API creates <a href="http://blogs.msdn.com/benkaras/archive/2006/09/05/740476.aspx">a bunch of components and stacks them together</a>.</p> <p>The top layer I'm calling the <strong>Coercion Layer</strong>.&nbsp; It's job is to ensure that values are of the correct type by weeding out bad ones, removing duplicates from vectors, and trimming spaces from strings.</p> <p>The <strong>Shell Item Layer</strong> provides a set of properties, including PKEY_SFGAOFlags.&nbsp; The shell item layer sits atop the shell namespace extensibility point.&nbsp; As I mentioned earlier, I will&nbsp;focus on one in particular:&nbsp;the file system namespace.</p> <p>The <strong>Shell File System Namespace</strong> provides properties about files such as PKEY_Size and PKEY_ItemType.&nbsp; It sits atop the property handler extensibility point.</p> <p>The <strong>Property Handler</strong> is at the bottom of the stack and provides a set of properties derived from the contents of a file.&nbsp; Property handlers exist only in the file system namespace.</p> <p>The way to really <a href="http://en.wikipedia.org/wiki/Grok">grok</a> this stack is to understand that each layer wraps the one below it.&nbsp; When asked for a property, any given layer chooses whether to return the value itself or to ask the layer beneath it.&nbsp; The property stack is really just a chain of command.</p> <p>-Ben Karas</p>]]></content:encoded>
    </item>
    <item>
      <title>What does a property handler accomplish?</title>
      <link>https://docs.microsoft.com/archive/blogs/benkaras/what-does-a-property-handler-accomplish</link>
      <pubDate>Sun, 21 Jan 2007 19:53:46 GMT</pubDate>
      <dc:creator><![CDATA[benkaras]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/benkaras/2007/01/21/what-does-a-property-handler-accomplish/</guid>
      <description><![CDATA[A&nbsp;property handler is the piece of code that enables you to see the properties about your files...]]></description>
      <content:encoded><![CDATA[<p>A&nbsp;property handler is the piece of code that enables you to see the properties about your files as in the picture below.&nbsp; Don't worry about the ambiguity in this sentence; I will be much more specific concerning what component does what in later posts.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/benkaras/WindowsLiveWriter/WhyBuildaPropertyHandler_E155/image%7B0%7D%5B14%5D.png" original-url="http://blogs.msdn.com/blogfiles/benkaras/WindowsLiveWriter/WhyBuildaPropertyHandler_E155/image%7B0%7D%5B14%5D.png" atomicselection="true"><img height="267" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/benkaras/WindowsLiveWriter/WhyBuildaPropertyHandler_E155/image%7B0%7D_thumb%5B8%5D.png" original-url="http://blogs.msdn.com/blogfiles/benkaras/WindowsLiveWriter/WhyBuildaPropertyHandler_E155/image%7B0%7D_thumb%5B8%5D.png" width="792"></a> </p> <p>Here I've created three .book files.&nbsp; This is a file type I made up last weekend, so&nbsp;clearly Windows cannot know how to figure out all the data on the screen above without help.&nbsp; That is where a property handler comes in.&nbsp; It knows about the properties that apply to each .book&nbsp;file and helps Windows to display this information.</p> <p>In addition to displaying properties, property handlers let users edit them within the&nbsp;standard Windows user interface:</p> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/benkaras/WindowsLiveWriter/WhyBuildaPropertyHandler_E155/image%7B0%7D%5B18%5D.png" original-url="http://blogs.msdn.com/blogfiles/benkaras/WindowsLiveWriter/WhyBuildaPropertyHandler_E155/image%7B0%7D%5B18%5D.png" atomicselection="true"><img height="105" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/benkaras/WindowsLiveWriter/WhyBuildaPropertyHandler_E155/image%7B0%7D_thumb%5B10%5D.png" original-url="http://blogs.msdn.com/blogfiles/benkaras/WindowsLiveWriter/WhyBuildaPropertyHandler_E155/image%7B0%7D_thumb%5B10%5D.png" width="216"></a> </p> <p>Property handlers also let users search for files based on the property values.&nbsp; I can search for "Haunting" and Windows will show "Blindness" in the result set.&nbsp; And all this can happen from within the standard Windows user interface.</p> <p>So, in summary,&nbsp;property handlers help your file types fit better into the Windows search and organize experience.&nbsp; By exposing properties directly in the Windows UI, your users can&nbsp;seamlessly interact with your files without having to open them in applications all the time.&nbsp; When they have property handlers, your file types feel less bolted onto Windows.</p> <p>-Ben Karas</p>]]></content:encoded>
    </item>
    <item>
      <title>Computer Science Exams</title>
      <link>https://docs.microsoft.com/archive/blogs/benkaras/computer-science-exams</link>
      <pubDate>Fri, 19 Jan 2007 01:19:06 GMT</pubDate>
      <dc:creator><![CDATA[benkaras]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/benkaras/2007/01/19/computer-science-exams/</guid>
      <description><![CDATA[Graduate level courses are surreal.&nbsp; Professors assign nearly impossible homework assignments...]]></description>
      <content:encoded><![CDATA[<p>Graduate level courses are surreal.&nbsp; Professors assign nearly impossible homework assignments and projects.&nbsp;&nbsp;The exams&nbsp;make you&nbsp;break out in&nbsp;sweat just thinking about them.&nbsp;&nbsp;At the same time, you are often able to just sketch out solutions since it is assumed you could carry out the details if you really wanted to; weeks pass where you just hold classroom discussions instead of doing "real" work.</p> <p>The exams in an analaysis of algorithms course I took several years ago were particularly interesting.&nbsp; Consisting of only one or two questions, they asked you to perform analysis on an algorithm you had probably never seen before.&nbsp; Consequently, there wasn't much you could really do to prepare for the exam.</p> <p>This all led to a strange incident on the first exam day.&nbsp; The professor, who shall remain unnamed, was handing out the exam papers at the start of class.&nbsp; As he did so,&nbsp;one of the students raised his hand and asked, almost seriously, &nbsp;"Is this exam open book?".</p> <p>The professor casually replied, "Um, sure, why not?"</p> <p>:-)</p> <p>Needless to say this didn't make the exam any easier.&nbsp; Somehow, I miss those days.</p> <p>-Ben</p>]]></content:encoded>
    </item>
    <item>
      <title>Viruwormy</title>
      <link>https://docs.microsoft.com/archive/blogs/benkaras/viruwormy</link>
      <pubDate>Wed, 17 Jan 2007 02:25:52 GMT</pubDate>
      <dc:creator><![CDATA[benkaras]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/benkaras/2007/01/17/viruwormy/</guid>
      <description><![CDATA[I can't bring myself to click the "compile" button on my property handler project yet... so here's a...]]></description>
      <content:encoded><![CDATA[<p>I can't bring myself to click the "compile" button on my property handler project yet... so here's a little piece of geeky joy:&nbsp; <a href="http://www76.pair.com/keithlim/jabberwocky/parodies/viruwormy.html">Viruwormy</a>.</p> <p>-Ben Karas</p>]]></content:encoded>
    </item>
    <item>
      <title>Pandora and the Music Genome Project</title>
      <link>https://docs.microsoft.com/archive/blogs/benkaras/pandora-and-the-music-genome-project</link>
      <pubDate>Sat, 13 Jan 2007 19:39:22 GMT</pubDate>
      <dc:creator><![CDATA[benkaras]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/benkaras/2007/01/13/pandora-and-the-music-genome-project/</guid>
      <description><![CDATA[A coworker recently turned me onto Pandora.com, a new music service backed by the Music Genome...]]></description>
      <content:encoded><![CDATA[<p>A coworker recently turned me onto <a href="http://pandora.com">Pandora.com</a>, a new music service backed by the Music Genome Project.&nbsp; The concept is to create a radio station tailored to your exact likes and dislikes.&nbsp; You tell it an artist you enjoy and it decodes what makes you enjoy that style of music.&nbsp; </p> <p>What I like about this service is that it is free and has a single non-annoying, unobtrusive ad that refreshes every few seconds.&nbsp; Not bad!&nbsp; This is especially nice with <a href="http://www.microsoft.com/windows/ie/default.mspx#ie7tabs">IE 7 tabs</a>.&nbsp; I can place Pandora on one tab and then continue surfing the net.&nbsp; When it comes time to rate a new song, I just tab over and then tab back.&nbsp;</p> <p>-Ben Karas</p> <p>ps.&nbsp; I keep meaning to blog about how to write a property handler.&nbsp; Honestly!&nbsp; But I've discovered that blogging is hard if you want to talk about technical content.&nbsp; Not only do I have to write a program ahead of time, but I have to research the nooks and crannies of the APIs, design a way to present it, etc.&nbsp; Plus I've been working hard lately (<a href="http://msdn2.microsoft.com/en-us/default.aspx">writing documentation</a>, working late, <a href="http://seattlepi.nwsource.com/local/299492_weather12.html">waiting for the Seattle buses to put their chains</a> on, etc.).&nbsp; Maybe I should just develop <a href="http://dilbertblog.typepad.com/">funny opinions</a> which are quicker to blog?</p>]]></content:encoded>
    </item>
    <item>
      <title>Code for Previous Blog Posts</title>
      <link>https://docs.microsoft.com/archive/blogs/benkaras/code-for-previous-blog-posts</link>
      <pubDate>Wed, 10 Jan 2007 00:55:00 GMT</pubDate>
      <dc:creator><![CDATA[benkaras]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/benkaras/2007/01/10/code-for-previous-blog-posts/</guid>
      <description><![CDATA[Someone asked if I had a copy of the code I've been using in my blog so far.&nbsp; Well, I didn't as...]]></description>
      <content:encoded><![CDATA[<P>Someone asked if I had a copy of the code I've been using in my blog so far.&nbsp; Well, I didn't as of 5pm today, so I&nbsp;went back and collected the code into 3 projects:</P>
<OL>
<LI>propreader.exe &lt;file&gt;<BR>&nbsp;- <A href="http://blogs.msdn.com/benkaras/archive/2006/10/12/Property-coding-expedition-_2300_7-_2D00_-The-final-output.aspx" mce_href="http://blogs.msdn.com/benkaras/archive/2006/10/12/Property-coding-expedition-_2300_7-_2D00_-The-final-output.aspx">Prints a list of all properties we know about the file</A><BR></LI>
<LI>propwriter.exe &lt;file&gt; &lt;property&gt; &lt;value&gt;<BR>&nbsp;- <A href="http://blogs.msdn.com/benkaras/archive/2006/10/16/writing-a-property-1.aspx" mce_href="http://blogs.msdn.com/benkaras/archive/2006/10/16/writing-a-property-1.aspx">Writes a single value</A><BR></LI>
<LI>proplister.exe &lt;file&gt; &lt;proplist&gt;<BR>&nbsp;- <A href="http://blogs.msdn.com/benkaras/archive/2006/11/07/writing-properties-5-property-lists.aspx" mce_href="http://blogs.msdn.com/benkaras/archive/2006/11/07/writing-properties-5-property-lists.aspx">Prints all the properties included in a proplist</A> (e.g. System.PropList.PreviewDetails)</LI></OL>
<P><A class="" href="http://blogs.msdn.com/benkaras/attachment/1442530.ashx" mce_href="http://blogs.msdn.com/benkaras/attachment/1442530.ashx">I've attached the code here (code.zip)</A>.&nbsp;</P>
<P>Enjoy!</P>
<P>-Ben Karas</P>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/01/44/25/30/code.zip" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-01-44-25-30/code.zip">code.zip</a></p>]]></content:encoded>
    </item>
  </channel>
</rss>