<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Inside and Out...</title>
        <link>http://geekswithblogs.net/khanna/Default.aspx</link>
        <description>An attempt to understand technology better...</description>
        <language>en-US</language>
        <copyright>Gaurav Khanna</copyright>
        <managingEditor>gaurav@wintoolzone.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <image>
            <title>Inside and Out...</title>
            <url>http://geekswithblogs.net/images/RSS2Image.gif</url>
            <link>http://geekswithblogs.net/khanna/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>[Article] Authoring a Stack Walker for X86</title>
            <category>32bit</category>
            <category>Articles</category>
            <category>Development</category>
            <category>Downloads</category>
            <category>Windows API</category>
            <link>http://geekswithblogs.net/khanna/archive/2008/01/07/article-authoring-a-stack-walker-for-x86.aspx</link>
            <description>&lt;p&gt;&lt;font face="Calibri" size="3"&gt;Stack walking is second nature to debuggers. But if you had more interest in it than just debugging and either:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font face="Calibri" size="3"&gt;wanted to know what stack walking is about, or&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font face="Calibri" size="3"&gt;wanted to know how stack walking is implemented, or&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font face="Calibri" size="3"&gt;wanted to know how a custom stack walker can be authored for your application&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font face="Calibri" size="3"&gt;then you might find the article, &lt;strong&gt;Authoring a Stack Walker for X86, &lt;/strong&gt;useful. Its my attempt to help clarify the basics of stack walking and explain key concepts and show how it can be implemented on x86 platform. The article can be read &lt;/font&gt;&lt;a href="http://www.wintoolzone.com/PermaLink.aspx?ID=141" target="_blank"&gt;&lt;font face="Calibri" size="3"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt; and its accompanying stack walker implementation source code can be downloaded from &lt;/font&gt;&lt;a href="http://www.wintoolzone.com/Permalink.aspx?ID=140" target="_blank"&gt;&lt;font face="Calibri" size="3"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Calibri" size="3"&gt;Below is an output from the stack walker implementation discussed in the article:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="http://www.wintoolzone.com/images/stackwalker_ss.jpg" /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=118317"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=118317" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/118317.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2008/01/07/article-authoring-a-stack-walker-for-x86.aspx</guid>
            <pubDate>Mon, 07 Jan 2008 12:48:58 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2008/01/07/article-authoring-a-stack-walker-for-x86.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/118317.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/118317.aspx</trackback:ping>
        </item>
        <item>
            <title>[Download] MemAnalysis - Native memory leak analysis tool</title>
            <category>Debugging</category>
            <category>Development</category>
            <category>Downloads</category>
            <category>Windows API</category>
            <link>http://geekswithblogs.net/khanna/archive/2007/12/26/download-memanalysis---native-memory-leak-analysis-tool.aspx</link>
            <description>&lt;p&gt;&lt;a href="http://www.amazon.com/Advanced-Debugging-Addison-Wesley-Microsoft-Technology/dp/0321374460/ref=pd_bbs_sr_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1198681249&amp;amp;sr=8-1" target="_blank"&gt;&lt;strong&gt;&lt;font size="2"&gt;Advanced Windows Debugging&lt;/font&gt;&lt;/strong&gt;&lt;/a&gt;&lt;font size="2"&gt; got me hooked onto &lt;/font&gt;&lt;a href="http://research.microsoft.com/sn/detours" target="_blank"&gt;&lt;strong&gt;&lt;font size="2"&gt;Detours&lt;/font&gt;&lt;/strong&gt;&lt;/a&gt;&lt;font size="2"&gt; and that led me to experiment with it a bit more. It resulted in &lt;/font&gt;&lt;a href="http://geekswithblogs.net/khanna/archive/2007/12/23/using-detours-for-api-instrumentation.aspx" target="_blank"&gt;&lt;font size="2"&gt;this&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;. Over the past three days, I have been working on using &lt;strong&gt;Detours &lt;/strong&gt;to build a memory leak detection tool. &lt;/font&gt;&lt;a href="http://www.wintoolzone.com/Permalink.aspx?ID=139" target="_blank"&gt;&lt;strong&gt;&lt;font size="2"&gt;MemAnalysis&lt;/font&gt;&lt;/strong&gt;&lt;/a&gt;&lt;font size="2"&gt; is finally done (v1, that is) and can track memory allocation and release when done using the following APIs:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;VirtualAlloc&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;VirtualFree&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;HeapAlloc&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;HeapFree&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;HeapDestroy&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="2"&gt;Once the application being analyzed exits, &lt;strong&gt;MemAnalysis&lt;/strong&gt; produces a report with details on how many allocations took place, how many of them were freed and how much memory was not released. Below is a sample output:&lt;/font&gt;&lt;/p&gt;  &lt;p align="left"&gt;&lt;em&gt;&lt;font face="Calibri" size="2"&gt;Total Allocations: 8605        &lt;br /&gt;Total Virtual allocations: 1         &lt;br /&gt;Freed Virtual allocations: 1         &lt;br /&gt;Virtual allocation leaked size: 0 bytes &lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p align="left"&gt;&lt;em&gt;&lt;font face="Calibri" size="2"&gt;Total Heap allocations: 8604        &lt;br /&gt;Freed Heap allocations: 4189         &lt;br /&gt;Heap allocation leaked size: 1965244 bytes         &lt;br /&gt;============================================== &lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p align="left"&gt;&lt;em&gt;&lt;font face="Calibri" size="2"&gt;2344 bytes were leaked; Allocation method: Heap; Handle: 180000h; Address: 0019CDD0h        &lt;br /&gt;548 bytes were leaked; Allocation method: Heap; Handle: 180000h; Address: 0019D700h         &lt;br /&gt;16 bytes were leaked; Allocation method: Heap; Handle: 180000h; Address: 0019C718h         &lt;br /&gt;308 bytes were leaked; Allocation method: Heap; Handle: 10000h; Address: 00010588h         &lt;br /&gt;60 bytes were leaked; Allocation method: Heap; Handle: 180000h; Address: 0019C4F0h         &lt;br /&gt;24 bytes were leaked; Allocation method: Heap; Handle: 180000h; Address: 00184830h         &lt;br /&gt;1826 bytes were leaked; Allocation method: Heap; Handle: 180000h; Address: 0019D700h         &lt;br /&gt;2032 bytes were leaked; Allocation method: Heap; Handle: 180000h; Address: 0019DE30h         &lt;br /&gt;538 bytes were leaked; Allocation method: Heap; Handle: 180000h; Address: 0019D700h         &lt;br /&gt;104 bytes were leaked; Allocation method: Heap; Handle: 180000h; Address: 0019A600h&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;It is a &lt;em&gt;free &lt;/em&gt;download and can be downloaded from &lt;/font&gt;&lt;a href="http://www.wintoolzone.com/Permalink.aspx?ID=139" target="_blank"&gt;&lt;font size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;font size="2"&gt;Note: If not already present on your machine, you need to have VC++ 2008 runtimes installed. The X86 version can be downloaded from &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF&amp;amp;displaylang=en" target="_blank"&gt;here&lt;/a&gt; and the X64 version is &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=BD2A6171-E2D6-4230-B809-9A8D7548C1B6&amp;amp;displaylang=en" target="_blank"&gt;here&lt;/a&gt;.&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=117991"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=117991" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/117991.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2007/12/26/download-memanalysis---native-memory-leak-analysis-tool.aspx</guid>
            <pubDate>Wed, 26 Dec 2007 22:58:42 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2007/12/26/download-memanalysis---native-memory-leak-analysis-tool.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/117991.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/117991.aspx</trackback:ping>
        </item>
        <item>
            <title>Using Detours for API interception</title>
            <category>Development</category>
            <category>Downloads</category>
            <category>Windows API</category>
            <link>http://geekswithblogs.net/khanna/archive/2007/12/23/using-detours-for-api-instrumentation.aspx</link>
            <description>&lt;p&gt;&lt;strong&gt;&lt;a href="http://research.microsoft.com/sn/detours/" target="_blank"&gt;Detours&lt;/a&gt; &lt;/strong&gt;is a very interesting library from &lt;a href="http://research.microsoft.com/" target="_blank"&gt;&lt;strong&gt;Microsoft Research&lt;/strong&gt;&lt;/a&gt; that allows you to intercept Windows API calls that an application makes and redirect them to your code that can then:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;do some &lt;em&gt;pre-and-post processing &lt;/em&gt;work around the call to the original API, and/or&lt;/li&gt;    &lt;li&gt;customize what is returned to the caller of the API&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;This does not involve accessing original application source code and can be done at runtime! &lt;/p&gt;  &lt;p&gt;For an example, check the screenshot below for a sample that intercepts calls to &lt;em&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms724451.aspx" target="_blank"&gt;GetVersionEx&lt;/a&gt; &lt;/em&gt;API by an application and displays the OS version details. The first output is the original OS version information when the application invokes &lt;em&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms724451.aspx" target="_blank"&gt;GetVersionEx&lt;/a&gt;. &lt;/em&gt;The second output is when the application is launched by my wrapper application that enabled &lt;em&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms724451.aspx" target="_blank"&gt;GetVersionEx&lt;/a&gt; &lt;/em&gt;interception and returns the version details specified at the command line:&lt;/p&gt;  &lt;p&gt;&lt;img alt="Output from a Detours API interception" src="http://www.wintoolzone.com/images/DetoursForceVersionSS.jpg" /&gt; &lt;/p&gt;  &lt;p&gt;For those interested, you can download the complete sample source code from &lt;a href="http://www.wintoolzone.com/Permalink.aspx?ID=138" target="_blank"&gt;&lt;strong&gt;here&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=117940"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=117940" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/117940.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2007/12/23/using-detours-for-api-instrumentation.aspx</guid>
            <pubDate>Sun, 23 Dec 2007 19:18:33 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2007/12/23/using-detours-for-api-instrumentation.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/117940.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/117940.aspx</trackback:ping>
        </item>
        <item>
            <title>Advanced Windows Debugging</title>
            <category>32bit</category>
            <category>64bit</category>
            <category>Debugging</category>
            <category>Development</category>
            <category>Tips</category>
            <link>http://geekswithblogs.net/khanna/archive/2007/12/22/advanced-windows-debugging.aspx</link>
            <description>&lt;p&gt;The book is a &lt;u&gt;&lt;strong&gt;&lt;a href="http://www.amazon.com/Advanced-Debugging-Addison-Wesley-Microsoft-Technology/dp/0321374460/ref=pd_bbs_sr_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1198357122&amp;amp;sr=8-1" target="_blank"&gt;must have&lt;/a&gt;&lt;/strong&gt;&lt;/u&gt; for every serious Windows developer!&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=117934"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=117934" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/117934.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2007/12/22/advanced-windows-debugging.aspx</guid>
            <pubDate>Sun, 23 Dec 2007 05:00:21 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2007/12/22/advanced-windows-debugging.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/117934.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/117934.aspx</trackback:ping>
        </item>
        <item>
            <title>Integrating Windows Live Authentication in your application</title>
            <category>.NET Framework</category>
            <category>Development</category>
            <category>Windows Live</category>
            <link>http://geekswithblogs.net/khanna/archive/2007/12/16/integrating-windows-live-authentication-in-your-application.aspx</link>
            <description>&lt;p&gt;&lt;font size="2"&gt;For one of my pet projects I am writing, I was contemplating how to integrate &lt;em&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/bb404791.aspx" target="_blank"&gt;Windows Live Authentication&lt;/a&gt; &lt;/em&gt;with my standalone application, similar to &lt;strong&gt;&lt;em&gt;Windows Live Messenger. &lt;/em&gt;&lt;/strong&gt;Turns out, it is &lt;u&gt;really&lt;/u&gt; easy! Below are the three steps that were needed for the integration:&lt;/font&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;font size="2"&gt;Download the &lt;strong&gt;Windows Live Client SDK&lt;/strong&gt; from &lt;/font&gt;&lt;a href="http://go.microsoft.com/fwlink/?linkid=86974" target="_blank"&gt;&lt;font size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; and install it.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Create a new project and add reference to &lt;strong&gt;&lt;em&gt;Microsoft.WindowsLive.Id.Client &lt;/em&gt;&lt;/strong&gt;assembly&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Write code similar to the one below:&lt;/font&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; Microsoft.WindowsLive.Id.Client;

