<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>The Great Flying Tortoise : Property Handlers</title><link>http://blogs.msdn.com/benkaras/archive/tags/Property+Handlers/default.aspx</link><description>Tags: Property Handlers</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Troubleshooting: Why isn't my property handler getting indexed?</title><link>http://blogs.msdn.com/benkaras/archive/2007/07/24/troubleshooting-why-isn-t-my-property-handler-getting-indexed.aspx</link><pubDate>Tue, 24 Jul 2007 20:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4031975</guid><dc:creator>benkaras</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/benkaras/comments/4031975.aspx</comments><wfw:commentRss>http://blogs.msdn.com/benkaras/commentrss.aspx?PostID=4031975</wfw:commentRss><wfw:comment>http://blogs.msdn.com/benkaras/rsscomments.aspx?PostID=4031975</wfw:comment><description>&lt;P&gt;&lt;FONT face=georgia,palatino&gt;Having trouble getting your property handler working with the indexer?&amp;nbsp; Here are some troubleshooting tips.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 10pt 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpFirst&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Verify that your propdesc file(s) are in a global location&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Verify that you registered your propdesc file(s) using absolute paths&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;3.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Verify that the event log did not record any failures from registering your propdesc file.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;4.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Verify that your property description is well formed, accurate, and was registered properly.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;5.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Verify that your property descriptions are marked isColumn="true", isViewable="true", and isQueryable="true" as appropriate.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;6.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Verify that your DLL is in a global location (e.g. not under your user profile)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;7.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Verify that your DLL is registered under HKLM\Software\Classes&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;8.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;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)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;9.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Verify that your property handler works under explorer&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;10.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;We prefer that you use IInitializeWithStream.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you must use IInitializeWithFile or IInitializeWithItem, verify that you specify DisableProcessIsolation&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;11.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Verify that the "Indexing Options" control panel lists your filetype as an indexed filetype&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;12.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Verify that the test file is in an indexed location&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpLast&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;13.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Verify that the test file's has been modified since after you installed your property handler&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 10pt 0in" class=MsoNormal&gt;&lt;FONT face=georgia,palatino&gt;Common Mistakes:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 10pt 0in 0pt 0.5in; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpFirst&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Placing propdesc files or DLLs under a user directory&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpMiddle&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Registering things with relative paths&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpMiddle&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;3.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Registering things under HKCU instead of HKLM (remember that HKCR shows a merged view of the two hives)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpMiddle&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;4.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Forgetting DisableProcessIsolation for non-stream handlers&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpLast&gt;&lt;FONT face=georgia,palatino&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;5.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;The test file wasn't modified or wasn't in an indexed location&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 10pt 0in" class=MsoNormal&gt;&lt;FONT color=#000000&gt;&lt;FONT face=georgia,palatino&gt;If all else fails, you can use Image File Execution Options to attach a debugger to searchindexer.exe and child processes (On Vista, I&amp;nbsp;use "&amp;lt;pathto&amp;gt;\ntsd.exe -server tcp:port=8001,icfenable -gG -o -snul";&amp;nbsp; On Win7, I use: "&amp;lt;pathto&amp;gt;\ntsd.exe -server npipe:pipe=foo -gG -o -snul").&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Reboot, attach to the debugger, and type "sxeld mypropertyhandler".&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The debugger will break when your DLL gets loaded.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Use of debuggers is an advanced topic that I won't get into right now.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4031975" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/benkaras/archive/tags/Property+Handlers/default.aspx">Property Handlers</category><category domain="http://blogs.msdn.com/benkaras/archive/tags/indexing/default.aspx">indexing</category><category domain="http://blogs.msdn.com/benkaras/archive/tags/troubleshooting/default.aspx">troubleshooting</category></item><item><title>Property handlers and .NET</title><link>http://blogs.msdn.com/benkaras/archive/2007/05/02/property-handlers-and-net.aspx</link><pubDate>Wed, 02 May 2007 23:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2379977</guid><dc:creator>benkaras</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/benkaras/comments/2379977.aspx</comments><wfw:commentRss>http://blogs.msdn.com/benkaras/commentrss.aspx?PostID=2379977</wfw:commentRss><wfw:comment>http://blogs.msdn.com/benkaras/rsscomments.aspx?PostID=2379977</wfw:comment><description>&lt;P&gt;A reader asked:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Consolas&gt;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?&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Consolas size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Consolas&gt;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?&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is a very&amp;nbsp;good question, but the answer is "probably not".&amp;nbsp; &lt;/P&gt;
&lt;P&gt;The reason is that property handlers cannot cause .NET code to get loaded in the caller's process which is not supported.&amp;nbsp; It has nothing to do with performance.&amp;nbsp; So you cannot get around the issue by writing a C++ stub that calls a .NET COM object in the &lt;STRONG&gt;same&lt;/STRONG&gt; process.&lt;/P&gt;
&lt;P&gt;The only thing that works is to write a C++ stub that calls a .NET class running in a &lt;STRONG&gt;different&lt;/STRONG&gt; process altogether.&amp;nbsp; But that's a lot more work, introduces a lot of failure paths, may introduce subtle interactions, etc.&lt;/P&gt;
&lt;P&gt;Raymond Chen digs into the reasons with this post:&amp;nbsp; &lt;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"&gt;&lt;A href="http://blogs.msdn.com/1317290.aspx" mce_href="http://blogs.msdn.com/1317290.aspx"&gt;http://blogs.msdn.com/1317290.aspx&lt;/A&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;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"&gt;&amp;nbsp;[Update 2007-06-04: I found another article (from 2006) which repeats this warning:&amp;nbsp; &lt;A href="http://msdn.microsoft.com/msdnmag/issues/04/01/WindowsShell/default.aspx"&gt;http://msdn.microsoft.com/msdnmag/issues/04/01/WindowsShell/default.aspx&lt;/A&gt;]&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2379977" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/benkaras/archive/tags/Property+Handlers/default.aspx">Property Handlers</category><category domain="http://blogs.msdn.com/benkaras/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Property Handler Decisions and Preparation</title><link>http://blogs.msdn.com/benkaras/archive/2007/01/29/property-handler-decisions-and-preparation.aspx</link><pubDate>Tue, 30 Jan 2007 09:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1555583</guid><dc:creator>benkaras</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/benkaras/comments/1555583.aspx</comments><wfw:commentRss>http://blogs.msdn.com/benkaras/commentrss.aspx?PostID=1555583</wfw:commentRss><wfw:comment>http://blogs.msdn.com/benkaras/rsscomments.aspx?PostID=1555583</wfw:comment><description>&lt;P&gt;Viewed as a &lt;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"&gt;data flow component&lt;/A&gt;, a property handler has a single file stream input and outputs a one or more properties.&amp;nbsp; Unfortunately, writing one requires making many decisions before you even set eyes on the code.&amp;nbsp; Let's look at a few of these preparations.&lt;/P&gt;
&lt;P&gt;First, pick a file type.&amp;nbsp; You'll be writing a property handler for this file type.&lt;/P&gt;
&lt;P&gt;Now decide which properties you want to store.&amp;nbsp; Properties generally fall into a few categories.&amp;nbsp; Take a moment to consider which of the following you want to support:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;System defined properties (e.g. System.Author)&lt;/LI&gt;
&lt;LI&gt;Properties you define for your filetype (e.g. MyCompany.MyApp.MyProperty)&lt;/LI&gt;
&lt;LI&gt;Properties other people define and want to set on your file (e.g. SomeoneElse.Other.Property, aka "open metadata")&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Next, decide where in the file you'll be storing the properties.&amp;nbsp; Hopefully the file's format allows for this already.&amp;nbsp; If it doesn't, you'll have to collaborate with other users of this file format to accomodate these properties.&amp;nbsp; Here are a few storage&amp;nbsp;options:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Compute the property from other data in the file (e.g. System.Document.WordCount)&lt;/LI&gt;
&lt;LI&gt;Read the property from a specific location in the file (e.g. the EXIF header in certain image formats)&lt;/LI&gt;
&lt;LI&gt;Read the property from a dynamic storage structure (e.g. suitable for storing SomeoneElse.Other.Property)&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;And let's not forget deciding which of your properties will be &lt;A href="http://msdn2.microsoft.com/en-us/library/ms630273.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms630273.aspx"&gt;viewable&lt;/A&gt;, &lt;A href="http://msdn2.microsoft.com/en-us/library/ms630282.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms630282.aspx"&gt;editable&lt;/A&gt;, &lt;A href="http://msdn2.microsoft.com/en-us/library/ms630280.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms630280.aspx"&gt;searchable&lt;/A&gt;, &lt;A href="http://msdn2.microsoft.com/en-us/library/bb267290.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb267290.aspx"&gt;etc&lt;/A&gt;.&amp;nbsp; Better start taking notes if you haven't already!&lt;/P&gt;
&lt;P&gt;Once you know where to place your properties, you get to decide how to format them in your file.&amp;nbsp; Will you turn them into strings?&amp;nbsp; Or would a binary format be better?&amp;nbsp; Maybe you'll want to store some properties directly in the file format and others into a special dumping ground for open metadata.&lt;/P&gt;
&lt;P&gt;Also quite important is choosing which API you will use to write to the file format.&amp;nbsp; Hopefully it supports stream inputs.&amp;nbsp; If it doesn't you'll have to flag your handler as "legacy".&amp;nbsp; Typically you'll end up writing a small layer mapping propert keys and values to whatever the format-specific API uses.&lt;/P&gt;
&lt;P&gt;There is one easy decision in this mix.&amp;nbsp; Choose your programming language from the following list: C++, C.&amp;nbsp; Regrettably, &lt;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"&gt;shell extensions cannot use the CLR&lt;/A&gt;, so you may not use C# or any other .NET language.&lt;/P&gt;
&lt;P&gt;As you can see, there are a lot of little decisions you get to make when writing a property handler.&amp;nbsp; There are undoubtedly more that I've missed, but you'll stumble upon those as you prepare your handler.&amp;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.&amp;nbsp; I am skipping those for now in favor of presenting them as a list later.&lt;/P&gt;
&lt;P&gt;-Ben Karas&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1555583" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/benkaras/archive/tags/Property+Handlers/default.aspx">Property Handlers</category></item></channel></rss>