<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4157503910303046714</id><updated>2011-10-03T21:01:05.777+08:00</updated><title type='text'>NTSTATUS</title><subtitle type='html'>Some random technical pieces from my own meanderings through the scape that is Microsoft's Windows system...

With any luck, there might be something here that could save someone some time and grief ;)</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>22</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-4358025623467560989</id><published>2011-09-07T23:23:00.001+08:00</published><updated>2011-09-07T23:59:39.373+08:00</updated><title type='text'>.NET Preprocessor Visual Studio 2010 Add-In Update</title><content type='html'>&lt;p&gt;&lt;font size="4" face="Courier New"&gt;&lt;strong&gt;NTSTATUS: STATUS_DOTNET_MACRO&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Verdana"&gt;Here’s a new version of &lt;strong&gt;VSDotNetPP&lt;/strong&gt;: Version 0.2.0.0. It can be downloaded &lt;a href="http://www.archsignal.com/downloads-dotnetpp.html"&gt;here&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Verdana"&gt;Major updates and additions in this version:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font face="Verdana"&gt;Macros in open documents are now expanded in the file itself, therefore eliminating the previous message saying that the file has been updated outside the editor. This makes &lt;em&gt;‘Restore Macros In Source’&lt;/em&gt; practical, but still not recommended &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font face="Verdana"&gt;Context-menu item to expand macros. This expands all macros in the current document. &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font face="Verdana"&gt;&lt;strong&gt;DOTNETPP.EXE&lt;/strong&gt; is no longer included in the install&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font face="Verdana"&gt;&lt;em&gt;‘Expand Macros’&lt;/em&gt; in context-menu:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-GRU5BwCgyO8/TmeU533yXUI/AAAAAAAAAE8/OOIxEDBCEMc/s1600-h/ExpandMacros3.jpg"&gt;&lt;font color="#333333" face="ver"&gt;&lt;/font&gt;&lt;a href="http://lh5.ggpht.com/-GRU5BwCgyO8/TmeU533yXUI/AAAAAAAAAFA/CHHLdzEDPS4/s1600-h/ExpandMacros4.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Expand Macros" border="0" alt="Expand Macros" src="http://lh3.ggpht.com/-3py4zE-84q4/TmeMYxNICQI/AAAAAAAAAE4/xdgmoy9XxHE/Expand%252520Macros_thumb%25255B2%25255D.jpg?imgmax=800" width="644" height="371" /&gt;&lt;/a&gt;&lt;/a&gt;&lt;/a&gt;&lt;font face="ver"&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="ver"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="ver"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Verdana"&gt;As before, building will automatically expand the macros. If &lt;em&gt;‘Restore Macros In Source’&lt;/em&gt; is set, then the macros will be restored in the document after the build is completed.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-4358025623467560989?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/4358025623467560989/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2011/09/net-preprocessor-visual-studio-2010-add.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/4358025623467560989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/4358025623467560989'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2011/09/net-preprocessor-visual-studio-2010-add.html' title='.NET Preprocessor Visual Studio 2010 Add-In Update'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/-3py4zE-84q4/TmeMYxNICQI/AAAAAAAAAE4/xdgmoy9XxHE/s72-c/Expand%252520Macros_thumb%25255B2%25255D.jpg?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-6279932581697640552</id><published>2011-01-20T03:18:00.002+08:00</published><updated>2011-01-20T03:24:41.118+08:00</updated><title type='text'>.NET Preprocessor Update</title><content type='html'>&lt;span style="font-weight: bold;font-size:130%;" &gt;&lt;span style="font-family: courier new;"&gt;NTSTATUS: STATUS_DOTNET_MACRO&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;o:officedocumentsettings&gt;   &lt;o:allowpng/&gt;  &lt;/o:OfficeDocumentSettings&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:trackmoves/&gt;   &lt;w:trackformatting/&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:donotpromoteqf/&gt;   &lt;w:lidthemeother&gt;EN-US&lt;/w:LidThemeOther&gt;   &lt;w:lidthemeasian&gt;X-NONE&lt;/w:LidThemeAsian&gt;   &lt;w:lidthemecomplexscript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;    &lt;w:splitpgbreakandparamark/&gt;    &lt;w:enableopentypekerning/&gt;    &lt;w:dontflipmirrorindents/&gt;    &lt;w:overridetablestylehps/&gt;   &lt;/w:Compatibility&gt;   &lt;m:mathpr&gt;    &lt;m:mathfont val="Cambria Math"&gt;    &lt;m:brkbin val="before"&gt;    &lt;m:brkbinsub val="&amp;#45;-"&gt;    &lt;m:smallfrac val="off"&gt;    &lt;m:dispdef/&gt;    &lt;m:lmargin val="0"&gt;    &lt;m:rmargin val="0"&gt;    &lt;m:defjc val="centerGroup"&gt;    &lt;m:wrapindent val="1440"&gt;    &lt;m:intlim val="subSup"&gt;    &lt;m:narylim val="undOvr"&gt;   &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"&gt;   &lt;w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 1"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 2"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 3"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 4"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 5"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 6"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 7"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 8"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 9"&gt;   &lt;w:lsdexception locked="false" priority="35" qformat="true" name="caption"&gt;   &lt;w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"&gt;   &lt;w:lsdexception locked="false" priority="1" name="Default Paragraph Font"&gt;   &lt;w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"&gt;   &lt;w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"&gt;   &lt;w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Revision"&gt;   &lt;w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"&gt;   &lt;w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"&gt;   &lt;w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"&gt;   &lt;w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"&gt;   &lt;w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"&gt;   &lt;w:lsdexception locked="false" priority="37" name="Bibliography"&gt;   &lt;w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-priority:99;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin-top:0in;  mso-para-margin-right:0in;  mso-para-margin-bottom:10.0pt;  mso-para-margin-left:0in;  line-height:115%;  mso-pagination:widow-orphan;  font-size:11.0pt;  font-family:"Calibri","sans-serif";  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;  mso-bidi-font-family:"Times New Roman";  mso-bidi-theme-font:minor-bidi;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;Latest versions:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul style="font-family: verdana;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;&lt;span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=""&gt;DOTNETPP Version 0.1.12.0&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;&lt;span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=""&gt;VSDotNetPP Version 0.1.3.0&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;      &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;As before, they can be downloaded &lt;a href="http://www.archsignal.com/downloads-dotnetpp.html"&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;VSDotNetPP now implements DOTNETPP and does not call DOTNETPP.EXE, but it is still included in the install anyway. This update fixes some bugs and makes some processing changes (supposedly for the better). Following are the specific feature updates.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;&lt;span style=""&gt;Features Updated In The .NET Preprocessor&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;The setting for &amp;lt;MacroFilePath&amp;gt; now accepts a directory (path), and parses all .npp files for macro definitions. Or, you can just specify a file path (does not have to have a .npp extension).&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;A list of the source files processed is kept temporarily to avoid restoring files unecessarily during the cleanup process. It was an annoyance otherwise.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;Other than that, some bugs have been fixed.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;&lt;span style=""&gt;Features Updated In The Visual Studio Add-In&lt;/span&gt;&lt;/b&gt;&lt;span style=""&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;A new setting has been added: &lt;i style=""&gt;Close and re-open source files with macros during build&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style=""&gt;&lt;i style=""&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;a href="http://4.bp.blogspot.com/_IXsF0f8rteY/TTc5TViFJ9I/AAAAAAAAAEY/h-jAN20ZqSs/s1600/VS2010-Settings-AddIn-1.png"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 391px; height: 400px;" src="http://4.bp.blogspot.com/_IXsF0f8rteY/TTc5TViFJ9I/AAAAAAAAAEY/h-jAN20ZqSs/s400/VS2010-Settings-AddIn-1.png" alt="" id="BLOGGER_PHOTO_ID_5563978868999923666" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt; &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;I added this setting because I was getting annoyed at the source files getting closed. It’s OK if you have one or two, but it’s not OK if you have more open. Also, I think it should be obvious that the main problem with the closing/opening is that it currently does not return you to the same spot in the file you were in.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;I recommend the following settings in the image:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul style="font-family: verdana;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;&lt;/span&gt;&lt;span style=""&gt;NOT restore macros in source&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;&lt;/span&gt;&lt;span style=""&gt;NOT close/re-open the source files&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;&lt;/span&gt;&lt;span style=""&gt;Cleanup expanded source&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;      &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;By using these settings, it’s pretty much the same as using DOTNETPP in your pre-build and post-build events. But with the way it is currently, it works the best. So to do a build, you’d have to build &lt;b style=""&gt;twice&lt;/b&gt;. The first build expands the macros, and you have to say &lt;b style=""&gt;YES&lt;/b&gt; when Visual Studio asks if you want to reload the files (source changed the Preprocessor). I just build when I want to expand the macros.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;&lt;span style=""&gt;Finally&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;This is pretty much it for the time being. I’ve been using it and it’s been working well. I also found it was quite useful for SQL scripts as well. It managed to reduce some copy/paste/edit.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;Here’s a useful macro for the ternary operator:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;#define HASVAL(a)&lt;span style=""&gt; &lt;/span&gt;a.HasValue ? a.Value : 0&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;IntelliSense does not do regions:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;#define REGPRV&lt;span style=""&gt;    &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;            &lt;/span&gt;#region Private&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;            &lt;/span&gt;#endregion&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-6279932581697640552?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/6279932581697640552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2011/01/net-preprocessor-update.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/6279932581697640552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/6279932581697640552'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2011/01/net-preprocessor-update.html' title='.NET Preprocessor Update'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_IXsF0f8rteY/TTc5TViFJ9I/AAAAAAAAAEY/h-jAN20ZqSs/s72-c/VS2010-Settings-AddIn-1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-215063001341909660</id><published>2011-01-16T01:13:00.005+08:00</published><updated>2011-01-16T01:28:00.965+08:00</updated><title type='text'>Visual Studio &amp; Expression Blend crashes when opening Silverlight XAML</title><content type='html'>&lt;span style="font-weight: bold;font-size:130%;" &gt;&lt;span style="font-family: courier new;"&gt;NTSTATUS: STATUS_FATAL_ERROR&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt; &lt;/span&gt;&lt;br /&gt; &lt;/span&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;This happened to me recently, and it was a nightmare to repair. I will document my experience as many people faced the same problems, and different solutions worked for different people.&lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;I was using Visual Studio 2010 and Expression Blend 4, developing Silverlight 4.&lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;I will put the important points of this post here instead of at the end to save you, the reader, time.&lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;Determined Root Cause of Damage: &lt;/b&gt;Updated Silverlight runtime to the latest version.&lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;Caveat:&lt;/b&gt; Do &lt;b style=""&gt;NOT&lt;/b&gt; install a newer version of Silverlight unless you have the matching developer runtime (if you are developing Silverlight apps). I would also point out that it was &lt;b style=""&gt;IMPOSSIBLE&lt;/b&gt; to find the matching Silverlight developer runtime for the latest version of Silverlight. I am extremely infuriated and disappointed.&lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;1. The Problem As It Happened&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;Suddenly, whenever I opened a Silverlight XAML file, Visual Studio crashed. It does not happen to WPF XAML files. I don’t think I tried Blend at this point as I was trying to get some work done, and was trying to fix my VS.&lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;Steps taken:&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;ol style="font-family: verdana;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Uninstalled Silverlight 4 Toolkit&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Reinstalled Silverlight 4 SDK. Did not do an uninstall as the SDK documentation said it was safe to do (unless I read it wrong)&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;     &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;Results:&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;ul style="font-family: verdana;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;VS still crashes when opening Silverlight XAML&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Blend 4 crashes when opening Silverlight XAML. It cannot be confirmed if the steps taken caused this, or it was already damaged&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;     &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;2. Reinstallation&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;The next desperate step was to reinstall my dev tools. This did &lt;b style=""&gt;NOT&lt;/b&gt; fix the problem. But I will detail it for the record.&lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;Steps taken:&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;ol style="font-family: verdana;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Uninstalled &lt;/span&gt;&lt;span style="font-size:85%;"&gt;Silverlight 4 Toolkit&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Uninstalled &lt;/span&gt;&lt;span style="font-size:85%;"&gt;Silverlight 4 SDK&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Uninstalled &lt;/span&gt;&lt;span style="font-size:85%;"&gt;Silverlight 3 Toolkit&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Uninstalled &lt;/span&gt;&lt;span style="font-size:85%;"&gt;Silverlight 3 SDK&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Uninstalled &lt;/span&gt;&lt;span style="font-size:85%;"&gt;Silverlight Runtime&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Uninstalled Visual Studio 2010&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Uninstalled Visual Studio 2008&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Uninstalled Blend 4&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Uninstalled Blend 3&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Install Visual Studio 2010&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Install Blend 4&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Install Silverlight 4 SDK&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Install Silverlight 4 Toolkit&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;                           &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;Results:&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;ul style="font-family: verdana;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;VS still crashes when opening Silverlight XAML&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Blend 4 still crashes when opening Silverlight XAML&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;     &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;At this point, it is safe to say that the system is irreparably damaged. I read that some folks had to reinstall their entire system. So not wanting to waste any more time, I &lt;b style=""&gt;restored my last good system image&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;3. System Restore &amp;amp; Update&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;Having restored my system to the last good image, I attempted to update it. I verified that VS and Blend are working properly with Silverlight 4 XAML files. However, when I ran my Silverlight 4 app, it insisted I install a newer version of the Silverlight runtime and just refused to run. I could not understand this as I had just restored my system to an older state which actually is using an older version of Silverlight (4.0.50524.0). I figure this out later. I had no choice at the time, so…&lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;Update Steps:&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;ol style="font-family: verdana;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Update Silverlight runtime to version 4.0.51204.0 (Current version is 4.0.50524.0)&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;Results:&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;ul style="font-family: verdana;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;VS cannot debug Silverlight 4 app because the developer runtime does not match the current Silverlight version&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;So this is a big problem. To fix this, I tried the following:&lt;/span&gt;&lt;/p&gt;   &lt;ol style="font-family: verdana;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Uninstall Silverlight runtime&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Download and install the latest Silverlight 4 developer runtime that I could find&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;     &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;Result:&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;ul style="font-family: verdana;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;VS can now debug Silverlight 4 app again&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;However, VS now crashes when opening Silverlight XAML&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Blend 4 also now crashes when opening Silverlight XAML&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;       &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;So, it looks like this was how my system got &lt;b style=""&gt;damaged&lt;/b&gt; in the first place. I vaguely recall installing the latest version of Silverlight when prompted some weeks or months ago, and I had not worked on a Silverlight app until now.&lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;I restored the system AGAIN, and did NOT install the latest version of Silverlight. However, there was still that nagging problem of my app insisting I install the latest version of Silverlight! I finally figure it out:&lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;Silverlight App Project&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;ul style="font-family: verdana;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;The param “minRuntimeVersion” of the Silverlight object in the host webpage is what causes the popup to install a newer version of Silverlight if the value is above the current version installed. So just make sure that this is no greater than your current version of Silverlight.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;   &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: 0.5in; font-family: verdana;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;param name="minRuntimeVersion" value="4.0.50401.0" /&amp;gt;&lt;/span&gt;&lt;/p&gt;   &lt;ul style="font-family: verdana;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;I believe that I had created the said Silverlight app project after installing the newer version of the Silverlight runtime, and this is what caused the popup dialog to insist on the newer version of Silverlight even after I restored my system. This would make sense as my project was not affected by the system restore.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;Conclusion&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;Ultimately, I was not able to repair the damage. I could only restore my system back to a point where my development system was all good. The only thing I could really do was to make sure that I do not take any of the steps that would cause that kind of damage. And these steps, are those I laid out which I figured out through trial and error. I could have figured it out faster, but unfortunately, installs, uninstalls and system restores take a very, very long time. In all, it was about 18 hours wasted because nothing new was achieved… It was all just to get back to square one.&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-215063001341909660?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/215063001341909660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2011/01/visual-studio-expression-blend-crashes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/215063001341909660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/215063001341909660'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2011/01/visual-studio-expression-blend-crashes.html' title='Visual Studio &amp; Expression Blend crashes when opening Silverlight XAML'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-3713919448139871059</id><published>2011-01-05T16:55:00.003+08:00</published><updated>2011-01-05T17:07:38.612+08:00</updated><title type='text'>The .NET Preprocessor Visual Studio Add-In</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;NTSTATUS: STATUS_DOTNET_MACRO&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;o:officedocumentsettings&gt;   &lt;o:allowpng/&gt;  &lt;/o:OfficeDocumentSettings&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:trackmoves/&gt;   &lt;w:trackformatting/&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:donotpromoteqf/&gt;   &lt;w:lidthemeother&gt;EN-US&lt;/w:LidThemeOther&gt;   &lt;w:lidthemeasian&gt;X-NONE&lt;/w:LidThemeAsian&gt;   &lt;w:lidthemecomplexscript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;    &lt;w:splitpgbreakandparamark/&gt;    &lt;w:enableopentypekerning/&gt;    &lt;w:dontflipmirrorindents/&gt;    &lt;w:overridetablestylehps/&gt;   &lt;/w:Compatibility&gt;   &lt;m:mathpr&gt;    &lt;m:mathfont val="Cambria Math"&gt;    &lt;m:brkbin val="before"&gt;    &lt;m:brkbinsub val="&amp;#45;-"&gt;    &lt;m:smallfrac val="off"&gt;    &lt;m:dispdef/&gt;    &lt;m:lmargin val="0"&gt;    &lt;m:rmargin val="0"&gt;    &lt;m:defjc val="centerGroup"&gt;    &lt;m:wrapindent val="1440"&gt;    &lt;m:intlim val="subSup"&gt;    &lt;m:narylim val="undOvr"&gt;   &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"&gt;   &lt;w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 1"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 2"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 3"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 4"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 5"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 6"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 7"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 8"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 9"&gt;   &lt;w:lsdexception locked="false" priority="35" qformat="true" name="caption"&gt;   &lt;w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"&gt;   &lt;w:lsdexception locked="false" priority="1" name="Default Paragraph Font"&gt;   &lt;w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"&gt;   &lt;w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"&gt;   &lt;w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Revision"&gt;   &lt;w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"&gt;   &lt;w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"&gt;   &lt;w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"&gt;   &lt;w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"&gt;   &lt;w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"&gt;   &lt;w:lsdexception locked="false" priority="37" name="Bibliography"&gt;   &lt;w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-priority:99;  mso-style-parent:"";  mso-padding-alt:0cm 5.4pt 0cm 5.4pt;  mso-para-margin-top:0cm;  mso-para-margin-right:0cm;  mso-para-margin-bottom:10.0pt;  mso-para-margin-left:0cm;  line-height:115%;  mso-pagination:widow-orphan;  font-size:11.0pt;  font-family:"Calibri","sans-serif";  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;  mso-bidi-font-family:"Times New Roman";  mso-bidi-theme-font:minor-bidi;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;So this is the obvious next best step: a Visual Studio Add-In for DOTNETPP to integrate it (somewhat) with VS. The biggest problem it would fix is ‘&lt;b style=""&gt;the catch&lt;/b&gt;’ mentioned in earlier posts regarding open source files that have macros.&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;The Add-In &lt;b style=""&gt;VSDotNetPP&lt;/b&gt; can be downloaded &lt;a href="http://www.archsignal.com/downloads-dotnetpp.html"&gt;here&lt;/a&gt;. The download includes the latest version of DOTNETPP (Version 0.1.10.0).&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;Do note that this Add-In was built with Visual Studio 2010 for &lt;b style=""&gt;Visual Studio 2010&lt;/b&gt;. I do not believe it will work with an older version. The Setup created isn’t the greatest, it’s as basic as installing the files to a directory, and is uninstall-able. I’ll try to create a more comprehensive setup package later, but for now, there are some manual steps.&lt;/span&gt;&lt;/p&gt;&lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt; &lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;&lt;span style=""&gt;Registering the add-in&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;The default install directory is: “C:\Program Files\DOTNETPP\.NET Preprocessor Visual Studio Add-In”. You need to run the batch file Deploy-AddIn.bat to register the add-in with VS. This batch file copies the add-in file &lt;b style=""&gt;VSDotNetPP-Deploy.AddIn&lt;/b&gt; to the directory "%HOMEPATH%\Documents\Visual Studio 2010\Addins" which is one of the paths that VS2010 searches for add-ins. As I am using Windows 7, I am not sure if this path is valid for Windows Vista or XP.&lt;/span&gt;&lt;/p&gt;&lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;a href="http://4.bp.blogspot.com/_IXsF0f8rteY/TSQ0LbCQoPI/AAAAAAAAAEI/BwNk4A4vcn8/s1600/VS2010-Settings-AddIn.png"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 232px;" src="http://4.bp.blogspot.com/_IXsF0f8rteY/TSQ0LbCQoPI/AAAAAAAAAEI/BwNk4A4vcn8/s400/VS2010-Settings-AddIn.png" alt="" id="BLOGGER_PHOTO_ID_5558625210922475762" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;You can find the paths that VS2010 searches for add-ins in your options settings by going to Tools-&amp;gt;Options-&amp;gt;Environment-&amp;gt;Add-in/Macros Security. You may place the add-in file in any of those directories. This is the information from MSDN.&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;After registering the add-in, start VS2010, and you should see a new item in the ‘Tools’ menu called ‘.NET Preprocessor’.&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;To remove the add-in from VS, just remove the add-in file from the path you put it in and restart VS.&lt;/span&gt;&lt;/p&gt;&lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt; &lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;&lt;span style=""&gt;How the Add-In works&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;The add-in basically does what was suggested in previous posts: it closes the relevant open source files prior to running DOTNETPP… And, it opens them back after the build completes! So with this, you will not be bugged with the dialog asking if you want to reload the file as it has been modified outside the editor and fail the build. With this, you can choose to retain the macros in your source with much less inconvenience. However, I’d still not recommend that. I know it’s an inconvenience, but I don’t know how to set the view of the open file back to where it was before it was closed yet. When I figure it out, I will add that feature.&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;The add-in will call DOTNETPP for pre-build and post-build, so you will no longer have to add the calls yourself into the pre-build and post-build events in your project settings.&lt;/span&gt;&lt;/p&gt;&lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt; &lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;&lt;span style=""&gt;Settings Dialog&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;There is a settings dialog when you click on the ‘.NET Preprocessor’ menu item in the ‘Tools’ menu. This is basically for editing the DOTNETPP config file. Enter the full path of the config file into the settings dialog, and it will load all the settings. If the config file path is invalid, or it is blank, then DOTNETPP will not run during the build. This is how you can ‘turn it off’.&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;The rest of the settings have already been explained in the previous post about it.&lt;/span&gt;&lt;/p&gt;&lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;a href="http://4.bp.blogspot.com/_IXsF0f8rteY/TSQ0Li5_dDI/AAAAAAAAAEQ/anr1nzAFTJI/s1600/DOTNETPP-Settings.png"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 381px;" src="http://4.bp.blogspot.com/_IXsF0f8rteY/TSQ0Li5_dDI/AAAAAAAAAEQ/anr1nzAFTJI/s400/DOTNETPP-Settings.png" alt="" id="BLOGGER_PHOTO_ID_5558625213035279410" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt; &lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;&lt;span style=""&gt;Some Notes&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;OK, writing the add-in was really tricky. It was not straight forward at all, and I think I caught most of the ‘catches’, and I’ve been using it, and it works fine for the most part. However, if it is not behaving right, like changed settings don’t seem to be taking effect, I can only suggesting restarting Visual Studio. I know, it’s dumb, but that’s what I did and it was fine. However, in the latest testing, this problem hasn’t turned up, so it’s possible I fixed it. As I said, building add-ins for VS is not straight forward eventhough it looks like it is.&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;Before I forget, the add-in creates an XML file called &lt;b style=""&gt;VSDotNetPP.xml&lt;/b&gt; in your solution path. It is used to keep track of the DOTNETPP config file path.&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: verdana;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;Send me email at &lt;a href="mailto:tim@bugslayersrus.com"&gt;tim@bugslayersrus.com&lt;/a&gt; to comment, report bugs, or chat. Or, you could leave a comment here. Thanks.&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-3713919448139871059?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/3713919448139871059/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2011/01/net-preprocessor-visual-studio-add-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/3713919448139871059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/3713919448139871059'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2011/01/net-preprocessor-visual-studio-add-in.html' title='The .NET Preprocessor Visual Studio Add-In'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_IXsF0f8rteY/TSQ0LbCQoPI/AAAAAAAAAEI/BwNk4A4vcn8/s72-c/VS2010-Settings-AddIn.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-921344492754929552</id><published>2011-01-03T21:13:00.008+08:00</published><updated>2011-01-03T21:37:34.577+08:00</updated><title type='text'>The .NET Preprocessor - Part 4</title><content type='html'>&lt;span style="font-weight: bold;font-size:130%;" &gt;&lt;span style="font-family:courier new;"&gt;NTSTATUS: STATUS_DOTNET_MACRO&lt;/span&gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;    &lt;p style="font-family: verdana;font-family:verdana;"  class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;OK,  so now let’s see what macros would be useful… But before we actually  get to that, I think we should look at the motivations and the  sensibilities behind it. For those who are or were not C/C++  programmers, this would be relevant. Also, the article on the C  Preprocessor in &lt;a href="http://en.wikipedia.org/wiki/C_preprocessor"&gt;Wikipedia&lt;/a&gt; is a good place to start.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;     &lt;p style="font-family: verdana;font-family:verdana;"  class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;One  of the first points, I believe, is that the macros should help you  reduce or simplify your work/effort. Apart from general term replacement  as in declaring what would be const values and such, is that the macros  can help you expand arguments into pieces of code. So the common sense  here would be that if it takes more effort to use the macros than  actually writing the code, then it’s probably a poor choice in using  that macro.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;       &lt;p class="MsoListParagraphCxSpLast"  style="text-indent: -18pt; font-family: verdana;font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;The only real guidelines I can recommend are the following:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;ol style="font-family: verdana;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;If  you start to get annoyed about having to write some code because you’ve  done it so many times and want some magic shortcut, then it’s a good  candidate to be a macro.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;If  you are writing a piece of code that is repetitive, but a term or two  changes just a little bit here and there, then it’s a good candidate to  be a macro.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;If calling the macro takes more effort than writing the code itself, then it might not be a good idea.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-family: verdana;font-size:85%;" &gt;&lt;span style=""&gt;Because  IntelliSense is so good now, some code don’t need to be macros as  keystrokes have been reduced dramatically for languages like C# and  VB.NET. Not so lucky if you’re writing C/C++. IntelliSense still (until  today) behaves like a retarded potato that is two bricks short of a  load. I just don’t get it. Do they think that Visual C/C++ don’t need  IntelliSense to pop-up as soon as you type and make clever suggestions  and auto-complete for you? OK, now that I’ve gotten that out of the way,  you get the point.&lt;/span&gt;&lt;/span&gt;     &lt;p style="font-family: verdana;font-family:verdana;"  class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;If  a macro results in more keystrokes, then it might not be that great an  idea. Also, do take note that the macro (keystroke) recorder is a  brilliant tool which I love, that is perfect for adjusting text with a  pattern or structure. It’s an absolute gem of Visual Studio. However,  that isn’t really practical in actually writing code.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;     &lt;p style="font-family: verdana;font-family:verdana;"  class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;Here are some macros that you might useful for C#. I use some of them:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p  class="MsoNormal" style="font-family:verdana;"&gt;&lt;a href="http://1.bp.blogspot.com/_IXsF0f8rteY/TSHNvlHblaI/AAAAAAAAADw/8t-PUpnhZZo/s1600/macros-1.PNG"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 335px;" src="http://1.bp.blogspot.com/_IXsF0f8rteY/TSHNvlHblaI/AAAAAAAAADw/8t-PUpnhZZo/s400/macros-1.PNG" alt="" id="BLOGGER_PHOTO_ID_5557949632452728226" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;p face="verdana" class="MsoNormal"&gt;&lt;a href="http://1.bp.blogspot.com/_IXsF0f8rteY/TSHNv4M2iiI/AAAAAAAAAEA/sl6WtpIGyFw/s1600/macros-3.PNG"&gt;&lt;br /&gt;  &lt;/a&gt;&lt;/p&gt;   &lt;p face="verdana" class="MsoNormal"&gt;&lt;a href="http://1.bp.blogspot.com/_IXsF0f8rteY/TSHNvlw3MAI/AAAAAAAAAD4/wY4hn8F2gjI/s1600/macros-2.PNG"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 357px; height: 400px;" src="http://1.bp.blogspot.com/_IXsF0f8rteY/TSHNvlw3MAI/AAAAAAAAAD4/wY4hn8F2gjI/s400/macros-2.PNG" alt="" id="BLOGGER_PHOTO_ID_5557949632626503682" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;br /&gt;  &lt;p face="verdana" class="MsoNormal"&gt;&lt;a href="http://1.bp.blogspot.com/_IXsF0f8rteY/TSHNv4M2iiI/AAAAAAAAAEA/sl6WtpIGyFw/s1600/macros-3.PNG"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 345px; height: 400px;" src="http://1.bp.blogspot.com/_IXsF0f8rteY/TSHNv4M2iiI/AAAAAAAAAEA/sl6WtpIGyFw/s400/macros-3.PNG" alt="" id="BLOGGER_PHOTO_ID_5557949637575739938" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;span style=";font-family:&amp;quot;;font-size:9.5pt;"  &gt; &lt;/span&gt;     &lt;p face="verdana" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: verdana;font-family:verdana;"  class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;As  for the names of the macros (the identifier), those above are basically  cryptic. This is because I’m keeping them short, for if not, it’ not be  practical as I’d have to type a long name, which might make me punch  more keys than if I did not use the macro in the first place. So it’s  really up to you how you choose to name it. Refer to guideline no.3  above.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;      &lt;p style="font-family: verdana;font-family:verdana;"  class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=""&gt;So  really, you can do quite a lot with macro expansion, and as cliché’d as  it sounds, it’s really up to your imagination. For example, the macro  PROPVM(p) above is something that would be useful for implementing MVVM,  and you’re not using any magic framework. Even a basic Property like  that though simple to write, becomes tedious when you need to do a lot  of it. Yes, you can copy/paste and modify, you but it does get tedious,  doesn’t it? The macro would have reduced work significantly.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-921344492754929552?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/921344492754929552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2011/01/net-preprocessor-part-4.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/921344492754929552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/921344492754929552'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2011/01/net-preprocessor-part-4.html' title='The .NET Preprocessor - Part 4'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_IXsF0f8rteY/TSHNvlHblaI/AAAAAAAAADw/8t-PUpnhZZo/s72-c/macros-1.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-6272506168931758124</id><published>2011-01-03T18:40:00.004+08:00</published><updated>2011-01-03T18:50:52.933+08:00</updated><title type='text'>The .NET Preprocessor - Part 3</title><content type='html'>&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;o:officedocumentsettings&gt;   &lt;o:allowpng/&gt;  &lt;/o:OfficeDocumentSettings&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:trackmoves/&gt;   &lt;w:trackformatting/&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:donotpromoteqf/&gt;   &lt;w:lidthemeother&gt;EN-US&lt;/w:LidThemeOther&gt;   &lt;w:lidthemeasian&gt;X-NONE&lt;/w:LidThemeAsian&gt;   &lt;w:lidthemecomplexscript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;    &lt;w:splitpgbreakandparamark/&gt;    &lt;w:enableopentypekerning/&gt;    &lt;w:dontflipmirrorindents/&gt;    &lt;w:overridetablestylehps/&gt;   &lt;/w:Compatibility&gt;   &lt;m:mathpr&gt;    &lt;m:mathfont val="Cambria Math"&gt;    &lt;m:brkbin val="before"&gt;    &lt;m:brkbinsub val="&amp;#45;-"&gt;    &lt;m:smallfrac val="off"&gt;    &lt;m:dispdef/&gt;    &lt;m:lmargin val="0"&gt;    &lt;m:rmargin val="0"&gt;    &lt;m:defjc val="centerGroup"&gt;    &lt;m:wrapindent val="1440"&gt;    &lt;m:intlim val="subSup"&gt;    &lt;m:narylim val="undOvr"&gt;   &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"&gt;   &lt;w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 1"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 2"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 3"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 4"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 5"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 6"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 7"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 8"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 9"&gt;   &lt;w:lsdexception locked="false" priority="35" qformat="true" name="caption"&gt;   &lt;w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"&gt;   &lt;w:lsdexception locked="false" priority="1" name="Default Paragraph Font"&gt;   &lt;w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"&gt;   &lt;w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"&gt;   &lt;w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Revision"&gt;   &lt;w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"&gt;   &lt;w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"&gt;   &lt;w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"&gt;   &lt;w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"&gt;   &lt;w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"&gt;   &lt;w:lsdexception locked="false" priority="37" name="Bibliography"&gt;   &lt;w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-priority:99;  mso-style-parent:"";  mso-padding-alt:0cm 5.4pt 0cm 5.4pt;  mso-para-margin-top:0cm;  mso-para-margin-right:0cm;  mso-para-margin-bottom:10.0pt;  mso-para-margin-left:0cm;  line-height:115%;  mso-pagination:widow-orphan;  font-size:11.0pt;  font-family:"Calibri","sans-serif";  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;  mso-bidi-font-family:"Times New Roman";  mso-bidi-theme-font:minor-bidi;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;b&gt;&lt;span style="font-size: 13.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;NTSTATUS: STATUS_DOTNET_MACRO&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Now let’s go through the config file that DOTNETPP expects. It’s an XML file, and doesn’t expect any special name, and I called mine &lt;b&gt;dotnetpp.xml&lt;/b&gt;. Here are the settings:&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;xml&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt; &lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;version&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;1.0&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;encoding&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;utf-8&lt;/span&gt;"&lt;span style="color: blue;"&gt; ?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;Settings&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;Language&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;C#&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Language&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;Extension&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;.cs&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Extension&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;MacroFilePath&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;.\MyMacros.npp&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;MacroFilePath&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;SourceBasePath&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;C:\MyProject&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;SourceBasePath&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;RecurseSubDirectories&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;true&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;RecurseSubDirectories&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;RestoreMacrosInSource&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;false&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;RestoreMacrosInSource&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;CleanupOriginalSources&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;false&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;CleanupOriginalSources&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;ClenupExpandedSources&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;false&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;ClenupExpandedSources&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;Diagnostics&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;stdout&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;true&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;stdout&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;debug&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;true&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;debug&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;Diagnostics&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: rgb(163, 21, 21);"&gt;Settings&lt;/span&gt;&lt;span style="font-size: 9.5pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Following are the meanings of each setting item:&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Language&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;: [C#/VB]&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Supports only ‘C#’ and ‘VB’ where it will look for files of their respective extensions.&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Extension&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;: source file extensions including the dot (.cs, .vb)&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;OK, so it doesn’t only specifically support only .NET languages like C#/VB.NET. It will parse files of any extension you specify here. And this setting will override the &amp;lt;Language&amp;gt; setting.&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;MacroFilePath&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;: Full path to the macro file&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;No specific file name, but will expect &lt;b&gt;.npp&lt;/b&gt; as an extension. Currently, this setting expects the full path to a file, but does not harp on the file name or extension. However, the next feature upgrade will allow you to put a path (directory) in this setting, and it will look for all .npp files to parse for marco definitions.&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;SourceBasePath&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;: The base path of the source files which require macro expansion&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Usually would either be the path of your solution, or project.&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;RecurseSubDirectories&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;: [true/false]&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Recurse the subdirectories of &amp;lt;SourceBasePath&amp;gt; in search of source files&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;RestoreMacrosInSource&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;: [true/false]&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Restore the macros in the source files after expansion. Refer to ‘The Catch’ in Part 2. As mentioned prior, might be a better way to NOT restore macros and have them ‘permanently’ expanded into actual source.&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;CleanupOriginalSources&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;: [true/false]&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Delete all saved copies of source files before the expansion&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;ClenupExpandedSources&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;: [true/false]&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Delete all copies of the expanded source files. They have the extension .nmx. There was some challenge in finding an extension that was not already used and had an associated application.&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;stdout&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;: [true/false]&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Output messages to stdout.&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;debug&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;: [true/false]&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Output messages to the Debugger. Can be viewed with DebugView from Sysinternals.&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-6272506168931758124?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/6272506168931758124/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2011/01/net-preprocessor-part-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/6272506168931758124'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/6272506168931758124'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2011/01/net-preprocessor-part-3.html' title='The .NET Preprocessor - Part 3'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-276829955890110356</id><published>2010-12-31T02:25:00.008+08:00</published><updated>2011-01-02T16:19:26.195+08:00</updated><title type='text'>The .NET Preprocessor - Part 2</title><content type='html'>&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;o:officedocumentsettings&gt;   &lt;o:allowpng/&gt;  &lt;/o:OfficeDocumentSettings&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:trackmoves/&gt;   &lt;w:trackformatting/&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:donotpromoteqf/&gt;   &lt;w:lidthemeother&gt;EN-US&lt;/w:LidThemeOther&gt;   &lt;w:lidthemeasian&gt;X-NONE&lt;/w:LidThemeAsian&gt;   &lt;w:lidthemecomplexscript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;    &lt;w:splitpgbreakandparamark/&gt;    &lt;w:enableopentypekerning/&gt;    &lt;w:dontflipmirrorindents/&gt;    &lt;w:overridetablestylehps/&gt;   &lt;/w:Compatibility&gt;   &lt;m:mathpr&gt;    &lt;m:mathfont val="Cambria Math"&gt;    &lt;m:brkbin val="before"&gt;    &lt;m:brkbinsub val="&amp;#45;-"&gt;    &lt;m:smallfrac val="off"&gt;    &lt;m:dispdef/&gt;    &lt;m:lmargin val="0"&gt;    &lt;m:rmargin val="0"&gt;    &lt;m:defjc val="centerGroup"&gt;    &lt;m:wrapindent val="1440"&gt;    &lt;m:intlim val="subSup"&gt;    &lt;m:narylim val="undOvr"&gt;   &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"&gt;   &lt;w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 1"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 2"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 3"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 4"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 5"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 6"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 7"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 8"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 9"&gt;   &lt;w:lsdexception locked="false" priority="35" qformat="true" name="caption"&gt;   &lt;w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"&gt;   &lt;w:lsdexception locked="false" priority="1" name="Default Paragraph Font"&gt;   &lt;w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"&gt;   &lt;w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"&gt;   &lt;w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Revision"&gt;   &lt;w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"&gt;   &lt;w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"&gt;   &lt;w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"&gt;   &lt;w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"&gt;   &lt;w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"&gt;   &lt;w:lsdexception locked="false" priority="37" name="Bibliography"&gt;   &lt;w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-priority:99;  mso-style-parent:"";  mso-padding-alt:0cm 5.4pt 0cm 5.4pt;  mso-para-margin-top:0cm;  mso-para-margin-right:0cm;  mso-para-margin-bottom:10.0pt;  mso-para-margin-left:0cm;  line-height:115%;  mso-pagination:widow-orphan;  font-size:11.0pt;  font-family:"Calibri","sans-serif";  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;  mso-bidi-font-family:"Times New Roman";  mso-bidi-theme-font:minor-bidi;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal" style="margin-bottom: 12pt; line-height: normal;"&gt;&lt;b&gt;&lt;span style="font-size: 13.5pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;NTSTATUS: STATUS_DOTNET_MACRO&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The .NET Pre-Processor may be downloaded &lt;/span&gt;&lt;a href="http://www.archsignal.com/downloads-dotnetpp.html"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: blue;"&gt;here&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;.&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The first debate was which language it should be written in. The candidates were C/C++, C# and Python. I really wanted to write it in C/C++, but the conveniences of C# and the .NET platform was just scoring too many points. No, I will not write managed C++ in Visual C++. I do not like the syntax. As for Python, the code would probably have been shorter, but it’s not a common install, and not as commonly used, I think. Related to that, Python got a boost when an actual Python came to my house a week ago. No, seriously. It’s the second one to come by in 6 months. I told my good friend Walter (Developer Security MVP) that it might have been a sign. But alas, it was C#.&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;DOTNETPP is a command-line tool that is largely designed to work with Visual Studio’s pre and post-build facilities. The settings are expected to be in an XML file, a sample of which is included in the download. Following is the usage:&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Usage: DOTNETPP /p:"&amp;lt;config file path&amp;gt;" [/process|/cleanup]&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 36pt; line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/process: Process macro expansion&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 36pt; line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/cleanup: Cleanup expanded macro files&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The config file path is specified by the /p: parameter. /process and /cleanup are actually mutually exclusive. If they both appear, /process will take priority. So basically, you will use /process in your Visual Studio .NET Project’s pre-build event, and /cleanup in your post-build event. Of course you can also manually run it to process and cleanup.&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Macro Definition File&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The macro definition file is basically a text file where you define your C Preprocessor macros. I will post some examples subsequent posts. DOTNETPP supports the following macro/preprocessor features:&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 36pt; line-height: normal;"&gt;&lt;span style="font-size: 7pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;- &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Non-parameterized macros&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 36pt; line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;- Parameterized macros&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 36pt; line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;- Token concatenation (##)&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 36pt; line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;- Stringizing Operator (#)&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 36pt; line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;- C++ style comments (//)&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Since the macro definitions are in its own file, the line-continuation backslash ‘\’ is not required at the end of each line of the token list.&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Source Files&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;In the source files which you want to use macros and have DOTNETPP process them, include the following syntax in said source file:&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;#include DOTNETPP&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Since this syntax is not processed, it must be commented or excluded from compilation for the build to succeed. In the case of C#, you may use the following:&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;//#include DOTNETPP&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Or&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;#if false&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;#include DOTNETPP&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;#endif&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The Catch&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;There is a catch. This is because this tool is NOT integrated into Visual Studio. This is what the problem is… the way DOTNETPP works is that it (obviously) expands the macros, and then writes it back into the source file. So the catch is, if any of the source files that are processed by DOTNETPP are open when the build runs (with DOTNETPP running in the pre/post-build events), the build WILL FAIL.&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Why? This is because Visual Studio will ask if you want to reload the file as it has been edited outside of the source editor. The compilation would have started way before you’re able to say you want to reload the files. So if you reload and save the changed files, you will LOSE all your macros, and have the expanded code instead. This would be equivalent to setting &amp;lt;RestoreMacrosInSource&amp;gt; to FALSE in the config file.&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Here’s the scenario:&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 36pt; line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;1. Build project/solution&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 36pt; line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;2. Build fails&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 36pt; line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;3. Visual Studio asks if you want to reload the files&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 36pt; line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;4. Reload the files and save&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 36pt; line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;5. Build project/solution (this time it will succeed assuming you did not screw up the macro definitions)&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;This is a clearly a serious inconvenience to have to close all the source files with the macros before doing a build every time. This is a major con. Well, it’s not part of Visual Studio, tough. So maybe there is a way to work around this if the tool is integrated into Visual Studio. That would be something to look into for the future.&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;However, having thought about it, this problem probably isn’t necessarily a bad thing. I probably don’t actually want the macros to remain in the source as it can be cryptic. So, as a potentially fortunate consequence of the way Visual Studio works, DOTNETPP could work as a one-time-no-return macro expander. After all, one of the config settings is &amp;lt;RestoreMacrosInSource&amp;gt;true/false&amp;lt;/RestoreMacrosInSource&amp;gt;. OK, so maybe this is a less ‘evil’ way. Expand the macros so they become the source code, and no more macros in the source.&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Next I will write about the config file, but the elements should be quite obvious.&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Here’s one of the main reasons I started this project:&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;#define FOR(a)                 for (int i = 0; i &amp;lt; a.Count; i++)&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-276829955890110356?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/276829955890110356/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2010/12/net-pre-processor-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/276829955890110356'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/276829955890110356'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2010/12/net-pre-processor-part-2.html' title='The .NET Preprocessor - Part 2'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-3620574060175712586</id><published>2010-12-30T22:47:00.002+08:00</published><updated>2011-01-02T16:18:22.132+08:00</updated><title type='text'>The .NET Preprocessor - Part 1</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;NTSTATUS: STATUS_DOTNET_MACRO&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;This is my only technical blog, so I’ll just put it here for now…&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;My favourite programming language is still C. One of the things I liked a lot about it is the C Preprocessor. There are people who love it, and then there are those who hate it. Some say that it is evil. Like they say, with C, you shoot yourself in the foot. I guess the C Preprocessor (CPP) is the same. It can be used for good, or evil. If used appropriately, boy, can it save you a load of tedious coding/keystrokes. If you screw it up, you shoot yourself in the foot.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;So nowadays, I don’t use C/C++ as much as there is not all that much need for it, and better languages/platforms for certain jobs… Like web apps, and general Windows apps… Yes, that makes up most of the needs nowadays. I’ve always been Windows kinda guy, so naturally I’m using C# on .NET. Man, C# is sweet, and the .NET libraries are super sweet. OK, so at least C# has some basic compiler-directives, like symbol definition and conditional compilation. From a C background, that is very welcome indeed.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;However, there is NO macro expansion!!! [Insert expletive here]. If you’ve used the CPP, you’ll soon start to miss it. I swear, man, I am so sick of typing tedious repetitive code. If you are one of those who would say to substitute the macros with functions, then forget it because I don’t want to create more overhead where it can be avoided. Besides, it just isn’t the same concept or in the same spirit.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;So about a month ago, I started moaning about this again because I am so, so, so, did I say I was sooo sick of writing for-loops (for instance)? So I kindly asked someone (anyone) to add the CPP/Precompiler to C# on Facebook. OK, I know it was not included in C# for reasons unknown to me. But I believe Hejlsberg and co. had good reasons. But I know what I am doing, and I WANT IT!!! So how now brown cow?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;So, having toyed with the idea for a couple of weeks, I spent another week or two actually thinking it out in my head how to build it, and which features it would include. Of course, I thought about how it could work with Visual Studio. Not surprisingly, after a few weeks of laying it all out in my head, I finally took some ‘time off’, sat down, and went about building it. Surprisingly, it took me just over half a day to finish the first complete app. So next time your boss catches you seemingly doing nothing, just tell ‘em that you’re laying it all out in your head first so the execution will be quicker and smoother.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Anyway, I will continue to write about how it works in subsequent posts and put the links up. Oh, I beg your pardon, I haven’t introduced it. I call it the ‘.NET Pre-Processor’, and it is DOTNETPP.EXE.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-3620574060175712586?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/3620574060175712586/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2010/12/net-pre-processor-part-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/3620574060175712586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/3620574060175712586'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2010/12/net-pre-processor-part-1.html' title='The .NET Preprocessor - Part 1'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-7927298342523566350</id><published>2010-09-07T16:59:00.006+08:00</published><updated>2010-09-07T17:42:38.387+08:00</updated><title type='text'>Dissassemble Me</title><content type='html'>&lt;span style="font-weight: bold;font-family:courier new;font-size:130%;"  &gt;NTSTATUS: STATUS_OBJECT_DUMPED&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt; &lt;/span&gt;&lt;h3  style="color: rgb(0, 0, 0); font-weight: normal; font-family: verdana;font-family:verdana;" class="UIIntentionalStory_Message" ft="{&amp;quot;type&amp;quot;:&amp;quot;msg&amp;quot;}"&gt;&lt;span style="font-size:85%;"&gt;&lt;span class="UIStory_Message"&gt;A  must have tool is &lt;a href="http://www.smidgeonsoft.prohosting.com/pebrowse-pro-file-viewer.html"&gt; PEBrowse Pro&lt;/a&gt; by &lt;a href="http://www.smidgeonsoft.prohosting.com/index.html"&gt;SmidgeonSoft&lt;/a&gt; written by the great Russell Osterlund.  Use it to disassemble Win32/Win64 and .NET (assemblies) PE binaries  (EXE/DLL).&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;h3  style="color: rgb(0, 0, 0); font-weight: normal; font-family: verdana;font-family:verdana;" class="UIIntentionalStory_Message" ft="{&amp;quot;type&amp;quot;:&amp;quot;msg&amp;quot;}"&gt;&lt;span style="font-size:85%;"&gt;&lt;span class="UIStory_Message"&gt;I have been using this great tool as a lightweight disassembler for a decade. It is updated fairly often improving features. It's really nice tool to use to see a Win32 binary's imports and exports. Much nicer than using DUMPBIN, unless you prefer a command line app. They also have a debugger as well that works on Win32 apps and .NET apps.&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;br /&gt;&lt;a style="font-family: courier new;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.smidgeonsoft.com/images/PEBrowsePro945x689.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 945px; height: 689px;" src="http://www.smidgeonsoft.com/images/PEBrowsePro945x689.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-7927298342523566350?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/7927298342523566350/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2010/09/dissassemble-me.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/7927298342523566350'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/7927298342523566350'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2010/09/dissassemble-me.html' title='Dissassemble Me'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-264911515646268904</id><published>2010-03-01T00:33:00.012+08:00</published><updated>2010-03-01T18:05:00.289+08:00</updated><title type='text'>Process Session</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;NTSTATUS: STATUS_JAM_SESSION&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;I think there are a fair number of people who are not aware of the concept of &lt;span style="font-style: italic;"&gt;'sessions'&lt;/span&gt; in Windows, and some are aware of it, but only that there is such a thing. We're going to go through the basics of it, and see how it might be relevant.&lt;br /&gt;&lt;br /&gt;A session in Windows NT is basically a user login session. It is managed by the &lt;span style="font-weight: bold; font-style: italic;"&gt;Session Manager Subsystem&lt;/span&gt; process (&lt;span style="font-weight: bold;"&gt;SMSS.EXE&lt;/span&gt;). This includes &lt;span style="font-style: italic;"&gt;Terminal Services/Remote Desktop sessions&lt;/span&gt;. Windows NT servers allow multiple concurrent Terminal Services login sessions whereas the client versions Windows NT does not.&lt;br /&gt;&lt;br /&gt;If I recall correctly, in the initial version of Windows XP, you could be logged in to Windows, and have a Remote Desktop session active with another user being logged in. So, you could actually have two simultaneous user sessions. Then it came to pass, in, I think it was SP2 that Terminal Services was changed such that you could not run a Remote Desktop session without having the current user logged off. I think the story was that the change was made because the way Terminal Services was working was in violation of the EULA which allowed &lt;/span&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;only &lt;/span&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;one user of that copy of Windows XP at any one time.&lt;br /&gt;&lt;br /&gt;Now, moving along, sessions weren't terribly relevant prior to Windows Vista with the exception of the case of Windows XP prior to the Service Pack with changed Terminal Services. This is because prior to Vista, you could not actually have more than one user logged in to Windows at the same time. You'd remember this because if you wanted to login as another user, you had to logout of your current session. So in that sense, it wasn't actually relevant for your apps to be concerned about which session it was running in.&lt;br /&gt;&lt;br /&gt;However, since Vista, you could login multiple users in your machine which I really appreciated because you didn't have to lose your session. I hated having to have my session restarted and to get things back to the way they were, and it took an amount of time I wasn't interested in waiting on.&lt;br /&gt;&lt;br /&gt;So now, in Vista and Windows 7, the session in which your process runs becomes relevant. There are &lt;span style="font-family:verdana;"&gt;two basic scenarios here:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;ol  style="font-family:verdana;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;There should only be one instance of your app running in Windows&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;There should be only one instance of your app &lt;/span&gt;&lt;span style="font-size:85%;"&gt;running &lt;/span&gt;&lt;span style="font-size:85%;"&gt;in each user session&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;&lt;span style="font-family:verdana;"&gt;In &lt;/span&gt;the first case, it is pretty straightforward. You would enumerate all processes and see if there is already in instance running.&lt;br /&gt;&lt;br /&gt;In the second scenario, it is commonly the case where an instance of your app is required to deal with one (instance of a) user specifically. Therefore, if there was another user logged in, you needed another instance of your app to run in that user's context as well. In most cases, this would be a UI app. Also, it is an app where you only want only a single instance running (per user session). So in the old days before multiple concurrent user sessions, you would just check to see if the app is already running, and not start up a second process. If that was done now, you will end up with only one instance of the app running regardless of the number of user sessions.&lt;br /&gt;&lt;br /&gt;So now we get to the gist of it, which is: ensuring only one instance of your app runs per user session.&lt;br /&gt;&lt;br /&gt;To do this, we need to enumerate all instances of the app in question, and check the session in which it belongs to. As an aside, you can use &lt;span style="font-style: italic;"&gt;Process Explorer&lt;/span&gt; from &lt;span style="font-style: italic;"&gt;Sysinternals&lt;/span&gt; to look at the process tree to see all the session running, and their associated processes. And obviously, you are not able to access the processes that do not belong to your current session.&lt;br /&gt;&lt;br /&gt;The Session ID of a process can be obtained from the &lt;span style="font-weight: bold;"&gt;Process Environment Block (PEB)&lt;/span&gt; Win32 structure. This one of those magic data structures that are largely undocumented, and in most instances, for good reason. Following is the struct from the Windows SDK version 7.0:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;typedef struct _PEB {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    BYTE Reserved1[2];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    BYTE BeingDebugged;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    BYTE Reserved2[1];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    PVOID Reserved3[2];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    PPEB_LDR_DATA Ldr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    PRTL_USER_PROCESS_PARAMETERS ProcessParameters;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    BYTE Reserved4[104];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    PVOID Reserved5[52];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    PPS_POST_PROCESS_INIT_ROUTINE PostProcessInitRoutine;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    BYTE Reserved6[128];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    PVOID Reserved7[1];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    &lt;span style="font-weight: bold;"&gt;ULONG SessionId;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;} PEB, *PPEB;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You can see the &lt;span style="font-weight: bold; font-style: italic;"&gt;SessionId&lt;/span&gt; field in the struct, which is what we're interested in. Another field of potential interest is the &lt;span style="font-style: italic;"&gt;Ldr&lt;/span&gt; field which contains a doubly-linked list of the modules loaded by the process.&lt;br /&gt;&lt;br /&gt;The information of this struct is obtained via the Win32 API function:&lt;br /&gt;&lt;/span&gt;&lt;span id="ctl00_MTCS_main_ctl01"&gt;&lt;pre class="libCScode" id="ctl00_MTCS_main_ctl01_code" space="preserve"&gt;&lt;code&gt;NTSTATUS WINAPI NtQueryInformationProcess(&lt;br /&gt;__in       HANDLE ProcessHandle,&lt;br /&gt;__in       PROCESSINFOCLASS ProcessInformationClass,&lt;br /&gt;__out      PVOID ProcessInformation,&lt;br /&gt;__in       ULONG ProcessInformationLength,&lt;br /&gt;__out_opt  PULONG ReturnLength&lt;br /&gt;);&lt;/code&gt;&lt;br /&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;&lt;br /&gt;Pass in &lt;/span&gt;ProcessBasicInformation&lt;span style=";font-family:verdana;font-size:85%;"  &gt; in the &lt;/span&gt;&lt;span id="ctl00_MTCS_main_ctl01"&gt;&lt;pre class="libCScode" id="ctl00_MTCS_main_ctl01_code" space="preserve"&gt;&lt;code&gt;ProcessInformationClass&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt; parameter, and the function will return a pointer to a PEB structure.&lt;br /&gt;&lt;br /&gt;So there you have it, the session in which the process is running.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-264911515646268904?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/264911515646268904/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2010/03/process-session.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/264911515646268904'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/264911515646268904'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2010/03/process-session.html' title='Process Session'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-4433155652199342606</id><published>2009-12-24T14:17:00.003+08:00</published><updated>2009-12-24T14:20:06.853+08:00</updated><title type='text'>Happy Holidays!</title><content type='html'>&lt;span style="font-weight: bold;font-size:130%;" &gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;NTSTATUS: STATUS_W00T&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;font-family:verdana;" &gt;Here's wishing everyone a Merry Christmas, and a Happy New Year! :)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-4433155652199342606?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/4433155652199342606/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2009/12/happy-holidays.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/4433155652199342606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/4433155652199342606'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2009/12/happy-holidays.html' title='Happy Holidays!'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-4986825324549509490</id><published>2009-12-06T12:40:00.004+08:00</published><updated>2009-12-06T12:43:26.203+08:00</updated><title type='text'>"You cannot be serious!"</title><content type='html'>&lt;span style="font-size:85%;"&gt;  &lt;span style="font-family: courier new; font-weight: bold;font-family:verdana;font-size:130%;"  &gt;&lt;br /&gt;&lt;span&gt;NTSTATUS: STATUS_IS_NOT_WIN32&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Following up from my previous post...&lt;br /&gt;&lt;br /&gt;I found a novel way to crash &lt;span style="font-weight: bold;"&gt;WPF&lt;/span&gt; (&lt;span style="font-weight: bold;"&gt;.net 3.5 SP1&lt;/span&gt;). Here's how to do it:&lt;br /&gt;&lt;br /&gt;Create a WPF DLL:&lt;br /&gt;1. Create WPF User Control Library&lt;br /&gt;2. Create a User Control, say, MyUserControl&lt;br /&gt;3. Create another User Control, say, MySubUserControl&lt;br /&gt;4. Add MySubUserControl (as a project control) into MyUserControl (in the XAML)&lt;br /&gt;&lt;br /&gt;So now you have a user control that has a user control in it. Next:&lt;br /&gt;&lt;br /&gt;Create an Application (I created a .net WinForm app):&lt;br /&gt;1. Create a WinForm Application&lt;br /&gt;2. Load the DLL created, via Assembly.Load(byte[] rawAssembly)&lt;br /&gt;2.a. Create an instance of the type MyUserControl&lt;br /&gt;2.b. Add the instance of MyUserControl in a container (I just put it into an ElementHost)&lt;br /&gt;3. Repeat setps 2, 2.a. and 2.b.&lt;br /&gt;&lt;br /&gt;Basically, in the WinForm app, you just need to run your code that does steps 2, 2.a. and 2.b. twice. I just execute that piece of code via a button's event, so I can run it by pressing the button twice.&lt;br /&gt;&lt;br /&gt;On the second execution of the code, it crashes. The exception I got is:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;"Cannot create instance of '&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;font-family:verdana;font-size:85%;"  &gt;MySubUserControl&lt;/span&gt;&lt;span style="font-style: italic;font-family:verdana;font-size:85%;"  &gt;' defined in assembly 'WpfControlLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation. Error at object 'System.Windows.Controls.Canvas' in markup file 'WpfControlLibrary1;component/&lt;/span&gt;&lt;span style="font-style: italic;font-family:verdana;font-size:85%;"  &gt;MyUserControl&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-style: italic;font-family:verdana;" &gt;.xaml' Line 9 Position 6."&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;So, long story short, it seems that you can't multi-load, and re-instantiate a WPF user control, that has a user control inside it! You can imagine the shock my colleague was in for when I broke the news.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;I was doing this basically to implement plug-ins. Tough luck, apparently... Who would expect this to happen? Certainly not me. This can't be right. It had me doing a Johnny Mac.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-4986825324549509490?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/4986825324549509490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2009/12/you-cannot-be-serious.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/4986825324549509490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/4986825324549509490'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2009/12/you-cannot-be-serious.html' title='&quot;You cannot be serious!&quot;'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-5537810372445855584</id><published>2009-10-24T02:06:00.027+08:00</published><updated>2009-11-10T01:41:51.398+08:00</updated><title type='text'>"I thought you were still there..."</title><content type='html'>&lt;span style="font-weight: bold;font-size:130%;" &gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;NTSTATUS: STATUS_IS_NOT_WIN32&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;This has to do with the &lt;span style="font-weight: bold;"&gt;.net CLR&lt;/span&gt; loading assemblies dynamically. Sure, it's not a Win32 thing, but it is related when I went about trying to achieve what I normally would in native Win32 apps.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;The story begins quite simply, in implementing basic plug-in type architectures. When one did it in regular (native) Win32 apps with C/C++, you'd just use &lt;span style="font-style: italic;"&gt;LoadLibrary()&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;FreeLibrary()&lt;/span&gt; to load and unload the relevant DLL's that would function as plug-ins.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Trying to achieve the same in .net, the methods from the &lt;span style="font-weight: bold;"&gt;Assembly&lt;/span&gt; class &lt;span style="font-style: italic;"&gt;LoadFrom()&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;LoadFile()&lt;/span&gt; can be used to load an assembly at runtime. However, what's obviously missing is any method to unload those assemblies. After a little searching, we come across &lt;a href="http://blogs.msdn.com/jasonz/archive/2004/05/31/145105.aspx"&gt;this&lt;/a&gt;. Apparently, there are plenty of reasons not to. So, this clearly begs the question, why it can be done in native Win32, and not in the .net CLR. From what I can tell, it's basically a case of trying to stop people from shooting themselves in the foot. In my case, I know exactly what I'm doing, and it's exactly what I intend to do. But too bad, everyone gets the same treatment.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;It seems the closest is to read the entire assembly binary into memory, and use Assembly.Load(). Effectively, this gets the job done. So, problem solved. However, it wasn't so for me. The problem laid in &lt;span style="font-weight: bold;"&gt;WPF&lt;/span&gt;. This 'bug' is related to user controls and assembly loading, and I will write about that in a subsequent post.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;So anyway, I wanted to see what would happen if I manually unloaded a .net assembly. I did the obvious thing having the assembly's path:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;IntPtr hModule = Win32.GetModuleHandleW(assemblyPath);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;if (hModule != null)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;if (Win32.FreeLibrary(hModule))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Debug.WriteLine("DLL released...");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;// failed&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Debug.WriteLine("Failed to release DLL...");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Win32 in the above code is a class in which I declared the Win32 API functions. In any case, the assembly is unloaded from the process, piece of cake. So, the question now is, does anybody know about it? Obviously, the answer is NO. I suppose it is not reasonable for the .net CLR to check if the assembly is still there anytime it wanted anything from it. Heck, I wouldn't do that either since I did not let anybody else but myself do it.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Calling the code to load the assembly again does not result in the assembly being loaded again. Simply a matter of replacing the assembly with one with different content/code, and loading it again. As far as the CLR is concerned, it's already loaded. Fair enough. So the next time you called anything in the assembly, BOOM! It crashes as expected.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Oh, do note that there would still be a handle to the assembly (the DLL) in the process. It is no easy task to find the handle and close it, so I wasn't bothered as it wouldn't make any difference.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Freeing the .net DLL manually was really just a case of 'let's see what happens'. Not recommended for .net assemblies, but it's just regular for native Windows Win32 DLL's if you're working with them.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-5537810372445855584?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/5537810372445855584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2009/10/i-thought-you-were-still-there.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/5537810372445855584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/5537810372445855584'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2009/10/i-thought-you-were-still-there.html' title='&quot;I thought you were still there...&quot;'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-293708715326467815</id><published>2009-10-08T21:50:00.007+08:00</published><updated>2009-10-09T00:36:25.149+08:00</updated><title type='text'>"Who's your daddy, and what does he do?"</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;NTSTATUS: STATUS_NO_SUCH_PROCESS&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;Recently, I had stumbled upon some bizarre behaviour relating to Windows processes. Here's how it went...&lt;br /&gt;&lt;br /&gt;I noticed that a process (of an app I wrote) had been running for a couple of minutes and still had not completed. It usually takes only a matter of seconds to complete (this is in &lt;span style="font-weight: bold;"&gt;Windows Vista&lt;/span&gt;). So I killed it (with &lt;span style="font-weight: bold;"&gt;Sysinternal's Process Explorer&lt;/span&gt;), and ran it again. Same behaviour...&lt;br /&gt;&lt;br /&gt;Before going further, the basic operation of this app is to run some checks on processes in certain branches of the system process tree. For example, to only perform a task on processes that are not services.&lt;br /&gt;&lt;br /&gt;To dig into the problem, I proceeded to rebuild the app with debug output, and see what it says with Sysinternal's &lt;span style="font-weight: bold;"&gt;DebugView&lt;/span&gt;. According to the output, it appears that the process doesn't get past going through the processes in the system.&lt;br /&gt;&lt;br /&gt;Next thing I did was to run the app in the debugger and see what happens. Well, it just keeps going, and going. Trying my luck, I hit the &lt;span style="font-style: italic;"&gt;'pause'&lt;/span&gt; button to break the process. Happily, it actually stopped in my code. It stopped in a piece of code that traverses up the process tree from any particular process. This is pretty straightforward:&lt;br /&gt;&lt;br /&gt;I had already built a map of all the processes in the system. I got the processes via &lt;span style="font-weight: bold;"&gt;ToolHelp32&lt;/span&gt;. So the basic idea is (simplified):&lt;br /&gt;&lt;br /&gt;For a process:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;ol  style="font-family:verdana;"&gt;&lt;li  style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;Stop if this is an ancestor I am looking for&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li  style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;Get the parent process of currently examined process&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li  style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;If there are no more processes, stop&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;Loop back to 1.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;So basically, it just goes up a process's ancestry, to see if it can find a specific process. The problem that was occurring, was that it somehow ended up being an infinite loop! And how can that happen?!?&lt;br /&gt;&lt;br /&gt;Well, here's how it happened... Two processes have each other as parents! In the instance of the problem I was having, this was how it went:&lt;br /&gt;&lt;br /&gt;devenv.exe[PID:&lt;span style="color: rgb(255, 102, 0); font-weight: bold;"&gt;3824&lt;/span&gt;] has parent [PID:&lt;span style="color: rgb(0, 0, 102); font-weight: bold;"&gt;3364&lt;/span&gt;]&lt;br /&gt;explorer.exe[PID:&lt;span style="color: rgb(0, 0, 102); font-weight: bold;"&gt;3364&lt;/span&gt;] has parent [PID:&lt;span style="color: rgb(255, 153, 0); font-weight: bold;"&gt;3824&lt;/span&gt;]&lt;br /&gt;&lt;br /&gt;"This can't be right?!?", I thought. Taking a look at explorer.exe in &lt;span style="font-style: italic;"&gt;Process Explorer&lt;/span&gt;, it did show that &lt;span style="font-style: italic;"&gt;devenv.exe&lt;/span&gt; was its parent, which I know is wrong because I did not use &lt;span style="font-style: italic;"&gt;devenv.exe&lt;/span&gt; to start the shell. It was the other way round, as is normally. However, &lt;span style="font-style: italic;"&gt;Process Explorer&lt;/span&gt;, or rather, &lt;span style="font-style: italic;"&gt;Mark Russinovich&lt;/span&gt; (We're not worthy!!!) knows it's wrong, and indicates that the parent process is a &lt;span style="font-weight: bold; font-style: italic;"&gt;'Non-existent Process'&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;So, I reworked the code to account for such a situation, and it works nominally again. In retrospect, I think it's fair that I did not write the code to expect such a situation, or to even think of it.&lt;br /&gt;&lt;br /&gt;It was late and I was tired, so I turned in right after that. Later, I realized I should have taken some screenshots as I still have no idea how that whole fiasco happened...&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-293708715326467815?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/293708715326467815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2009/10/whos-your-daddy-and-what-does-he-do.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/293708715326467815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/293708715326467815'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2009/10/whos-your-daddy-and-what-does-he-do.html' title='&quot;Who&apos;s your daddy, and what does he do?&quot;'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-3852239836860515737</id><published>2009-08-03T19:42:00.012+08:00</published><updated>2009-08-03T20:16:36.121+08:00</updated><title type='text'>Process Creation API Functions Path (XP)</title><content type='html'>&lt;span style="font-weight: bold; color: rgb(0, 0, 0);font-size:130%;" &gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;NTSTATUS: STATUS_CREATE_PROCESS_NT51&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt; &lt;span style="font-family:verdana;"&gt;Following up on the previous post on the Win32 API's process creation functions in Windows Vista SP1, now let's take a look at how it was in Windows XP SP2.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;Following are the process creation functions available in the Win32 API:&lt;br /&gt;&lt;br /&gt;kernel32.dll:&lt;/span&gt;&lt;/span&gt;&lt;ul  style="font-weight: bold; color: rgb(0, 0, 0); font-family: courier new;font-family:courier new;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;CreateProcessA()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;CreateProcessW()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;CreateProcessInternalA()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;CreateProcessInternalW()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;CreateProcessInternalWSecure()&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;advapi32.dll:&lt;/span&gt;&lt;/span&gt;&lt;ul  style="font-weight: bold; color: rgb(0, 0, 0); font-family: arial;font-family:courier new;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;CreateProcessAsUserA()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;CreateProcessAsUserW()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;CreateProcessWithLogonW()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;CreateProcessAsUserSecure&lt;/span&gt;&lt;span style="font-size:85%;"&gt;()&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:verdana;font-size:85%;"  &gt;Of note are &lt;span style="font-family:courier new;"&gt;CreateProcessInternalWSecure()&lt;/span&gt; and &lt;span style="font-family:courier new;"&gt;CreateProcessAsUserSecure()&lt;/span&gt;. These two functions do absolutely nothing. They just return zero. It's also worth noting that these two functions do not appear in Windows Vista. I suppose as a joke, it means that there is no secure way to create processes in Windows XP! GYAHAHA!!!&lt;br /&gt;&lt;br /&gt;Below is a diagram that shows how these functions are related to each other, with the exception of &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:courier new;"&gt;CreateProcessWithLogonW&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;()&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;a style="color: rgb(0, 0, 0);" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_IXsF0f8rteY/SnbQmecgu9I/AAAAAAAAACY/Q24cdofQOKc/s1600-h/CreateProcess-Flow-NT51.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 133px;" src="http://2.bp.blogspot.com/_IXsF0f8rteY/SnbQmecgu9I/AAAAAAAAACY/Q24cdofQOKc/s400/CreateProcess-Flow-NT51.JPG" alt="" id="BLOGGER_PHOTO_ID_5365705365484780498" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center; color: rgb(0, 0, 0);"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold;font-family:verdana;" &gt;Win32 API  Process Creation Functions&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;The general workings of these functions are the same as they were described in the previous post for Windows Vista.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-3852239836860515737?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/3852239836860515737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2009/08/ntstatus-statuscreateprocessnt51.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/3852239836860515737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/3852239836860515737'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2009/08/ntstatus-statuscreateprocessnt51.html' title='Process Creation API Functions Path (XP)'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_IXsF0f8rteY/SnbQmecgu9I/AAAAAAAAACY/Q24cdofQOKc/s72-c/CreateProcess-Flow-NT51.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-2528943351118615975</id><published>2009-07-03T20:04:00.018+08:00</published><updated>2009-07-04T02:58:21.307+08:00</updated><title type='text'>Process Creation API Functions Path (Vista)</title><content type='html'>&lt;span style="font-weight: bold;font-size:130%;" &gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;NTSTATUS: STATUS_CREATE_PROCESS_NT60&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt; &lt;span style="font-family:verdana;"&gt;It's been a while since the last posting, so let's move right on to the current one...&lt;br /&gt;&lt;br /&gt;We'll have a little look at the &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;Win32 API &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;process creation functions, and what other exported (Win32) functions they use under the hood. First, we'll take a look at how it goes for &lt;span style="font-weight: bold;"&gt;Windows Vista (SP1)&lt;/span&gt;, and we'll look at Windows XP in a subsequent posting.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;Following are the process creation functions available in the Win32 API:&lt;br /&gt;&lt;br /&gt;kernel32.dll:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;ul  style="font-weight: bold; font-family: courier new;font-family:courier new;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;CreateProcessA()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;CreateProcessW()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;CreateProcessInternalA()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;CreateProcessInternalW()&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;advapi32.dll:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;ul  style="font-weight: bold; font-family: courier new;font-family:courier new;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;CreateProcessAsUserA()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;CreateProcessAsUserW()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;CreateProcessWithLogonW()&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;CreateProcessWithTokenW()&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;The two 'internal' versions of &lt;span style="font-style: italic;"&gt;CreateProcess&lt;/span&gt; are not documented. Also, for those who are not familiar with the Win32 API conventions, the suffix of either 'A' or 'W' as in the above functions denote whether they are the &lt;span style="font-style: italic;"&gt;ANSI&lt;/span&gt; or &lt;span style="font-style: italic;"&gt;Unicode&lt;/span&gt; versions of the functions.&lt;br /&gt;&lt;br /&gt;Below is a diagram that shows how these functions are related to each other, with the exception of &lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;CreateProcessWithLogonW&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;()&lt;/span&gt; &lt;/span&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;and &lt;/span&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;CreateProcessWithTokenW().&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt; Those two are more complicated, and we'll leave them out for now (translated as, I haven't looked into it enough at this time):&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_IXsF0f8rteY/Sk5Q4Y7omqI/AAAAAAAAACA/K2uNSE-iGyU/s1600-h/CreateProcess-Flow.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 127px;" src="http://2.bp.blogspot.com/_IXsF0f8rteY/Sk5Q4Y7omqI/AAAAAAAAACA/K2uNSE-iGyU/s400/CreateProcess-Flow.jpg" alt="" id="BLOGGER_PHOTO_ID_5354305936685570722" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold;font-family:verdana;" &gt;Win32 API  Process Creation Functions&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;So, from the diagram above, &lt;/span&gt; &lt;/span&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;we can see that the five above functions ultimately call &lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;CreateProcessInternalW()&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;.&lt;br /&gt;&lt;br /&gt;It is interesting to note the following of the above mentioned five functions:&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;CreateProcessA/W() sets up parameters and calls CreateProcessInternalA/W() respectively, nothing more.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;CreateProcessAsUserA/W() &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;sets up parameters and calls CreateProcessInternalA/W() (respectively). then sets process, thread and security information of the user [the high-level overview].&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;CreateProcessInternalA() sets up parameters, converts ANSI strings to Unicode strings, then calls &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;CreateProcessInternalW().&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;&lt;br /&gt;As of all undocumented functions, whether in the Win32 API or not, the general idea is that they are undocumented because they could change between versions of the operating system. Of course, there is also the old, old conspiracy theory that they are being kept secret for advantage. Maybe a little bit of both. Fair game, if you ask me. However, I will confirm that I have seen changes in undocumented functions even between different Windows service packs. And this is includes function prototypes and behaviour.&lt;br /&gt;&lt;br /&gt;I suppose the moral is, that if you depend on undocumented functions or behaviours, you will basically have more work to do in making sure that your applications don't blow up in different versions of the system binaries.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-2528943351118615975?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/2528943351118615975/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2009/07/process-creation-api-functions-path.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/2528943351118615975'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/2528943351118615975'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2009/07/process-creation-api-functions-path.html' title='Process Creation API Functions Path (Vista)'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_IXsF0f8rteY/Sk5Q4Y7omqI/AAAAAAAAACA/K2uNSE-iGyU/s72-c/CreateProcess-Flow.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-3756236315460373674</id><published>2009-06-03T20:53:00.016+08:00</published><updated>2009-06-03T22:14:34.641+08:00</updated><title type='text'>"Did you forget to check something?"</title><content type='html'>&lt;span style="font-weight: bold; color: rgb(0, 0, 0);font-family:courier new;font-size:130%;"  &gt;&lt;br /&gt;NTSTATUS: STATUS_KABOOM&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt; &lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;Some &lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic; font-family: verdana;"&gt;.net&lt;/span&gt;&lt;span style="font-family: verdana;"&gt; applications have been behaving strangely... Actually, practically all of them have been behaving strangely, but consistently. They crash after &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0); font-family: verdana;font-size:85%;" &gt;approximately &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0); font-family: verdana;font-size:85%;" &gt;5 seconds upon starting up. Obviously, it must be something I did.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0); font-family: verdana;font-size:85%;" &gt;The reported error:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;Description:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;   Stopped working&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;Problem signature:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;  Problem Event Name:    APPCRASH&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;  Application Name:    MyApp.exe&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;  Application Version:    1.0.0.0&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;  Application Timestamp:    49f5e887&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;   Fault Module Name:    mscorwks.dll&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;   Fault Module Version:    2.0.50727.1434&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;  Fault Module Timestamp:    4757b767&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;  Exception Code:    c0000005&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;  Exception Offset:    001496a2&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;  OS Version:    6.0.6001.2.1.0.256.4&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;  Locale ID:    1033&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0); font-family: verdana;font-family:verdana;font-size:85%;"  &gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0); font-family: verdana;font-family:arial,helvetica,sans-serif;font-size:85%;"  &gt;Upon debugging, the crash consistently fails at the below piece of code in &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0); font-weight: bold; font-style: italic; font-family: verdana;font-family:verdana;font-size:85%;"  &gt;&lt;span class="il"&gt;mscorwks&lt;/span&gt;.dll&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0); font-family: verdana;font-family:arial,helvetica,sans-serif;font-size:85%;"  &gt; (highlighted in the red box):&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0); font-family: verdana;font-size:85%;" &gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;a style="color: rgb(0, 0, 0); font-family: verdana;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_IXsF0f8rteY/SiZ3-AyPHCI/AAAAAAAAABY/-8A6XBzFc0k/s1600-h/MB-crash-code-edit.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 198px;" src="http://4.bp.blogspot.com/_IXsF0f8rteY/SiZ3-AyPHCI/AAAAAAAAABY/-8A6XBzFc0k/s320/MB-crash-code-edit.jpg" alt="" id="BLOGGER_PHOTO_ID_5343089915167972386" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0); font-family: verdana;font-family:arial,helvetica,sans-serif;font-size:85%;"  &gt;... where the value of the register esi is zero(0)&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0); font-family: verdana;font-family:verdana;font-size:85%;"  &gt;:&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;a style="color: rgb(0, 0, 0); font-family: verdana;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_IXsF0f8rteY/SiZ4vxuQsoI/AAAAAAAAABg/YUaLRD9FHhI/s1600-h/MB-crash-autos.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 92px;" src="http://4.bp.blogspot.com/_IXsF0f8rteY/SiZ4vxuQsoI/AAAAAAAAABg/YUaLRD9FHhI/s320/MB-crash-autos.jpg" alt="" id="BLOGGER_PHOTO_ID_5343090770118226562" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0); font-family: verdana;font-size:85%;" &gt;&lt;br /&gt;&lt;br /&gt;The Call Stack:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;a style="color: rgb(0, 0, 0); font-family: verdana;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_IXsF0f8rteY/SiZ4vyTNFCI/AAAAAAAAABo/jaTP9DRvEqk/s1600-h/MB-crash-callstack.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 135px;" src="http://1.bp.blogspot.com/_IXsF0f8rteY/SiZ4vyTNFCI/AAAAAAAAABo/jaTP9DRvEqk/s320/MB-crash-callstack.jpg" alt="" id="BLOGGER_PHOTO_ID_5343090770273178658" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0); font-family: verdana;font-size:85%;" &gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The modules list indicating the base address of mscorwks.dll:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;a style="color: rgb(0, 0, 0); font-family: verdana;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_IXsF0f8rteY/SiZ4wJtFhNI/AAAAAAAAABw/x-5HUZCGWAQ/s1600-h/MB-crash-modules.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 44px;" src="http://2.bp.blogspot.com/_IXsF0f8rteY/SiZ4wJtFhNI/AAAAAAAAABw/x-5HUZCGWAQ/s320/MB-crash-modules.jpg" alt="" id="BLOGGER_PHOTO_ID_5343090776555750610" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;br /&gt;&lt;span style="font-family: verdana;font-family:verdana;" &gt;Upon inspection of the disassembly, it is immediately obvious that it is a poorly written bit of code related to the 2 instructions before the faulting instruction at address &lt;span style="font-style: italic;"&gt;7148FF92&lt;/span&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;The return from the (function) call at &lt;span style="font-style: italic;"&gt;7148FF8A&lt;/span&gt; is not checked for zero/NULL before being used as a pointer:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Call function:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:courier new,monospace;" &gt;&lt;br /&gt;7148FF8A  call        dword ptr ds:[71EB3244h] &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;Save the return value of the function call from the register &lt;span style="font-style: italic;"&gt;eax&lt;/span&gt; into the register &lt;span style="font-style: italic;"&gt;esi&lt;/span&gt;:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:courier new,monospace;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:courier new,monospace;" &gt;7148&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:courier new,monospace;" &gt;FF90  mov         esi,eax &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;Use the value in &lt;span style="font-style: italic;"&gt;esi&lt;/span&gt; as a dword pointer with offset 0Ch(0xC) and store the value at the address into &lt;span style="font-style: italic;"&gt;eax&lt;/span&gt;. It appears likely to be code to get a value from the address of a struct at offset 0Ch and save it into &lt;span style="font-style: italic;"&gt;eax&lt;/span&gt;:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:courier new,monospace;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:courier new,monospace;" &gt;7148&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:courier new,monospace;" &gt;FF92  mov         eax,dword ptr [esi+0Ch] &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;The value from the struct member is then saved into a local variable via &lt;span style="font-style: italic;"&gt;eax&lt;/span&gt;:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:courier new,monospace;" &gt;&lt;br /&gt;7148FF95  mov         dword ptr [ebp-14h],eax &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;Now, there is one more detail I have not mentioned until now, and that is, the .net application(s) are being injected with a DLL as soon as its process is created. This is the 'something' I must have done, and did. This is the scenario where it is experiencing this crash. If the .net processes are being injected with a DLL &lt;span style="font-style: italic;"&gt;after&lt;/span&gt; (not instantly) it has started up and running, then there isn't a problem.&lt;br /&gt;&lt;br /&gt;So, even if the .net process is being injected with a DLL immediately after its creation, why should there be a problem? All other Win32 processes do not have this problem. If someone is going to tell me that I shouldn't be doing something like this, yadda yadda yadda, then I'd tell them to talk to the hand.&lt;br /&gt;&lt;br /&gt;In any case, back to the crashing code, it is clearly a situation where the return value of the function being called can be a NULL (seems obvious to be a pointer) value, and it was never checked prior to being used. Although I don't know what the operational implications are to the returned pointer being NULL, I expect the .net framework to handle it properly and either return with an error gracefully, or raise a .net exception instead of crashing out.&lt;br /&gt;&lt;br /&gt;Oh, and some nice folks at Microsoft are kind enough to take a look into this. It's very much appreciated.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-3756236315460373674?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/3756236315460373674/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2009/06/did-you-forget-to-check-something.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/3756236315460373674'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/3756236315460373674'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2009/06/did-you-forget-to-check-something.html' title='&quot;Did you forget to check something?&quot;'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_IXsF0f8rteY/SiZ3-AyPHCI/AAAAAAAAABY/-8A6XBzFc0k/s72-c/MB-crash-code-edit.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-5052657547500735196</id><published>2009-05-19T19:12:00.005+08:00</published><updated>2009-05-21T23:02:02.336+08:00</updated><title type='text'>New Offering From Microsoft Research</title><content type='html'>&lt;span style="color: rgb(0, 0, 0); font-weight: bold;font-size:130%;" &gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;NTSTATUS: STATUS_CIBAI&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;I swear I did not make this up... Look here: &lt;/span&gt;&lt;a style="font-family: verdana;" href="http://research.microsoft.com/apps/pubs/default.aspx?id=78035"&gt;Cibai from Microsoft Research&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;Here's what they have to say in the abstract:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;p style="font-family: verdana;font-family:verdana;" &gt;&lt;span style="font-size:85%;"&gt;"We introduce &lt;span style="font-weight: bold; font-style: italic;"&gt;Cibai&lt;/span&gt; a generic static analyzer based on abstract interpretation for the modular analysis and verification of Java classes. We present the abstract semantics and the underlying abstract domain, a combination of an aliasing analysis and octagons. &lt;/span&gt;&lt;/p&gt;&lt;p style="font-family: verdana;font-family:verdana;" &gt;&lt;span style="font-size:85%;"&gt; We discuss some implementation issues, and we compare &lt;span style="font-weight: bold; font-style: italic;"&gt;Cibai&lt;/span&gt; with similar tools &lt;span style="font-style: italic; color: rgb(102, 102, 102);"&gt;(I dunno, like 'blue bird'? :P)&lt;/span&gt;, showing how &lt;span style="font-weight: bold; font-style: italic;"&gt;Cibai &lt;/span&gt;achieves a higher level of automation and precision while having comparable performances."&lt;/span&gt;&lt;/p&gt;&lt;p style="font-family: verdana;font-family:verdana;" &gt;&lt;span style="font-size:85%;"&gt;I'm not sure what to think about that last statement... a &lt;span style="font-style: italic;"&gt;"Cibai achieves a higher level of automation and precision while having comparable performances"&lt;/span&gt;... If that isn't speechlessly incredible in-your-dreams type of thing, I don't know what is...&lt;/span&gt;&lt;/p&gt;&lt;p style="font-family: verdana;font-family:verdana;" &gt;&lt;span style="font-size:85%;"&gt;I mean, heck, if Jabba The Hutt can say &lt;span style="font-style: italic;"&gt;"Kan Ni Naa"&lt;/span&gt;, it's all good ;)&lt;/span&gt;&lt;/p&gt;&lt;p  style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-5052657547500735196?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/5052657547500735196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2009/05/ntstatus-statuscibai-i-swear-i-did-not.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/5052657547500735196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/5052657547500735196'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2009/05/ntstatus-statuscibai-i-swear-i-did-not.html' title='New Offering From Microsoft Research'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-4594035411326389649</id><published>2009-05-11T18:12:00.011+08:00</published><updated>2009-05-15T00:14:10.969+08:00</updated><title type='text'>Determining User Local Groups</title><content type='html'>&lt;span style="font-weight: bold; color: rgb(0, 0, 0);font-size:130%;" &gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;NTSTATUS: STATUS_WHAT_IS_MY_POWER&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;There might be occasions where you are developing an application where it has to take actions which depend on the permissions and privileges of the user context under which it is running. To check if a process has a specific security privilege enabled, the &lt;span style="font-weight: bold;"&gt;LSA&lt;/span&gt; (Local Security Authority) API functions can be used.&lt;br /&gt;&lt;br /&gt;In this article, we will look at a simpler and more general scenario. We will make a decision based on what everybody should be well familiar with, and that is &lt;span style="font-weight: bold;"&gt;Local Groups&lt;/span&gt; (we'll call it LG for short). The most common ones are of course:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;ul  style="color: rgb(0, 0, 0);font-family:verdana;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Administrators&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Power Users&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Users&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;So, our simple scenario is that based on the our process's user's LG membership, we will take different courses of action(s).&lt;br /&gt;&lt;br /&gt;We will use the following &lt;span style="font-weight: bold;"&gt;Network Management Function&lt;/span&gt;:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;pre class="libCScode" style="white-space: pre-wrap; color: rgb(0, 0, 0);" id="ctl00_mainContentContainer_ctl01C++" space="preserve"&gt;NET_API_STATUS NetUserGetLocalGroups(&lt;br /&gt;__in   LPCWSTR &lt;em&gt;servername&lt;/em&gt;,&lt;br /&gt;__in   LPCWSTR &lt;em&gt;username&lt;/em&gt;,&lt;br /&gt;__in   DWORD &lt;em&gt;level&lt;/em&gt;,&lt;br /&gt;__in   DWORD &lt;em&gt;flags&lt;/em&gt;,&lt;br /&gt;__out  LPBYTE *&lt;em&gt;bufptr&lt;/em&gt;,&lt;br /&gt;__in   DWORD &lt;em&gt;prefmaxlen&lt;/em&gt;,&lt;br /&gt;__out  LPDWORD &lt;em&gt;entriesread&lt;/em&gt;,&lt;br /&gt;__out  LPDWORD &lt;em&gt;totalentries&lt;/em&gt;&lt;br /&gt;);&lt;br /&gt;&lt;/pre&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt; &lt;span style="font-family:verdana;"&gt;&lt;br /&gt;There is an example of how to use this function in MSDN: &lt;a href="http://msdn.microsoft.com/en-us/library/aa370655%28VS.85%29.aspx"&gt;NetuserGetLocalGroups Function&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;What's important here are the first two parameters. The &lt;span style="font-style: italic; font-weight: bold;"&gt;servername&lt;/span&gt; would be the local computer name, or &lt;span style="font-style: italic; font-weight: bold;"&gt;localhost&lt;/span&gt; can also be used in its place. The &lt;span style="font-style: italic; font-weight: bold;"&gt;username&lt;/span&gt; is of course the user whose LG membership we're interested in.&lt;br /&gt;&lt;br /&gt;The value for level should be &lt;span style="font-style: italic; font-weight: bold;"&gt;0&lt;/span&gt;, the only value defined for flags is &lt;span style="font-style: italic; font-weight: bold;"&gt;LG_INCLUDE_INDIRECT&lt;/span&gt;. The data will then be return in the buffer as type &lt;span style="font-style: italic; font-weight: bold;"&gt;LPLOCALGROUP_USERS_INFO_0&lt;/span&gt;:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;pre class="libCScode" style="white-space: pre-wrap; color: rgb(0, 0, 0);" id="ctl00_mainContentContainer_ctl01C++" space="preserve"&gt;typedef struct _LOCALGROUP_USERS_INFO_0 {&lt;br /&gt;LPWSTR lgrui0_name;&lt;br /&gt;} LOCALGROUP_USERS_INFO_0, *PLOCALGROUP_USERS_INFO_0, *LPLOCALGROUP_USERS_INFO_0;&lt;/pre&gt; &lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:verdana;font-size:85%;"  &gt;&lt;br /&gt;The LG info returned are therefore the names of the groups itself as Unicode strings. So, string comparisons have to be done to check for the groups (such as) "Administrators", "Power Users" and "Users".&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-4594035411326389649?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/4594035411326389649/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2009/05/determining-user-local-groups.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/4594035411326389649'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/4594035411326389649'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2009/05/determining-user-local-groups.html' title='Determining User Local Groups'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-5937433574033840275</id><published>2009-04-24T16:43:00.019+08:00</published><updated>2009-04-24T17:32:53.718+08:00</updated><title type='text'>That is not how you say my name...</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;&lt;span style="color: rgb(0, 0, 0);font-size:130%;" &gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;NTSTATUS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-size:130%;" &gt;: STATUS_LMAO&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:verdana;font-size:85%;"  &gt;If you're ever looking for some random, cryptic or &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;WTF&lt;/span&gt; type of name to use as an identifier in your code, I've got one for you... And it is: &lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;Xobile&lt;/span&gt;&lt;/span&gt;.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:verdana;font-size:85%;"  &gt;However, there are some rather special uses for &lt;span style="font-style: italic;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;Xobile&lt;/span&gt;&lt;/span&gt;. It works best in C/C++, and can also be used in C#. Here are the characteristics:&lt;/span&gt;&lt;ul  style="color: rgb(0, 0, 0);font-family:verdana;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;It should be of a type where it can be tested for 0 (zero)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;The type can be of a pointer type&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;The type can be of a numerical type&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;The special case is that it must be tested for 0 (zero)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;The whole crux of this is to use the '&lt;span style="font-weight: bold;"&gt;!&lt;/span&gt;' operator on it&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="color: rgb(0, 0, 0);font-family:verdana;font-size:85%;"  &gt;&lt;br /&gt;What we are specifically targeting for, is to write: &lt;span style="font-weight: bold; font-style: italic;"&gt;!&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;Xobile&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Examples of declarations as variables:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;a style="color: rgb(0, 0, 0); font-family: verdana;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_IXsF0f8rteY/SfGAY8UlznI/AAAAAAAAAAc/MOT3ng1BNUI/s1600-h/xobile-vars.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 169px; height: 77px;" src="http://4.bp.blogspot.com/_IXsF0f8rteY/SfGAY8UlznI/AAAAAAAAAAc/MOT3ng1BNUI/s320/xobile-vars.jpg" alt="" id="BLOGGER_PHOTO_ID_5328181000153714290" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:verdana;font-size:85%;"  &gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:verdana;font-size:85%;"  &gt;Examples of declarations as a function:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;a style="color: rgb(0, 0, 0); font-family: verdana;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_IXsF0f8rteY/SfGAkyvC9lI/AAAAAAAAAAk/iF8C9UNEfOE/s1600-h/xobile-funcs.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 169px; height: 86px;" src="http://1.bp.blogspot.com/_IXsF0f8rteY/SfGAkyvC9lI/AAAAAAAAAAk/iF8C9UNEfOE/s320/xobile-funcs.jpg" alt="" id="BLOGGER_PHOTO_ID_5328181203738752594" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:verdana;font-size:85%;"  &gt;Examples of usage:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;a style="color: rgb(0, 0, 0); font-family: verdana;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_IXsF0f8rteY/SfGAsARt3LI/AAAAAAAAAAs/vaEZENkhVj0/s1600-h/xobile-usage.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 169px; height: 190px;" src="http://1.bp.blogspot.com/_IXsF0f8rteY/SfGAsARt3LI/AAAAAAAAAAs/vaEZENkhVj0/s320/xobile-usage.jpg" alt="" id="BLOGGER_PHOTO_ID_5328181327632915634" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:verdana;font-size:85%;"  &gt;Just FYI, '&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;Xobile&lt;/span&gt;' is not pronounced "so-buy-l&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(0, 0, 0);font-family:verdana;" &gt;"&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:verdana;font-size:85%;"  &gt;, or "so-&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;beel&lt;/span&gt;", or "so-bee-&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;leh&lt;/span&gt;". But more importantly, how do you say "!&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;Xobile&lt;/span&gt;"?&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-family:verdana;"&gt;With no further delay, please allow me to introduce Russell Peters to give us the low-down on '!&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;Xobile&lt;/span&gt;'... *Applause*&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/R9ZxJW-UTL8&amp;amp;hl=en&amp;amp;fs=1"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/R9ZxJW-UTL8&amp;amp;hl=en&amp;amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-5937433574033840275?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/5937433574033840275/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2009/04/that-is-not-how-you-say-my-name.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/5937433574033840275'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/5937433574033840275'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2009/04/that-is-not-how-you-say-my-name.html' title='That is not how you say my name...'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_IXsF0f8rteY/SfGAY8UlznI/AAAAAAAAAAc/MOT3ng1BNUI/s72-c/xobile-vars.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-9094287510453983880</id><published>2009-04-21T23:47:00.013+08:00</published><updated>2009-04-22T16:10:04.779+08:00</updated><title type='text'>Handling And Re-Handling</title><content type='html'>&lt;span style="font-weight: bold; color: rgb(0, 0, 0);font-family:courier new;font-size:130%;"  &gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;&lt;br /&gt;NTSTATUS&lt;/span&gt;: STATUS_IT_&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;WASNT&lt;/span&gt;_REALLY_OBVIOUS&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;In the Windows system, an object that represents a system resource such as a process, thread, file or synchronization object are accessed via a &lt;span style="font-style: italic;"&gt;handle&lt;/span&gt;. The application will have to obtain a handle to such objects which can then be used to manipulate or examine these objects.&lt;br /&gt;&lt;br /&gt;Here are some common handle types in Win32:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;Kernel Objects&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;ul style="color: rgb(0, 0, 0);"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;Process: &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;HANDLE&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;Thread&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;: &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;HANDLE&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;File&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;: &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;HANDLE&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li  style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;Synchronization Objects (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;mutex&lt;/span&gt;, semaphore)&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;: &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;HANDLE&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="color: rgb(0, 0, 0);font-family:verdana;font-size:85%;"  &gt;&lt;br /&gt;User Objects:&lt;br /&gt;&lt;/span&gt;&lt;ul style="color: rgb(0, 0, 0);font-family:verdana;" &gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Window: &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;HWND&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Menu: &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;HMENU&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Icon: &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;HICON&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="color: rgb(0, 0, 0);font-family:verdana;font-size:85%;"  &gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;GDI&lt;/span&gt; Objects:&lt;br /&gt;&lt;/span&gt; &lt;ul style="color: rgb(0, 0, 0);font-family:verdana;" &gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Device Context: &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;HDC&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Bitmap: &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;HBITMAP&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Brush: &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;HBRUSH&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt; &lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;What we're going to focus on here are kernel objects, and a particular scenario where a not-so-obvious Win32 &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;API&lt;/span&gt; function earns it's dollars.&lt;br /&gt;&lt;br /&gt;Here's the scenario. You have obtained a handle to a kernel object, and for this example, it is a process handle (HANDLE). You did not create the process to which this handle is for, nor did you open the process to which this handle is for. You just got hold of it. Now, you want to get some information on this process, so let's start by trying to get the process's module file name with &lt;span style="font-weight: bold;" class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;GetProcessImageFileName&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;()&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Boom! The function returns a failure. And the error reason is that you basically do not have the access permissions to do so. The handle must have one of the following permissions:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;ul style="font-family: verdana; font-weight: bold; color: rgb(0, 0, 0);"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;PROCESS_QUERY_INFORMATION&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;PROCESS_QUERY_LIMITED_INFORMATION&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;So clearly, it doesn't. And since you did not create or open that process, you also don't know which Process ID it was either that the handle came from. &lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;!@#$%. Guess we'll just have to try to get that information from the handle then. Oh, wait, we probably can't either &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;coz&lt;/span&gt; we don't have the necessary permissions. How now brown cow?&lt;br /&gt;&lt;br /&gt;Well, as it turns out, there is a particular Win32 &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;API&lt;/span&gt; function I've known for ages, but had never examined it (clearly, I've not used it until not too long ago) as it seemed silly back then. The function: &lt;span style="font-weight: bold;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;DuplicateHandle&lt;/span&gt;()&lt;/span&gt;. I guess I never paid attention to it because I didn't see the need for that as I could just use another HANDLE variable and assign it the same value. D-uh...&lt;br /&gt;&lt;br /&gt;However, here's the prototype:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;pre class="libCScode" style="white-space: pre-wrap; color: rgb(0, 0, 0);" id="ctl00_rs1_mainContentContainer_ctl01C++" space="preserve"&gt;&lt;code&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;BOOL&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;WINAPI&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;DuplicateHandle&lt;/span&gt;(&lt;br /&gt;__in   HANDLE &lt;em&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;hSourceProcessHandle&lt;/span&gt;&lt;/em&gt;,&lt;br /&gt;__in   HANDLE &lt;em&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;hSourceHandle&lt;/span&gt;&lt;/em&gt;,&lt;br /&gt;__in   HANDLE &lt;em&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20"&gt;hTargetProcessHandle&lt;/span&gt;&lt;/em&gt;,&lt;br /&gt;__out  &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_21"&gt;LPHANDLE&lt;/span&gt; &lt;em&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22"&gt;lpTargetHandle&lt;/span&gt;&lt;/em&gt;,&lt;br /&gt;__in   &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_23"&gt;DWORD&lt;/span&gt; &lt;em&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_24"&gt;dwDesiredAccess&lt;/span&gt;&lt;/em&gt;,&lt;br /&gt;__in   &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_25"&gt;BOOL&lt;/span&gt; &lt;em&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_26"&gt;bInheritHandle&lt;/span&gt;&lt;/em&gt;,&lt;br /&gt;__in   &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_27"&gt;DWORD&lt;/span&gt; &lt;em&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_28"&gt;dwOptions&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;);&lt;/code&gt;&lt;br /&gt;&lt;span style="font-family: verdana;font-size:85%;" &gt;&lt;br /&gt;So, it clearly does a whole lot more than just duplicating a handle, so to speak. The magic is in the parameter &lt;/span&gt;&lt;code&gt;&lt;em&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_29"&gt;dwDesiredAccess&lt;/span&gt;&lt;/em&gt;&lt;/code&gt;&lt;span style="font-family: verdana;font-size:85%;" &gt;. You can set the permissions for the new handle that is to be duplicated from the original. So, what you'd get is a new handle that accesses the same object as the original handle, but with different properties such as the access permissions. However, there is another catch. This won't work either unless the source process of the original handle has the PROCESS_&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_30"&gt;DUP&lt;/span&gt;_HANDLE permission. So far, I don't think it's common to not have this permission.&lt;br /&gt;&lt;br /&gt;Just for good measure, you can specify DUPLICATE_SAME_ACCESS in the &lt;/span&gt;&lt;code&gt;&lt;em&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_31"&gt;dwOptions&lt;/span&gt;&lt;/em&gt;&lt;/code&gt; &lt;span style="font-family:verdana;"&gt;parameter, and the &lt;/span&gt;&lt;code&gt;&lt;em&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_32"&gt;dwDesiredAccess&lt;/span&gt;&lt;/em&gt;&lt;/code&gt;&lt;span style="font-family:verdana;"&gt; parameter will be ignored.&lt;/span&gt;&lt;span style="font-family: verdana;font-size:85%;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-family: verdana; color: rgb(0, 0, 0);font-size:85%;" &gt;Therefore, by duplicating the original process handle this way, you can now obtain some information from it, like what &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;GetProcessImageFileName&lt;/span&gt;() can tell you.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-9094287510453983880?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/9094287510453983880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2009/04/handling-and-re-handling.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/9094287510453983880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/9094287510453983880'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2009/04/handling-and-re-handling.html' title='Handling And Re-Handling'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157503910303046714.post-9091621173618215551</id><published>2009-04-20T20:32:00.009+08:00</published><updated>2009-04-21T23:31:51.094+08:00</updated><title type='text'>NTSTATUS? Wazzat?</title><content type='html'>&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-size:130%;" &gt;NTSTATUS&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-size:130%;" &gt;: STATUS_GENERAL_INFORMATION&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;In recent times, I've met a fair number of people in software development who work on Microsoft Windows who go "Win32 &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;API&lt;/span&gt;? What's that?" I guess it is that people just don't, or can get by without needing to know what that is, let alone use it. I'm not saying that there's anything wrong with that. Just sign o' the times, I guess. Also a sign of what kind of development is being done more pervasively nowadays.&lt;br /&gt;&lt;br /&gt;In this blog, unless specified, 'Windows' (as in Microsoft Windows) will generally refer to &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;WindowsNT&lt;/span&gt;, and usually NT5.1 (Windows &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;XP&lt;/span&gt;), and NT6.0 (Windows Vista) unless specified. I still have some good memories of Windows 9x, but they are few and far between.&lt;br /&gt;&lt;br /&gt;So, for those who don't already know, the calling convention alias for the Win32 &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;API&lt;/span&gt; is &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;WINAPI&lt;/span&gt;, and the standard error does not have a special type definition. One more layer down, in Window's kernel-mode, where the neat NT Native &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;API&lt;/span&gt; is used, the calling convention is &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;NTAPI&lt;/span&gt;, and the standard return type is &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;NTSTATUS&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;And then, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;WINAPI&lt;/span&gt; and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;NTAPI&lt;/span&gt; is the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;stdcall&lt;/span&gt; calling convention of Intel's x86 architecture, and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;NTSTATUS&lt;/span&gt; is an unsigned 32-bit (unless you're into 64-bit) type.&lt;br /&gt;&lt;br /&gt;Well, so that's that. Let's see if there will be anything randomly interesting coming up...&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4157503910303046714-9091621173618215551?l=ntstatus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ntstatus.blogspot.com/feeds/9091621173618215551/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ntstatus.blogspot.com/2009/04/ntstatus-wazzat.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/9091621173618215551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157503910303046714/posts/default/9091621173618215551'/><link rel='alternate' type='text/html' href='http://ntstatus.blogspot.com/2009/04/ntstatus-wazzat.html' title='NTSTATUS? Wazzat?'/><author><name>Artemis</name><uri>http://www.blogger.com/profile/13295622634245640235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_IXsF0f8rteY/S87VLnBiXqI/AAAAAAAAADE/YnoMUUIlJAg/S220/red.jpg'/></author><thr:total>3</thr:total></entry></feed>