&lt;span style="color: rgb(0,0,255)"&gt;namespace&lt;/span&gt; WLAuthenticate
{
    &lt;span style="color: rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;Program
&lt;/span&gt;    {
        [&lt;span style="color: rgb(43,145,175)"&gt;STAThread&lt;/span&gt;]
        &lt;span style="color: rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; Main(&lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt;[] args)
        {
            &lt;span style="color: rgb(0,128,0)"&gt;// Attempt user authentication
&lt;/span&gt;            &lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: rgb(163,21,21)"&gt;"Enter your passport email address: "&lt;/span&gt;);
            &lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; strPassportEmail = &lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.ReadLine();
            &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (&lt;span style="color: rgb(43,145,175)"&gt;String&lt;/span&gt;.IsNullOrEmpty(strPassportEmail))
            {
                &lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: rgb(163,21,21)"&gt;"Enter valid address!"&lt;/span&gt;);
                &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt;;
            }

            &lt;span style="color: rgb(0,128,0)"&gt;// Got the details - attempt to authenticate
&lt;/span&gt;            &lt;span style="color: rgb(43,145,175)"&gt;IdentityManager&lt;/span&gt; idMgr = &lt;span style="color: rgb(0,0,255)"&gt;null&lt;/span&gt;;
            &lt;span style="color: rgb(43,145,175)"&gt;Identity&lt;/span&gt; curID = &lt;span style="color: rgb(0,0,255)"&gt;null&lt;/span&gt;;

            &lt;span style="color: rgb(0,128,0)"&gt;// Create the identity manager
&lt;/span&gt;            idMgr = &lt;span style="color: rgb(43,145,175)"&gt;IdentityManager&lt;/span&gt;.CreateInstance(&lt;span style="color: rgb(163,21,21)"&gt;"OrganizationName;name@company.com;ClientAuthSample"&lt;/span&gt;,
                &lt;span style="color: rgb(163,21,21)"&gt;"Windows Live Client Authentication Sample App"&lt;/span&gt;);

            &lt;span style="color: rgb(0,128,0)"&gt;// and now create the user's identity from it..
&lt;/span&gt;            curID = idMgr.CreateIdentity(strPassportEmail);
            &lt;span style="color: rgb(0,0,255)"&gt;bool&lt;/span&gt; fAuthenticated = &lt;span style="color: rgb(0,0,255)"&gt;false&lt;/span&gt;;

            &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (curID != &lt;span style="color: rgb(0,0,255)"&gt;null&lt;/span&gt;)
            {
                &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (curID.SavedCredentials == &lt;span style="color: rgb(43,145,175)"&gt;CredentialType&lt;/span&gt;.UserNameAndPassword)
                {
                    &lt;span style="color: rgb(0,128,0)"&gt;// the credentials are persisted in local store and we can authenticate
&lt;/span&gt;                    fAuthenticated = curID.Authenticate(&lt;span style="color: rgb(43,145,175)"&gt;AuthenticationType&lt;/span&gt;.Silent);
                }
                &lt;span style="color: rgb(0,0,255)"&gt;else
&lt;/span&gt;                {
                    &lt;span style="color: rgb(0,128,0)"&gt;// Credentials not available locally, so show the signin dialog...
&lt;/span&gt;                    curID = idMgr.CreateIdentity();

                    &lt;span style="color: rgb(0,128,0)"&gt;// This will prompt for credentials to authenticate...
&lt;/span&gt;                    fAuthenticated = curID.Authenticate();
                }

                &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (fAuthenticated)
                {
                    &lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: rgb(163,21,21)"&gt;"Authenticated with Windows Live!"&lt;/span&gt;);
                    &lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: rgb(163,21,21)"&gt;"Your username is {0}"&lt;/span&gt;, curID.UserName);
                    
                    &lt;span style="color: rgb(0,128,0)"&gt;// Close the authentication
&lt;/span&gt;                    curID.CloseIdentityHandle();
                }
            }
            
        }
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;font size="2"&gt;Easy, isn't it :) ?&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;The &lt;u&gt;only thing to be kept in mind&lt;/u&gt; is that if the passport authentication details are not persisted on the machine where authentication is attempted, then you will need to invoke &lt;strong&gt;Identity.Authenticate &lt;/strong&gt;method without any arguments. This overload uses COM subsystem to display the &lt;em&gt;Windows Live&lt;strong&gt; &lt;/strong&gt;&lt;/em&gt;signin dialog to attempt authentication and requires the calling thread to be in STA mode and thus, tagged with &lt;em&gt;STAThread &lt;/em&gt;attribute. Hence, I have set this attribute to the &lt;em&gt;Main &lt;/em&gt;method above. Not setting this attribute will result in a &lt;em&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/system.threading.threadstateexception(VS.90).aspx" target="_blank"&gt;ThreadStateException&lt;/a&gt; &lt;/em&gt;being raised.&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=117765"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=117765" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/117765.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2007/12/16/integrating-windows-live-authentication-in-your-application.aspx</guid>
            <pubDate>Mon, 17 Dec 2007 07:42:11 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2007/12/16/integrating-windows-live-authentication-in-your-application.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/117765.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/117765.aspx</trackback:ping>
        </item>
        <item>
            <title>[Article] AppDomains and Unhandled Exception Notifications</title>
            <category>.NET Framework</category>
            <category>Articles</category>
            <category>CLR</category>
            <category>Development</category>
            <link>http://geekswithblogs.net/khanna/archive/2007/12/15/article-appdomains-and-unhandled-exception-notifications.aspx</link>
            <description>&lt;p&gt;&lt;font size="2"&gt;One always strives to write exception safe application but there are times when an exception can go unhandled. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;In the .NET Framework, the &lt;/font&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/system.appdomain(VS.90).aspx" target="_blank"&gt;&lt;em&gt;&lt;font size="2"&gt;AppDomain&lt;/font&gt;&lt;/em&gt;&lt;/a&gt;&lt;font size="2"&gt;&lt;em&gt; &lt;/em&gt;class exposes the &lt;em&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/system.appdomain.unhandledexception(VS.90).aspx" target="_blank"&gt;UnhandledException&lt;/a&gt;&lt;/em&gt; event that can be used&lt;em&gt; &lt;/em&gt;by by the managed application to know when an exception has gone unhandled. In the writeup, &lt;em&gt;&lt;a href="http://www.wintoolzone.com/PermaLink.aspx?ID=137" target="_blank"&gt;AppDomains and Unhandled Exception Notifications&lt;/a&gt;, &lt;/em&gt;I discuss the specifics of when and how this notification is made, what is the relationship between the thread that had unhandled exception and the AppDomain(s) for which this notification will be done and what should be done during the notification callback.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The source code for the article can be downloaded from &lt;/font&gt;&lt;a href="http://www.wintoolzone.com/downloads/aduehandler.zip" target="_blank"&gt;&lt;font size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;.&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=117754"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=117754" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/117754.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2007/12/15/article-appdomains-and-unhandled-exception-notifications.aspx</guid>
            <pubDate>Sun, 16 Dec 2007 05:46:30 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2007/12/15/article-appdomains-and-unhandled-exception-notifications.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/117754.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/117754.aspx</trackback:ping>
        </item>
        <item>
            <title>[Download] TransNTFS v1.0.0.1 - support for folders, symbolic and hard links and more</title>
            <category>.NET Framework</category>
            <category>Development</category>
            <category>Downloads</category>
            <category>Tools/Applications</category>
            <category>Windows API</category>
            <category>Windows Vista</category>
            <link>http://geekswithblogs.net/khanna/archive/2007/03/18/Download-TransNTFS-v1.0.0.1---support-for-folders-symbolic-and-hard.aspx</link>
            <description>&lt;p&gt;&lt;span style="font-size: 0.9em; font-family: arial,helvetica,sans-serif"&gt;&lt;font size="2"&gt;&lt;font face="Trebuchet MS"&gt;I have updated &lt;/font&gt;&lt;a href="http://geekswithblogs.net/khanna/archive/2007/03/15/Download-TransNTFS---Managed-implementation-of-Transactional-NTFS-TxF-APIs.aspx" target="_blank"&gt;&lt;font face="Trebuchet MS"&gt;TransNTFS&lt;/font&gt;&lt;/a&gt;&lt;font face="Trebuchet MS"&gt;, my managed implementation for the transactional NTFS APIs that have been introduced with Windows Vista. TransNTFS now also supports the following operations under a transaction:&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;font size="2"&gt;Creation and deletion of folders &lt;/font&gt; &lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Deletion of files &lt;/font&gt; &lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Creation of &lt;/font&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa365680.aspx" target="_blank"&gt;&lt;font size="2"&gt;symbolic links&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; &lt;/font&gt; &lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Creation of &lt;/font&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms810604.aspx" target="_blank"&gt;&lt;font size="2"&gt;hard links&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;font size="2"&gt;It comes with complete documentation (as always) and can be downloaded from &lt;/font&gt;&lt;a href="http://www.wintoolzone.com/ListDotNET.aspx?Listtype=3" target="_blank"&gt;&lt;font size="2"&gt;http://www.wintoolzone.com/ListDotNET.aspx?Listtype=3&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113759"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113759" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/113759.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2007/03/18/Download-TransNTFS-v1.0.0.1---support-for-folders-symbolic-and-hard.aspx</guid>
            <pubDate>Sun, 18 Mar 2007 17:09:21 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2007/03/18/Download-TransNTFS-v1.0.0.1---support-for-folders-symbolic-and-hard.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/113759.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/113759.aspx</trackback:ping>
        </item>
        <item>
            <title>[Download] TransNTFS - Managed implementation of Transactional NTFS (TxF) APIs</title>
            <category>.NET Framework</category>
            <category>Development</category>
            <category>Downloads</category>
            <category>Tools/Applications</category>
            <category>Windows API</category>
            <category>Windows Vista</category>
            <link>http://geekswithblogs.net/khanna/archive/2007/03/15/Download-TransNTFS---Managed-implementation-of-Transactional-NTFS-TxF-APIs.aspx</link>
            <description>&lt;p&gt;&lt;font size="2"&gt;Sometime back, I had made a &lt;/font&gt;&lt;a href="http://geekswithblogs.net/khanna/archive/2007/03/01/Programming-the-Transactional-NTFS-TxF.aspx" target="_blank"&gt;&lt;font size="2"&gt;post&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; regarding a native C++ class I had authored for using some of the &lt;/font&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa365456.aspx" target="_blank"&gt;&lt;font size="2"&gt;Transactional NTFS (TxF)&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;APIs introduced in Windows Vista.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;Almost two weeks from that post, I just finished my managed implementation, &lt;/font&gt;&lt;a href="http://www.wintoolzone.com/ListDotNET.aspx?Listtype=3" target="_blank"&gt;&lt;strong&gt;&lt;font size="2"&gt;TransNTFS&lt;/font&gt;&lt;/strong&gt;&lt;/a&gt;&lt;font size="2"&gt;&lt;strong&gt;,&lt;/strong&gt; that enables you to use the &lt;/font&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa365456.aspx" target="_blank"&gt;&lt;font size="2"&gt;TxF&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; APIs from managed code. As always, &lt;em&gt;Managed C++&lt;/em&gt; enabled the implementation with excellent ease. It comes with complete documentation and can be downloaded from &lt;/font&gt;&lt;a href="http://www.wintoolzone.com/ListDotNET.aspx?Listtype=3"&gt;&lt;font size="2"&gt;http://www.wintoolzone.com/ListDotNET.aspx?Listtype=3&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;Below is an example usage of how to copy a file under a transaction:&lt;/font&gt;&lt;/p&gt;&lt;pre class="code"&gt;&lt;font size="2"&gt;&lt;font face="Trebuchet MS"&gt;&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Collections.Generic;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; System.Text;
&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; WinToolZone;
&lt;span style="color: rgb(0,0,255)"&gt;namespace&lt;/span&gt; ManagedTransactionCopyDemo
{
    &lt;span style="color: rgb(0,0,255)"&gt;class&lt;/span&gt; Program
    {
        &lt;span style="color: rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; Main(&lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt;[] args)
        {
            TransNTFS refTC = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; TransNTFS();
            &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Trebuchet MS"&gt;&lt;span style="color: rgb(0,128,0)"&gt;// Init the transaction
&lt;/span&gt;            &lt;span style="color: rgb(0,0,255)"&gt;bool&lt;/span&gt; fSuccess = refTC.BeginTransaction();
            &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (fSuccess)
            {
                fSuccess = refTC.CopyFile(&lt;span style="color: rgb(163,21,21)"&gt;"d:\\transcopy.pdb"&lt;/span&gt;, &lt;span style="color: rgb(163,21,21)"&gt;"d:\\t.pdb"&lt;/span&gt;, &lt;span style="color: rgb(0,0,255)"&gt;false&lt;/span&gt;);
                &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (fSuccess)
                {
                    fSuccess = refTC.Commit();
                    &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (fSuccess)
                    {
                        &lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: rgb(163,21,21)"&gt;"Copy successful!"&lt;/span&gt;);
                    }
                    &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Trebuchet MS"&gt;&lt;span style="color: rgb(0,0,255)"&gt;else
&lt;/span&gt;                    {
                        ShowErrorAndExit(&lt;span style="color: rgb(163,21,21)"&gt;"Commit failed!"&lt;/span&gt;, refTC.LastError);
                    }
                }
                &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Trebuchet MS"&gt;&lt;span style="color: rgb(0,0,255)"&gt;else
&lt;/span&gt;                {
                    ShowErrorAndExit(&lt;span style="color: rgb(163,21,21)"&gt;"Copy failed!"&lt;/span&gt;, refTC.LastError);
                }
            }
            &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Trebuchet MS"&gt;&lt;span style="color: rgb(0,0,255)"&gt;else
&lt;/span&gt;            {
                ShowErrorAndExit(&lt;span style="color: rgb(163,21,21)"&gt;"Unable to start the transaction!"&lt;/span&gt;, refTC.LastError);
            }
        }
        &lt;span style="color: rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; ShowErrorAndExit(&lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; p, &lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt; p_2)
        {
            &lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: rgb(163,21,21)"&gt;"ERROR: {0}"&lt;/span&gt;, p);
            &lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: rgb(163,21,21)"&gt;"CODE: {0}"&lt;/span&gt;, p_2);
            System.&lt;span style="color: rgb(43,145,175)"&gt;Environment&lt;/span&gt;.Exit(1);
        }
    }
}
&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113758"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113758" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/113758.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2007/03/15/Download-TransNTFS---Managed-implementation-of-Transactional-NTFS-TxF-APIs.aspx</guid>
            <pubDate>Thu, 15 Mar 2007 21:30:31 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2007/03/15/Download-TransNTFS---Managed-implementation-of-Transactional-NTFS-TxF-APIs.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/113758.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/113758.aspx</trackback:ping>
        </item>
        <item>
            <title>Programming the Transactional NTFS (TxF)</title>
            <category>Development</category>
            <category>Downloads</category>
            <category>Tools/Applications</category>
            <category>Windows Vista</category>
            <link>http://geekswithblogs.net/khanna/archive/2007/03/01/Programming-the-Transactional-NTFS-TxF.aspx</link>
            <description>&lt;p&gt;&lt;span style="font-size: 0.9em; font-family: 'Trebuchet MS',sans-serif"&gt;&lt;font size="2"&gt;One of the key new features of &lt;/font&gt;&lt;a title="Windows Vista Homepage" href="http://www.microsoft.com/windows/products/windowsvista/default.mspx" target="_blank"&gt;&lt;em&gt;&lt;font size="2"&gt;Windows Vista&lt;/font&gt;&lt;/em&gt;&lt;/a&gt;&lt;font size="2"&gt; is a component called the &lt;/font&gt;&lt;a href="http://msdn2.microsoft.com/en-us/aa488080.aspx" target="_blank"&gt;&lt;font size="2"&gt;Kernel Transaction Manager (KTM)&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; that brings inherent support for transactional development in not just the kernel-mode but also for user mode. &lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;span style="font-size: 0.9em; font-family: 'Trebuchet MS',sans-serif"&gt;Infact, NTFS has been enhanced to use and support transactions such that couple of new APIs (e.g. &lt;em&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa363853.aspx" target="_blank"&gt;&lt;em&gt;CopyFileTransacted&lt;/em&gt;&lt;/a&gt;, &lt;a href="http://msdn2.microsoft.com/en-us/aa365241.aspx" target="_blank"&gt;MoveFileTransacted&lt;/a&gt;&lt;/em&gt; just to name a few) have surfaced up. You can get more details on &lt;a href="http://msdn2.microsoft.com/en-us/library/aa365456.aspx"&gt;Transactional NTFS here&lt;/a&gt;.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 0.9em; font-family: 'Trebuchet MS',sans-serif"&gt;&lt;font size="2"&gt;To demonstrate the power of the new APIs, I wrote a C++ class library (unmanaged), &lt;em&gt;CTransCopy,&lt;/em&gt; that allows you to:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;font size="2"&gt;&lt;span style="font-size: 0.9em; font-family: 'Trebuchet MS',sans-serif"&gt;Copy files under a transaction&lt;/span&gt; &lt;/font&gt; &lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;&lt;span style="font-size: 0.9em; font-family: 'Trebuchet MS',sans-serif"&gt;Move files under a transaction&lt;/span&gt; &lt;/font&gt; &lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;&lt;span style="font-size: 0.9em; font-family: 'Trebuchet MS',sans-serif"&gt;Commit or Rollback the transaction&lt;/span&gt; &lt;/font&gt; &lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;&lt;span style="font-size: 0.9em; font-family: 'Trebuchet MS',sans-serif"&gt;Let you wire up a callback handler for copy/move progress&lt;/span&gt; &lt;/font&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;span style="font-size: 0.9em; font-family: 'Trebuchet MS',sans-serif"&gt;&lt;font size="2"&gt;You can download it from &lt;/font&gt;&lt;a href="http://www.wintoolzone.com/ListWin32.aspx?Listtype=5"&gt;&lt;font size="2"&gt;http://www.wintoolzone.com/ListWin32.aspx?Listtype=5&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;. The zipped archive also contains a sample client source code. &lt;em&gt;BTW, since the .LIB file containing the class was compiled using VC++ 2005 compiler, you will need the same to link against it and write an application&lt;/em&gt;. &lt;em&gt;You can use&lt;/em&gt; &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/vstudio/express/visualc/" target="_blank"&gt;&lt;em&gt;&lt;font size="2"&gt;VC++ 2005 Express Edition&lt;/font&gt;&lt;/em&gt;&lt;/a&gt;&lt;font size="2"&gt;. Below is an example usage of the same:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre class="code"&gt;CTransCopy tcopy;

&lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (tcopy.IsOSSupported() == FALSE)
{
    printf(&lt;span style="color: rgb(163,21,21)"&gt;"This application requires Windows Vista or later."&lt;/span&gt;);
    &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; -1;
}

&lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (tcopy.Init() == FALSE)
{
    printf(&lt;span style="color: rgb(163,21,21)"&gt;"Init failed with error %08X\n"&lt;/span&gt;,tcopy.LastError());
    &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; -1;
}

&lt;span style="color: rgb(0,128,0)"&gt;// Setup a callback for progress
&lt;/span&gt;tcopy.SetCopyCallback(ProgressCallback);

&lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (tcopy.CopyFileW(L&lt;span style="color: rgb(163,21,21)"&gt;"D:\\KGK\\Development\\VS\\Windows Vista\\VC\\TransCopy\\debug\\transcopy.pdb"&lt;/span&gt;,
                    L&lt;span style="color: rgb(163,21,21)"&gt;"D:\\transcopy.pdb"&lt;/span&gt;,FALSE) == FALSE)
{
    printf(&lt;span style="color: rgb(163,21,21)"&gt;"Copy/move failed with error %08X\n"&lt;/span&gt;,tcopy.LastError());
    tcopy.Rollback();
    &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; -1;
}

&lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (tcopy.Rollback() == FALSE)
{
    printf(&lt;span style="color: rgb(163,21,21)"&gt;"Rollback failed with error %08X\n"&lt;/span&gt;,tcopy.LastError());
    &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; -1;
}

&lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (tcopy.Commit() == FALSE)
{
    printf(&lt;span style="color: rgb(163,21,21)"&gt;"Commit failed with error %08X\n"&lt;/span&gt;,tcopy.LastError());
    &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; -1;
}&lt;/pre&gt;&lt;pre class="code"&gt;printf(&lt;span style="color: rgb(163,21,21)"&gt;"Copy/move successful!\n"&lt;/span&gt;);&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-size: 0.9em; font-family: 'Trebuchet MS',sans-serif"&gt;&lt;span style="font-size: 0.9em"&gt;&lt;font size="2"&gt;&lt;br /&gt;The &lt;em&gt;ProgressCallback&lt;/em&gt; function is implemented as shown below:&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; ProgressCallback(LARGE_INTEGER total, LARGE_INTEGER transferred)
{
    &lt;span style="color: rgb(0,0,255)"&gt;double&lt;/span&gt; percent = (transferred.QuadPart*100.00)/total.QuadPart;
    printf(&lt;span style="color: rgb(163,21,21)"&gt;"%f%% over\n"&lt;/span&gt;,percent);
}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p class="zoundry_bw_tags"&gt;&lt;!-- Tag links generated by Zoundry Blog Writer. Do not manually edit. http://www.zoundry.com --&gt;&lt;span class="ztags"&gt;&lt;span class="ztagspace"&gt;Technorati&lt;/span&gt; : &lt;a class="ztag" href="http://technorati.com/tag/API" rel="tag"&gt;API&lt;/a&gt;, &lt;a class="ztag" href="http://technorati.com/tag/KTM" rel="tag"&gt;KTM&lt;/a&gt;, &lt;a class="ztag" href="http://technorati.com/tag/Kernel%20Transaction%20Manager" rel="tag"&gt;Kernel Transaction Manager&lt;/a&gt;, &lt;a class="ztag" href="http://technorati.com/tag/NTFS" rel="tag"&gt;NTFS&lt;/a&gt;, &lt;a class="ztag" href="http://technorati.com/tag/Programming" rel="tag"&gt;Programming&lt;/a&gt;, &lt;a class="ztag" href="http://technorati.com/tag/Transaction" rel="tag"&gt;Transaction&lt;/a&gt;, &lt;a class="ztag" href="http://technorati.com/tag/Transactional%20NTFS" rel="tag"&gt;Transactional NTFS&lt;/a&gt;, &lt;a class="ztag" href="http://technorati.com/tag/TxF" rel="tag"&gt;TxF&lt;/a&gt;, &lt;a class="ztag" href="http://technorati.com/tag/WinToolZone" rel="tag"&gt;WinToolZone&lt;/a&gt;, &lt;a class="ztag" href="http://technorati.com/tag/Windows%20Vista" rel="tag"&gt;Windows Vista&lt;/a&gt;&lt;/span&gt; &lt;br /&gt;&lt;span class="ztags"&gt;&lt;span class="ztagspace"&gt;Del.icio.us&lt;/span&gt; : &lt;a class="ztag" href="http://del.icio.us/tag/API" rel="tag"&gt;API&lt;/a&gt;, &lt;a class="ztag" href="http://del.icio.us/tag/KTM" rel="tag"&gt;KTM&lt;/a&gt;, &lt;a class="ztag" href="http://del.icio.us/tag/Kernel+Transaction+Manager" rel="tag"&gt;Kernel Transaction Manager&lt;/a&gt;, &lt;a class="ztag" href="http://del.icio.us/tag/NTFS" rel="tag"&gt;NTFS&lt;/a&gt;, &lt;a class="ztag" href="http://del.icio.us/tag/Programming" rel="tag"&gt;Programming&lt;/a&gt;, &lt;a class="ztag" href="http://del.icio.us/tag/Transaction" rel="tag"&gt;Transaction&lt;/a&gt;, &lt;a class="ztag" href="http://del.icio.us/tag/Transactional+NTFS" rel="tag"&gt;Transactional NTFS&lt;/a&gt;, &lt;a class="ztag" href="http://del.icio.us/tag/TxF" rel="tag"&gt;TxF&lt;/a&gt;, &lt;a class="ztag" href="http://del.icio.us/tag/WinToolZone" rel="tag"&gt;WinToolZone&lt;/a&gt;, &lt;a class="ztag" href="http://del.icio.us/tag/Windows+Vista" rel="tag"&gt;Windows Vista&lt;/a&gt;&lt;/span&gt; &lt;br /&gt;&lt;span class="ztags"&gt;&lt;span class="ztagspace"&gt;Ice Rocket&lt;/span&gt; : &lt;a class="ztag" href="http://blogs.icerocket.com/tag/API" rel="tag"&gt;API&lt;/a&gt;, &lt;a class="ztag" href="http://blogs.icerocket.com/tag/KTM" rel="tag"&gt;KTM&lt;/a&gt;, &lt;a class="ztag" href="http://blogs.icerocket.com/tag/Kernel+Transaction+Manager" rel="tag"&gt;Kernel Transaction Manager&lt;/a&gt;, &lt;a class="ztag" href="http://blogs.icerocket.com/tag/NTFS" rel="tag"&gt;NTFS&lt;/a&gt;, &lt;a class="ztag" href="http://blogs.icerocket.com/tag/Programming" rel="tag"&gt;Programming&lt;/a&gt;, &lt;a class="ztag" href="http://blogs.icerocket.com/tag/Transaction" rel="tag"&gt;Transaction&lt;/a&gt;, &lt;a class="ztag" href="http://blogs.icerocket.com/tag/Transactional+NTFS" rel="tag"&gt;Transactional NTFS&lt;/a&gt;, &lt;a class="ztag" href="http://blogs.icerocket.com/tag/TxF" rel="tag"&gt;TxF&lt;/a&gt;, &lt;a class="ztag" href="http://blogs.icerocket.com/tag/WinToolZone" rel="tag"&gt;WinToolZone&lt;/a&gt;, &lt;a class="ztag" href="http://blogs.icerocket.com/tag/Windows+Vista" rel="tag"&gt;Windows Vista&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113757"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113757" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/113757.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2007/03/01/Programming-the-Transactional-NTFS-TxF.aspx</guid>
            <pubDate>Fri, 02 Mar 2007 07:37:29 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2007/03/01/Programming-the-Transactional-NTFS-TxF.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/113757.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/113757.aspx</trackback:ping>
        </item>
        <item>
            <title>Article: Customizing AppDomain Creation</title>
            <category>.NET Framework</category>
            <category>Articles</category>
            <category>CLR</category>
            <category>Development</category>
            <link>http://geekswithblogs.net/khanna/archive/2007/02/26/Article-Customizing-AppDomain-Creation.aspx</link>
            <description>&lt;p&gt;&lt;font size="2"&gt;Did you have a scenario where you wished you could customize the creation of &lt;em&gt;AppDomains? &lt;/em&gt;Or, you could control how many &lt;em&gt;AppDomains &lt;/em&gt;any code that runs in your application context (e.g. if you are writing a plugin load framework) could create? Or, how about reusing &lt;em&gt;AppDomains &lt;/em&gt;for various assemblies?&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;I have just finished an article on how any of the above scenarios can be accomplished using the &lt;em&gt;System.AppDomainManager &lt;/em&gt;type, introduced in .NET Framework 2.0, by intercept &lt;em&gt;AppDomain &lt;/em&gt;creation requests.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;You can read the article at &lt;/font&gt;&lt;a title="Customizing_AppDomain_Creation.aspx" href="http://www.wintoolzone.com/articles/Customizing_AppDomain_Creation.aspx" target="_blank"&gt;&lt;font size="2"&gt;http://www.wintoolzone.com/articles/Customizing_AppDomain_Creation.aspx&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; and download associated source code from &lt;/font&gt;&lt;a title="Customizing_AppDomain_Creation_src.zip" href="http://www.wintoolzone.com/downloads/Customizing_AppDomain_Creation_src.zip" target="_blank"&gt;&lt;font size="2"&gt;http://www.wintoolzone.com/downloads/Customizing_AppDomain_Creation_src.zip&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113756"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113756" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/113756.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2007/02/26/Article-Customizing-AppDomain-Creation.aspx</guid>
            <pubDate>Tue, 27 Feb 2007 03:56:09 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2007/02/26/Article-Customizing-AppDomain-Creation.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/113756.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/113756.aspx</trackback:ping>
        </item>
        <item>
            <title>How the SSCLI [a.k.a. Rotor] managed &amp;quot;new&amp;quot; works</title>
            <category>.NET Framework</category>
            <category>Articles</category>
            <category>CLR</category>
            <category>Development</category>
            <category>Rotor</category>
            <link>http://geekswithblogs.net/khanna/archive/2007/02/13/How-the-SSCLI-a.k.a.-Rotor-managed-ampquotnewampquot-works.aspx</link>
            <description>&lt;p&gt;&lt;span style="font-size: 0.75em; font-family: arial,helvetica,sans-serif"&gt;&lt;font face="tre" size="2"&gt;One of the best ways to understand how the CLR works internally is to have a look at the &lt;strong&gt;&lt;em&gt;SSCLI [a.k.a Rotor]&lt;/em&gt;&lt;/strong&gt; &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/net/sscli/" target="_blank"&gt;&lt;font face="tre" size="2"&gt;source code&lt;/font&gt;&lt;/a&gt;&lt;font face="tre" size="2"&gt;.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="tre" size="2"&gt;In &lt;strong&gt;&lt;a href="http://www.wintoolzone.com/articles/How_Rotor_Managed_New_Works.aspx" target="_blank"&gt;How the SSCLI [a.k.a. Rotor] managed "new" works&lt;/a&gt;&lt;/strong&gt;, I have used &lt;em&gt;Rotor&lt;/em&gt; source code to discuss what happens behind the scenes when you use the managed &lt;em&gt;new&lt;/em&gt; operator to instantiate a managed type, discussing implications of object size, how requests from multiple threads are handled, the different validations that are done, when &lt;em&gt;out-of-memory&lt;/em&gt; exception is thrown, etc. If you are a managed code developer, you may learn a thing or two that can help you write better code besides understanding how the managed allocation works internally.&lt;/font&gt;&lt;/p&gt; &lt;p class="zoundry_bw_tags"&gt;&lt;!-- Tag links generated by Zoundry Blog Writer. Do not manually edit. http://www.zoundry.com --&gt;&lt;span class="ztags"&gt;&lt;font size="2"&gt;&lt;font face="tre"&gt;&lt;span class="ztagspace"&gt;Technorati&lt;/span&gt; : &lt;/font&gt;&lt;/font&gt;&lt;a class="ztag" href="http://technorati.com/tag/.NET%20Framework" rel="tag"&gt;&lt;font face="tre" size="2"&gt;.NET Framework&lt;/font&gt;&lt;/a&gt;&lt;font face="tre" size="2"&gt;, &lt;/font&gt;&lt;a class="ztag" href="http://technorati.com/tag/Common%20language%20Infrastructure" rel="tag"&gt;&lt;font face="tre" size="2"&gt;Common language Infrastructure&lt;/font&gt;&lt;/a&gt;&lt;font face="tre" size="2"&gt;, &lt;/font&gt;&lt;a class="ztag" href="http://technorati.com/tag/Rotor" rel="tag"&gt;&lt;font face="tre" size="2"&gt;Rotor&lt;/font&gt;&lt;/a&gt;&lt;font face="tre" size="2"&gt;, &lt;/font&gt;&lt;a class="ztag" href="http://technorati.com/tag/SSCLI" rel="tag"&gt;&lt;font face="tre" size="2"&gt;SSCLI&lt;/font&gt;&lt;/a&gt;&lt;font face="tre" size="2"&gt;, &lt;/font&gt;&lt;a class="ztag" href="http://technorati.com/tag/article" rel="tag"&gt;&lt;font face="tre" size="2"&gt;article&lt;/font&gt;&lt;/a&gt;&lt;font face="tre" size="2"&gt;, &lt;/font&gt;&lt;a class="ztag" href="http://technorati.com/tag/clr" rel="tag"&gt;&lt;font face="tre" size="2"&gt;clr&lt;/font&gt;&lt;/a&gt;&lt;font face="tre" size="2"&gt;, &lt;/font&gt;&lt;a class="ztag" href="http://technorati.com/tag/common%20language%20runtime" rel="tag"&gt;&lt;font face="tre" size="2"&gt;common language runtime&lt;/font&gt;&lt;/a&gt;&lt;/span&gt;&lt;font face="tre" size="2"&gt; &lt;br /&gt;&lt;span class="ztags"&gt;&lt;span class="ztagspace"&gt;Del.icio.us&lt;/span&gt; : &lt;a class="ztag" href="http://del.icio.us/tag/.NET+Framework" rel="tag"&gt;.NET Framework&lt;/a&gt;, &lt;a class="ztag" href="http://del.icio.us/tag/Common+language+Infrastructure" rel="tag"&gt;Common language Infrastructure&lt;/a&gt;, &lt;a class="ztag" href="http://del.icio.us/tag/Rotor" rel="tag"&gt;Rotor&lt;/a&gt;, &lt;a class="ztag" href="http://del.icio.us/tag/SSCLI" rel="tag"&gt;SSCLI&lt;/a&gt;, &lt;a class="ztag" href="http://del.icio.us/tag/article" rel="tag"&gt;article&lt;/a&gt;, &lt;a class="ztag" href="http://del.icio.us/tag/clr" rel="tag"&gt;clr&lt;/a&gt;, &lt;a class="ztag" href="http://del.icio.us/tag/common+language+runtime" rel="tag"&gt;common language runtime&lt;/a&gt;&lt;/span&gt; &lt;br /&gt;&lt;span class="ztags"&gt;&lt;span class="ztagspace"&gt;Buzznet&lt;/span&gt; : &lt;a class="ztag" href="http://www.buzznet.com/buzzwords/.NET%20Framework" rel="tag"&gt;.NET Framework&lt;/a&gt;, &lt;a class="ztag" href="http://www.buzznet.com/buzzwords/Common%20language%20Infrastructure" rel="tag"&gt;Common language Infrastructure&lt;/a&gt;, &lt;a class="ztag" href="http://www.buzznet.com/buzzwords/Rotor" rel="tag"&gt;Rotor&lt;/a&gt;, &lt;a class="ztag" href="http://www.buzznet.com/buzzwords/SSCLI" rel="tag"&gt;SSCLI&lt;/a&gt;, &lt;a class="ztag" href="http://www.buzznet.com/buzzwords/article" rel="tag"&gt;article&lt;/a&gt;, &lt;a class="ztag" href="http://www.buzznet.com/buzzwords/clr" rel="tag"&gt;clr&lt;/a&gt;, &lt;a class="ztag" href="http://www.buzznet.com/buzzwords/common%20language%20runtime" rel="tag"&gt;common language runtime&lt;/a&gt;&lt;/span&gt; &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113755"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113755" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/113755.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2007/02/13/How-the-SSCLI-a.k.a.-Rotor-managed-ampquotnewampquot-works.aspx</guid>
            <pubDate>Tue, 13 Feb 2007 10:48:49 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2007/02/13/How-the-SSCLI-a.k.a.-Rotor-managed-ampquotnewampquot-works.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/113755.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/113755.aspx</trackback:ping>
        </item>
        <item>
            <title>[Download] PocketMaps 2.0 - with GPS support!</title>
            <category>.NET Compact Framework</category>
            <category>Downloads</category>
            <category>Tools/Applications</category>
            <category>Windows CE/Windows Mobile</category>
            <link>http://geekswithblogs.net/khanna/archive/2007/07/04/Download-PocketMaps-2.0---with-GPS-support.aspx</link>
            <description>&lt;p&gt;&lt;font size="2"&gt;Last week I updated &lt;strong&gt;&lt;a href="http://geekswithblogs.net/khanna/archive/2007/06/25/Download-Pocket-Maps---mapping-addresses-on-the-Pocket-PC.aspx" target="_blank"&gt;PocketMaps&lt;/a&gt; &lt;/strong&gt;to support GPS. Once the GPS receiver is connected to your &lt;strong&gt;Windows Mobile &lt;/strong&gt;device, &lt;strong&gt;PocketMaps &lt;/strong&gt;can:&lt;/font&gt;&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;font size="2"&gt;Map your current location on the map &lt;/font&gt; &lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Auto-refresh the map as you move to plot your move &lt;/font&gt; &lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Display details regarding your current location, like altitude, wind speed, etc.&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;font size="2"&gt;You can download it from &lt;/font&gt;&lt;a title="http://www.wintoolzone.com/ListDotNET.aspx?Listtype=1" href="http://www.wintoolzone.com/ListDotNET.aspx?Listtype=1"&gt;&lt;font size="2"&gt;http://www.wintoolzone.com/ListDotNET.aspx?Listtype=1&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;. Below are some screenshots:&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;img src="http://www.wintoolzone.com/images/PocketMaps_CurrentLocDetails.jpg" /&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;em&gt;&lt;font size="2"&gt;Displaying current location's details&lt;/font&gt;&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;img src="http://www.wintoolzone.com/images/PocketMaps_MenuWithGPSSupport.jpg" /&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;em&gt;&lt;font size="2"&gt;Support for GPS - mapping current location, autorefresh to plot your move, etc.&lt;/font&gt;&lt;/em&gt;&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:70589639-ac3c-4628-a88c-a383f3f050ac" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/PocketMaps" rel="tag"&gt;PocketMaps&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Windows%20Mobile%205.0" rel="tag"&gt;Windows Mobile 5.0&lt;/a&gt;, &lt;a href="http://technorati.com/tags/GPS" rel="tag"&gt;GPS&lt;/a&gt;, &lt;a href="http://technorati.com/tags/.NET%20Compact%20Framework" rel="tag"&gt;.NET Compact Framework&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Address%20Mapping" rel="tag"&gt;Address Mapping&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Yahoo!%20Maps" rel="tag"&gt;Yahoo! Maps&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113754"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113754" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/113754.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2007/07/04/Download-PocketMaps-2.0---with-GPS-support.aspx</guid>
            <pubDate>Thu, 05 Jul 2007 04:26:05 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2007/07/04/Download-PocketMaps-2.0---with-GPS-support.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/113754.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/113754.aspx</trackback:ping>
        </item>
        <item>
            <title>[Download] Pocket Maps - mapping addresses on the Pocket PC</title>
            <category>.NET Compact Framework</category>
            <category>Downloads</category>
            <category>Tools/Applications</category>
            <category>Windows CE/Windows Mobile</category>
            <link>http://geekswithblogs.net/khanna/archive/2007/06/25/Download-Pocket-Maps---mapping-addresses-on-the-Pocket-PC.aspx</link>
            <description>&lt;p&gt;&lt;font size="2"&gt;I just finished authoring &lt;strong&gt;PocketMaps&lt;/strong&gt;&lt;em&gt;, &lt;/em&gt;a &lt;strong&gt;.NET CF 2.0 &lt;/strong&gt;based application for &lt;strong&gt;Windows Mobile 5.0&lt;/strong&gt; based Pocket PC devices that does address mapping on the device using the &lt;em&gt;&lt;a href="http://developer.yahoo.com/maps/rest/V1/mapImage.html" target="_blank"&gt;Yahoo! Map Image API&lt;/a&gt;&lt;/em&gt;. You can enter the address as free text, or with city/state/zipcode details or as latitude/longitude combination and &lt;strong&gt;PocketMaps &lt;/strong&gt;will map it for you. Particularly useful when you are on the move and want to know the location of an address. It also lets you save the map image that you can send via email/bluetooth, etc. &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;Below are some screenshots of the application:&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;img src="http://www.wintoolzone.com/images/ss_pocketmaps.jpg" /&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;em&gt;&lt;strong&gt;PocketMaps&lt;/strong&gt; &lt;/em&gt; in the &lt;em&gt;Programs Folder&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;img src="http://www.wintoolzone.com/images/ss_pocketmaps_map.jpg" /&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;An address mapped by &lt;strong&gt;PocketMaps&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;img src="http://www.wintoolzone.com/images/ss_pocketmaps_zoom.jpg" /&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;Support for zooming in/out on the map.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;It's &lt;strong&gt;free&lt;/strong&gt; for download and use - download it from &lt;/font&gt;&lt;a title="http://www.wintoolzone.com/ListDotNET.aspx?Listtype=1" href="http://www.wintoolzone.com/ListDotNET.aspx?Listtype=1"&gt;&lt;font size="2"&gt;http://www.wintoolzone.com/ListDotNET.aspx?Listtype=1&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;. &lt;/font&gt;&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:8f081c7c-971f-466d-8cf7-b5eacde67730" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/PocketMaps" rel="tag"&gt;PocketMaps&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Windows%20Mobile%205.0" rel="tag"&gt;Windows Mobile 5.0&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Address%20Mapping" rel="tag"&gt;Address Mapping&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Yahoo!%20Maps" rel="tag"&gt;Yahoo! Maps&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113753"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113753" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/113753.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2007/06/25/Download-Pocket-Maps---mapping-addresses-on-the-Pocket-PC.aspx</guid>
            <pubDate>Tue, 26 Jun 2007 04:28:21 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2007/06/25/Download-Pocket-Maps---mapping-addresses-on-the-Pocket-PC.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/113753.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/113753.aspx</trackback:ping>
        </item>
        <item>
            <title>Enumerating AppDomains - I</title>
            <category>.NET Framework</category>
            <category>CLR</category>
            <category>Development</category>
            <link>http://geekswithblogs.net/khanna/archive/2007/06/09/Enumerating-AppDomains---I.aspx</link>
            <description>&lt;p&gt;&lt;font size="2"&gt;Surprisingly, enumerating &lt;em&gt;AppDomains &lt;/em&gt;is not that straightforward. The &lt;em&gt;System.AppDomain &lt;/em&gt;type does not expose functionality to enumerate them at all. The way to enumerate them will be to use the V1 Hosting interface, &lt;em&gt;ICorRuntimeHost &lt;/em&gt;and then invoke the &lt;em&gt;EnumDomains &lt;/em&gt;and &lt;em&gt;NextDomain &lt;/em&gt;methods against it to get the list. If you are using CLR 2.0, you needn't worry as CLR 2.0 does implement the V1 interfaces as well. &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;Below is the snippet that exemplifies the concept (&lt;em&gt;note: AppDomains will only be enumerated in the current process - I will discuss AppDomain enumeration in remote processes later). &lt;/em&gt;You can download the source code (VS Solution) from &lt;/font&gt;&lt;a title="http://www.wintoolzone.com/ListDotNET.aspx?Listtype=5" href="http://www.wintoolzone.com/ListDotNET.aspx?Listtype=5" target="_blank"&gt;&lt;font size="2"&gt;http://www.wintoolzone.com/ListDotNET.aspx?Listtype=5&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;&lt;pre class="code"&gt;&lt;font size="2"&gt;&lt;span style="color: rgb(0,128,0)"&gt;// EnumAppDomains.cpp : Defines the entry point for the console application.
// 
&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;#include&lt;/span&gt; &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="color: rgb(163,21,21)"&gt;"stdafx.h"
&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;#include&lt;/span&gt; &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="color: rgb(163,21,21)"&gt;&amp;lt;windows.h&amp;gt;
&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;#include&lt;/span&gt; &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="color: rgb(163,21,21)"&gt;"mscoree.h"

&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;#import&lt;/span&gt; &lt;span style="color: rgb(163,21,21)"&gt;"C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\mscorlib.tlb"&lt;/span&gt; raw_interfaces_only

&lt;span style="color: rgb(0,0,255)"&gt;using&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;namespace&lt;/span&gt; mscorlib; 

&lt;span style="color: rgb(0,0,255)"&gt;#define&lt;/span&gt; EXITONERROR(hr, mesg) \
&lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (FAILED(hr)) \
{ \
    printf(&lt;span style="color: rgb(163,21,21)"&gt;"%s\n"&lt;/span&gt;, mesg); \
    ExitProcess(1); \
} 

&lt;span style="color: rgb(0,0,255)"&gt;#define&lt;/span&gt; SUCCESSFUL(hr) (SUCCEEDED(hr) &amp;amp;&amp;amp; hr != S_FALSE) 
&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt; _tmain(&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt; argc, _TCHAR* argv[])
{
    ICorRuntimeHost * pV1HostPtr = NULL;
    HRESULT hr = CorBindToRuntimeEx(NULL,
                NULL, 0, 
                CLSID_CorRuntimeHost,
                IID_ICorRuntimeHost,
                (LPVOID *)&amp;amp;pV1HostPtr);

    EXITONERROR(hr, &lt;span style="color: rgb(163,21,21)"&gt;"Unable to get ICorRuntimeHost*"&lt;/span&gt;); 
    
    &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="color: rgb(0,128,0)"&gt;// Start the runtime
&lt;/span&gt;    hr = pV1HostPtr-&amp;gt;Start();
    EXITONERROR(hr, &lt;span style="color: rgb(163,21,21)"&gt;"Unable to start the runtime"&lt;/span&gt;); 
    
    &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="color: rgb(0,128,0)"&gt;// Enumerate the AppDomains
&lt;/span&gt;    HDOMAINENUM adEnum;
    hr = pV1HostPtr-&amp;gt;EnumDomains(&amp;amp;adEnum);
    EXITONERROR(hr, &lt;span style="color: rgb(163,21,21)"&gt;"Unable to enumerate AppDomains"&lt;/span&gt;);
    
    &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="color: rgb(0,128,0)"&gt;// Loop thru the domains
&lt;/span&gt;    IUnknown * pDomainUnk = NULL;
    hr = pV1HostPtr-&amp;gt;NextDomain(adEnum, &amp;amp;pDomainUnk);
    &lt;span style="color: rgb(0,0,255)"&gt;while&lt;/span&gt;(SUCCESSFUL(hr))
    {
        &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="color: rgb(0,128,0)"&gt;// Got the IUnknown* to the AppDomain - convert it to AppDomain pointer
&lt;/span&gt;        _AppDomain * pCurDomain = NULL;
        hr = pDomainUnk-&amp;gt;QueryInterface(&lt;span style="color: rgb(0,0,255)"&gt;__uuidof&lt;/span&gt;(_AppDomain), (VOID**)&amp;amp;pCurDomain);
        &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (SUCCESSFUL(hr))
        {
            &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="color: rgb(0,128,0)"&gt;// Display the name of the AppDomain
&lt;/span&gt;            BSTR str;
            &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (SUCCESSFUL(pCurDomain-&amp;gt;get_FriendlyName(&amp;amp;str)))
            {
            wprintf(L&lt;span style="color: rgb(163,21,21)"&gt;"AppDomain: %s\n"&lt;/span&gt;,str);
            }
            &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="color: rgb(0,0,255)"&gt;else
&lt;/span&gt;            {
                printf(&lt;span style="color: rgb(163,21,21)"&gt;"AppDomain: unable to get the name!\n"&lt;/span&gt;);
            }
        } 
    
        &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="color: rgb(0,128,0)"&gt;// Loop onto the next Domain
&lt;/span&gt;        hr = pV1HostPtr-&amp;gt;NextDomain(adEnum, &amp;amp;pDomainUnk);
    } 

    &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="color: rgb(0,128,0)"&gt;// Stop the runtime
&lt;/span&gt;    &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (pV1HostPtr)
    {
        pV1HostPtr-&amp;gt;Stop();
    }

    &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; 0;
} &lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:38da0fc2-6f07-48a6-9bd6-b1f22a4e41db" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/CLR%20Hosting" rel="tag"&gt;CLR Hosting&lt;/a&gt;, &lt;a href="http://technorati.com/tags/CorBindToRuntimeEx" rel="tag"&gt;CorBindToRuntimeEx&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Hosting" rel="tag"&gt;Hosting&lt;/a&gt;, &lt;a href="http://technorati.com/tags/AppDomains" rel="tag"&gt;AppDomains&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Enumeration" rel="tag"&gt;Enumeration&lt;/a&gt;, &lt;a href="http://technorati.com/tags/EnumDomains" rel="tag"&gt;EnumDomains&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113752"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113752" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/113752.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2007/06/09/Enumerating-AppDomains---I.aspx</guid>
            <pubDate>Sun, 10 Jun 2007 03:45:46 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2007/06/09/Enumerating-AppDomains---I.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/113752.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/113752.aspx</trackback:ping>
        </item>
        <item>
            <title>Lessons in Exception Handling</title>
            <category>32bit</category>
            <category>Articles</category>
            <category>CLR</category>
            <category>Development</category>
            <category>Windows API</category>
            <link>http://geekswithblogs.net/khanna/archive/2007/05/13/Lessons-in-Exception-Handling.aspx</link>
            <description>&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;Working on the CLR's exception handling subsystem is not just challenging but also gives unique opportunities to understand how the various exception handling subsystems (e.g. SEH, C++ EH, etc) work, and in particular, how they interoperate with one another. It was such case that had me discuss one such issue with &lt;/font&gt;&lt;a href="http://blogs.msdn.com/freik/" target="_blank"&gt;&lt;font size="2"&gt;Kevin&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;, development lead of the JIT, that he mentions &lt;/font&gt;&lt;a href="http://blogs.msdn.com/freik/archive/2007/03/15/how-to-use-rtlunwindex.aspx" target="_blank"&gt;&lt;font size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;That discussion got me exploring the interoperability aspects of EH further and resulted in the bullets listed below. Incase you are interested, download the PDF version of this article from &lt;/font&gt;&lt;a href="http://www.wintoolzone.com/articles/Lessons_in_EH.aspx" target="_blank"&gt;&lt;font size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; and the accompanying source code from &lt;/font&gt;&lt;a href="http://www.wintoolzone.com/ListWin32.aspx?Listtype=5" target="_blank"&gt;&lt;font size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;. For those uninitiated to exception handling, Matt Pietrek's &lt;strong&gt;must&lt;/strong&gt; read article is &lt;/font&gt;&lt;a href="http://www.microsoft.com/msj/0197/exception/exception.aspx" target="_blank"&gt;&lt;font size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;. &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;Now, onto the interoperability aspects of EH.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;i&gt;&lt;font size="2"&gt;Note: the following discussion is in context of the x86 platform&lt;/font&gt;&lt;/i&gt;&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;b&gt;&lt;font size="2"&gt;Catching an exception using __try/__except SEH handler will result in &lt;i&gt;RtlUnwind&lt;/i&gt; being called without exception record&lt;br /&gt;&lt;/font&gt;&lt;/b&gt;&lt;i&gt;&lt;br /&gt;&lt;font size="2"&gt;Structured Exception Handling (SEH) &lt;/font&gt;&lt;/i&gt;&lt;font size="2"&gt;is built into the Windows OS and it is how the OS processes the exceptions. Compilers offer their own specific ways of setting up a &lt;i&gt;SEH handler. &lt;/i&gt;To setup one using Microsoft Visual C++, we use &lt;i&gt;__try/__except &lt;/i&gt;keywords. For example: &lt;br /&gt;&lt;br /&gt;&lt;/font&gt; &lt;p&gt;__try&lt;br /&gt;{ &lt;br /&gt;&lt;span style="color: #0000ff"&gt;printf&lt;/span&gt;("&lt;span style="color: #8b0000"&gt;Calling the /EHSc function\n&lt;/span&gt;"); &lt;br /&gt;InvokeCPPFunction(); &lt;br /&gt;} &lt;br /&gt;__except (IsForUs(GetExceptionInformation())) &lt;br /&gt;{ &lt;br /&gt;&lt;span style="color: #0000ff"&gt;printf&lt;/span&gt;("&lt;span style="color: #8b0000"&gt;In __except\n&lt;/span&gt;"); &lt;br /&gt;} &lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;If the &lt;i&gt;InvokeCPPFunction &lt;/i&gt;throws an exception, the OS will invoke the &lt;i&gt;filter function &lt;/i&gt;(the &lt;i&gt;IsForUs &lt;/i&gt;function referenced in the braces of __&lt;i&gt;except&lt;/i&gt;) and check its return value. The filter function can be passed exception details that can be retrieved using the &lt;i&gt;GetExceptionInformation &lt;/i&gt;function and using that information, it can decide whether it wants to process the exception or not. &lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;If the filter function returns &lt;a href="http://msdn2.microsoft.com/en-us/library/6wxdsc38(vs.80).aspx" target="_blank"&gt;EXCEPTION_CONTINUE_EXECUTION&lt;/a&gt;, the OS retries the instruction that created the exception. However, if the return value is &lt;a href="http://msdn2.microsoft.com/en-us/library/6wxdsc38(vs.80).aspx" target="_blank"&gt;EXCEPTION_CONTINUE_SEARCH&lt;/a&gt;, it tells the OS that the filter function has declined to process the exception and the OS continues its search for the handler in the &lt;i&gt;SEH handler chain &lt;/i&gt;(that is available from &lt;i&gt;FS:0 &lt;/i&gt;on x86 machines for each OS thread). &lt;/font&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt; &lt;blockquote&gt; &lt;p&gt;&lt;font size="2"&gt;The filter function can also return &lt;a href="http://msdn2.microsoft.com/en-us/library/6wxdsc38(vs.80).aspx" target="_blank"&gt;EXCEPTION_EXECUTE_HANDLER&lt;/a&gt; to tell the OS that it wants to handle the exception and the OS proceeds to invoke the &lt;i&gt;funclet &lt;/i&gt;within the &lt;i&gt;__except &lt;/i&gt;block. But before invoking the &lt;i&gt;funclet, the OS &lt;/i&gt;has to unwind&lt;i&gt; &lt;/i&gt;the call stack. On x86, the code generated by VC++ compiler does this by invoking &lt;i&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms680609.aspx" target="_blank"&gt;RtlUnwind&lt;/a&gt; &lt;/i&gt;API, with &lt;i&gt;NULL &lt;/i&gt;for the third argument - this argument is a pointer to the exception record for the exception being processed. This is done by the compiler by invoking &lt;i&gt;GlobalUnwind &lt;/i&gt;(an internal function) after doing some processing. &lt;i&gt;GlobalUnwind &lt;/i&gt;makes the call to &lt;i&gt;RtlUnwind &lt;/i&gt;as shown below: &lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;em&gt;@_EH4_GlobalUnwind@4: &lt;/em&gt;&lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;em&gt;70508FB2 push ebp &lt;/em&gt;&lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;em&gt;70508FB3 mov ebp,esp &lt;/em&gt;&lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;em&gt;70508FB5 push ebx &lt;/em&gt;&lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;em&gt;70508FB6 push esi &lt;/em&gt;&lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;em&gt;70508FB7 push edi &lt;/em&gt;&lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;em&gt;70508FB8 push 0 &lt;/em&gt;&lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;font size="2"&gt;&lt;em&gt;&lt;font color="#ff0000"&gt;70508FBA push 0&lt;/font&gt; &lt;/em&gt;&lt;/font&gt;&lt;/b&gt; &lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;em&gt;70508FBC push offset ReturnPoint (70508FC7h) &lt;/em&gt;&lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;em&gt;70508FC1 push ecx &lt;/em&gt;&lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;em&gt;70508FC2 call RtlUnwind (70526620h)&lt;/em&gt; &lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;The highlighted &lt;font color="#ff0000"&gt;&lt;strong&gt;red&lt;/strong&gt;&lt;/font&gt; line is the one where NULL is pushed for exception record. &lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;What this implies that all &lt;i&gt;SEH handlers &lt;/i&gt;that are in the x86 FS:0 chain&lt;i&gt;, &lt;/i&gt;prior to the one that agreed to process the exception, will be called by the OS once again to give them a chance to do some cleanup (e.g. release resources) – this is typically known as &lt;i&gt;unwinding &lt;/i&gt;of the stack. And since the unwind was initiated with a NULL for the exception record, if your &lt;i&gt;SEH handler &lt;/i&gt;relies on checking the exception record for details before deciding to do the cleanup, it can potentially fail (e.g. not end up doing the cleanup)! &lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;ul&gt; &lt;li&gt;&lt;font size="2"&gt;&lt;b&gt;Corollary Lesson: Don’t throw (and expect to catch &lt;i&gt;correctly&lt;/i&gt;) exception across environment boundaries. E.g. throwing a C++ exception and trying to catch it using a SEH handler&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;Since a C++ application can have a mix of both C++ exception handling constructs and SEH exception handing constructs, it is easy to commit the mistake of writing code that throws an exception from C++ EH and excepts that to be &lt;i&gt;correctly &lt;/i&gt;caught and processed in SEH EH constructs – the focus is on correct processing. &lt;br /&gt;&lt;br /&gt;Let’s extend the previous example. Assume that &lt;i&gt;InvokeCPPFunction &lt;/i&gt;is a function in a DLL that was compiled to use C++ EH (using the &lt;i&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/1deeycx5(VS.80).aspx" target="_blank"&gt;/EHSc&lt;/a&gt; &lt;/i&gt;switch) and implemented as shown below:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt; CPPClass2 &lt;br /&gt;{ &lt;br /&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;: &lt;br /&gt;CPPClass2() &lt;br /&gt;{ &lt;br /&gt;printf("&lt;span style="color: #8b0000"&gt;CPPClass2 constructor\n&lt;/span&gt;"); &lt;br /&gt;} &lt;br /&gt;~CPPClass2() &lt;br /&gt;{ &lt;br /&gt;printf("&lt;span style="color: #8b0000"&gt;CPPClass2 destructor\n&lt;/span&gt;"); &lt;br /&gt;} &lt;br /&gt;}; &lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt; CPPClass &lt;br /&gt;{ &lt;br /&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;: &lt;br /&gt;CPPClass() &lt;br /&gt;{ &lt;br /&gt;printf("&lt;span style="color: #8b0000"&gt;CPPClass constructor\n&lt;/span&gt;"); &lt;br /&gt;} &lt;br /&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ThrowException() &lt;br /&gt;{ &lt;br /&gt;CPPClass2 cpp2; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; 1; &lt;br /&gt;} &lt;br /&gt;~CPPClass() &lt;br /&gt;{ &lt;br /&gt;printf("&lt;span style="color: #8b0000"&gt;CPPClass destructor\n&lt;/span&gt;"); &lt;br /&gt;} &lt;br /&gt;}; &lt;br /&gt;&lt;br /&gt;__declspec (dllexport) &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; InvokeCPPFunction() &lt;br /&gt;{ &lt;br /&gt;CPPClass cpp; &lt;br /&gt;cpp.ThrowException(); &lt;br /&gt;}&lt;br /&gt;&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;&lt;b&gt;&lt;/b&gt; &lt;blockquote&gt; &lt;p&gt;&lt;font size="2"&gt;We have two classes, &lt;i&gt;CPPClass &amp;amp; CPPClass2 &lt;/i&gt;that have destructors each. &lt;i&gt;InvokeCPPFunction &lt;/i&gt;instantiates &lt;i&gt;CPPClass &lt;/i&gt;object, &lt;i&gt;cpp, &lt;/i&gt;and invokes the &lt;i&gt;ThrowException &lt;/i&gt;method, which in turn, instantiates &lt;i&gt;CPPClass2 &lt;/i&gt;object, &lt;i&gt;cpp2, &lt;/i&gt;and throws an exception. &lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;As per the C++ semantics, when this exception is caught, the destructors should be invoked as they are expected to do the cleanup for the respective class instance. However, &lt;i&gt;this depends upon who catches the exception. &lt;/i&gt;&lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;In our previous example, &lt;i&gt;InvokeCPPFunction &lt;/i&gt;was invoked from within &lt;i&gt;__try/__except &lt;/i&gt;SEH mechanism. Hence, when &lt;i&gt;ThrowException &lt;/i&gt;throws an exception, the OS walks the &lt;i&gt;FS:0 &lt;/i&gt;chain to look for a handler that will handle the exception. When the OS comes to our &lt;i&gt;__except &lt;/i&gt;block, if the filter &lt;i&gt;funclet &lt;/i&gt;returns EXECEPTION_EXECUTE_HANDLER, as per our last discussion, &lt;i&gt;RtlUnwind &lt;/i&gt;is invoked with a NULL for the exception record pointer. &lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;When this happens and the unwind call comes to C++ exception handler, the &lt;i&gt;C++ EH does not process the unwind since the exception record is NULL&lt;/i&gt;. This is because C++ EH only processes the unwind when the exception code in the exception record has the C++ exception code (0Xe06d7363). Thus, &lt;i&gt;no destructors are invoked&lt;/i&gt; and that is not something you want. Below is the output this example: &lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a href="http://www.wintoolzone.com/images/f060de3d24ca_144A7/clip_image0026.jpg" atomicselection="true"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="313" src="http://www.wintoolzone.com/images/f060de3d24ca_144A7/clip_image002_thumb1.jpg" width="623" border="0" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;Hence, it’s important to catch the exception in the &lt;i&gt;environment/EH-context &lt;/i&gt;it was thrown in, since that &lt;i&gt;EH-context &lt;/i&gt;will know how to process it correctly. &lt;/font&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:1828d01d-0707-4ea1-a8a6-673c0e5d61ee" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/Exception%20Handling" rel="tag"&gt;Exception Handling&lt;/a&gt;, &lt;a href="http://technorati.com/tags/RtlUnwind" rel="tag"&gt;RtlUnwind&lt;/a&gt;, &lt;a href="http://technorati.com/tags/RtlUnwindEx" rel="tag"&gt;RtlUnwindEx&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Structured%20Exception%20Handling" rel="tag"&gt;Structured Exception Handling&lt;/a&gt;, &lt;a href="http://technorati.com/tags/SEH" rel="tag"&gt;SEH&lt;/a&gt;, &lt;a href="http://technorati.com/tags/C++%20Exception%20Handling" rel="tag"&gt;C++ Exception Handling&lt;/a&gt;, &lt;a href="http://technorati.com/tags/FS:[0]" rel="tag"&gt;FS:[0]&lt;/a&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113751"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113751" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/113751.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2007/05/13/Lessons-in-Exception-Handling.aspx</guid>
            <pubDate>Sun, 13 May 2007 23:50:29 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2007/05/13/Lessons-in-Exception-Handling.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/113751.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/113751.aspx</trackback:ping>
        </item>
        <item>
            <title>Windows Communication Foundation (Indigo) India Tour</title>
            <category>Events</category>
            <category>WinFX</category>
            <link>http://geekswithblogs.net/khanna/archive/2006/01/05/64908.aspx</link>
            <description>&lt;div&gt;&lt;font size="2"&gt;&lt;font face="Tahoma" color="darkgoldenrod"&gt;&lt;strong&gt;[Original Post Date: 9th November 2005]&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;strong&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/strong&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;&lt;font size="2"&gt;&lt;font face="Tahoma"&gt;&lt;strong&gt;Windows Communication Foundation&lt;/strong&gt;, formerly codenamed &lt;em&gt;Indigo&lt;/em&gt;, is the future of Microsoft distributed computing platform. And to take it to the next level &lt;strong&gt;&lt;em&gt;in India&lt;/em&gt;&lt;/strong&gt;, we are having &lt;strong&gt;&lt;em&gt;Windows Communication Foundation (WCF) Tour&lt;/em&gt;&lt;/strong&gt; across the month of November. The dates are as below:&lt;/font&gt;&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/div&gt; &lt;div&gt; &lt;table class="msoUcTable" style="border-right: medium none; table-layout: fixed; border-top: medium none; border-left: medium none; width: 384px; border-bottom: medium none; border-collapse: collapse; word-wrap: break-word" tabindex="-1" bordercolor="buttontext" border="1"&gt; &lt;colgroup&gt;&lt;font size="2"&gt; &lt;col style="width: 192px"&gt; &lt;col style="width: 192px"&gt;&lt;font face="Tahoma"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/colgroup&gt; &lt;tbody valign="top"&gt; &lt;tr&gt; &lt;td&gt; &lt;div align="center"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;strong&gt;City&lt;/strong&gt;&lt;/font&gt;&lt;/div&gt;&lt;/td&gt; &lt;td&gt; &lt;div align="center"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;strong&gt;Date&lt;/strong&gt;&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;div&gt;&lt;font face="Tahoma" size="2"&gt;Bangalore&lt;/font&gt;&lt;/div&gt;&lt;/td&gt; &lt;td&gt; &lt;div&gt;&lt;font face="Tahoma" size="2"&gt;10th November&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;div&gt;&lt;font face="Tahoma" size="2"&gt;Pune&lt;/font&gt;&lt;/div&gt;&lt;/td&gt; &lt;td&gt; &lt;div&gt;&lt;font face="Tahoma" size="2"&gt;15th November&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;div&gt;&lt;font face="Tahoma" size="2"&gt;Chennai&lt;/font&gt;&lt;/div&gt;&lt;/td&gt; &lt;td&gt; &lt;div&gt;&lt;font face="Tahoma" size="2"&gt;17th November&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;div&gt;&lt;font face="Tahoma" size="2"&gt;Hyderabad&lt;/font&gt;&lt;/div&gt;&lt;/td&gt; &lt;td&gt; &lt;div&gt;&lt;font face="Tahoma" size="2"&gt;22nd November&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt; &lt;div&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;&lt;font face="Tahoma" size="2"&gt;In this tour, we will enable the attendee to understand WCF, its relation with service orientation and Microsoft's distributed communication platform commitment and its roadmap. It will help understand the technology better, its interoperability aspects and also understand the best practices to be undertaken today for a smoother migration from existing technologies (ASMX, Remoting, ES, MSMQ) to WCF.&lt;br&gt;&lt;br&gt;For more details and registration, visit &lt;/font&gt;&lt;a href="http://www.microsoft.com/india/msdn/events/"&gt;&lt;font face="Tahoma" size="2"&gt;http://www.microsoft.com/india/msdn/events/&lt;/font&gt;&lt;/a&gt;&lt;font face="Tahoma" size="2"&gt;.&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/div&gt; &lt;div id="CSBloggerSig"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=64908"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=64908" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/64908.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna [gaurav@wintoolzone.com]</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2006/01/05/64908.aspx</guid>
            <pubDate>Thu, 05 Jan 2006 18:03:00 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2006/01/05/64908.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/64908.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/64908.aspx</trackback:ping>
        </item>
        <item>
            <title>[Download] NotifyOnEmail - Get notified on email about SMS and Missed Calls</title>
            <link>http://geekswithblogs.net/khanna/archive/2007/03/29/110237.aspx</link>
            <description>&lt;p&gt;&lt;font size="2"&gt;[&lt;em&gt;Originally posted on 5th June 2006]&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;I just finished off with TechED 2006 India at Delhi and had sometime at hand today before TechED starts at Pune tomorrow. So, I thought about writing an application I had been waiting to develop.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;There are times when we forget our phones at home. However, we continue to get SMS and phone calls on our device while we are at a totally different location. Would it not be great if our phone could &lt;em&gt;email us&lt;/em&gt; details of the SMS received and phone calls we missed?&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;Download &lt;/font&gt;&lt;strong&gt;&lt;font size="2"&gt;&lt;a href="http://www.wintoolzone.com/showpage.aspx?url=http://www.wintoolzone.com/ListDotNET.aspx?Listtype=1" target="_blank"&gt;NotifyOnEmail&lt;/a&gt;&lt;/font&gt;&lt;/strong&gt;&lt;font size="2"&gt; which will do just that. It is for PocketPC and &lt;strong&gt;requires Windows Mobile 5.0 and .NET Compact Framework 2.0.&lt;/strong&gt; Screenshot is below:&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="ttp://www.wintoolzone.com/images/NotifyOnemailss.jpg" target="_blank"&gt;&lt;img style="width: 226px; height: 302px" height="302" src="http://www.wintoolzone.com/images/NotifyOnemailss.jpg" width="226"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p class="zoundry_bw_tags"&gt;&lt;!-- Tag links generated by Zoundry Blog Writer. Do not manually edit. http://www.zoundry.com --&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=110237"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=110237" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/110237.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna [gaurav@wintoolzone.com]</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2007/03/29/110237.aspx</guid>
            <pubDate>Thu, 29 Mar 2007 21:46:00 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2007/03/29/110237.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/110237.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/110237.aspx</trackback:ping>
        </item>
        <item>
            <title>WinToolZone.Bluetooth - Support for authentication</title>
            <category>.NET Framework</category>
            <category>Development</category>
            <link>http://geekswithblogs.net/khanna/archive/2007/03/29/110236.aspx</link>
            <description>&lt;p&gt;&lt;em&gt;&lt;font size="2"&gt;[Originally posted on 10th July 2006]&lt;/font&gt;&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;&lt;em&gt;WinToolZone.Bluetooth&lt;/em&gt;&lt;/strong&gt; now has authentication support. You can use a &lt;strong&gt;&lt;em&gt;BluetoothDevice&lt;/em&gt;&lt;/strong&gt; object (which is used represent a Bluetooth device that has been detected) and use the &lt;em&gt;SendPassKey&lt;/em&gt; method to send a pass key for authentication:&lt;/font&gt;&lt;/p&gt; &lt;div class="CodeFormatContainer"&gt;.  &lt;style&gt;
&lt;!--
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }

--&gt;
&lt;/style&gt;  &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;bth.Devices[ i ].SendPassKey(&lt;span class="str"&gt;"123"&lt;/span&gt;, &lt;span class="kwrd"&gt;null&lt;/span&gt;);&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;br&gt;Also, I have added &lt;em&gt;OnIncomingAuthenticationRequest&lt;/em&gt; event handler against a &lt;strong&gt;&lt;em&gt;BluetoothDevice&lt;/em&gt;&lt;/strong&gt; object that can be used to setup an event handler, which will be invoked when the &lt;em&gt;Bluetooth&lt;/em&gt; device sends an authentication request to the machine running &lt;strong&gt;&lt;em&gt;WinToolZone.Bluetooth:&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;
&lt;div class="CodeFormatContainer"&gt;. 
&lt;style&gt;
&lt;!--
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }

--&gt;
&lt;/style&gt;

&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;bth.Devices[ i ].OnIncomingAuthenticationRequest += &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;BluetoothDevice.IncomingAuthenticationRequestHandler(&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;Program_OnIncomingAuthenticationRequest);&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The event handler is implemented as shown below:&lt;/p&gt;
&lt;div class="CodeFormatContainer"&gt;. 
&lt;style&gt;
&lt;!--
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }

--&gt;
&lt;/style&gt;

&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Program_OnIncomingAuthenticationRequest(&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;               BluetoothDevice refDeviceRequestingAuthentication)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt; {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;  Console.WriteLine(&lt;span class="str"&gt;"{0} is requesting me to send pass key."&lt;/span&gt;, &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    refDeviceRequestingAuthentication.Name);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;  &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;  &lt;span class="kwrd"&gt;bool&lt;/span&gt; bSentResponse = &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;  refDeviceRequestingAuthentication.SendAuthenticationResponse(&lt;span class="str"&gt;"123"&lt;/span&gt;, &lt;span class="kwrd"&gt;null&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt" style="width: 100%; height: 14px"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;  Console.WriteLine(&lt;span class="str"&gt;"Sent response: {0}"&lt;/span&gt;,bSentResponse.ToString());&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;The handler gets as an argument the &lt;em&gt;BluetoothDevice&lt;/em&gt; instance representing the device that sent the authentication request. To send the pass key back as part of completing the incoming authentication process, &lt;em&gt;SendAuthenticationResponse&lt;/em&gt; method of &lt;em&gt;BluetoothDevice&lt;/em&gt; is used.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;For a partnership/bonding that has been established with a &lt;em&gt;Bluetooth&lt;/em&gt; device, &lt;em&gt;DeleteDeviceAuthentication&lt;/em&gt; method has been introduced that should be invoked against the &lt;em&gt;BluetoothDevice&lt;/em&gt; instance representing the partnered device to break the partnership.&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=110236"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=110236" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/110236.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna [gaurav@wintoolzone.com]</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2007/03/29/110236.aspx</guid>
            <pubDate>Thu, 29 Mar 2007 21:42:00 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2007/03/29/110236.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/110236.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/110236.aspx</trackback:ping>
        </item>
        <item>
            <title>WinToolZone.Bluetooth - Added device enumeration support</title>
            <category>.NET Framework</category>
            <category>Development</category>
            <category>Embedded Development</category>
            <link>http://geekswithblogs.net/khanna/archive/2007/03/29/110235.aspx</link>
            <description>&lt;p&gt;&lt;font size="2"&gt;&lt;em&gt;[Originally posted on 6th July 2006]&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;WinToolZone.Bluetooth,&lt;/strong&gt; the managed Bluetooth API for the desktop that I am working on, now has the support for enumerating devices as well. The snippet below exemplifies it:&lt;/font&gt;&lt;/p&gt; &lt;div class="CodeFormatContainer"&gt;.  &lt;style&gt;
&lt;!--
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }

--&gt;
&lt;/style&gt;  &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;Bluetooth bth = &lt;span class="kwrd"&gt;new&lt;/span&gt; Bluetooth();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;            &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="rem"&gt;// EnumRadios(bth);&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (bth.RefreshDevices(&lt;span class="kwrd"&gt;false&lt;/span&gt;, &lt;span class="kwrd"&gt;true&lt;/span&gt;, &lt;span class="kwrd"&gt;true&lt;/span&gt;, &lt;span class="kwrd"&gt;true&lt;/span&gt;, &lt;span class="kwrd"&gt;true&lt;/span&gt;, &lt;span class="kwrd"&gt;null&lt;/span&gt;) == &lt;span class="kwrd"&gt;false&lt;/span&gt;)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;         Console.WriteLine(&lt;span class="str"&gt;"Unable to enum devices"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;         &lt;span class="kwrd"&gt;return&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (BluetoothDevice device &lt;span class="kwrd"&gt;in&lt;/span&gt; bth.Devices)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;         Console.WriteLine(&lt;span class="str"&gt;"Devicename: {0}"&lt;/span&gt;, device.Name);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;         Console.WriteLine(&lt;span class="str"&gt;"LastSeen: {0}"&lt;/span&gt;, device.LastSeen.ToString());&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;         Console.WriteLine(&lt;span class="str"&gt;"LastUsed: {0}"&lt;/span&gt;, device.LastUsed.ToString());&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;         Console.WriteLine(&lt;span class="str"&gt;"Connected: {0}"&lt;/span&gt;, device.IsConnected.ToString());&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;         Console.WriteLine(&lt;span class="str"&gt;"Remembered: {0}"&lt;/span&gt;, device.IsRemembered.ToString());&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;         Console.WriteLine(&lt;span class="str"&gt;"Authenticated: {0}"&lt;/span&gt;, device.IsAuthenticated.ToString());&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;         Console.WriteLine(&lt;span class="str"&gt;"DeviceClass: {0}"&lt;/span&gt;, device.DeviceClassID);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;         Console.WriteLine(&lt;span class="str"&gt;"Address: {0}\n"&lt;/span&gt;, device.Address.ToString());&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;                &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;    }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;font face="Trebuchet MS" size="2"&gt;And below is an output screenshot:&lt;/font&gt;&lt;br&gt;&lt;/p&gt;&lt;a href="http://www.wintoolzone.com/images/WinToolZoneBluetoothSS.JPG" target="_blank"&gt;&lt;img title="Bluetooth device enumeration output using WinToolZone.Bluetooth" style="display: inline; width: 550px; height: 300px" height="300" alt="Bluetooth device enumeration output using WinToolZone.Bluetooth" src="http://www.wintoolzone.com/images/WinToolZoneBluetoothSS.JPG" width="550"&gt;&lt;/a&gt; &lt;!-- Tag links generated by Zoundry Blog Writer. Do not manually edit. http://www.zoundry.com --&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=110235"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=110235" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/110235.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna [gaurav@wintoolzone.com]</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2007/03/29/110235.aspx</guid>
            <pubDate>Thu, 29 Mar 2007 21:39:00 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2007/03/29/110235.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/110235.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/110235.aspx</trackback:ping>
        </item>
        <item>
            <title>WinToolZone.Bluetooth - Managed Bluetooth API for the desktop</title>
            <category>.NET Framework</category>
            <category>Development</category>
            <link>http://geekswithblogs.net/khanna/archive/2007/03/29/110234.aspx</link>
            <description>&lt;p&gt;&lt;span style="font-family: times new roman"&gt;&lt;font size="2"&gt;&lt;font face="Trebuchet MS"&gt;[&lt;em&gt;Originally posted on 5th July 2006]&lt;/em&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Trebuchet MS"&gt;One of the communication protocols not present in .NET Framework class libraries is Bluetooth. So today, I started to work on my implementation of a managed API for Bluetooth programming - &lt;em&gt;&lt;strong&gt;WinToolZone.Bluetooth&lt;/strong&gt;&lt;/em&gt;. I am authoring it using &lt;em&gt;Managed C++&lt;/em&gt; and leveraging the Microsoft Bluetooth stack APIs.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;I just completed implementing the support for enumerating the &lt;em&gt;Bluetooth radios&lt;/em&gt; on a machine. Below is a C# program that exemplifies how they can be enumerated:&lt;/font&gt;&lt;/p&gt; &lt;div class="CodeFormatContainer"&gt;.  &lt;style&gt;
&lt;!--
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }

--&gt;
&lt;/style&gt;  &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; WinToolZone;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; BTHCSClient&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;        {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;            Bluetooth bth = &lt;span class="kwrd"&gt;new&lt;/span&gt; Bluetooth();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (bth.RefreshRadios())&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;            {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;                &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (BluetoothRadio radio &lt;span class="kwrd"&gt;in&lt;/span&gt; bth.Radios)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;                {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;                    Console.WriteLine(&lt;span class="str"&gt;"RadioName: {0}"&lt;/span&gt;, radio.Name);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;                    Console.WriteLine(&lt;span class="str"&gt;"Address: {0}"&lt;/span&gt;, radio.Address.ToString());&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;                    Console.WriteLine(&lt;span class="str"&gt;"ManuID: {0}"&lt;/span&gt;, radio.ManufacturerID);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;                    Console.WriteLine(&lt;span class="str"&gt;"LMPSubversion: {0}"&lt;/span&gt;, radio.LMPSubversion);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;                    Console.WriteLine(&lt;span class="str"&gt;"DeviceClass: {0}"&lt;/span&gt;, radio.DeviceClass);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;                }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;            }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;            &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;            {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;                Console.WriteLine(&lt;span class="str"&gt;"Unable to enumerate BTH radios"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;            }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=110234"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=110234" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;B