<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" 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:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>this.Pose() as Expert - Vista</title>
    <link>http://chrison.net/</link>
    <description />
    <language>en-us</language>
    <copyright>Christoph Wille</copyright>
    <lastBuildDate>Wed, 30 Jul 2008 14:55:11 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>christoph.wille@gmail.com</managingEditor>
    <webMaster>christoph.wille@gmail.com</webMaster>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=f0d1f505-a9c2-4536-81b1-862c87c7e745</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,f0d1f505-a9c2-4536-81b1-862c87c7e745.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,f0d1f505-a9c2-4536-81b1-862c87c7e745.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=f0d1f505-a9c2-4536-81b1-862c87c7e745</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I am currently working on a Compact Framework project, and started development on
a different machine - where I successfully used the Cellular Emulator of the Windows
Mobile SDK. Today, on the other machine (the laptop), it didn't start but present
me with the following error message:
</p>
        <p>
          <img src="http://chrison.net/content/binary/sevenpairsofsomething.png" border="0" />
        </p>
        <p>
After some searching (on the G-word search engine), I came across this post:
</p>
        <p>
          <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3538593&amp;SiteID=1">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3538593&amp;SiteID=1</a>
        </p>
        <p>
Sure enough I am using Vista x64, heck, we are living in 2008 with multicore CPUs
and 4GB+ of RAM!
</p>
        <p>
And here is the Catch 22: when moving development to a Virtual PC image, you don't
get USB ports which you need for connecting to a real device...
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=f0d1f505-a9c2-4536-81b1-862c87c7e745" />
      </body>
      <title>Mid-2008 and x64 is Still a Dead End</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,f0d1f505-a9c2-4536-81b1-862c87c7e745.aspx</guid>
      <link>http://chrison.net/Mid2008AndX64IsStillADeadEnd.aspx</link>
      <pubDate>Wed, 30 Jul 2008 14:55:11 GMT</pubDate>
      <description>&lt;p&gt;
I am currently working on a Compact Framework project, and started development on
a different machine - where I successfully used the Cellular Emulator of the Windows
Mobile SDK. Today, on the other machine (the laptop), it didn't start but present
me with the following error message:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/sevenpairsofsomething.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
After some searching (on the G-word search engine), I came across this post:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3538593&amp;amp;SiteID=1"&gt;http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3538593&amp;amp;SiteID=1&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Sure enough I am using Vista x64, heck, we are living in 2008 with multicore CPUs
and 4GB+ of RAM!
&lt;/p&gt;
&lt;p&gt;
And here is the Catch 22: when moving development to a Virtual PC image, you don't
get USB ports which you need for connecting to a real device...
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=f0d1f505-a9c2-4536-81b1-862c87c7e745" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,f0d1f505-a9c2-4536-81b1-862c87c7e745.aspx</comments>
      <category>.NET</category>
      <category>Smartphone and PocketPC</category>
      <category>Vista</category>
      <category>x64</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=fda92259-cadc-4f15-9419-bc11af9cd423</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,fda92259-cadc-4f15-9419-bc11af9cd423.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,fda92259-cadc-4f15-9419-bc11af9cd423.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=fda92259-cadc-4f15-9419-bc11af9cd423</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <p>
          <img src="http://chrison.net/content/binary/DriverSoftwareInstallation.png" border="0" />
        </p>
        <p>
This is the most ridiculous message I have received so far on Vista.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=fda92259-cadc-4f15-9419-bc11af9cd423" />
      </body>
      <title>Unknown Device Installed &amp; Ready to Use</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,fda92259-cadc-4f15-9419-bc11af9cd423.aspx</guid>
      <link>http://chrison.net/UnknownDeviceInstalledReadyToUse.aspx</link>
      <pubDate>Thu, 19 Jul 2007 09:33:56 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/DriverSoftwareInstallation.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
This is the most ridiculous message I have received so far on Vista.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=fda92259-cadc-4f15-9419-bc11af9cd423" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,fda92259-cadc-4f15-9419-bc11af9cd423.aspx</comments>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=df13057c-d32e-47df-80cc-6d8aa456c428</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,df13057c-d32e-47df-80cc-6d8aa456c428.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,df13057c-d32e-47df-80cc-6d8aa456c428.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=df13057c-d32e-47df-80cc-6d8aa456c428</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
"<em>The Sony Ericsson Update Service for Windows Vista™ will be available for download
on </em><a href="http://www.sonyericsson.com/updateservice"><em>www.sonyericsson.com/updateservice</em></a><em> in
September."</em> You ain't serious, right? This is more than annoying simply because
I don't have a single computer with XP any more - <a href="http://chrison.net/WhenYouThoughtYouHadSeenItAll.aspx">not
that SE software ever worked on XP either</a>.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=df13057c-d32e-47df-80cc-6d8aa456c428" />
      </body>
      <title>Sony Ericsson Must be Kidding Me</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,df13057c-d32e-47df-80cc-6d8aa456c428.aspx</guid>
      <link>http://chrison.net/SonyEricssonMustBeKiddingMe.aspx</link>
      <pubDate>Thu, 28 Jun 2007 08:34:29 GMT</pubDate>
      <description>&lt;p&gt;
"&lt;em&gt;The Sony Ericsson Update Service for Windows Vista™ will be available for download
on &lt;/em&gt;&lt;a href="http://www.sonyericsson.com/updateservice"&gt;&lt;em&gt;www.sonyericsson.com/updateservice&lt;/em&gt;&lt;/a&gt;&lt;em&gt; in
September."&lt;/em&gt; You ain't serious, right? This is more than annoying simply because
I don't have&amp;nbsp;a single&amp;nbsp;computer with XP any more - &lt;a href="http://chrison.net/WhenYouThoughtYouHadSeenItAll.aspx"&gt;not
that SE software ever worked on XP either&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=df13057c-d32e-47df-80cc-6d8aa456c428" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,df13057c-d32e-47df-80cc-6d8aa456c428.aspx</comments>
      <category>this</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=406befc0-334e-4a9d-8812-d840d5869617</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,406befc0-334e-4a9d-8812-d840d5869617.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,406befc0-334e-4a9d-8812-d840d5869617.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=406befc0-334e-4a9d-8812-d840d5869617</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Microsoft <a href="http://www.microsoft.com/downloads/details.aspx?familyid=2cd92e43-6cda-478a-9e3b-4f831e899433&amp;displaylang=en&amp;tm">released
a UAC demo</a>. It is just basic process elevation (read: save the time by not downloading
it), which I described in more detail (with more reuseability) in <a href="http://chrison.net/UACElevationInManagedCodeStartingElevatedProcesses.aspx">UAC
Elevation in Managed Code: Starting Elevated Processes</a>.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=406befc0-334e-4a9d-8812-d840d5869617" />
      </body>
      <title>MS Sample for Starting Elevated Processes (UAC)</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,406befc0-334e-4a9d-8812-d840d5869617.aspx</guid>
      <link>http://chrison.net/MSSampleForStartingElevatedProcessesUAC.aspx</link>
      <pubDate>Mon, 04 Jun 2007 08:34:52 GMT</pubDate>
      <description>&lt;p&gt;
Microsoft &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=2cd92e43-6cda-478a-9e3b-4f831e899433&amp;amp;displaylang=en&amp;amp;tm"&gt;released
a UAC demo&lt;/a&gt;. It is just basic process elevation (read: save the time by not downloading
it), which I described in more detail (with more reuseability) in &lt;a href="http://chrison.net/UACElevationInManagedCodeStartingElevatedProcesses.aspx"&gt;UAC
Elevation in Managed Code: Starting Elevated Processes&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=406befc0-334e-4a9d-8812-d840d5869617" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,406befc0-334e-4a9d-8812-d840d5869617.aspx</comments>
      <category>.NET</category>
      <category>Vista</category>
      <category>UAC</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=805f55d7-c0a7-4066-a553-050479e2940b</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,805f55d7-c0a7-4066-a553-050479e2940b.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,805f55d7-c0a7-4066-a553-050479e2940b.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=805f55d7-c0a7-4066-a553-050479e2940b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Just tried to do the usual "telnet myserver port#" to see if a service is actually
listening, but Vista came up with a search window. The command line told me that there
is no such tool as telnet. Wtf? Solution: <a href="http://vista.beyondthemanual.com/2006/11/vista_tip_get_telnet_back.html">Vista
Tip: Get Telnet Back</a></p>
        <p>
          <img src="http://chrison.net/content/binary/InstallingTelnetOnVista.png" border="0" />
        </p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=805f55d7-c0a7-4066-a553-050479e2940b" />
      </body>
      <title>Telnet in Vista</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,805f55d7-c0a7-4066-a553-050479e2940b.aspx</guid>
      <link>http://chrison.net/TelnetInVista.aspx</link>
      <pubDate>Thu, 10 May 2007 08:46:01 GMT</pubDate>
      <description>&lt;p&gt;
Just tried to do the usual "telnet myserver port#" to see if a service is actually
listening, but Vista came up with a search window. The command line told me that there
is no such tool as telnet. Wtf? Solution: &lt;a href="http://vista.beyondthemanual.com/2006/11/vista_tip_get_telnet_back.html"&gt;Vista
Tip: Get Telnet Back&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/InstallingTelnetOnVista.png" border=0&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=805f55d7-c0a7-4066-a553-050479e2940b" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,805f55d7-c0a7-4066-a553-050479e2940b.aspx</comments>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=110bfeb2-3676-438a-a5af-57c5921e1862</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,110bfeb2-3676-438a-a5af-57c5921e1862.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,110bfeb2-3676-438a-a5af-57c5921e1862.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=110bfeb2-3676-438a-a5af-57c5921e1862</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
This is <a href="http://www.microsoft.com/downloads/details.aspx?familyid=ba73b169-a648-49af-bc5e-a2eebb74c16b&amp;displaylang=en&amp;tm">v2
of the Vista UAC development requirements document</a>. From the TOC:
</p>
        <ul>
          <li>
Why User Account Control? 
</li>
          <li>
How UAC Works 
</li>
          <li>
Will UAC Affect Your Application? 
</li>
          <li>
Designing Applications for Windows Vista 
</li>
          <li>
Deploying and Patching Applications for Standard Users 
</li>
          <li>
Troubleshooting Common Issues 
</li>
          <li>
References</li>
        </ul>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=110bfeb2-3676-438a-a5af-57c5921e1862" />
      </body>
      <title>Windows Vista Application Development Requirements for User Account Control Compatibility</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,110bfeb2-3676-438a-a5af-57c5921e1862.aspx</guid>
      <link>http://chrison.net/WindowsVistaApplicationDevelopmentRequirementsForUserAccountControlCompatibility.aspx</link>
      <pubDate>Wed, 21 Feb 2007 08:48:17 GMT</pubDate>
      <description>&lt;p&gt;
This is &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=ba73b169-a648-49af-bc5e-a2eebb74c16b&amp;amp;displaylang=en&amp;amp;tm"&gt;v2
of the Vista UAC development requirements document&lt;/a&gt;. From the TOC:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Why User Account Control? 
&lt;li&gt;
How UAC Works 
&lt;li&gt;
Will UAC Affect Your Application? 
&lt;li&gt;
Designing Applications for Windows Vista 
&lt;li&gt;
Deploying and Patching Applications for Standard Users 
&lt;li&gt;
Troubleshooting Common Issues 
&lt;li&gt;
References&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=110bfeb2-3676-438a-a5af-57c5921e1862" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,110bfeb2-3676-438a-a5af-57c5921e1862.aspx</comments>
      <category>Security</category>
      <category>UAC</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=c111f9a0-7e3e-40ea-9b6a-8b5f01c85082</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,c111f9a0-7e3e-40ea-9b6a-8b5f01c85082.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,c111f9a0-7e3e-40ea-9b6a-8b5f01c85082.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=c111f9a0-7e3e-40ea-9b6a-8b5f01c85082</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <img src="http://chrison.net/content/binary/isthisweirdorwhat.png" border="0" />
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=c111f9a0-7e3e-40ea-9b6a-8b5f01c85082" />
      </body>
      <title>What is Vista Trying to Tell Me?</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,c111f9a0-7e3e-40ea-9b6a-8b5f01c85082.aspx</guid>
      <link>http://chrison.net/WhatIsVistaTryingToTellMe.aspx</link>
      <pubDate>Fri, 16 Feb 2007 18:51:04 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;img src="http://chrison.net/content/binary/isthisweirdorwhat.png" border=0&gt;&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=c111f9a0-7e3e-40ea-9b6a-8b5f01c85082" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,c111f9a0-7e3e-40ea-9b6a-8b5f01c85082.aspx</comments>
      <category>this</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=07f52abe-5ebe-4f41-97b4-7d1aa32ec09c</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,07f52abe-5ebe-4f41-97b4-7d1aa32ec09c.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,07f52abe-5ebe-4f41-97b4-7d1aa32ec09c.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=07f52abe-5ebe-4f41-97b4-7d1aa32ec09c</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In my last blog entry <a href="http://chrison.net/UACElevationInManagedCodeANETCOMComponentElevated.aspx">UAC
Elevation in Managed Code: A .NET COM Component Elevated</a> I showed how to get up
and running with an all-managed code solution for UAC and COM elevation. Today I want
close out my series on UAC with some information on how to properly organize
the project plus present a library you can reuse to get up and running quickly - without
many of the manual and tedious steps from the previous proof of concept example.
</p>
        <p>
Speaking of the previous sample: it is still the basis for this best practice, so
the following directory layout will look familiar to you:
</p>
        <p>
          <img src="http://chrison.net/content/binary/xplatformdirlayout.png" border="0" />
        </p>
        <p>
Before diving into code, I want to start out with the SampleSetup directory, which
contains the executables. As you can guess, the starting point is Step1Register. It
contains register.bat, which you have to execute:
</p>
        <p>
          <img src="http://chrison.net/content/binary/xplatformregistration.png" border="0" />
        </p>
        <p>
Note that on machines without the .NET Framework SDK, there is no gacutil.exe. In
that case, you have to drag &amp; drop ManagedElevator.dll to c:\windows\assembly. 
</p>
        <p>
And in case you have been wondering from this screenshot, yes, the application now
also plays nicely on Windows XP:
</p>
        <p>
          <img src="http://chrison.net/content/binary/xplatformrunxp.png" border="0" />
        </p>
        <p>
Of course, there is no consent UI popping up, nor is there a shield icon like there
is on Windows Vista:
</p>
        <p>
          <img src="http://chrison.net/content/binary/xplatformrunvista.png" border="0" />
        </p>
        <p>
The magic for this cross-platform functionality is hidden in the UACHelper project
- which brings us to the source section of this blog post:
</p>
        <p>
          <img src="http://chrison.net/content/binary/xplatformuachelpercd.png" border="0" />
        </p>
        <p>
All the necessary COM elevation magic is now moved to this neat little library - including
the adapted UAC bits of VistaBridgeLibrary (no longer necessary). The names already
give away the purpose of each class and where they are used:
</p>
        <ul>
          <li>
            <strong>COMRegistration</strong> Used by the elevated component to automatically register
the necessary registry keys. 
</li>
          <li>
            <strong>ShieldButton</strong> Used by the client to display a button with a shield
icon (on Vista). For XP, no shield is rendered. 
</li>
          <li>
            <strong>COMElevation</strong> Starts the requested component with admin privileges. 
</li>
          <li>
            <strong>ElevatedProcess</strong>
            <a href="http://chrison.net/UACElevationInManagedCodeStartingElevatedProcesses.aspx">If
you want to start a simple process elevated</a>. Not used in this guidance.</li>
        </ul>
        <p>
The first customer of this library is the elevated component, so we start discussing
this guy next:
</p>
        <p>
          <img src="http://chrison.net/content/binary/xplatformmanagedelevatorcd.png" border="0" />
        </p>
        <p>
At first glance, this is similar to the previous POC implementation. The main difference
now is that I have broken down the functionality by feature area into namespaces:
</p>
        <ul>
          <li>
The "main" namespace 
</li>
          <li>
The .Components namespace 
</li>
          <li>
The .Guids namespace 
</li>
          <li>
The .InterOp namespace</li>
        </ul>
        <p>
Let's look at these one by one.
</p>
        <p>
          <strong>The "main" namespace</strong>
        </p>
        <p>
Here, we have one class only:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> RegisterFunctions<br />
{<br />
  [ComRegisterFunction]<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> CustomRegister(Type
t)<br />
  {<br />
    COMRegistration.RegisterForElevation(Assembly.GetExecutingAssembly().Location,<br />
       SampleComponent.ClassToElevate,<br />
       Global.AppId,<br />
       100);<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">    //
add additional "for elevation" components here by duplicating the above</span><br />
  }<br /><br />
  [ComUnregisterFunction]<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> CustomUnregister(Type
t)<br />
  {<br />
    COMRegistration.UnRegisterFromElevation(Assembly.GetExecutingAssembly().Location, 
<br />
        Global.AppId);<br />
  }<br />
}</span>
        </p>
        <p>
It is called when the assembly is regasm'ed, and it is here where you call into COMRegistration.RegisterForElevation
to add all the necessary registry keys for elevation:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> RegisterForElevation(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> assemblyLocation,<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   
string</span> classToElevate,<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   
string</span> appId,<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   
int</span> localizedStringId)<br />
{<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> if</span> (!UACHelperFunctions.IsUACEnabledOS()) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">return</span>;<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> //
[HKEY_CLASSES_ROOT\CLSID\{71E050A7-AF7F-42dd-BE00-BF955DDD13D4}]</span><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> //
"AppID"="{75AB90B0-8B9C-45c9-AC55-C53A9D718E1A}"</span><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> //
"LocalizedString"="@E:\\Daten\\Firma\\Konferenzen und Talks\\..."</span><br />
 RegistryKey classKey <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Registry.ClassesRoot.OpenSubKey(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">@"CLSID\{"</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> classToElevate <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"}"</span>, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>);<br />
 classKey.SetValue(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"AppId"</span>, <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"{"</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> appId <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"}"</span>,
RegistryValueKind.String);<br />
 classKey.SetValue(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"LocalizedString"</span>, <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"@"</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> assemblyLocation <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">",-"</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> localizedStringId.ToString(),
RegistryValueKind.String);<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> //
[HKEY_CLASSES_ROOT\CLSID\{71E050A7-AF7F-42dd-BE00-BF955DDD13D4}\Elevation]</span><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> //
"Enabled"=dword:00000001</span><br />
 RegistryKey elevationKey <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> classKey.CreateSubKey(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Elevation"</span>);<br />
 elevationKey.SetValue(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Enabled"</span>,
1, RegistryValueKind.DWord);<br />
 elevationKey.Close();<br /><br />
 classKey.Close();<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> //
[HKEY_CLASSES_ROOT\AppID\{75AB90B0-8B9C-45c9-AC55-C53A9D718E1A}]</span><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> //
@="ManagedElevator"</span><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> //
"DllSurrogate"=""</span><br />
 RegistryKey hkcrappId <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Registry.ClassesRoot.OpenSubKey(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"AppID"</span>, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>);<br />
 RegistryKey appIdKey <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> hkcrappId.CreateSubKey(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"{"</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> appId <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"}"</span>);<br />
 appIdKey.SetValue(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>,
Path.GetFileNameWithoutExtension(assemblyLocation));<br />
 appIdKey.SetValue(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"DllSurrogate"</span>, <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">""</span>,
RegistryValueKind.String);<br />
 appIdKey.Close();<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> //
[HKEY_CLASSES_ROOT\AppID\ManagedElevator.dll]</span><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> //
"AppID"="{75AB90B0-8B9C-45c9-AC55-C53A9D718E1A}"</span><br />
 RegistryKey asmKey <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> hkcrappId.CreateSubKey(Path.GetFileName(assemblyLocation));<br />
 asmKey.SetValue(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"AppID"</span>, <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"{"</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> appId <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"}"</span>,
RegistryValueKind.String);<br />
 asmKey.Close();<br /><br />
 hkcrappId.Close();<br />
}</span>
        </p>
        <p>
Please take note that when the component is registered on eg Windows XP, no registry
entries are written. After all, they are not needed.
</p>
        <p>
          <strong>The .Components namespace</strong>
        </p>
        <p>
Not much of a change - it contains the administrative component(s).
</p>
        <p>
          <strong>The .Guids namespace</strong>
        </p>
        <p>
The guids have been moved to a separate namespace. The reason? That way you can reference
the assembly in the client project and use the guids directly - no magic strings anywhere
any more.
</p>
        <p>
          <strong>The .InterOp namespace</strong>
        </p>
        <p>
This is the most important change with regards to the POC project - defining the correct
ComImport'ed interface is now the responsibility of the implementer of the elevated
component. That way, anyone needing access to this component only needs to reference
the assembly and they are good to go. It is a bad idea to have this interface part
of the client codebase!
</p>
        <p>
Speaking of the client... here is the button code for DemoForm.cs:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> cmdLaunch_Click(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> sender,
EventArgs e)<br />
{<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> if</span> (UACHelperFunctions.IsUACEnabledOS())<br />
 {<br />
   IHelloWorld ihw <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> COMElevation.Start&lt;IHelloWorld&gt;(<br />
        SampleComponent.ClassToElevate, SampleComponent.IHelloWorld);<br />
   ihw.SayHello();<br />
   COMElevation.Release(ihw);<br />
 }<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> else</span><br />
 { 
<br />
   ManagedElevator.Components.ClassToElevate c <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> ManagedElevator.Components.ClassToElevate();<br />
   c.SayHello();<br />
 }<br />
}</span>
        </p>
        <p>
What looks interesting at first is COMElevation.Start as well as Release:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> COMElevation<br />
{<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span> TIFace
Start&lt;TIFace&gt;(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> IID_Class, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> IID_Interface)<br />
 {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">  return</span> Start&lt;TIFace&gt;(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> Guid(IID_Class), <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> Guid(IID_Interface));<br />
 }<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span> TIFace
Start&lt;TIFace&gt;(Guid IID_Class, Guid IID_Interface)<br />
 {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
object</span> o <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> UACManager.LaunchElevatedCOMObject(IID_Class,
IID_Interface);<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
return</span> (TIFace)o;<br />
 }<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> Release(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> o)<br />
 {<br />
  Marshal.ReleaseComObject(o);<br />
 }<br />
}</span>
        </p>
        <p>
Actually all it does is encapsulate the necessary calls to UACManager and Marshal.
Why is there no if / else using IsUACEnabledOS here? Well, at first I thought I'd
build such a switch, but then I thought again: why would I use COM InterOp if I don't
have to? I already referenced the assembly for the component (for the guids and interop
interface), so why not use managed all the way and save time? That's what I did in
the cmdLaunch_Click event handler.
</p>
        <p>
That's it for the code folks, now a little discussion at the end on why in the world
would you even think about doing this in a cross-platform way, or why it is a stupid
idea all along:
</p>
        <p>
This approach is only sensible if your application runs as administrative user on
XP, otherwise all the calls in the administrative component will fail. However, the
cross-platform part is only there to make it a complete best practice, there is no
"you must use it cross-platform" - if you build applications for Windows Vista with
the eventual need to elevate a task, then UACHelper is definitely for you! (and forget
about that it would even work on XP)
</p>
        <p>
Oh, and I almost forgot - here is the complete download, source code included of course
(my code is BSD licensed):
</p>
        <p>
          <a href="http://chrison.net/content/binary/AutomaticRegistration.zip">AutomaticRegistration.zip
(91.92 KB)</a>
        </p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=07f52abe-5ebe-4f41-97b4-7d1aa32ec09c" />
      </body>
      <title>UAC Elevation in Managed Code: Guidance for Implementing COM Elevation</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,07f52abe-5ebe-4f41-97b4-7d1aa32ec09c.aspx</guid>
      <link>http://chrison.net/UACElevationInManagedCodeGuidanceForImplementingCOMElevation.aspx</link>
      <pubDate>Fri, 16 Feb 2007 07:02:29 GMT</pubDate>
      <description>&lt;p&gt;
In my last blog entry &lt;a href="http://chrison.net/UACElevationInManagedCodeANETCOMComponentElevated.aspx"&gt;UAC
Elevation in Managed Code: A .NET COM Component Elevated&lt;/a&gt; I showed how to get up
and running with an all-managed code solution for UAC and COM elevation. Today I want
close out my series on UAC with&amp;nbsp;some information on how to properly organize
the project plus present a library you can reuse to get up and running quickly - without
many of the manual and tedious steps from the previous proof of concept&amp;nbsp;example.
&lt;/p&gt;
&lt;p&gt;
Speaking of the previous sample: it is still the basis for this best practice, so
the following directory layout will look familiar to you:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/xplatformdirlayout.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Before diving into code, I want to start out with the SampleSetup directory, which
contains the executables. As you can guess, the starting point is Step1Register. It
contains register.bat, which you have to execute:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/xplatformregistration.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Note that on machines without the .NET Framework SDK, there is no gacutil.exe. In
that case, you have to drag &amp;amp; drop ManagedElevator.dll to c:\windows\assembly. 
&lt;/p&gt;
&lt;p&gt;
And in case you have been wondering from this screenshot, yes, the application now
also plays nicely on Windows XP:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/xplatformrunxp.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Of course, there is no consent UI popping up, nor is there a shield icon like there
is on Windows Vista:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/xplatformrunvista.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
The magic for this cross-platform functionality is hidden in the UACHelper project
- which brings us to the source section of this blog post:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/xplatformuachelpercd.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
All the necessary COM elevation magic is now moved to this neat little library - including
the adapted UAC bits of VistaBridgeLibrary (no longer necessary). The names already
give away the purpose of each class and where they are used:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;COMRegistration&lt;/strong&gt; Used by the elevated component to automatically register
the necessary registry keys. 
&lt;li&gt;
&lt;strong&gt;ShieldButton&lt;/strong&gt; Used by the client to display a button with a shield
icon (on Vista). For XP, no shield is rendered. 
&lt;li&gt;
&lt;strong&gt;COMElevation&lt;/strong&gt; Starts the requested component with admin privileges. 
&lt;li&gt;
&lt;strong&gt;ElevatedProcess&lt;/strong&gt; &lt;a href="http://chrison.net/UACElevationInManagedCodeStartingElevatedProcesses.aspx"&gt;If
you want to start a simple process elevated&lt;/a&gt;. Not used in this guidance.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The first customer of this library is the elevated component, so we start discussing
this guy next:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/xplatformmanagedelevatorcd.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
At first glance, this is similar to the previous POC implementation. The main difference
now is that I have broken down the functionality by feature area into namespaces:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
The "main" namespace 
&lt;li&gt;
The .Components namespace 
&lt;li&gt;
The .Guids namespace 
&lt;li&gt;
The .InterOp namespace&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Let's look at these one by one.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;The "main" namespace&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Here, we have one class only:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; RegisterFunctions&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; [ComRegisterFunction]&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; CustomRegister(Type
t)&lt;br&gt;
&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; COMRegistration.RegisterForElevation(Assembly.GetExecutingAssembly().Location,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SampleComponent.ClassToElevate,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Global.AppId,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100);&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
add additional "for elevation" components here by duplicating the above&lt;/span&gt;
&lt;br&gt;
&amp;nbsp; }&lt;br&gt;
&lt;br&gt;
&amp;nbsp; [ComUnregisterFunction]&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; CustomUnregister(Type
t)&lt;br&gt;
&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; COMRegistration.UnRegisterFromElevation(Assembly.GetExecutingAssembly().Location, 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Global.AppId);&lt;br&gt;
&amp;nbsp; }&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
It is called when the assembly is regasm'ed, and it is here where you call into COMRegistration.RegisterForElevation
to add all the necessary registry keys for elevation:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; RegisterForElevation(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; assemblyLocation,&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
string&lt;/span&gt; classToElevate,&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
string&lt;/span&gt; appId,&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
int&lt;/span&gt; localizedStringId)&lt;br&gt;
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;if&lt;/span&gt; (!UACHelperFunctions.IsUACEnabledOS()) &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;return&lt;/span&gt;;&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;//
[HKEY_CLASSES_ROOT\CLSID\{71E050A7-AF7F-42dd-BE00-BF955DDD13D4}]&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;//
"AppID"="{75AB90B0-8B9C-45c9-AC55-C53A9D718E1A}"&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;//
"LocalizedString"="@E:\\Daten\\Firma\\Konferenzen und Talks\\..."&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;RegistryKey classKey &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; Registry.ClassesRoot.OpenSubKey(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;@"CLSID\{"&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; classToElevate &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"}"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;true&lt;/span&gt;);&lt;br&gt;
&amp;nbsp;classKey.SetValue(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"AppId"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"{"&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; appId &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"}"&lt;/span&gt;,
RegistryValueKind.String);&lt;br&gt;
&amp;nbsp;classKey.SetValue(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"LocalizedString"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"@"&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; assemblyLocation &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;",-"&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; localizedStringId.ToString(),
RegistryValueKind.String);&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;//
[HKEY_CLASSES_ROOT\CLSID\{71E050A7-AF7F-42dd-BE00-BF955DDD13D4}\Elevation]&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;//
"Enabled"=dword:00000001&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;RegistryKey elevationKey &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; classKey.CreateSubKey(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Elevation"&lt;/span&gt;);&lt;br&gt;
&amp;nbsp;elevationKey.SetValue(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Enabled"&lt;/span&gt;,
1, RegistryValueKind.DWord);&lt;br&gt;
&amp;nbsp;elevationKey.Close();&lt;br&gt;
&lt;br&gt;
&amp;nbsp;classKey.Close();&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;//
[HKEY_CLASSES_ROOT\AppID\{75AB90B0-8B9C-45c9-AC55-C53A9D718E1A}]&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;//
@="ManagedElevator"&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;//
"DllSurrogate"=""&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;RegistryKey hkcrappId &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; Registry.ClassesRoot.OpenSubKey(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"AppID"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;true&lt;/span&gt;);&lt;br&gt;
&amp;nbsp;RegistryKey appIdKey &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; hkcrappId.CreateSubKey(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"{"&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; appId &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"}"&lt;/span&gt;);&lt;br&gt;
&amp;nbsp;appIdKey.SetValue(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;,
Path.GetFileNameWithoutExtension(assemblyLocation));&lt;br&gt;
&amp;nbsp;appIdKey.SetValue(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"DllSurrogate"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;""&lt;/span&gt;,
RegistryValueKind.String);&lt;br&gt;
&amp;nbsp;appIdKey.Close();&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;//
[HKEY_CLASSES_ROOT\AppID\ManagedElevator.dll]&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;//
"AppID"="{75AB90B0-8B9C-45c9-AC55-C53A9D718E1A}"&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;RegistryKey asmKey &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; hkcrappId.CreateSubKey(Path.GetFileName(assemblyLocation));&lt;br&gt;
&amp;nbsp;asmKey.SetValue(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"AppID"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"{"&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; appId &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"}"&lt;/span&gt;,
RegistryValueKind.String);&lt;br&gt;
&amp;nbsp;asmKey.Close();&lt;br&gt;
&lt;br&gt;
&amp;nbsp;hkcrappId.Close();&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Please take note that when the component is registered on eg Windows XP, no registry
entries are written. After all, they are not needed.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;The .Components namespace&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Not much of a change - it contains the administrative component(s).
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;The .Guids namespace&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
The guids have been moved to a separate namespace. The reason? That way you can reference
the assembly in the client project and use the guids directly - no magic strings anywhere
any more.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;The .InterOp namespace&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
This is the most important change with regards to the POC project - defining the correct
ComImport'ed interface is now the responsibility of the implementer of the elevated
component. That way, anyone needing access to this component only needs to reference
the assembly and they are good to go. It is a bad idea to have this interface part
of the client codebase!
&lt;/p&gt;
&lt;p&gt;
Speaking of the client... here is the button code for DemoForm.cs:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; cmdLaunch_Click(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; sender,
EventArgs e)&lt;br&gt;
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;if&lt;/span&gt; (UACHelperFunctions.IsUACEnabledOS())&lt;br&gt;
&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp; IHelloWorld ihw &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; COMElevation.Start&amp;lt;IHelloWorld&amp;gt;(&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SampleComponent.ClassToElevate, SampleComponent.IHelloWorld);&lt;br&gt;
&amp;nbsp;&amp;nbsp; ihw.SayHello();&lt;br&gt;
&amp;nbsp;&amp;nbsp; COMElevation.Release(ihw);&lt;br&gt;
&amp;nbsp;}&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;else&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;{ 
&lt;br&gt;
&amp;nbsp;&amp;nbsp; ManagedElevator.Components.ClassToElevate c &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; ManagedElevator.Components.ClassToElevate();&lt;br&gt;
&amp;nbsp;&amp;nbsp; c.SayHello();&lt;br&gt;
&amp;nbsp;}&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
What looks interesting at first is COMElevation.Start as well as Release:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; COMElevation&lt;br&gt;
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; TIFace
Start&amp;lt;TIFace&amp;gt;(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; IID_Class, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; IID_Interface)&lt;br&gt;
&amp;nbsp;{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;return&lt;/span&gt; Start&amp;lt;TIFace&amp;gt;(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; Guid(IID_Class), &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; Guid(IID_Interface));&lt;br&gt;
&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; TIFace
Start&amp;lt;TIFace&amp;gt;(Guid IID_Class, Guid IID_Interface)&lt;br&gt;
&amp;nbsp;{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
object&lt;/span&gt; o &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; UACManager.LaunchElevatedCOMObject(IID_Class,
IID_Interface);&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
return&lt;/span&gt; (TIFace)o;&lt;br&gt;
&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; Release(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; o)&lt;br&gt;
&amp;nbsp;{&lt;br&gt;
&amp;nbsp; Marshal.ReleaseComObject(o);&lt;br&gt;
&amp;nbsp;}&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Actually all it does is encapsulate the necessary calls to UACManager and Marshal.
Why is there no if / else using IsUACEnabledOS here? Well, at first I thought I'd
build such a switch, but then I thought again: why would I use COM InterOp if I don't
have to? I already referenced the assembly for the component (for the guids and interop
interface), so why not use managed all the way and save time? That's what I did in
the cmdLaunch_Click event handler.
&lt;/p&gt;
&lt;p&gt;
That's it for the code folks, now a little discussion at the end on why in the world
would you even think about doing this in a cross-platform way, or why it is a stupid
idea all along:
&lt;/p&gt;
&lt;p&gt;
This approach is only sensible if your application runs as administrative user on
XP, otherwise all the calls in the administrative component will fail. However, the
cross-platform part is only there to make it a complete best practice, there is no
"you must use it cross-platform" - if you build applications for Windows Vista with
the eventual need to elevate a task, then UACHelper is definitely for you! (and forget
about that it would even work on XP)
&lt;/p&gt;
&lt;p&gt;
Oh, and I almost forgot - here is the complete download, source code included of course
(my code is BSD licensed):
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://chrison.net/content/binary/AutomaticRegistration.zip"&gt;AutomaticRegistration.zip
(91.92 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=07f52abe-5ebe-4f41-97b4-7d1aa32ec09c" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,07f52abe-5ebe-4f41-97b4-7d1aa32ec09c.aspx</comments>
      <category>Security</category>
      <category>UAC</category>
      <category>Use the source Luke</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=1392e674-8b58-407b-b101-903d7e9d95a8</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,1392e674-8b58-407b-b101-903d7e9d95a8.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,1392e674-8b58-407b-b101-903d7e9d95a8.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=1392e674-8b58-407b-b101-903d7e9d95a8</wfw:commentRss>
      <slash:comments>7</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I admit it: <a href="http://chrison.net/UACElevationInManagedCodeTalkingToAnElevatedProcessViaWCF.aspx">UAC
Elevation in Managed Code: "Talking" to an Elevated Process via WCF</a> is a kludge.
The reason why I dabbled with this approach at all is that I failed to implement COM
elevation with managed code (not <a href="http://chrison.net/UACElevationInManagedCodeStartingElevatedCOMComponents.aspx">elevating
a COM component</a>, but the COM component itself). However, at long last, I succeeded
in that respect too: I now present you the all-managed code solution to UAC elevation!
</p>
        <p>
Once again I built myself a small demo frontend application:
</p>
        <p>
          <img src="http://chrison.net/content/binary/comelevationincsharp.png" border="0" />
        </p>
        <p>
As you can guess, the first button does plain vanilla COM InterOp without any UAC
elevation. Thus its code is rather simple:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> simpleCallButton_Click(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> sender,
EventArgs e)<br />
{<br />
  Type t <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Type.GetTypeFromCLSID(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> Guid(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"71E050A7-AF7F-42dd-BE00-BF955DDD13D4"</span>));<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
object</span> o <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Activator.CreateInstance(t);<br />
  t.InvokeMember(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"SayHello"</span>,
BindingFlags.InvokeMethod, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>,
o, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>);<br />
}</span>
        </p>
        <p>
Why this reflection magic? Well, the COM component I am calling here is implemented
in .NET - and <a href="http://chrison.net/AReferenceToCouldNotBeAdded.aspx">both
VS as well as tlbimp balk at reimporting the exported type library</a>.
</p>
        <p>
The COM component in question has been regasm'ed &amp; gacutil'ed (ManagedElevator
project in the download). Although the name implies that I am after elevation, it
is pretty much a standard COM component written using C#:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> TheGuids<br />
{<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">const</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> IHelloWorld <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"B8CD5C09-9ACD-49b0-BF6F-C7B0F29795F9"</span>;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">const</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> ClassToElevate <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"71E050A7-AF7F-42dd-BE00-BF955DDD13D4"</span>;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">const</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> AppId <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"75AB90B0-8B9C-45c9-AC55-C53A9D718E1A"</span>;<br />
}<br /><br />
[Guid(TheGuids.IHelloWorld)]<br />
[InterfaceType(ComInterfaceType.InterfaceIsDual)]<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">interface</span> IHelloWorld<br />
{<br />
  [ComVisible(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>)]<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
void</span> SayHello();<br />
}<br /><br />
[Guid(TheGuids.ClassToElevate)]<br />
[ClassInterface(ClassInterfaceType.None)]<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> ClassToElevate
: IHelloWorld<br />
{<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> public</span> ClassToElevate()<br />
 {<br />
 }<br /><br />
 [ComVisible(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>)]<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> SayHello()<br />
 {<br />
  MessageBox.Show(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Hello
World"</span>);<br />
 }<br />
}<br /></span>
        </p>
        <p>
So how do you go from "standard" "plain-vanilla" COM component to COM elevation? The
part that stumped me for so long was the ClassInterface attribute - if you forget
this guy, you'll end up with an InvalidCastException thrown by UACManager.LaunchElevatedCOMObject.
</p>
        <p>
But that's not quite all to get up and running with COM elevation: in addition, you
need to modify the default registration for this component - specifically, you need
to configure the DllSurrogate. This is where the AppId GUID comes into play: it isn't
used in code (kept there for documentation purposes only), but in registryadditions.reg.
It binds the various registry keys. And speaking of this .reg file, please take note
of the LocalizedString value: it contains the text for the UAC prompt (also check
out UACPrompts.rc, resource.h, compilerc.bat as well as the properties of the ManagedElevator
project where the compiled .res file is referenced). 
</p>
        <p>
          <strong>Note</strong> Before importing the .reg file into the registry make sure to
fix the file path contained in LocalizedString! And if you create your own elevated
COM component DO NOT reuse any of my three GUIDs - use guidgen.exe to create your
personal ones.
</p>
        <p>
From there, UAC elevation is smooth sailing. The Reflection version of COM elevation
looks very similar to non-elevated calls:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> managedElevation_Click(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> sender,
EventArgs e)<br />
{<br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
// CLSID</span><br />
  Guid classId <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> Guid(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"71E050A7-AF7F-42dd-BE00-BF955DDD13D4"</span>);<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
// Interface ID</span><br />
  Guid interfaceId <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> Guid(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"B8CD5C09-9ACD-49b0-BF6F-C7B0F29795F9"</span>);<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
object</span> o <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> UACManager.LaunchElevatedCOMObject(classId,
interfaceId);<br /><br />
  Type t <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> o.GetType();<br />
  t.InvokeMember(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"SayHello"</span>,
BindingFlags.InvokeMethod, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>,
o, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>);<br /><br />
  Marshal.ReleaseComObject(o);<br />
}</span>
        </p>
        <p>
Of course this is not really a good solution (late binding). So instead I manually
imported the IHelloWorld interface:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">[<br />
ComImport(), 
<br />
Guid(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"B8CD5C09-9ACD-49b0-BF6F-C7B0F29795F9"</span>), 
<br />
InterfaceType(ComInterfaceType.InterfaceIsDual)<br />
]<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
interface</span> IHelloWorld<br />
  {<br />
   [<br />
   MethodImpl(MethodImplOptions.InternalCall, MethodCodeType <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> MethodCodeType.Runtime),<br />
   PreserveSig<br />
   ]<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   
void</span> SayHello();<br />
  }</span>
        </p>
        <p>
Which makes calls into the elevated COM object much easier and cleaner:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> managedElevationInterface_Click(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> sender,
EventArgs e)<br />
{<br />
  Guid classId <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> Guid(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"71E050A7-AF7F-42dd-BE00-BF955DDD13D4"</span>);<br />
  Guid interfaceId <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> Guid(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"B8CD5C09-9ACD-49b0-BF6F-C7B0F29795F9"</span>);<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
object</span> o <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> UACManager.LaunchElevatedCOMObject(classId,
interfaceId);<br /><br />
  IHelloWorld ihw <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> (IHelloWorld)o;<br />
  ihw.SayHello();<br /><br />
  Marshal.ReleaseComObject(o);<br />
}</span>
        </p>
        <p>
So why should you use the COM elevation solution instead of starting the process?
Well, there are a couple of reasons:
</p>
        <ul>
          <li>
You can package more than one component into a DLL and still have custom UAC prompts
thanks to LocalizedString 
</li>
          <li>
Your users don't get "an unidentified program..." warnings. Thank you COM registration 
</li>
          <li>
If you ever need to talk more extensively with the elevated process then this approach
can be adapted more easily</li>
        </ul>
        <p>
          <strong>The source code</strong>
        </p>
        <p>
          <a href="http://chrison.net/content/binary/ConsumeMyElevatedCOM.zip">ConsumeMyElevatedCOM.zip
(97.56 KB)</a>
        </p>
        <p>
You will find a file aptly named notes.txt in the ManagedElevator project that describes
all the necessary steps to get up and running. 
</p>
        <p>
I hope you find this sample useful and not have to spend as much time as I did. Cheers!
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=1392e674-8b58-407b-b101-903d7e9d95a8" />
      </body>
      <title>UAC Elevation in Managed Code: A .NET COM Component Elevated</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,1392e674-8b58-407b-b101-903d7e9d95a8.aspx</guid>
      <link>http://chrison.net/UACElevationInManagedCodeANETCOMComponentElevated.aspx</link>
      <pubDate>Mon, 05 Feb 2007 21:41:46 GMT</pubDate>
      <description>&lt;p&gt;
I admit it: &lt;a href="http://chrison.net/UACElevationInManagedCodeTalkingToAnElevatedProcessViaWCF.aspx"&gt;UAC
Elevation in Managed Code: "Talking" to an Elevated Process via WCF&lt;/a&gt; is a kludge.
The reason why I dabbled with this approach at all is that I failed to implement COM
elevation with managed code (not &lt;a href="http://chrison.net/UACElevationInManagedCodeStartingElevatedCOMComponents.aspx"&gt;elevating
a COM component&lt;/a&gt;, but the COM component itself). However, at long last, I succeeded
in that respect too: I now present you the all-managed code solution to UAC elevation!
&lt;/p&gt;
&lt;p&gt;
Once again I built myself a small demo frontend application:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/comelevationincsharp.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
As you can guess, the first button does plain vanilla COM InterOp without any UAC
elevation. Thus its code is rather simple:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; simpleCallButton_Click(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; sender,
EventArgs e)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; Type t &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; Type.GetTypeFromCLSID(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; Guid(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"71E050A7-AF7F-42dd-BE00-BF955DDD13D4"&lt;/span&gt;));&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
object&lt;/span&gt; o &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; Activator.CreateInstance(t);&lt;br&gt;
&amp;nbsp; t.InvokeMember(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"SayHello"&lt;/span&gt;,
BindingFlags.InvokeMethod, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;,
o, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;);&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Why this reflection magic? Well, the COM component I am calling here is implemented
in .NET - and&amp;nbsp;&lt;a href="http://chrison.net/AReferenceToCouldNotBeAdded.aspx"&gt;both
VS&amp;nbsp;as well as&amp;nbsp;tlbimp balk at reimporting the exported type library&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
The COM component in question has been regasm'ed &amp;amp; gacutil'ed (ManagedElevator
project in the download). Although the name implies that I am after elevation, it
is pretty much a standard COM component written using C#:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; TheGuids&lt;br&gt;
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;const&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; IHelloWorld &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"B8CD5C09-9ACD-49b0-BF6F-C7B0F29795F9"&lt;/span&gt;;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;const&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; ClassToElevate &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"71E050A7-AF7F-42dd-BE00-BF955DDD13D4"&lt;/span&gt;;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;const&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; AppId &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"75AB90B0-8B9C-45c9-AC55-C53A9D718E1A"&lt;/span&gt;;&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
[Guid(TheGuids.IHelloWorld)]&lt;br&gt;
[InterfaceType(ComInterfaceType.InterfaceIsDual)]&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;interface&lt;/span&gt; IHelloWorld&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; [ComVisible(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;true&lt;/span&gt;)]&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
void&lt;/span&gt; SayHello();&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
[Guid(TheGuids.ClassToElevate)]&lt;br&gt;
[ClassInterface(ClassInterfaceType.None)]&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; ClassToElevate
: IHelloWorld&lt;br&gt;
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;public&lt;/span&gt; ClassToElevate()&lt;br&gt;
&amp;nbsp;{&lt;br&gt;
&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&amp;nbsp;[ComVisible(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;true&lt;/span&gt;)]&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; SayHello()&lt;br&gt;
&amp;nbsp;{&lt;br&gt;
&amp;nbsp; MessageBox.Show(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Hello
World"&lt;/span&gt;);&lt;br&gt;
&amp;nbsp;}&lt;br&gt;
}&lt;br&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
So how do you go from "standard" "plain-vanilla" COM component to COM elevation? The
part that stumped me for so long was the ClassInterface attribute - if you forget
this guy, you'll end up with an InvalidCastException thrown by UACManager.LaunchElevatedCOMObject.
&lt;/p&gt;
&lt;p&gt;
But that's not quite all to get up and running with COM elevation: in addition, you
need to modify the default registration for this component - specifically, you need
to configure the DllSurrogate. This is where the AppId GUID comes into play: it isn't
used in code (kept there for documentation purposes only), but in registryadditions.reg.
It binds the various registry keys. And speaking of this .reg file, please take note
of the LocalizedString value: it contains the text for the UAC prompt (also check
out UACPrompts.rc, resource.h, compilerc.bat as well as the properties of the ManagedElevator
project where the compiled .res file is referenced). 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Note&lt;/strong&gt; Before importing the .reg file into the registry make sure to
fix the file path contained in LocalizedString! And if you create your own elevated
COM component DO NOT reuse any of my three GUIDs - use guidgen.exe to create your
personal ones.
&lt;/p&gt;
&lt;p&gt;
From there, UAC elevation is smooth sailing. The Reflection version of COM elevation
looks very similar to non-elevated calls:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; managedElevation_Click(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; sender,
EventArgs e)&lt;br&gt;
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
// CLSID&lt;/span&gt;
&lt;br&gt;
&amp;nbsp; Guid classId &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; Guid(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"71E050A7-AF7F-42dd-BE00-BF955DDD13D4"&lt;/span&gt;);&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
// Interface ID&lt;/span&gt;
&lt;br&gt;
&amp;nbsp; Guid interfaceId &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; Guid(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"B8CD5C09-9ACD-49b0-BF6F-C7B0F29795F9"&lt;/span&gt;);&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
object&lt;/span&gt; o &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; UACManager.LaunchElevatedCOMObject(classId,
interfaceId);&lt;br&gt;
&lt;br&gt;
&amp;nbsp; Type t &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; o.GetType();&lt;br&gt;
&amp;nbsp; t.InvokeMember(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"SayHello"&lt;/span&gt;,
BindingFlags.InvokeMethod, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;,
o, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;);&lt;br&gt;
&lt;br&gt;
&amp;nbsp; Marshal.ReleaseComObject(o);&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Of course this is not really a good solution (late binding). So instead I manually
imported the IHelloWorld interface:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;[&lt;br&gt;
ComImport(), 
&lt;br&gt;
Guid(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"B8CD5C09-9ACD-49b0-BF6F-C7B0F29795F9"&lt;/span&gt;), 
&lt;br&gt;
InterfaceType(ComInterfaceType.InterfaceIsDual)&lt;br&gt;
]&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
interface&lt;/span&gt; IHelloWorld&lt;br&gt;
&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp; [&lt;br&gt;
&amp;nbsp;&amp;nbsp; MethodImpl(MethodImplOptions.InternalCall, MethodCodeType &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; MethodCodeType.Runtime),&lt;br&gt;
&amp;nbsp;&amp;nbsp; PreserveSig&lt;br&gt;
&amp;nbsp; &amp;nbsp;]&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
void&lt;/span&gt; SayHello();&lt;br&gt;
&amp;nbsp; }&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Which makes calls into the elevated COM object much easier and cleaner:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; managedElevationInterface_Click(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; sender,
EventArgs e)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; Guid classId &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; Guid(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"71E050A7-AF7F-42dd-BE00-BF955DDD13D4"&lt;/span&gt;);&lt;br&gt;
&amp;nbsp; Guid interfaceId &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; Guid(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"B8CD5C09-9ACD-49b0-BF6F-C7B0F29795F9"&lt;/span&gt;);&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
object&lt;/span&gt; o &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; UACManager.LaunchElevatedCOMObject(classId,
interfaceId);&lt;br&gt;
&lt;br&gt;
&amp;nbsp; IHelloWorld ihw &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; (IHelloWorld)o;&lt;br&gt;
&amp;nbsp; ihw.SayHello();&lt;br&gt;
&lt;br&gt;
&amp;nbsp; Marshal.ReleaseComObject(o);&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
So why should you use the COM elevation solution instead of starting the process?
Well, there are a couple of reasons:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
You can package more than one component into a DLL and still have custom UAC prompts
thanks to LocalizedString 
&lt;li&gt;
Your users don't get "an unidentified program..." warnings. Thank you COM registration 
&lt;li&gt;
If you ever need to talk more extensively with the elevated process then this approach
can be adapted more easily&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;The source code&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://chrison.net/content/binary/ConsumeMyElevatedCOM.zip"&gt;ConsumeMyElevatedCOM.zip
(97.56 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
You will find a file aptly named notes.txt in the ManagedElevator project that describes
all the necessary steps to get up and running. 
&lt;/p&gt;
&lt;p&gt;
I hope you find this sample useful and not have to spend as much time as I did. Cheers!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=1392e674-8b58-407b-b101-903d7e9d95a8" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,1392e674-8b58-407b-b101-903d7e9d95a8.aspx</comments>
      <category>.NET</category>
      <category>Security</category>
      <category>UAC</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=a860d58a-d4c5-4073-9fee-b3e5fab629bf</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,a860d58a-d4c5-4073-9fee-b3e5fab629bf.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,a860d58a-d4c5-4073-9fee-b3e5fab629bf.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=a860d58a-d4c5-4073-9fee-b3e5fab629bf</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In the blog post <a href="http://chrison.net/UACElevationInManagedCodeStartingElevatedProcesses.aspx">UAC
Elevation in Managed Code: Starting Elevated Processes</a> I talked about how to start
an elevated process. However, just starting a process might not cut the mustard, for
example if you need to hand over data to the elevated process. You could achieve this
by passing, let's say, some data as command line arguments to ProcessInfo before starting
the elevated process. But that seriously limits communication.
</p>
        <p>
So how can you perform communication with an elevated process? My first idea was to
use .NET Remoting. Once I thought through the multi-instance scenario, I quickly realized
that this meant the server had to be running in the non-elevated application, because
only it could properly choose a port. And because I am not a fan of Remoting anyways,
I decided to give WCF (Windows Communication Foundation, a pillar of .NET 3.0) a try.
</p>
        <p>
It looked like smooth sailing at first, but then I realized that with WCF too I needed
to implement the service inside the non-elevated application. This time, however,
the reason was "How do I know when the elevated application has initialized before
I can actually start communicating with it?". Back to the drawing board.
</p>
        <p>
The final solution now looks like this: the non-elevated application starts a service.
The operations contract specifies a callback, which, once the elevated application
has signalled its readiness, can be used by the non-elevated application to "talk"
with the elevated application. I didn't intend to go duplex, but hey, if there's no
other way I am willing to take plunge. Speaking of tricks of the trade: I am using
imperative binding to a named pipe. Reason? Well, WS bindings won't work (see <a href="http://dotnet.org.za/armand/archive/2006/06/14/53390.aspx">here</a> and <a href="http://blogs.msdn.com/drnick/archive/2006/10/16/configuring-http-for-windows-vista.aspx">here</a>),
and the TCP channel would pop up a firewall warning. That's why.
</p>
        <p>
Let's look at the applications - first the non-elevated one:
</p>
        <p>
          <img src="http://chrison.net/content/binary/uacwcfpoc1.png" border="0" />
        </p>
        <p>
This time I forfeited eye candy (the shield button). Same (missing eye candy) goes
for the elevated application as it is a console application only:
</p>
        <p>
          <img src="http://chrison.net/content/binary/uacwcfpoc3.png" border="0" />
        </p>
        <p>
Solution-wise, this simple two-application scenario is split into four projects:
</p>
        <p>
          <img src="http://chrison.net/content/binary/uacwcfpoc2.png" border="0" />
        </p>
        <p>
So where do we start? With the easy part inside ElevationContract:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">[ServiceContract(Namespace <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"http://Christoph.Wille.Samples"</span>,<br />
CallbackContract <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">typeof</span>(IElevatedProcess))]<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">interface</span> IWaitForElevatedProcess<br />
{<br />
  [OperationContract(IsOneWay <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">false</span>)]<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
void</span> ElevatedProcessStarted();<br />
}<br /><br />
[ServiceContract(Namespace <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"http://Christoph.Wille.Samples"</span>)]<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">interface</span> IElevatedProcess<br />
{<br />
  [OperationContract(IsOneWay <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">false</span>)]<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
void</span> SayHello(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> message);<br />
}</span>
        </p>
        <p>
The interface IWaitForElevatedProcess is implemented in StandardUserApp. It is the
service endpoint that is initialized before the elevated process is started - and
once the elevated application is up and running, it calls into ElevatedProcessStarted.
And we are in business for using the IElevatedProcess callback that is implemented
in the ElevatedProcess console application.
</p>
        <p>
So how is the service endpoint intialized - let's take a look inside:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">const</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> theProcess <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">@"..\..\..\ElevatedProcess\bin\Debug\ElevatedProcess.exe"</span>;<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> tryitButton_Click(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> sender,
EventArgs e)<br />
{<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
string</span> channelIdentifier <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> MiscHelpers.CreateRandomString(64);<br />
  MyUACServiceHost.StartService(channelIdentifier);<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
// starting it modal doesn't work (obviously - unless we have more threads, of course)</span><br />
  ElevatedProcess.Start(theProcess, channelIdentifier);<br />
}</span>
        </p>
        <p>
Interesting tidbit #1 is CreateRandomString: it creates a random string to use for
the address. Why? Well, if multiple instances of our application are running and trying
to elevate a process, we are in trouble. Which brings me to StartService:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">internal</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> StartService(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> pipeEndPoint)<br />
{<br />
  NetNamedPipeBinding binding <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> NetNamedPipeBinding();<br />
  binding.Name <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"uacbinding"</span>;<br />
  binding.Security.Mode <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> NetNamedPipeSecurityMode.Transport;<br /><br />
  Uri baseAddress <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> Uri(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"net.pipe://localhost/uac/"</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> pipeEndPoint);<br /><br />
  myServiceHost <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> ServiceHost(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">typeof</span>(SampleService),
baseAddress);<br />
  myServiceHost.AddServiceEndpoint(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">typeof</span>(IWaitForElevatedProcess),
binding, baseAddress);<br />
  myServiceHost.Open();<br />
}</span>
        </p>
        <p>
As I said before, I am doing it imperatively (no configuration in app.config necessary).
That's all there is to getting the service up and running.
</p>
        <p>
Now let's switch to the console application's Main method:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> Main(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span>[]
args)<br />
{<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
if</span> (args.Length !<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> 1)<br />
  {<br />
    Console.WriteLine(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"One
argument expected - the channel identifier"</span>);<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">  
 return</span>;<br />
  } 
<br /><br />
  NetNamedPipeBinding binding <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> NetNamedPipeBinding();<br />
  binding.Name <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"uacbinding"</span>;<br />
  binding.Security.Mode <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> NetNamedPipeSecurityMode.Transport;<br /><br />
  String url <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"net.pipe://localhost/uac/"</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> args[0];<br />
  EndpointAddress address <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> EndpointAddress(url);<br /><br />
  WaitForElevatedProcess client <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> WaitForElevatedProcess(<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">     
new</span> InstanceContext(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> SampleCallback()),<br />
      binding,<br />
      address);<br /><br />
  client.ElevatedProcessStarted();<br /><br />
  Console.WriteLine(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"The
elevated process is now ready"</span>);<br />
  Console.ReadLine();<br /><br />
  client.Close();<br />
}</span>
        </p>
        <p>
Similar to normal client WCF code, however, with the duplex twist hidden inside WaitForElevatedProcess:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> WaitForElevatedProcess
: DuplexClientBase&lt;IWaitForElevatedProcess&gt;, IWaitForElevatedProcess<br />
{<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
public</span> WaitForElevatedProcess(System.ServiceModel.InstanceContext callbackInstance,</span>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> <br />
    System.ServiceModel.Channels.Binding binding, 
<br />
    System.ServiceModel.EndpointAddress remoteAddress)<br />
       : <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">base</span>(callbackInstance,
binding, remoteAddress)<br />
  {<br />
  }<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> ElevatedProcessStarted()<br />
  {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   
base</span>.Channel.ElevatedProcessStarted();<br />
  }<br />
}</span>
        </p>
        <p>
Once the channel is connected, this elevated process calls back into the service piece
which lives in the non-elevated application, namely SampleService:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">[ServiceBehavior(ConcurrencyMode <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> ConcurrencyMode.Reentrant, 
<br />
      InstanceContextMode <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> InstanceContextMode.PerSession)]<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> SampleService
: IWaitForElevatedProcess<br />
{<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> ElevatedProcessStarted()<br />
  {<br />
    OperationContext.Current.GetCallbackChannel&lt;IElevatedProcess&gt;().SayHello(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Chris"</span>);<br />
  }<br />
}</span>
        </p>
        <p>
This method is the workhorse where I can talk to the elevated process - if only my
callback interface had more as well as more serious methods ;-) 
</p>
        <p>
Speaking of talking, I owe you the code for the callee in the console application:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">[CallbackBehavior(ConcurrencyMode <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> ConcurrencyMode.Reentrant)]<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> SampleCallback
: IElevatedProcess<br />
{<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> SayHello(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> message)<br />
  {<br />
    Console.WriteLine(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Hello
world "</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> message);<br />
  }<br />
}</span>
        </p>
        <p>
That's it - to recap: first, we initialize the WCF service. Then elevate a process.
This process, once initialized, calls into our service and leaves a callback. And
then we are in business talking to the elevated process (setting data, being notified
when the elevated application quits and why, ...).
</p>
        <p>
Sample warnings before you download: MyUACServiceHost definitely should be instance
instead of static. And, more restricting - starting the elevated process modal won't
allow communication <strong>unless</strong> you start the service on a separate thread.
For simplicity reasons I didn't do this for the POC.
</p>
        <p>
          <a href="http://chrison.net/content/binary/ElevateProcessTalkWCF.zip">ElevateProcessTalkWCF.zip
(27 KB)</a>
        </p>
        <p>
Before concluding I wanted to add a few words: my ideal implementation for UAC would
be COM elevation. That way, one can put more than one component into a single DLL,
and still get a meaningful UAC prompt thanks to the LocalizedString registry key -
which is per component, and not per executable (which is the case for this solution
if you add multiple actions). If you need differing prompts for each administrative
action, there is only one course of action you can take with processes: create multiple
executables. Not very pretty, but I failed with writing an elevatable (not a word,
I am sure) managed (C#) COM component.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=a860d58a-d4c5-4073-9fee-b3e5fab629bf" />
      </body>
      <title>UAC Elevation in Managed Code: "Talking" to an Elevated Process via WCF</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,a860d58a-d4c5-4073-9fee-b3e5fab629bf.aspx</guid>
      <link>http://chrison.net/UACElevationInManagedCodeTalkingToAnElevatedProcessViaWCF.aspx</link>
      <pubDate>Sun, 04 Feb 2007 21:23:45 GMT</pubDate>
      <description>&lt;p&gt;
In the blog post &lt;a href="http://chrison.net/UACElevationInManagedCodeStartingElevatedProcesses.aspx"&gt;UAC
Elevation in Managed Code: Starting Elevated Processes&lt;/a&gt; I talked about how to start
an elevated process. However, just starting a process might not cut the mustard, for
example if you need to hand over data to the elevated process. You could achieve this
by passing, let's say, some data as command line arguments to ProcessInfo before starting
the elevated process. But that seriously limits communication.
&lt;/p&gt;
&lt;p&gt;
So how can you perform communication with an elevated process? My first idea was to
use .NET Remoting. Once I thought through the multi-instance scenario, I quickly realized
that this meant the server had to be running in the non-elevated application, because
only it could properly choose a port. And because I am not a fan of Remoting anyways,
I decided to give WCF (Windows Communication Foundation, a pillar of .NET 3.0) a try.
&lt;/p&gt;
&lt;p&gt;
It looked like smooth sailing at first, but then I realized that with WCF too I needed
to implement the service inside the non-elevated application. This time, however,
the reason was "How do I know when the elevated application has initialized before
I can actually start communicating with it?". Back to the drawing board.
&lt;/p&gt;
&lt;p&gt;
The final solution now looks like this: the non-elevated application starts a service.
The operations contract specifies a callback, which, once the elevated application
has signalled its readiness, can be used by the non-elevated application to "talk"
with the elevated application. I didn't intend to go duplex, but hey, if there's no
other way I am willing to take plunge. Speaking of tricks of the trade: I am using
imperative binding to a named pipe. Reason? Well, WS bindings won't work (see &lt;a href="http://dotnet.org.za/armand/archive/2006/06/14/53390.aspx"&gt;here&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/drnick/archive/2006/10/16/configuring-http-for-windows-vista.aspx"&gt;here&lt;/a&gt;),
and the TCP channel would pop up a firewall warning. That's why.
&lt;/p&gt;
&lt;p&gt;
Let's look at the applications - first the non-elevated one:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/uacwcfpoc1.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
This time I forfeited eye candy (the shield button). Same (missing eye candy) goes
for the elevated application as it is a console application only:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/uacwcfpoc3.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Solution-wise, this simple two-application scenario is split into four projects:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/uacwcfpoc2.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
So where do we start? With the easy part inside ElevationContract:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;[ServiceContract(Namespace &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"http://Christoph.Wille.Samples"&lt;/span&gt;,&lt;br&gt;
CallbackContract &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;typeof&lt;/span&gt;(IElevatedProcess))]&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;interface&lt;/span&gt; IWaitForElevatedProcess&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; [OperationContract(IsOneWay &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;false&lt;/span&gt;)]&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
void&lt;/span&gt; ElevatedProcessStarted();&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
[ServiceContract(Namespace &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"http://Christoph.Wille.Samples"&lt;/span&gt;)]&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;interface&lt;/span&gt; IElevatedProcess&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; [OperationContract(IsOneWay &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;false&lt;/span&gt;)]&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
void&lt;/span&gt; SayHello(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; message);&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
The interface IWaitForElevatedProcess is implemented in StandardUserApp. It is the
service endpoint that is initialized before the elevated process is started - and
once the elevated application is up and running, it calls into ElevatedProcessStarted.
And we are in business for using the IElevatedProcess callback that is implemented
in the ElevatedProcess console application.
&lt;/p&gt;
&lt;p&gt;
So how is the service endpoint intialized - let's take a look inside:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;const&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; theProcess &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;@"..\..\..\ElevatedProcess\bin\Debug\ElevatedProcess.exe"&lt;/span&gt;;&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; tryitButton_Click(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; sender,
EventArgs e)&lt;br&gt;
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
string&lt;/span&gt; channelIdentifier &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; MiscHelpers.CreateRandomString(64);&lt;br&gt;
&amp;nbsp; MyUACServiceHost.StartService(channelIdentifier);&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
// starting it modal doesn't work (obviously - unless we have more threads, of course)&lt;/span&gt;
&lt;br&gt;
&amp;nbsp; ElevatedProcess.Start(theProcess, channelIdentifier);&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Interesting tidbit #1 is CreateRandomString: it creates a random string to use for
the address. Why? Well, if multiple instances of our application are running and trying
to elevate a process, we are in trouble. Which brings me to StartService:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;internal&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; StartService(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; pipeEndPoint)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; NetNamedPipeBinding binding &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; NetNamedPipeBinding();&lt;br&gt;
&amp;nbsp; binding.Name &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"uacbinding"&lt;/span&gt;;&lt;br&gt;
&amp;nbsp; binding.Security.Mode &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; NetNamedPipeSecurityMode.Transport;&lt;br&gt;
&lt;br&gt;
&amp;nbsp; Uri baseAddress &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; Uri(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"net.pipe://localhost/uac/"&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; pipeEndPoint);&lt;br&gt;
&lt;br&gt;
&amp;nbsp; myServiceHost &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; ServiceHost(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;typeof&lt;/span&gt;(SampleService),
baseAddress);&lt;br&gt;
&amp;nbsp; myServiceHost.AddServiceEndpoint(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;typeof&lt;/span&gt;(IWaitForElevatedProcess),
binding, baseAddress);&lt;br&gt;
&amp;nbsp; myServiceHost.Open();&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
As I said before, I am doing it imperatively (no configuration in app.config necessary).
That's all there is to getting the service up and running.
&lt;/p&gt;
&lt;p&gt;
Now let's switch to the console application's Main method:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; Main(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt;[]
args)&lt;br&gt;
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
if&lt;/span&gt; (args.Length !&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; 1)&lt;br&gt;
&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"One
argument expected - the channel identifier"&lt;/span&gt;);&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;
&amp;nbsp;return&lt;/span&gt;;&lt;br&gt;
&amp;nbsp; } 
&lt;br&gt;
&lt;br&gt;
&amp;nbsp; NetNamedPipeBinding binding &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; NetNamedPipeBinding();&lt;br&gt;
&amp;nbsp; binding.Name &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"uacbinding"&lt;/span&gt;;&lt;br&gt;
&amp;nbsp; binding.Security.Mode &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; NetNamedPipeSecurityMode.Transport;&lt;br&gt;
&lt;br&gt;
&amp;nbsp; String url &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"net.pipe://localhost/uac/"&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; args[0];&lt;br&gt;
&amp;nbsp; EndpointAddress address &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; EndpointAddress(url);&lt;br&gt;
&lt;br&gt;
&amp;nbsp; WaitForElevatedProcess client &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; WaitForElevatedProcess(&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
new&lt;/span&gt; InstanceContext(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; SampleCallback()),&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binding,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address);&lt;br&gt;
&lt;br&gt;
&amp;nbsp; client.ElevatedProcessStarted();&lt;br&gt;
&lt;br&gt;
&amp;nbsp; Console.WriteLine(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"The
elevated process is now ready"&lt;/span&gt;);&lt;br&gt;
&amp;nbsp; Console.ReadLine();&lt;br&gt;
&lt;br&gt;
&amp;nbsp; client.Close();&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Similar to normal client WCF code, however, with the duplex twist hidden inside WaitForElevatedProcess:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; WaitForElevatedProcess
: DuplexClientBase&amp;lt;IWaitForElevatedProcess&amp;gt;, IWaitForElevatedProcess&lt;br&gt;
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
public&lt;/span&gt; WaitForElevatedProcess(System.ServiceModel.InstanceContext callbackInstance,&lt;/span&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; System.ServiceModel.Channels.Binding binding, 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; System.ServiceModel.EndpointAddress remoteAddress)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;base&lt;/span&gt;(callbackInstance,
binding, remoteAddress)&lt;br&gt;
&amp;nbsp; {&lt;br&gt;
&amp;nbsp; }&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; ElevatedProcessStarted()&lt;br&gt;
&amp;nbsp; {&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
base&lt;/span&gt;.Channel.ElevatedProcessStarted();&lt;br&gt;
&amp;nbsp; }&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Once the channel is connected, this elevated process calls back into the service piece
which lives in the non-elevated application, namely SampleService:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;[ServiceBehavior(ConcurrencyMode &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; ConcurrencyMode.Reentrant, 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InstanceContextMode &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; InstanceContextMode.PerSession)]&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; SampleService
: IWaitForElevatedProcess&lt;br&gt;
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; ElevatedProcessStarted()&lt;br&gt;
&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; OperationContext.Current.GetCallbackChannel&amp;lt;IElevatedProcess&amp;gt;().SayHello(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Chris"&lt;/span&gt;);&lt;br&gt;
&amp;nbsp; }&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
This method is the workhorse where I can talk to the elevated process - if only my
callback interface had more as well as more serious methods ;-) 
&lt;/p&gt;
&lt;p&gt;
Speaking of talking, I owe you the code for the callee in the console application:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;[CallbackBehavior(ConcurrencyMode &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; ConcurrencyMode.Reentrant)]&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; SampleCallback
: IElevatedProcess&lt;br&gt;
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; SayHello(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; message)&lt;br&gt;
&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Hello
world "&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; message);&lt;br&gt;
&amp;nbsp; }&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
That's it - to recap: first, we initialize the WCF service. Then elevate a process.
This process, once initialized, calls into our service and leaves a callback. And
then we are in business talking to the elevated process (setting data, being notified
when the elevated application quits and why, ...).
&lt;/p&gt;
&lt;p&gt;
Sample warnings before you download: MyUACServiceHost definitely should be instance
instead of static. And, more restricting - starting the elevated process modal won't
allow communication &lt;strong&gt;unless&lt;/strong&gt; you start the service on a separate thread.
For simplicity reasons I didn't do this for the POC.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://chrison.net/content/binary/ElevateProcessTalkWCF.zip"&gt;ElevateProcessTalkWCF.zip
(27 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Before concluding I wanted to add a few words: my ideal implementation for UAC would
be COM elevation. That way, one can put more than one component into a single DLL,
and still get a meaningful UAC prompt thanks to the LocalizedString registry key -
which is per component, and not per executable (which is the case for this solution
if you add multiple actions). If you need differing prompts for each administrative
action, there is only one course of action you can take with processes: create multiple
executables. Not very pretty, but I failed with writing an elevatable (not a word,
I am sure) managed (C#) COM component.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=a860d58a-d4c5-4073-9fee-b3e5fab629bf" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,a860d58a-d4c5-4073-9fee-b3e5fab629bf.aspx</comments>
      <category>.NET</category>
      <category>3.0</category>
      <category>Security</category>
      <category>UAC</category>
      <category>Vista</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=7525c10e-1806-483d-8fcd-52ed10377b7f</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,7525c10e-1806-483d-8fcd-52ed10377b7f.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,7525c10e-1806-483d-8fcd-52ed10377b7f.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=7525c10e-1806-483d-8fcd-52ed10377b7f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://www.microsoft.com/downloads/details.aspx?familyid=C6EF4735-C7DE-46A2-997A-EA58FDFCBA63&amp;displaylang=en">Download
here</a>
        </p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=7525c10e-1806-483d-8fcd-52ed10377b7f" />
      </body>
      <title>PowerShell 1.0 for Windows Vista</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,7525c10e-1806-483d-8fcd-52ed10377b7f.aspx</guid>
      <link>http://chrison.net/PowerShell10ForWindowsVista.aspx</link>
      <pubDate>Sun, 04 Feb 2007 10:43:49 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=C6EF4735-C7DE-46A2-997A-EA58FDFCBA63&amp;amp;displaylang=en"&gt;Download
here&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=7525c10e-1806-483d-8fcd-52ed10377b7f" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,7525c10e-1806-483d-8fcd-52ed10377b7f.aspx</comments>
      <category>Cool Download</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=0b4c5137-0b5c-475b-9f6b-e013dc9c7d5f</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,0b4c5137-0b5c-475b-9f6b-e013dc9c7d5f.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,0b4c5137-0b5c-475b-9f6b-e013dc9c7d5f.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=0b4c5137-0b5c-475b-9f6b-e013dc9c7d5f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The previous installment <a href="http://chrison.net/UACElevationInManagedCodeStartingElevatedProcesses.aspx">UAC
Elevation in Managed Code: Starting Elevated Processes</a> dealt with starting executables
with the "real" administrative token. In this blog post, we deal with starting a COM
component with elevated privileges. For in-depth background information, please consult
Kenny Kerr's absolutely excellent post on <a href="http://weblogs.asp.net/kennykerr/archive/2006/09/29/Windows-Vista-for-Developers-_1320_-Part-4-_1320_-User-Account-Control.aspx">Windows
Vista for Developers – Part 4 – User Account Control</a>.
</p>
        <p>
To start with, we need a COM component. Instead of writing an ATL C++ COM component
from scratch, I took the MyElevateCom sample from <a href="http://blogs.msdn.com/vistacompatteam/archive/2006/09/28/CoCreateInstanceAsAdmin-or-CreateElevatedComObject-sample.aspx">CoCreateInstanceAsAdmin
or CreateElevatedComObject sample</a> from the <a href="http://blogs.msdn.com/vistacompatteam/">Vista
Compatibility Team Blog</a>. Note that for building it, check out my post <a href="http://chrison.net/VisualStudioOnVistaNotSoFast.aspx">Visual
Studio on Vista: Not so Fast!</a></p>
        <p>
Assuming that you built and successfully registered the COM component (it is built
to the instuctions from Kenny's post), you can go about and write the managed caller.
First, we need a reference to the component:
</p>
        <p>
          <img src="http://chrison.net/content/binary/atladdcomreference.png" border="0" />
        </p>
        <p>
Then comes the tricky part - actually instantiating the COM component. When you take
a look at the C++ example, you see that quite some "moniker magic" is involved that
cannot be replicated by simply newing up the component. So how to mimic this behavior
in managed code? The <a href="http://www.microsoft.com/downloads/details.aspx?familyid=c2b1e300-f358-4523-b479-f53d234cdccf&amp;displaylang=en">Microsoft®
Windows® Software Development Kit for Windows Vista™ and .NET Framework 3.0 Runtime
Components</a> comes to the rescue: inside, you find C:\Program Files\Microsoft SDKs\Windows\v6.0\Samples\CrossTechnologySamples.zip,
which contains the VistaBridge sample. 
</p>
        <p>
From that, I took the VistaBridgeLibary, and modified the static UACManager.LaunchElevatedCOMObject
method a bit:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">[<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">return</span>:
MarshalAs(UnmanagedType.Interface)]<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> LaunchElevatedCOMObject(Guid
Clsid, Guid InterfaceID)<br />
{<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
string</span> CLSID <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Clsid.ToString(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"B"</span>); 
<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
string</span> monikerName <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Elevation:Administrator!new:"</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> CLSID;<br /><br />
  NativeMethods.BIND_OPTS3 bo <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> NativeMethods.BIND_OPTS3();<br />
  bo.cbStruct <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> (<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">uint</span>)Marshal.SizeOf(bo);<br />
  bo.hwnd <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> IntPtr.Zero;<br />
  bo.dwClassContext <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> (<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">int</span>)NativeMethods.CLSCTX.CLSCTX_LOCAL_SERVER;<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
object</span> retVal <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> UnsafeNativeMethods.CoGetObject(monikerName, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ref</span> bo,
InterfaceID);<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">  return</span> (retVal);<br />
}</span>
        </p>
        <p>
Modifications: the method is now public instead of internal, and CLSCTX changed to
local server (otherwise it wouldn't work).
</p>
        <p>
Next, we need a UI:
</p>
        <p>
          <img src="http://chrison.net/content/binary/uacstartatlcomponent.png" border="0" />
        </p>
        <p>
This button is the CommandLinkWinForms control from VistaBridgeLibary, with the ShieldIcon
property set to true. 
</p>
        <p>
Let's hook up the event code:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> tryItButton_Click(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> sender,
EventArgs e)<br />
{<br />
 Guid IID_ITheElevated <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
new</span> Guid(0x5EFC3EFB, 0xC7D3, 0x4D00, 0xB7, 0x2E, 0x2F, 0x86, 0x4A, 0x1E, 0xAD,
0x06);<br /><br />
 Guid CLSID_TheElevated <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
new</span> Guid(0x253E7696, 0xA524, 0x4E49, 0x9E, 0x50, 0xBF, 0xCC, 0x29, 0x91, 0x31,
0x23);<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> object</span> o <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> UACManager.LaunchElevatedCOMObject(CLSID_TheElevated,
IID_ITheElevated);<br /><br />
 ITheElevated iface <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> (ITheElevated)o;<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> //
Call the method on the interface just like in the C++ example</span><br />
 iface.ShowMe();<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> //
Release the object</span><br />
 Marshal.ReleaseComObject(o);<br />
}</span>
        </p>
        <p>
The interface ID as well as class ID guids come directly from the C++ project (it
is always a good idea to "speak" more than one language), but you could obtain those
from the type library or registry as well if you don't have the source code of the
component handy.
</p>
        <p>
Object creation is handled via LaunchElevatedCOMObject, and the resultant object is
cast to the interface from the imported type library. Noteable (and important) is
the last line: because the object wasn't created by the runtime, we have to take care
of its destruction (the created interface doesn't have a Release() method, so we use
Marshal.ReleaseComObject).
</p>
        <p>
That's it - your managed code is now instantiating an elevated COM object that has
full reign over the system.
</p>
        <p>
          <a href="http://chrison.net/content/binary/ElevateCOMComponentSample.zip">ElevateCOMComponentSample.zip
(117.07 KB)</a>
        </p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=0b4c5137-0b5c-475b-9f6b-e013dc9c7d5f" />
      </body>
      <title>UAC Elevation in Managed Code: Starting Elevated COM Components</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,0b4c5137-0b5c-475b-9f6b-e013dc9c7d5f.aspx</guid>
      <link>http://chrison.net/UACElevationInManagedCodeStartingElevatedCOMComponents.aspx</link>
      <pubDate>Tue, 30 Jan 2007 09:14:50 GMT</pubDate>
      <description>&lt;p&gt;
The previous installment &lt;a href="http://chrison.net/UACElevationInManagedCodeStartingElevatedProcesses.aspx"&gt;UAC
Elevation in Managed Code: Starting Elevated Processes&lt;/a&gt; dealt with starting executables
with the "real" administrative token. In this blog post, we deal with starting a COM
component with elevated privileges. For in-depth background information, please consult
Kenny Kerr's absolutely excellent post on &lt;a href="http://weblogs.asp.net/kennykerr/archive/2006/09/29/Windows-Vista-for-Developers-_1320_-Part-4-_1320_-User-Account-Control.aspx"&gt;Windows
Vista for Developers – Part 4 – User Account Control&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
To start with, we need a COM component. Instead of writing an ATL C++ COM component
from scratch, I took the MyElevateCom sample from &lt;a href="http://blogs.msdn.com/vistacompatteam/archive/2006/09/28/CoCreateInstanceAsAdmin-or-CreateElevatedComObject-sample.aspx"&gt;CoCreateInstanceAsAdmin
or CreateElevatedComObject sample&lt;/a&gt; from the &lt;a href="http://blogs.msdn.com/vistacompatteam/"&gt;Vista
Compatibility Team Blog&lt;/a&gt;. Note that for building it, check out my post &lt;a href="http://chrison.net/VisualStudioOnVistaNotSoFast.aspx"&gt;Visual
Studio on Vista: Not so Fast!&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Assuming that you built and successfully registered the COM component (it is built
to the instuctions from Kenny's post), you can go about and write the managed caller.
First, we need a reference to the component:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/atladdcomreference.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Then comes the tricky part - actually instantiating the COM component. When you take
a look at the C++ example, you see that quite some "moniker magic" is involved that
cannot be replicated by simply newing up the component. So how to mimic this behavior
in managed code? The &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=c2b1e300-f358-4523-b479-f53d234cdccf&amp;amp;displaylang=en"&gt;Microsoft®
Windows® Software Development Kit for Windows Vista™ and .NET Framework 3.0 Runtime
Components&lt;/a&gt; comes to the rescue: inside, you find C:\Program Files\Microsoft SDKs\Windows\v6.0\Samples\CrossTechnologySamples.zip,
which contains the VistaBridge sample. 
&lt;/p&gt;
&lt;p&gt;
From that, I took the VistaBridgeLibary, and modified the static UACManager.LaunchElevatedCOMObject
method a bit:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;[&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;return&lt;/span&gt;:
MarshalAs(UnmanagedType.Interface)]&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; LaunchElevatedCOMObject(Guid
Clsid, Guid InterfaceID)&lt;br&gt;
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
string&lt;/span&gt; CLSID &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; Clsid.ToString(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"B"&lt;/span&gt;); 
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
string&lt;/span&gt; monikerName &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Elevation:Administrator!new:"&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; CLSID;&lt;br&gt;
&lt;br&gt;
&amp;nbsp; NativeMethods.BIND_OPTS3 bo &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; NativeMethods.BIND_OPTS3();&lt;br&gt;
&amp;nbsp; bo.cbStruct &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; (&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;uint&lt;/span&gt;)Marshal.SizeOf(bo);&lt;br&gt;
&amp;nbsp; bo.hwnd &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; IntPtr.Zero;&lt;br&gt;
&amp;nbsp; bo.dwClassContext &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; (&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;int&lt;/span&gt;)NativeMethods.CLSCTX.CLSCTX_LOCAL_SERVER;&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
object&lt;/span&gt; retVal &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; UnsafeNativeMethods.CoGetObject(monikerName, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;ref&lt;/span&gt; bo,
InterfaceID);&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;return&lt;/span&gt; (retVal);&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Modifications: the method is now public instead of internal, and CLSCTX changed to
local server (otherwise it wouldn't work).
&lt;/p&gt;
&lt;p&gt;
Next, we need a UI:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/uacstartatlcomponent.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
This button is the CommandLinkWinForms control from VistaBridgeLibary, with the ShieldIcon
property set to true. 
&lt;/p&gt;
&lt;p&gt;
Let's hook up the event code:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; tryItButton_Click(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; sender,
EventArgs e)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;Guid IID_ITheElevated &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
new&lt;/span&gt; Guid(0x5EFC3EFB, 0xC7D3, 0x4D00, 0xB7, 0x2E, 0x2F, 0x86, 0x4A, 0x1E, 0xAD,
0x06);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;Guid CLSID_TheElevated &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; 
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
new&lt;/span&gt; Guid(0x253E7696, 0xA524, 0x4E49, 0x9E, 0x50, 0xBF, 0xCC, 0x29, 0x91, 0x31,
0x23);&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;object&lt;/span&gt; o &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; UACManager.LaunchElevatedCOMObject(CLSID_TheElevated,
IID_ITheElevated);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;ITheElevated iface &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; (ITheElevated)o;&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;//
Call the method on the interface just like in the C++ example&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;iface.ShowMe();&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;//
Release the object&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;Marshal.ReleaseComObject(o);&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
The interface ID as well as class ID guids come directly from the C++ project (it
is always a good idea to "speak" more than one language), but you could obtain those
from the type library or registry as well if you don't have the source code of the
component handy.
&lt;/p&gt;
&lt;p&gt;
Object creation is handled via LaunchElevatedCOMObject, and the resultant object is
cast to the interface from the imported type library. Noteable (and important) is
the last line: because the object wasn't created by the runtime, we have to take care
of its destruction (the created interface doesn't have a Release() method, so we use
Marshal.ReleaseComObject).
&lt;/p&gt;
&lt;p&gt;
That's it - your managed code is now instantiating an elevated COM object that has
full reign over the system.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://chrison.net/content/binary/ElevateCOMComponentSample.zip"&gt;ElevateCOMComponentSample.zip
(117.07 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=0b4c5137-0b5c-475b-9f6b-e013dc9c7d5f" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,0b4c5137-0b5c-475b-9f6b-e013dc9c7d5f.aspx</comments>
      <category>.NET</category>
      <category>Security</category>
      <category>UAC</category>
      <category>Use the source Luke</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=8f54c1c4-56df-4965-a1fd-20c1bd9932ae</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,8f54c1c4-56df-4965-a1fd-20c1bd9932ae.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,8f54c1c4-56df-4965-a1fd-20c1bd9932ae.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=8f54c1c4-56df-4965-a1fd-20c1bd9932ae</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
When you are working with Windows Vista, you know that even the administrative users
are stripped ("filtered") of their privileges for normal operations, and that when
you have to perform tasks requiring administrative privileges, you are presented with
an UAC elevation prompt. The idea of this blog post series is to provide you with
working samples on how to work with elevation from inside managed applications (you
might also want to read <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ba73b169-a648-49af-bc5e-a2eebb74c16b&amp;DisplayLang=en">Windows
Vista Application Development Requirements for User Account Control Compatibility</a>).
</p>
        <p>
I want to side-step the really easy part - providing a manifest to start the entire
application elevated (a good idea if the application makes no sense at all unless
it has administrative rights, like regedit.exe). You can find information on those
topics in <a href="http://blogs.msdn.com/shawnfa/archive/2006/04/06/568563.aspx">Adding
a UAC Manifest to Managed Code</a> and <a href="http://www.danielmoth.com/Blog/2006/07/vista-user-account-control.html">Vista:
User Account Control</a>.
</p>
        <p>
Now back to the topic of this post: App A needs to start App B with administrative
rights (because App B e.g. needs to write to HKLM or Program Files). Therefore, we
somehow must run App B as an administrative user (or with the non-filtered token of
the current user). So how do we go about it?
</p>
        <p>
First, some eye candy. You definitely already saw those nice shield icons before:
</p>
        <p>
          <img src="http://chrison.net/content/binary/uacstartprocess.png" border="0" />
        </p>
        <p>
Those shield icons are stock on Windows Vista and indicate to the user that the action
that hides behind the button requires elevation. I didn't create a button control
myself - instead, I reused one that is readily available on the Web: <a href="http://www.brethorsting.com/uidesign/2006/11/add_a_uac_shield_to_your_winfo.html">Add
a UAC Shield to your Winforms buttons in C#</a>.
</p>
        <p>
All I had to do myself was to start the Process ("App B"):
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> startProcess_Click(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> sender,
EventArgs e)<br />
{<br />
  ProcessStartInfo psi <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> ProcessStartInfo();<br />
  psi.FileName <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> theProcess;<br />
  psi.Verb <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"runas"</span>;<br />
  Process.Start(psi);<br />
}</span>
        </p>
        <p>
The ticket (so to speak) for the elevation prompt is setting the Verb to "runas"
in the ProcessStartInfo instance - this will pop up the elevation prompt if necessary
when Process.Start is called.
</p>
        <p>
This simplistic approach has a problem though - once App B is started, users can switch
back to App A, because it App B isn't "modal" for App A. To solve this problem, I
incorporated the approach from Daniel Moth outlined in his post <a href="http://www.danielmoth.com/Blog/2006/12/launch-elevated-and-modal-too.html">Launch
elevated and modal too</a>:
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> launchModal_Click(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> sender,
EventArgs e)<br />
{<br />
  ProcessStartInfo psi <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> ProcessStartInfo();<br />
  psi.FileName <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> theProcess;<br />
  psi.Verb <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"runas"</span>;<br /><br />
  psi.ErrorDialog <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>;<br />
  psi.ErrorDialogParentHandle <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>.Handle;<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
try</span><br />
  {<br />
    Process p <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Process.Start(psi);<br />
    p.WaitForExit();<br />
  }<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> 
catch</span> (Exception ex)<br />
  {<br />
    MessageBox.Show(ex.ToString());<br />
  }<br />
}</span>
        </p>
        <p>
And that's it - App B is now modal. Once App B quits, control is relinquished to App
A (which still doesn't run with administrative rights). 
</p>
        <p>
          <a href="http://chrison.net/content/binary/ElevateProcessSample.zip">ElevateProcessSample.zip
(21.1 KB)</a>
        </p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=8f54c1c4-56df-4965-a1fd-20c1bd9932ae" />
      </body>
      <title>UAC Elevation in Managed Code: Starting Elevated Processes</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,8f54c1c4-56df-4965-a1fd-20c1bd9932ae.aspx</guid>
      <link>http://chrison.net/UACElevationInManagedCodeStartingElevatedProcesses.aspx</link>
      <pubDate>Tue, 30 Jan 2007 07:14:31 GMT</pubDate>
      <description>&lt;p&gt;
When you are working with Windows Vista, you know that even the administrative users
are stripped ("filtered") of their privileges for normal operations, and that when
you have to perform tasks requiring administrative privileges, you are presented with
an UAC elevation prompt. The idea of this blog post series is to provide you with
working samples on how to work with elevation from inside managed applications (you
might also want to read &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ba73b169-a648-49af-bc5e-a2eebb74c16b&amp;amp;DisplayLang=en"&gt;Windows
Vista Application Development Requirements for User Account Control Compatibility&lt;/a&gt;).
&lt;/p&gt;
&lt;p&gt;
I want to side-step the really easy part - providing a manifest to start the entire
application elevated (a good idea if the application makes no sense at all unless
it has administrative rights, like regedit.exe). You can find information on those
topics in &lt;a href="http://blogs.msdn.com/shawnfa/archive/2006/04/06/568563.aspx"&gt;Adding
a UAC Manifest to Managed Code&lt;/a&gt; and &lt;a href="http://www.danielmoth.com/Blog/2006/07/vista-user-account-control.html"&gt;Vista:
User Account Control&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Now back to the topic of this post: App A needs to start App B with administrative
rights (because App B e.g. needs to write to HKLM or Program Files). Therefore, we
somehow must run App B as an administrative user (or with the non-filtered token of
the current user). So how do we go about it?
&lt;/p&gt;
&lt;p&gt;
First, some eye candy. You definitely already saw those nice shield icons before:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/uacstartprocess.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Those shield icons are stock on Windows Vista and indicate to the user that the action
that hides behind the button requires elevation. I didn't create a button control
myself - instead, I reused one that is readily available on the Web: &lt;a href="http://www.brethorsting.com/uidesign/2006/11/add_a_uac_shield_to_your_winfo.html"&gt;Add
a UAC Shield to your Winforms buttons in C#&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
All I had to do myself was to start the Process ("App B"):
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; startProcess_Click(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; sender,
EventArgs e)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; ProcessStartInfo psi &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; ProcessStartInfo();&lt;br&gt;
&amp;nbsp; psi.FileName &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; theProcess;&lt;br&gt;
&amp;nbsp; psi.Verb &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"runas"&lt;/span&gt;;&lt;br&gt;
&amp;nbsp; Process.Start(psi);&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
The ticket (so to speak)&amp;nbsp;for the elevation prompt is setting the Verb to "runas"
in the ProcessStartInfo instance - this will pop up the elevation prompt if necessary
when Process.Start is called.
&lt;/p&gt;
&lt;p&gt;
This simplistic approach has a problem though - once App B is started, users can switch
back to App A, because it App B isn't "modal" for App A. To solve this problem, I
incorporated the approach from Daniel Moth outlined in his post &lt;a href="http://www.danielmoth.com/Blog/2006/12/launch-elevated-and-modal-too.html"&gt;Launch
elevated and modal too&lt;/a&gt;:
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; launchModal_Click(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; sender,
EventArgs e)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; ProcessStartInfo psi &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; ProcessStartInfo();&lt;br&gt;
&amp;nbsp; psi.FileName &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; theProcess;&lt;br&gt;
&amp;nbsp; psi.Verb &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"runas"&lt;/span&gt;;&lt;br&gt;
&lt;br&gt;
&amp;nbsp; psi.ErrorDialog &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;true&lt;/span&gt;;&lt;br&gt;
&amp;nbsp; psi.ErrorDialogParentHandle &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;this&lt;/span&gt;.Handle;&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
try&lt;/span&gt;
&lt;br&gt;
&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Process p &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; Process.Start(psi);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; p.WaitForExit();&lt;br&gt;
&amp;nbsp; }&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;
catch&lt;/span&gt; (Exception ex)&lt;br&gt;
&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(ex.ToString());&lt;br&gt;
&amp;nbsp; }&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
And that's it - App B is now modal. Once App B quits, control is relinquished to App
A (which still doesn't run with administrative rights). 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://chrison.net/content/binary/ElevateProcessSample.zip"&gt;ElevateProcessSample.zip
(21.1 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=8f54c1c4-56df-4965-a1fd-20c1bd9932ae" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,8f54c1c4-56df-4965-a1fd-20c1bd9932ae.aspx</comments>
      <category>Security</category>
      <category>UAC</category>
      <category>Use the source Luke</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=869ad0a0-5faa-43f5-a1a7-ef8a385abc26</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,869ad0a0-5faa-43f5-a1a7-ef8a385abc26.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,869ad0a0-5faa-43f5-a1a7-ef8a385abc26.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=869ad0a0-5faa-43f5-a1a7-ef8a385abc26</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you want to do this (Register Output, C++)
</p>
        <p>
          <img src="http://chrison.net/content/binary/ifyouwanttodothis.png" border="0" />
        </p>
        <p>
and don't want to get this error message
</p>
        <p>
          <img src="http://chrison.net/content/binary/failedtoregisteroutput.png" border="0" />
        </p>
        <p>
then start Visual Studio with Run as Administrator. I have SP1 and no Vista supplements
installed, so maybe there will be (or already is) an elevation prompt for registering
output.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=869ad0a0-5faa-43f5-a1a7-ef8a385abc26" />
      </body>
      <title>Visual Studio on Vista: Not so Fast!</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,869ad0a0-5faa-43f5-a1a7-ef8a385abc26.aspx</guid>
      <link>http://chrison.net/VisualStudioOnVistaNotSoFast.aspx</link>
      <pubDate>Mon, 29 Jan 2007 16:46:24 GMT</pubDate>
      <description>&lt;p&gt;
If you want to do this (Register Output, C++)
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/ifyouwanttodothis.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
and don't want to get this error message
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/failedtoregisteroutput.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
then start Visual Studio with Run as Administrator. I have SP1 and no Vista supplements
installed, so maybe there will be (or already is) an elevation prompt for registering
output.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=869ad0a0-5faa-43f5-a1a7-ef8a385abc26" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,869ad0a0-5faa-43f5-a1a7-ef8a385abc26.aspx</comments>
      <category>Vista</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=5523fa67-d5b0-4d39-b459-8019146e6391</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,5523fa67-d5b0-4d39-b459-8019146e6391.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,5523fa67-d5b0-4d39-b459-8019146e6391.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=5523fa67-d5b0-4d39-b459-8019146e6391</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
From the "What could possibly go wrong?" department: starting a WPF application (verified
offenders are MsbuildG and VistaBridge from the Windows Vista SDK) crashes Vista.
Or the graphics driver to be more precise. The result is nonetheless a perfectly reproducible
BSOD on my IBM X31 laptop. The funny part? This ATI Mobility driver (6.14.10.6546)
came from the Windows Vista Update Service and is MS HW Compat signed!
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=5523fa67-d5b0-4d39-b459-8019146e6391" />
      </body>
      <title>Crashing Vista With WPF Applications</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,5523fa67-d5b0-4d39-b459-8019146e6391.aspx</guid>
      <link>http://chrison.net/CrashingVistaWithWPFApplications.aspx</link>
      <pubDate>Mon, 29 Jan 2007 09:20:11 GMT</pubDate>
      <description>&lt;p&gt;
From the "What could possibly go wrong?" department: starting a WPF application (verified
offenders are MsbuildG and VistaBridge from the Windows Vista SDK)&amp;nbsp;crashes Vista.
Or the graphics driver to be more precise. The result is nonetheless a perfectly reproducible
BSOD on my IBM X31 laptop. The funny part? This ATI Mobility driver (6.14.10.6546)
came from the Windows Vista Update Service and is MS HW Compat signed!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=5523fa67-d5b0-4d39-b459-8019146e6391" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,5523fa67-d5b0-4d39-b459-8019146e6391.aspx</comments>
      <category>.NET</category>
      <category>Tri 0</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=e7f560a9-bd3e-4974-819e-d4b3771e8ca9</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,e7f560a9-bd3e-4974-819e-d4b3771e8ca9.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,e7f560a9-bd3e-4974-819e-d4b3771e8ca9.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=e7f560a9-bd3e-4974-819e-d4b3771e8ca9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Got a developer question on how Windows Vista security affects your application? Then
the MSDN Forum <a href="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=116&amp;SiteID=1">Security
for Applications in Windows Vista</a> is the right place to go.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=e7f560a9-bd3e-4974-819e-d4b3771e8ca9" />
      </body>
      <title>Security for Applications in Windows Vista Forum</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,e7f560a9-bd3e-4974-819e-d4b3771e8ca9.aspx</guid>
      <link>http://chrison.net/SecurityForApplicationsInWindowsVistaForum.aspx</link>
      <pubDate>Thu, 25 Jan 2007 09:38:07 GMT</pubDate>
      <description>&lt;p&gt;
Got a developer question on how Windows Vista security affects your application? Then
the MSDN Forum &lt;a href="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=116&amp;amp;SiteID=1"&gt;Security
for Applications in Windows Vista&lt;/a&gt; is the right place to go.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=e7f560a9-bd3e-4974-819e-d4b3771e8ca9" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,e7f560a9-bd3e-4974-819e-d4b3771e8ca9.aspx</comments>
      <category>Community</category>
      <category>Security</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=16957842-8624-4513-a236-1b2c342f7bbe</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,16957842-8624-4513-a236-1b2c342f7bbe.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,16957842-8624-4513-a236-1b2c342f7bbe.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=16957842-8624-4513-a236-1b2c342f7bbe</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <p>
I don't recommend turning off UAC (User Account Control) on Windows Vista, but there
might be valid reasons to shut it off once in a while for testing purposes (like in
a VM). That is where <a href="http://www.tweak-uac.com/what-is-tweak-uac/">TweakUAC</a> comes
in handy:
</p>
        <p>
          <img src="http://chrison.net/content/binary/tweakuac.png" border="0" />
        </p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=16957842-8624-4513-a236-1b2c342f7bbe" />
      </body>
      <title>TweakUAC</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,16957842-8624-4513-a236-1b2c342f7bbe.aspx</guid>
      <link>http://chrison.net/TweakUAC.aspx</link>
      <pubDate>Thu, 25 Jan 2007 09:32:21 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
I don't recommend turning off UAC (User Account Control) on Windows Vista, but there
might be valid reasons to shut it off once in a while for testing purposes (like in
a VM). That is where &lt;a href="http://www.tweak-uac.com/what-is-tweak-uac/"&gt;TweakUAC&lt;/a&gt; comes
in handy:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/tweakuac.png" border=0&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=16957842-8624-4513-a236-1b2c342f7bbe" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,16957842-8624-4513-a236-1b2c342f7bbe.aspx</comments>
      <category>Security</category>
      <category>UAC</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=262bdd6b-df69-450a-aeab-5752d19b6762</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,262bdd6b-df69-450a-aeab-5752d19b6762.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,262bdd6b-df69-450a-aeab-5752d19b6762.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=262bdd6b-df69-450a-aeab-5752d19b6762</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The Shift key can be very useful on Windows Vista. For example, type in the name of
the application in the Search box and press Ctrl+Shift+Enter:
</p>
        <p>
          <img src="http://chrison.net/content/binary/shiftexpectations_ctrlshiftenter.png" border="0" />
        </p>
        <p>
This will start the application as Administrator. Next is Windows Explorer, where
Shift + right-clicking on a file will yield a different context menu:
</p>
        <p>
          <img src="http://chrison.net/content/binary/shiftexpectations_shiftonfile.png" border="0" />
        </p>
        <p>
The new feature is "Copy as Path" - allowing you to copy the full file path to the
clipboard. I need that quite often, so this is a welcome addition indeed.
</p>
        <p>
Speaking of Shift +  right-clicking: when you do that without a file selected
on the right-hand pane in Explorer, you get another option, namely "Open Command Windows
Here":
</p>
        <p>
          <img src="http://chrison.net/content/binary/shiftexpectations_shiftfolder.png" border="0" />
        </p>
        <p>
That is most useful!
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=262bdd6b-df69-450a-aeab-5752d19b6762" />
      </body>
      <title>Shift Expectations</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,262bdd6b-df69-450a-aeab-5752d19b6762.aspx</guid>
      <link>http://chrison.net/ShiftExpectations.aspx</link>
      <pubDate>Wed, 24 Jan 2007 09:23:10 GMT</pubDate>
      <description>&lt;p&gt;
The Shift key can be very useful on Windows Vista. For example, type in the name of
the application in the Search box and press Ctrl+Shift+Enter:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/shiftexpectations_ctrlshiftenter.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
This will start the application as Administrator. Next is Windows Explorer, where
Shift + right-clicking on a file will yield a different context menu:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/shiftexpectations_shiftonfile.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
The new feature is "Copy as Path" - allowing you to copy the full file path to the
clipboard. I need that quite often, so this is a welcome addition indeed.
&lt;/p&gt;
&lt;p&gt;
Speaking of Shift +&amp;nbsp; right-clicking: when you do that without a file selected
on the right-hand pane in Explorer, you get another option, namely "Open Command Windows
Here":
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/shiftexpectations_shiftfolder.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
That is most useful!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=262bdd6b-df69-450a-aeab-5752d19b6762" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,262bdd6b-df69-450a-aeab-5752d19b6762.aspx</comments>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=330847cd-4c01-49d8-9c6f-4727957510eb</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,330847cd-4c01-49d8-9c6f-4727957510eb.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,330847cd-4c01-49d8-9c6f-4727957510eb.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=330847cd-4c01-49d8-9c6f-4727957510eb</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <p>
Now I can claim my office to be XP-free too (via <a href="http://blogs.msdn.com/michael_howard/archive/2007/01/01/expired-poster-available.aspx">eXPired
Poster Available!</a>) - the last victim of migration was my IBM X31.
</p>
        <p>
          <img src="http://chrison.net/content/binary/eXPired.jpg" border="0" />
        </p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=330847cd-4c01-49d8-9c6f-4727957510eb" />
      </body>
      <title>eXPired</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,330847cd-4c01-49d8-9c6f-4727957510eb.aspx</guid>
      <link>http://chrison.net/eXPired.aspx</link>
      <pubDate>Tue, 02 Jan 2007 13:07:12 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Now I can claim my office to be XP-free too (via &lt;a href="http://blogs.msdn.com/michael_howard/archive/2007/01/01/expired-poster-available.aspx"&gt;eXPired
Poster Available!&lt;/a&gt;) - the last victim of migration was my IBM X31.
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/eXPired.jpg" border=0&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=330847cd-4c01-49d8-9c6f-4727957510eb" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,330847cd-4c01-49d8-9c6f-4727957510eb.aspx</comments>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=7ae883a7-6aef-419e-9a75-30d322a2671d</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,7ae883a7-6aef-419e-9a75-30d322a2671d.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,7ae883a7-6aef-419e-9a75-30d322a2671d.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=7ae883a7-6aef-419e-9a75-30d322a2671d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Michael Howard has all the links in this blog entry <a href="http://blogs.msdn.com/michael_howard/archive/2006/12/21/online-security-sessions-from-teched-it-forum-available.aspx">Online
Security Sessions from TechEd IT Forum Available</a>. Topics include: malware cleaning,
UAC internals, social engineering, Vista kernel changes, Vista firewall and IPSec
enhancements. Which reminds me that the post-conference DVDs should tip up in my mailbox
rsn.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=7ae883a7-6aef-419e-9a75-30d322a2671d" />
      </body>
      <title>Passing the News: Online Security Sessions from TechEd IT Forum Available</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,7ae883a7-6aef-419e-9a75-30d322a2671d.aspx</guid>
      <link>http://chrison.net/PassingTheNewsOnlineSecuritySessionsFromTechEdITForumAvailable.aspx</link>
      <pubDate>Fri, 22 Dec 2006 15:46:01 GMT</pubDate>
      <description>&lt;p&gt;
Michael Howard has all the links in this blog entry &lt;a href="http://blogs.msdn.com/michael_howard/archive/2006/12/21/online-security-sessions-from-teched-it-forum-available.aspx"&gt;Online
Security Sessions from TechEd IT Forum Available&lt;/a&gt;. Topics include: malware cleaning,
UAC internals, social engineering, Vista kernel changes, Vista firewall and IPSec
enhancements. Which reminds me that the post-conference DVDs should tip up in my mailbox
rsn.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=7ae883a7-6aef-419e-9a75-30d322a2671d" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,7ae883a7-6aef-419e-9a75-30d322a2671d.aspx</comments>
      <category>.NET</category>
      <category>Security</category>
      <category>Training and Conferences</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=30b7ce62-f32a-4770-8629-019d5ed45881</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,30b7ce62-f32a-4770-8629-019d5ed45881.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,30b7ce62-f32a-4770-8629-019d5ed45881.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=30b7ce62-f32a-4770-8629-019d5ed45881</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The most useful utility for deployment (or name your task, like directory comparison)
is most decidedly Robocopy, which previously shipped only as part of the OS resource
kits. Now with Windows Vista, however, Robocopy comes in the box.
</p>
        <p>
          <img src="http://chrison.net/content/binary/robocopyonvista1.png" border="0" />
        </p>
        <p>
To get up and running quickly, I recommend that you get <a href="http://codegallery.gotdotnet.com/robocopygui">Robocopy
GUI</a>:
</p>
        <p>
          <img src="http://chrison.net/content/binary/robocopyonvista2.png" border="0" />
        </p>
        <p>
It makes getting started with Robocopy a tad easier.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=30b7ce62-f32a-4770-8629-019d5ed45881" />
      </body>
      <title>CLI Essentials: Robocopy Part of Vista</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,30b7ce62-f32a-4770-8629-019d5ed45881.aspx</guid>
      <link>http://chrison.net/CLIEssentialsRobocopyPartOfVista.aspx</link>
      <pubDate>Tue, 12 Dec 2006 20:01:27 GMT</pubDate>
      <description>&lt;p&gt;
The most useful utility for deployment (or name your task, like directory comparison)
is most decidedly Robocopy, which previously shipped only as part of the OS resource
kits. Now with Windows Vista, however, Robocopy comes in the box.
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/robocopyonvista1.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
To get up and running quickly, I recommend that you get &lt;a href="http://codegallery.gotdotnet.com/robocopygui"&gt;Robocopy
GUI&lt;/a&gt;:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/robocopyonvista2.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
It makes getting started with Robocopy a tad easier.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=30b7ce62-f32a-4770-8629-019d5ed45881" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,30b7ce62-f32a-4770-8629-019d5ed45881.aspx</comments>
      <category>Administration</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=df8f0d28-91c6-4bc2-8a48-0531b881aa3a</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,df8f0d28-91c6-4bc2-8a48-0531b881aa3a.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,df8f0d28-91c6-4bc2-8a48-0531b881aa3a.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=df8f0d28-91c6-4bc2-8a48-0531b881aa3a</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
This is the firewall settings dialog - much the same as we know it from Windows XP
already:
</p>
        <p>
          <img src="http://chrison.net/content/binary/vistafirewall1.png" border="0" />
        </p>
        <p>
However, once you fire up the management console (mmc.exe), you can add snapins for
advanced firewall configuration (ok, IPSec is one of my personal favorites and not
necessary to configure the firewall per se...):
</p>
        <p>
          <img src="http://chrison.net/content/binary/vistafirewall2.png" border="0" />
        </p>
        <p>
Once you have done this, you can now configure the firewall like, well, an administrator
would expect - rule based:
</p>
        <p>
          <img src="http://chrison.net/content/binary/vistafirewall3.png" border="0" />
        </p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=df8f0d28-91c6-4bc2-8a48-0531b881aa3a" />
      </body>
      <title>Vista Firewall</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,df8f0d28-91c6-4bc2-8a48-0531b881aa3a.aspx</guid>
      <link>http://chrison.net/VistaFirewall.aspx</link>
      <pubDate>Tue, 12 Dec 2006 19:46:50 GMT</pubDate>
      <description>&lt;p&gt;
This is the firewall settings dialog - much the same as we know it from Windows XP
already:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/vistafirewall1.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
However, once you fire up the management console (mmc.exe), you can add snapins for
advanced firewall configuration (ok, IPSec is one of my personal favorites and not
necessary to configure the firewall per se...):
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/vistafirewall2.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Once you have done this, you can now configure the firewall like, well, an administrator
would expect - rule based:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/vistafirewall3.png" border=0&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=df8f0d28-91c6-4bc2-8a48-0531b881aa3a" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,df8f0d28-91c6-4bc2-8a48-0531b881aa3a.aspx</comments>
      <category>Administration</category>
      <category>Security</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=ff52016d-7630-4fe2-a97d-f101ad010184</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,ff52016d-7630-4fe2-a97d-f101ad010184.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,ff52016d-7630-4fe2-a97d-f101ad010184.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=ff52016d-7630-4fe2-a97d-f101ad010184</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Because I simply cannot remember which feature is in which edition of Windows Vista,
I searched the Web to come up with a couple of useful feature comparison matrixes
to back up my memory:
</p>
        <ul>
          <li>
            <a href="http://www.microsoft.com/windowsvista/getready/editions/default.mspx">The
Editions</a> (a very basic overview) 
</li>
          <li>
            <a href="http://www.iis.net/default.aspx?tabid=2&amp;subtabid=25&amp;i=1100">IIS 7
Features and Vista Editions</a> (useful for the Web guys like me) 
</li>
          <li>
            <a href="http://www.winsupersite.com/reviews/winvista_02.asp Windows Vista Review" temp_href="http://www.winsupersite.com/reviews/winvista_02.asp Windows Vista Review">Windows
Vista Review, Part 2: Understanding the Vista Product Editions</a> (Paul has a couple
of useful tables) 
</li>
          <li>
            <a href="http://blogs.zdnet.com/Bott/?p=39">The Windows Vista Secret Decoder Ring</a> (kind
of quick reference table) 
</li>
          <li>
            <a href="http://www.istartedsomething.com/20061112/vista-comparison-matrix/">Windows
Vista editions comparison matrix</a> (Windows Anytime Upgrade screenshot deluxe)</li>
        </ul>
        <p>
          <strong>Update</strong> And of course the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=bbc16ebf-4823-4a12-afe1-5b40b2ad3725&amp;DisplayLang=en">Windows
Vista Product Guide</a>.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=ff52016d-7630-4fe2-a97d-f101ad010184" />
      </body>
      <title>Windows Vista Feature Matrix</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,ff52016d-7630-4fe2-a97d-f101ad010184.aspx</guid>
      <link>http://chrison.net/WindowsVistaFeatureMatrix.aspx</link>
      <pubDate>Wed, 29 Nov 2006 15:01:30 GMT</pubDate>
      <description>&lt;p&gt;
Because I simply cannot remember which feature is in which edition of Windows Vista,
I searched the Web to come up with a couple of useful feature comparison matrixes
to back up my memory:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://www.microsoft.com/windowsvista/getready/editions/default.mspx"&gt;The
Editions&lt;/a&gt; (a very basic overview) 
&lt;li&gt;
&lt;a href="http://www.iis.net/default.aspx?tabid=2&amp;amp;subtabid=25&amp;amp;i=1100"&gt;IIS 7
Features and Vista Editions&lt;/a&gt; (useful for the Web guys like me) 
&lt;li&gt;
&lt;a href="http://www.winsupersite.com/reviews/winvista_02.asp Windows Vista Review" temp_href="http://www.winsupersite.com/reviews/winvista_02.asp Windows Vista Review"&gt;Windows
Vista Review, Part 2: Understanding the Vista Product Editions&lt;/a&gt; (Paul has a couple
of useful tables) 
&lt;li&gt;
&lt;a href="http://blogs.zdnet.com/Bott/?p=39"&gt;The Windows Vista Secret Decoder Ring&lt;/a&gt; (kind
of quick reference table) 
&lt;li&gt;
&lt;a href="http://www.istartedsomething.com/20061112/vista-comparison-matrix/"&gt;Windows
Vista editions comparison matrix&lt;/a&gt; (Windows Anytime Upgrade screenshot deluxe)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Update&lt;/strong&gt; And of course the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=bbc16ebf-4823-4a12-afe1-5b40b2ad3725&amp;amp;DisplayLang=en"&gt;Windows
Vista Product Guide&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=ff52016d-7630-4fe2-a97d-f101ad010184" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,ff52016d-7630-4fe2-a97d-f101ad010184.aspx</comments>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=cade86de-5efe-4977-8303-d913c8e60edb</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,cade86de-5efe-4977-8303-d913c8e60edb.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,cade86de-5efe-4977-8303-d913c8e60edb.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=cade86de-5efe-4977-8303-d913c8e60edb</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I already talked about the virtualization features of Windows Vista in a previous
blog post entitled <a href="http://chrison.net/UACRedirection4FunProfit.aspx">UAC
Redirection 4 Fun &amp; Profit</a>. Today, I want to tackle the file redirection that
happens when UAC virtualizes your application and you try to write to a location it
monitors - like the Program Files directory:
</p>
        <p>
          <img src="http://chrison.net/content/binary/virtualization_admin.png" border="0" />
        </p>
        <p>
This command prompt was started with Run as Administrator (the window title hints
at that). I was UAC-prompted, and then could go about my business. Not so if I would
be running it unelevated:
</p>
        <p>
          <img src="http://chrison.net/content/binary/virtualization_normaluser.png" border="0" />
        </p>
        <p>
It tells me that I don't have access. Right, not a big surprise, but why didn't virtualization
kick in for cmd.exe? Because it is off by default for the command line. How can I
turn it on? Well, easy. Go to Windows Task Manager
</p>
        <p>
          <img src="http://chrison.net/content/binary/virtualization_selectcolumn.png" border="0" />
        </p>
        <p>
Add the Virtualization column
</p>
        <p>
          <img src="http://chrison.net/content/binary/virtualization_virtcolumn.png" border="0" />
        </p>
        <p>
After a bit drag &amp; drop magic I made it the second column and I can see which
application is virtualized or not. And sure enough, cmd.exe isn't. Right-clicking
allows you to change that:
</p>
        <p>
          <img src="http://chrison.net/content/binary/virtualization_changevirtualization.png" border="0" />
        </p>
        <p>
You will be warned that this will possibly affect the running application, but go
ahead. And then try again to write to the Program Files location:
</p>
        <p>
          <img src="http://chrison.net/content/binary/virtualization_cmdvirtualized.png" border="0" />
        </p>
        <p>
This time I can write to Program Files - wait a second, really? No, it of course went
to the virtual store for this user account:
</p>
        <p>
          <img src="http://chrison.net/content/binary/virtualization_whereitreallyis.png" border="0" />
        </p>
        <p>
As you can see, it lives next to files from a heck a lot of applications that wanted
to write to somewhere (like system32) where they didn't have access to - but virtualization
(on by default for applications except those opting out explicitly) took care of the
disk operations and redirected them to the virtual store. Note that a well-written
application (ie one that doesn't require administrative rights) wouldn't show up here...
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=cade86de-5efe-4977-8303-d913c8e60edb" />
      </body>
      <title>Virtualization</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,cade86de-5efe-4977-8303-d913c8e60edb.aspx</guid>
      <link>http://chrison.net/Virtualization.aspx</link>
      <pubDate>Mon, 20 Nov 2006 07:03:43 GMT</pubDate>
      <description>&lt;p&gt;
I already talked about the virtualization features of Windows Vista in a previous
blog post entitled &lt;a href="http://chrison.net/UACRedirection4FunProfit.aspx"&gt;UAC
Redirection 4 Fun &amp;amp; Profit&lt;/a&gt;. Today, I want to tackle the file redirection that
happens when UAC virtualizes your application and you try to write to a location it
monitors - like the Program Files directory:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/virtualization_admin.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
This command prompt was started with Run as Administrator (the window title hints
at that). I was UAC-prompted, and then could go about my business. Not so if I would
be running it unelevated:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/virtualization_normaluser.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
It tells me that I don't have access. Right, not a big surprise, but why didn't virtualization
kick in for cmd.exe? Because it is off by default for the command line. How can I
turn it on? Well, easy. Go to Windows Task Manager
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/virtualization_selectcolumn.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Add the Virtualization column
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/virtualization_virtcolumn.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
After a bit drag &amp;amp; drop magic I made it the second column and I can see which
application is virtualized or not. And sure enough, cmd.exe isn't. Right-clicking
allows you to change that:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/virtualization_changevirtualization.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
You will be warned that this will possibly affect the running application, but go
ahead. And then try again to write to the Program Files location:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/virtualization_cmdvirtualized.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
This time I can write to Program Files - wait a second, really? No, it of course went
to the virtual store for this user account:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/virtualization_whereitreallyis.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
As you can see, it lives next to files from a heck a lot of applications that wanted
to write to somewhere (like system32) where they didn't have access to - but virtualization
(on by default for applications except those opting out explicitly) took care of the
disk operations and redirected them to the virtual store. Note that a well-written
application (ie one that doesn't require administrative rights) wouldn't show up here...
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=cade86de-5efe-4977-8303-d913c8e60edb" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,cade86de-5efe-4977-8303-d913c8e60edb.aspx</comments>
      <category>Security</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=15886fbd-9082-43ec-bc19-18a32a2035f9</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,15886fbd-9082-43ec-bc19-18a32a2035f9.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,15886fbd-9082-43ec-bc19-18a32a2035f9.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=15886fbd-9082-43ec-bc19-18a32a2035f9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In today's pre-lunch session at IT Forum the speaker used a term I had never heard
before: stiffware. And I have to agree - stiffware does pose a serious problem when
you cannot 'call' (other means of 'communication' might be unreliable to say the least
&lt;g /&gt;) the guy who wrote that piece of software so you can properly configure
or even install it. 
</p>
        <p>
Speaking of the session itself, <a href="http://www.microsoft.com/softgrid/">Microsoft
SoftGrid</a> is a really cool technology. The client - which contains more than the
SoftGrid client - called the <a href="http://www.windowsvista.com/optimizeddesktop/">Desktop
Optimization Pack</a>, is equally interesting.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=15886fbd-9082-43ec-bc19-18a32a2035f9" />
      </body>
      <title>Stiffware</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,15886fbd-9082-43ec-bc19-18a32a2035f9.aspx</guid>
      <link>http://chrison.net/Stiffware.aspx</link>
      <pubDate>Thu, 16 Nov 2006 11:07:18 GMT</pubDate>
      <description>&lt;p&gt;
In today's pre-lunch session at IT Forum the speaker used a term I had never heard
before: stiffware. And I have to agree - stiffware does pose a serious problem when
you cannot 'call' (other means of 'communication' might be unreliable to say the least
&amp;lt;g /&amp;gt;) the guy who wrote that piece of software so you can properly configure
or even install it. 
&lt;/p&gt;
&lt;p&gt;
Speaking of the session itself, &lt;a href="http://www.microsoft.com/softgrid/"&gt;Microsoft
SoftGrid&lt;/a&gt; is a really cool technology. The client - which contains more than the
SoftGrid client -&amp;nbsp;called the &lt;a href="http://www.windowsvista.com/optimizeddesktop/"&gt;Desktop
Optimization Pack&lt;/a&gt;, is equally interesting.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=15886fbd-9082-43ec-bc19-18a32a2035f9" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,15886fbd-9082-43ec-bc19-18a32a2035f9.aspx</comments>
      <category>Administration</category>
      <category>this</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=ee38a2ee-2130-4b41-8cf6-ab6da5ca1aa6</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,ee38a2ee-2130-4b41-8cf6-ab6da5ca1aa6.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,ee38a2ee-2130-4b41-8cf6-ab6da5ca1aa6.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=ee38a2ee-2130-4b41-8cf6-ab6da5ca1aa6</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <em>The Windows Vista Security Guide provides recommendations and tools to further
harden Windows Vista.</em> Well, <a href="http://www.microsoft.com/downloads/details.aspx?familyid=a3d1bbed-7f35-4e72-bfb5-b84a526c1565&amp;displaylang=en">go
get it</a>.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=ee38a2ee-2130-4b41-8cf6-ab6da5ca1aa6" />
      </body>
      <title>Windows Vista Security Guide</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,ee38a2ee-2130-4b41-8cf6-ab6da5ca1aa6.aspx</guid>
      <link>http://chrison.net/WindowsVistaSecurityGuide.aspx</link>
      <pubDate>Thu, 09 Nov 2006 07:28:41 GMT</pubDate>
      <description>&lt;p&gt;
&lt;em&gt;The Windows Vista Security Guide provides recommendations and tools to further
harden Windows Vista.&lt;/em&gt; Well, &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=a3d1bbed-7f35-4e72-bfb5-b84a526c1565&amp;amp;displaylang=en"&gt;go
get it&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=ee38a2ee-2130-4b41-8cf6-ab6da5ca1aa6" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,ee38a2ee-2130-4b41-8cf6-ab6da5ca1aa6.aspx</comments>
      <category>Security</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=53e81b49-a02e-43c2-bb76-357d84f6fc2e</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,53e81b49-a02e-43c2-bb76-357d84f6fc2e.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,53e81b49-a02e-43c2-bb76-357d84f6fc2e.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=53e81b49-a02e-43c2-bb76-357d84f6fc2e</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <p>
          <img src="http://chrison.net/content/binary/LMGottaBeKiddingMe.png" border="0" />
        </p>
        <p>
That's not very funny when all you try to do is watch a Live Meeting on another Vista
feature on your Vista box (last time, I was saved this problem by LM on Vista not
being able to connect to the audio stream). And I thought the last time I saw a system
swap itself to death was on Windows 3.0...
</p>
        <p>
In other Vista news - try this: right-click on a .zip archive of your choice, select
the Open With... option from the context menu. In the dialog that pops up expand Other
and choose Internet Explorer. Fun ensues. 
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=53e81b49-a02e-43c2-bb76-357d84f6fc2e" />
      </body>
      <title>Gotta Be Kidding Me</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,53e81b49-a02e-43c2-bb76-357d84f6fc2e.aspx</guid>
      <link>http://chrison.net/GottaBeKiddingMe.aspx</link>
      <pubDate>Mon, 18 Sep 2006 17:29:44 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/LMGottaBeKiddingMe.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
That's not very funny when all you try to do is watch a Live Meeting on another Vista
feature on your Vista box (last time, I was saved this problem by LM on Vista not
being able to connect to the audio stream). And I thought the last time I saw a system
swap itself to death was on Windows 3.0...
&lt;/p&gt;
&lt;p&gt;
In other Vista news - try this: right-click on a .zip archive of your choice, select
the Open With... option from the context menu. In the dialog that pops up expand Other
and choose&amp;nbsp;Internet Explorer. Fun ensues.&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=53e81b49-a02e-43c2-bb76-357d84f6fc2e" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,53e81b49-a02e-43c2-bb76-357d84f6fc2e.aspx</comments>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=96f7998d-4f7a-48a8-873b-7df95351ed5a</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,96f7998d-4f7a-48a8-873b-7df95351ed5a.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,96f7998d-4f7a-48a8-873b-7df95351ed5a.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=96f7998d-4f7a-48a8-873b-7df95351ed5a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://www.mwconn.com/">MWconn got a new homepage</a> which is also available
in English (<a href="http://www.mwconn.com/english.html">here</a>). What is MWconn
anyways? Take a look at <a href="http://chrison.net/MWConnAvailableInEnglish.aspx">my
short MWconn setup guide / introduction</a> plus if you use a Merlin UMTS card on
Windows Vista, <a href="http://chrison.net/MerlinYesMagicISRequired.aspx">my installation
instructions for the U630</a>.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=96f7998d-4f7a-48a8-873b-7df95351ed5a" />
      </body>
      <title>MWconn News</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,96f7998d-4f7a-48a8-873b-7df95351ed5a.aspx</guid>
      <link>http://chrison.net/MWconnNews.aspx</link>
      <pubDate>Mon, 18 Sep 2006 09:00:26 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://www.mwconn.com/"&gt;MWconn got a new homepage&lt;/a&gt; which is also available
in English (&lt;a href="http://www.mwconn.com/english.html"&gt;here&lt;/a&gt;). What is MWconn
anyways? Take a look at &lt;a href="http://chrison.net/MWConnAvailableInEnglish.aspx"&gt;my
short MWconn setup guide / introduction&lt;/a&gt; plus if you use a Merlin UMTS card on
Windows Vista, &lt;a href="http://chrison.net/MerlinYesMagicISRequired.aspx"&gt;my installation
instructions for the U630&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=96f7998d-4f7a-48a8-873b-7df95351ed5a" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,96f7998d-4f7a-48a8-873b-7df95351ed5a.aspx</comments>
      <category>Cool Download</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=09008fe8-9757-458f-8e6f-55e51df9c00b</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,09008fe8-9757-458f-8e6f-55e51df9c00b.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,09008fe8-9757-458f-8e6f-55e51df9c00b.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=09008fe8-9757-458f-8e6f-55e51df9c00b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://neosmart.net/dl.php?id=1">EasyBCD</a> is a must-have tool for Windows
Vista to manage the new bootloader:
</p>
        <img src="http://chrison.net/content/binary/easybcd.png" border="0" />
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=09008fe8-9757-458f-8e6f-55e51df9c00b" />
      </body>
      <title>EasyBCD</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,09008fe8-9757-458f-8e6f-55e51df9c00b.aspx</guid>
      <link>http://chrison.net/EasyBCD.aspx</link>
      <pubDate>Tue, 22 Aug 2006 18:22:46 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://neosmart.net/dl.php?id=1"&gt;EasyBCD&lt;/a&gt; is a must-have tool for Windows
Vista to manage the new bootloader:
&lt;/p&gt;
&lt;img src="http://chrison.net/content/binary/easybcd.png" border=0&gt;&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=09008fe8-9757-458f-8e6f-55e51df9c00b" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,09008fe8-9757-458f-8e6f-55e51df9c00b.aspx</comments>
      <category>Cool Download</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=b873b0a1-b1e6-4832-bb5a-3d8d646710c2</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,b873b0a1-b1e6-4832-bb5a-3d8d646710c2.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,b873b0a1-b1e6-4832-bb5a-3d8d646710c2.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=b873b0a1-b1e6-4832-bb5a-3d8d646710c2</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Aside from just reporting the fact, I decided to write a short guided tour to get
you started - and tested it with the most recent version of Windows Vista 5472.
</p>
        <ol>
          <li>
Download from <a href="http://mwconn.tribal-sunrise.com/">http://mwconn.tribal-sunrise.com/</a> -
the site is still German-only, but simply click the link "Version 1.0". 
</li>
          <li>
Copy to folder UMTS<br /><img src="http://chrison.net/content/binary/5472mwconn1.png" border="0" /></li>
          <li>
Right-click and Run as Administrator 
</li>
          <li>
You are asked for your preferred language - click No for English<br /><img src="http://chrison.net/content/binary/5472mwconn2.png" border="0" /></li>
          <li>
MWConn asks to create connection-type specific program copies - choose Yes:<br /><img src="http://chrison.net/content/binary/5472mwconn3.png" border="0" /></li>
          <li>
MWConn needs a connection to dial - it can create one itself, so choose Yes:<br /><img src="http://chrison.net/content/binary/5472mwconn4.png" border="0" /></li>
          <li>
You will be presented a message box that informs you about connection creation success
/ failure. You are almost done, and your UMTS folder now looks like this:<br /><img src="http://chrison.net/content/binary/5472mwconn5.png" border="0" /></li>
          <li>
Run UMTSGPRS (as Administrator). If asked again for the language, choose No to retain
English. It will exit with a note that you should edit MWConn.ini. 
</li>
          <li>
Edit MWConn.ini - you only need to edit a few entries: 
<br /><br />
08 COM=<br />
09 PIN=<br />
10 NET=<br />
11 APN= 
</li>
          <li>
Once done, start UMTSGPRS again, and you will be logged into your network:<br /><img src="http://chrison.net/content/binary/5472mwconn6.png" border="0" /></li>
        </ol>
        <p>
For details on configuring the settings in #9, see the Comments section of my previous
blog post <a href="http://chrison.net/MerlinYesMagicISRequired.aspx">Merlin - Yes,
Magic IS Required</a>.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=b873b0a1-b1e6-4832-bb5a-3d8d646710c2" />
      </body>
      <title>MWConn Available in English</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,b873b0a1-b1e6-4832-bb5a-3d8d646710c2.aspx</guid>
      <link>http://chrison.net/MWConnAvailableInEnglish.aspx</link>
      <pubDate>Tue, 18 Jul 2006 12:50:29 GMT</pubDate>
      <description>&lt;p&gt;
Aside from just reporting the fact, I decided to write a short guided tour to get
you started - and tested it with the most recent version of Windows Vista 5472.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Download from &lt;a href="http://mwconn.tribal-sunrise.com/"&gt;http://mwconn.tribal-sunrise.com/&lt;/a&gt; -
the site is still German-only, but simply click the link "Version 1.0". 
&lt;li&gt;
Copy to folder UMTS&lt;br&gt;
&lt;img src="http://chrison.net/content/binary/5472mwconn1.png" border=0&gt; 
&lt;li&gt;
Right-click and Run as Administrator 
&lt;li&gt;
You are asked for your preferred language - click No for English&lt;br&gt;
&lt;img src="http://chrison.net/content/binary/5472mwconn2.png" border=0&gt; 
&lt;li&gt;
MWConn asks to create connection-type specific program copies - choose Yes:&lt;br&gt;
&lt;img src="http://chrison.net/content/binary/5472mwconn3.png" border=0&gt; 
&lt;li&gt;
MWConn needs a connection to dial - it can create one itself, so choose Yes:&lt;br&gt;
&lt;img src="http://chrison.net/content/binary/5472mwconn4.png" border=0&gt; 
&lt;li&gt;
You will be presented a message box that informs you about connection creation success
/ failure. You are almost done, and your UMTS folder now looks like this:&lt;br&gt;
&lt;img src="http://chrison.net/content/binary/5472mwconn5.png" border=0&gt; 
&lt;li&gt;
Run UMTSGPRS (as Administrator). If asked again for the language, choose No to retain
English. It will exit with a note that you should edit MWConn.ini. 
&lt;li&gt;
Edit MWConn.ini - you only need to edit a few entries: 
&lt;br&gt;
&lt;br&gt;
08 COM=&lt;br&gt;
09 PIN=&lt;br&gt;
10 NET=&lt;br&gt;
11 APN= 
&lt;li&gt;
Once done, start UMTSGPRS again, and you will be logged into your network:&lt;br&gt;
&lt;img src="http://chrison.net/content/binary/5472mwconn6.png" border=0&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
For details on configuring the settings in #9, see the Comments section of my previous
blog post &lt;a href="http://chrison.net/MerlinYesMagicISRequired.aspx"&gt;Merlin - Yes,
Magic IS Required&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=b873b0a1-b1e6-4832-bb5a-3d8d646710c2" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,b873b0a1-b1e6-4832-bb5a-3d8d646710c2.aspx</comments>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=72b731a5-f474-4a9a-8d25-be78e83dc45f</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,72b731a5-f474-4a9a-8d25-be78e83dc45f.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,72b731a5-f474-4a9a-8d25-be78e83dc45f.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=72b731a5-f474-4a9a-8d25-be78e83dc45f</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
My post <a href="http://chrison.net/NovatelWirelessMerlinU630OnWindowsVista.aspx">Novatel
Wireless Merlin U630 on Windows Vista</a> generated quite some feedback like "How
did you install the drivers?". So I decided to take the latest and greatest build
5456 and see if I would get it up and running there too. Here is the list of things
you need to do:
</p>
        <p>
Obviously, the first thing to do is to insert the card. You will be prompted for driver
installation, and it will try to do just that. However, it will only succeed in installing
a "Generic Multifunction PC-Card". The two ports (later identified as multifunction
device) will fail because it cannot detect the drivers.
</p>
        <p>
Now we have to rectify this problem. Let's go to Device Manager (via Control Panel
/ Hardware), and right-click on the "Generic Multifunction PC-Card".  Choose
"Update Driver":
</p>
        <p>
          <img src="http://chrison.net/content/binary/U630_UpdatingGenericMultifunctionFirst.png" border="0" />
        </p>
        <p>
This will magically turn it into the Novatel Wireless UMTS Modem Parent. And this
in turn will allow auto-detection of the two ports:
</p>
        <p>
          <img src="http://chrison.net/content/binary/U630_InstallingDeviceDriverSoftware.png" border="0" />
        </p>
        <p>
Please note that the secondary port will show up under COM ports, not Modems:
</p>
        <p>
          <img src="http://chrison.net/content/binary/devicemanager.png" border="0" />
        </p>
        <p>
And here things get hairy - as I pointed out, I am using <a href="http://mwconn.tribal-sunrise.com/">MWConn</a>.
The current 0.9 version (as a reminder: at this time, German-only) assumes that
the secondary port is above the primary (ie COM4 for primary, COM5 for secondary).
However, on one of my laptops (Samsung X20) - the screenshot above - it is exactly
the other way around and <a href="http://mwconn.tribal-sunrise.com/">MWConn</a> cannot
cope with that at the moment. The IBM X31 orders the ports nicely right - and as such,
UMTS works like a charm!
</p>
        <p>
By the way, use <a href="http://mwconn.tribal-sunrise.com/">MWConn</a> with administrative
rights because it does create network connections:
</p>
        <p>
          <img src="http://chrison.net/content/binary/RunAsAdminIsAGoodIdea.png" border="0" />
        </p>
        <p>
I will report back on the inverted port problem, the author of <a href="http://mwconn.tribal-sunrise.com/">MWConn</a> promised
to send me an updated version that can deal with this issue. So stay tuned!
</p>
        <p>
          <strong>Update</strong> I got the new version - and I am modifying this blog entry
under Windows Vista 5456 using the Merlin U630 in UMTS mode, on the Samsung X20. Now
both laptops work! Proof:
</p>
        <p>
          <img src="http://chrison.net/content/binary/MWConn_RunningOnVista5456.png" border="0" />
        </p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=72b731a5-f474-4a9a-8d25-be78e83dc45f" />
      </body>
      <title>Merlin - Yes, Magic IS Required</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,72b731a5-f474-4a9a-8d25-be78e83dc45f.aspx</guid>
      <link>http://chrison.net/MerlinYesMagicISRequired.aspx</link>
      <pubDate>Wed, 28 Jun 2006 11:08:33 GMT</pubDate>
      <description>&lt;p&gt;
My post &lt;a href="http://chrison.net/NovatelWirelessMerlinU630OnWindowsVista.aspx"&gt;Novatel
Wireless Merlin U630 on Windows Vista&lt;/a&gt; generated quite some feedback like "How
did you install the drivers?". So I decided to take the latest and greatest build
5456 and see if I would get it up and running there too. Here is the list of things
you need to do:
&lt;/p&gt;
&lt;p&gt;
Obviously, the first thing to do is to insert the card. You will be prompted for driver
installation, and it will try to do just that. However, it will only succeed in installing
a "Generic Multifunction PC-Card". The two ports (later identified as multifunction
device) will fail because it cannot detect the drivers.
&lt;/p&gt;
&lt;p&gt;
Now we have to rectify this problem. Let's go to Device Manager (via Control Panel
/ Hardware), and right-click on the "Generic Multifunction PC-Card".&amp;nbsp; Choose
"Update Driver":
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/U630_UpdatingGenericMultifunctionFirst.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
This will magically turn it into the Novatel Wireless UMTS Modem Parent. And this
in turn will allow auto-detection of the two ports:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/U630_InstallingDeviceDriverSoftware.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Please note that the secondary port will show up under COM ports, not Modems:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/devicemanager.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
And here things get hairy - as I pointed out, I am using &lt;a href="http://mwconn.tribal-sunrise.com/"&gt;MWConn&lt;/a&gt;.
The current 0.9 version (as a reminder: at this time, German-only)&amp;nbsp;assumes that
the secondary port is above the primary (ie COM4 for primary, COM5 for secondary).
However, on one of my laptops (Samsung X20) - the screenshot above - it is exactly
the other way around and &lt;a href="http://mwconn.tribal-sunrise.com/"&gt;MWConn&lt;/a&gt; cannot
cope with that at the moment. The IBM X31 orders the ports nicely right - and as such,
UMTS works like a charm!
&lt;/p&gt;
&lt;p&gt;
By the way, use &lt;a href="http://mwconn.tribal-sunrise.com/"&gt;MWConn&lt;/a&gt; with administrative
rights because it does create network connections:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/RunAsAdminIsAGoodIdea.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
I will report back on the inverted port problem, the author of &lt;a href="http://mwconn.tribal-sunrise.com/"&gt;MWConn&lt;/a&gt; promised
to&amp;nbsp;send me an updated version that can deal with this issue. So stay tuned!
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Update&lt;/strong&gt; I got the new version - and I am modifying this blog entry
under Windows Vista 5456 using the Merlin U630 in UMTS mode, on the Samsung X20. Now
both laptops work! Proof:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/MWConn_RunningOnVista5456.png" border=0&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=72b731a5-f474-4a9a-8d25-be78e83dc45f" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,72b731a5-f474-4a9a-8d25-be78e83dc45f.aspx</comments>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=42695a47-8126-4d20-8526-c936bc03f1cc</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,42695a47-8126-4d20-8526-c936bc03f1cc.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,42695a47-8126-4d20-8526-c936bc03f1cc.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=42695a47-8126-4d20-8526-c936bc03f1cc</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <ul>
          <li>
            <a href="http://www.microsoft.com/downloads/details.aspx?familyid=8d09697e-4868-4d8d-a4cf-9b82a2ae542d&amp;displaylang=en">Microsoft
Pre-Release Software Microsoft .NET Framework 3.0 - June 2006 CTP</a> (Note: on Vista,
only build 5456 is supported!)</li>
          <li>
            <a href="http://www.microsoft.com/downloads/details.aspx?familyid=1a994549-94cb-4f61-903d-a8c8e453eef4&amp;displaylang=en">Microsoft
Visual Studio Code Name “Orcas” Community Technology Preview – Development Tools for
.NET Framework 3.0</a>
          </li>
          <li>
            <a href="http://www.microsoft.com/downloads/details.aspx?familyid=63a80a4b-bd27-4124-a2a5-61786adb626e&amp;displaylang=en">Microsoft®
Visual Studio® 2005 Extensions for Windows® Workflow Foundation Release Candidate
2</a>
          </li>
          <li>
            <a href="http://www.microsoft.com/downloads/details.aspx?familyid=2e575633-e357-4ee7-aaff-34138f00e830&amp;displaylang=en">Hands-on
Labs for Windows® Workflow Foundation Release Candidates</a>
            <br />
          </li>
        </ul>
        <p>
And if you still haven't had time to take a closer look at WinWF, check out Karsten's <a href="http://blogs.msdn.com/karstenj/archive/2006/06/15/632639.aspx">My
Five Day Course For Hitting the WPF Curve/Cliff</a>.
</p>
        <p>
 
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=42695a47-8126-4d20-8526-c936bc03f1cc" />
      </body>
      <title>Assorted .NET Framework 3.0 Downloads</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,42695a47-8126-4d20-8526-c936bc03f1cc.aspx</guid>
      <link>http://chrison.net/AssortedNETFramework30Downloads.aspx</link>
      <pubDate>Mon, 26 Jun 2006 12:10:48 GMT</pubDate>
      <description>&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=8d09697e-4868-4d8d-a4cf-9b82a2ae542d&amp;amp;displaylang=en"&gt;Microsoft
Pre-Release Software Microsoft .NET Framework 3.0 - June 2006 CTP&lt;/a&gt; (Note: on Vista,
only build 5456 is supported!)&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=1a994549-94cb-4f61-903d-a8c8e453eef4&amp;amp;displaylang=en"&gt;Microsoft
Visual Studio Code Name “Orcas” Community Technology Preview – Development Tools for
.NET Framework 3.0&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=63a80a4b-bd27-4124-a2a5-61786adb626e&amp;amp;displaylang=en"&gt;Microsoft®
Visual Studio® 2005 Extensions for Windows® Workflow Foundation Release Candidate
2&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=2e575633-e357-4ee7-aaff-34138f00e830&amp;amp;displaylang=en"&gt;Hands-on
Labs for Windows® Workflow Foundation Release Candidates&lt;/a&gt;
&lt;br&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
And if you still haven't had time to take a closer look at WinWF, check out Karsten's &lt;a href="http://blogs.msdn.com/karstenj/archive/2006/06/15/632639.aspx"&gt;My
Five Day Course For Hitting the WPF Curve/Cliff&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=42695a47-8126-4d20-8526-c936bc03f1cc" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,42695a47-8126-4d20-8526-c936bc03f1cc.aspx</comments>
      <category>.NET</category>
      <category>Tri 0</category>
      <category>Vista</category>
      <category>Visual Studio</category>
      <category>Workflow Foundation</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=8aaeddd8-9740-4edd-9671-bd244a4c2ec7</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,8aaeddd8-9740-4edd-9671-bd244a4c2ec7.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,8aaeddd8-9740-4edd-9671-bd244a4c2ec7.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=8aaeddd8-9740-4edd-9671-bd244a4c2ec7</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The Beta 2 UAC experience was somewhat annoying, but the current interim's experience
was able to actually top the user aggravation c'mere (my definition of UAC):
</p>
        <p>
          <img src="http://chrison.net/content/binary/WhenYouThoughtTheyCouldntTopUACAnyMore.png" border="0" />
        </p>
        <p>
UAC prompts appear as minimized dialog boxes! <a href="http://blogs.msdn.com/uac/">Guys</a>,
get your act together.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=8aaeddd8-9740-4edd-9671-bd244a4c2ec7" />
      </body>
      <title>When You Thought They Couldn't Make UAC Any More Annoying...</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,8aaeddd8-9740-4edd-9671-bd244a4c2ec7.aspx</guid>
      <link>http://chrison.net/WhenYouThoughtTheyCouldntMakeUACAnyMoreAnnoying.aspx</link>
      <pubDate>Mon, 26 Jun 2006 10:12:41 GMT</pubDate>
      <description>&lt;p&gt;
The Beta 2 UAC experience was somewhat annoying, but the current interim's experience
was able to actually top the user aggravation c'mere (my definition of UAC):
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/WhenYouThoughtTheyCouldntTopUACAnyMore.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
UAC prompts appear as minimized dialog boxes! &lt;a href="http://blogs.msdn.com/uac/"&gt;Guys&lt;/a&gt;,
get your act together.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=8aaeddd8-9740-4edd-9671-bd244a4c2ec7" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,8aaeddd8-9740-4edd-9671-bd244a4c2ec7.aspx</comments>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=e2f7193a-fbe8-4c43-956c-02e1a5d6784e</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,e2f7193a-fbe8-4c43-956c-02e1a5d6784e.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,e2f7193a-fbe8-4c43-956c-02e1a5d6784e.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=e2f7193a-fbe8-4c43-956c-02e1a5d6784e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I had seen this error message on another Vista box previously, but at that time it
definitely was related to a wrongly installed HDA driver for the onboard sound. This
time sound was working, and some videos did actually play, so I was peeved when I
got this error message while trying to watch recorded Web casts:
</p>
        <p>
          <img src="http://chrison.net/content/binary/WMPCannotPlayTheFile.png" border="0" />
        </p>
        <p>
Yesterday, my solution was to boot XP - but leaving Vista just for watching Web casts,
well, that is ridiculous. So I set out for a search on what other media players are
capable of viewing WMV files. In the end (the third one I tried) I settled for the
free <a href="http://www.divx.com/">DivX Player</a> which nicely views all the
recordings Windows Media Player 11 balked at.
</p>
        <p>
Other casualties to report: the Sony Ericsson tools PC Suite as well as Update Service crash
and burn on installation (the first one with MDAC, the other one with an <a href="http://chrison.net/WhenYouThoughtYouHadSeenItAll.aspx">already
well-hated Java Exception</a>, this time however on x86 and a different index).
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=e2f7193a-fbe8-4c43-956c-02e1a5d6784e" />
      </body>
      <title>Windows Media Player Cannot Play The File</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,e2f7193a-fbe8-4c43-956c-02e1a5d6784e.aspx</guid>
      <link>http://chrison.net/WindowsMediaPlayerCannotPlayTheFile.aspx</link>
      <pubDate>Sun, 04 Jun 2006 09:21:50 GMT</pubDate>
      <description>&lt;p&gt;
I had seen this error message on another Vista box previously, but at that time it
definitely was related to a wrongly installed HDA driver for the onboard sound. This
time sound was working, and some videos did actually play, so I was peeved when I
got this error message while trying to watch recorded Web casts:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/WMPCannotPlayTheFile.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Yesterday, my solution was to boot XP - but leaving Vista just for watching Web casts,
well, that is ridiculous. So I set out for a search on what other media players are
capable of viewing WMV files. In the end (the third one I tried) I settled for the
free&amp;nbsp;&lt;a href="http://www.divx.com/"&gt;DivX Player&lt;/a&gt; which nicely views all the
recordings Windows Media Player 11 balked at.
&lt;/p&gt;
&lt;p&gt;
Other casualties to report: the Sony Ericsson tools PC Suite as well as Update Service&amp;nbsp;crash
and burn on installation (the first one with MDAC, the other one with an &lt;a href="http://chrison.net/WhenYouThoughtYouHadSeenItAll.aspx"&gt;already
well-hated Java Exception&lt;/a&gt;, this time however on x86 and a different index).
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=e2f7193a-fbe8-4c43-956c-02e1a5d6784e" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,e2f7193a-fbe8-4c43-956c-02e1a5d6784e.aspx</comments>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=a7d64dfc-d25b-48ae-9481-c463e5cf438d</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,a7d64dfc-d25b-48ae-9481-c463e5cf438d.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,a7d64dfc-d25b-48ae-9481-c463e5cf438d.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=a7d64dfc-d25b-48ae-9481-c463e5cf438d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Now, UAC is painful at times like installation (but getting better according to <a href="http://blogs.msdn.com/uac/archive/2006/06/01/613098.aspx">Reducing
Elevation Prompts in RC1</a>), however, there are loads of cool features hidden behind
all the glitz of Aero that are really cool. Like Previous Versions:
</p>
        <p>
          <img src="http://chrison.net/content/binary/PreviousVersions1.png" border="0" />
        </p>
        <p>
It uses the Volume Shadow Copy technology already in use on Windows Server 2003, and
it "hides" itself as part of System Protection / automatic restore points:
</p>
        <p>
          <img src="http://chrison.net/content/binary/PreviousVersions2.png" border="0" />
        </p>
        <p>
This is definitely one of those features that "sell" a product.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=a7d64dfc-d25b-48ae-9481-c463e5cf438d" />
      </body>
      <title>Previous Versions</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,a7d64dfc-d25b-48ae-9481-c463e5cf438d.aspx</guid>
      <link>http://chrison.net/PreviousVersions.aspx</link>
      <pubDate>Fri, 02 Jun 2006 19:15:42 GMT</pubDate>
      <description>&lt;p&gt;
Now, UAC is painful at times like installation (but getting better according to &lt;a href="http://blogs.msdn.com/uac/archive/2006/06/01/613098.aspx"&gt;Reducing
Elevation Prompts in RC1&lt;/a&gt;), however, there are loads of cool features hidden behind
all the glitz of Aero that are really cool. Like Previous Versions:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/PreviousVersions1.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
It uses the Volume Shadow Copy technology already in use on Windows Server 2003, and
it "hides" itself as part of System Protection / automatic restore points:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/PreviousVersions2.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
This is definitely one of those features that "sell" a product.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=a7d64dfc-d25b-48ae-9481-c463e5cf438d" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,a7d64dfc-d25b-48ae-9481-c463e5cf438d.aspx</comments>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=4ae706dc-4b19-4270-9584-f5565367604b</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,4ae706dc-4b19-4270-9584-f5565367604b.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,4ae706dc-4b19-4270-9584-f5565367604b.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=4ae706dc-4b19-4270-9584-f5565367604b</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I decided to take the plunge and try running Vista on a daily basis. Thus far the
following casualties must be reported:
</p>
        <ul>
          <li>
Matrox P650 PCIe. No drivers, thus no dual head. Sorry Matrox. In more than ten years
this is now the first time that my machine has no Matrox graphics card inside.</li>
          <li>
PDFCreator. For some reason the setup msi dies during installation, as well as during
the subsequent uninstallation. Too bad.</li>
          <li>
Daemon Tools. On the first try, it didn't work. Maybe I'll give it another shot.</li>
        </ul>
        <p>
Given my previous experiences on my two laptops, it really turns out that the graphics
drivers (or lack of) are the #1 issue for getting productive with Vista. 
</p>
        <p>
Let's see how long it takes until I hit a snag that makes me return to XP. Copying
Application Data stuff to Vista was already quite "interesting" because Firefox and
Thunderbird store their settings in Roaming and not Local.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=4ae706dc-4b19-4270-9584-f5565367604b" />
      </body>
      <title>Vista On My Machine</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,4ae706dc-4b19-4270-9584-f5565367604b.aspx</guid>
      <link>http://chrison.net/VistaOnMyMachine.aspx</link>
      <pubDate>Thu, 01 Jun 2006 18:28:57 GMT</pubDate>
      <description>&lt;p&gt;
I decided to take the plunge and try running Vista on a daily basis. Thus far the
following casualties must be reported:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Matrox P650 PCIe. No drivers, thus no dual head. Sorry Matrox. In more than ten years
this is now the first time that my machine has no Matrox graphics card inside.&lt;/li&gt;
&lt;li&gt;
PDFCreator. For some reason the setup msi dies during installation, as well as during
the subsequent uninstallation. Too bad.&lt;/li&gt;
&lt;li&gt;
Daemon Tools. On the first try, it didn't work. Maybe I'll give it another shot.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Given my previous experiences on my two laptops, it really turns out that the graphics
drivers (or lack of) are the #1 issue for getting productive with Vista. 
&lt;/p&gt;
&lt;p&gt;
Let's see how long it takes until I hit a snag that makes me return to XP. Copying
Application Data stuff to Vista was already quite "interesting" because Firefox and
Thunderbird store their settings in Roaming and not Local.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=4ae706dc-4b19-4270-9584-f5565367604b" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,4ae706dc-4b19-4270-9584-f5565367604b.aspx</comments>
      <category>this</category>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=5a4ad036-dd3e-4983-a131-a6765c02016f</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,5a4ad036-dd3e-4983-a131-a6765c02016f.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,5a4ad036-dd3e-4983-a131-a6765c02016f.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=5a4ad036-dd3e-4983-a131-a6765c02016f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
But Adobe thinks I am too stupid to choose my baseline OS on my own, and presents
me with a rather limited choice:
</p>
        <p>
          <img src="http://chrison.net/content/binary/VistaIsAVersionOfNTAlright.PNG" border="0" />
        </p>
        <p>
Also note that IE 7+ doesn't render the page correctly (menu). Time to fix your Web
page, Adobe.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=5a4ad036-dd3e-4983-a131-a6765c02016f" />
      </body>
      <title>Vista Is a Descendant Of NT Alright...</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,5a4ad036-dd3e-4983-a131-a6765c02016f.aspx</guid>
      <link>http://chrison.net/VistaIsADescendantOfNTAlright.aspx</link>
      <pubDate>Wed, 31 May 2006 13:56:20 GMT</pubDate>
      <description>&lt;p&gt;
But Adobe thinks I am too stupid to choose my baseline OS on my own, and presents
me with a rather limited choice:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/VistaIsAVersionOfNTAlright.PNG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Also note that IE 7+ doesn't render the page correctly (menu). Time to fix your Web
page, Adobe.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=5a4ad036-dd3e-4983-a131-a6765c02016f" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,5a4ad036-dd3e-4983-a131-a6765c02016f.aspx</comments>
      <category>Vista</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=a89c7ed2-0fb1-45bf-8132-0c8a366f3ed0</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,a89c7ed2-0fb1-45bf-8132-0c8a366f3ed0.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,a89c7ed2-0fb1-45bf-8132-0c8a366f3ed0.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=a89c7ed2-0fb1-45bf-8132-0c8a366f3ed0</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
When you run an application that needs administrative rights (in this specific case
via a manifest file), you are prompted with an UAC dialog to allow this operation:
</p>
        <p>
          <img src="http://chrison.net/content/binary/uacpromptdefaultuser.PNG" border="0" />
        </p>
        <p>
This is the dialog you get for the "default" user, the one you create during
setup that is a member of the Administrators group. Contrast that to the dialog a
standard user is presented with:
</p>
        <p>
          <img height="360" alt="uacpromptforadmin.PNG" src="http://chrison.net/content/binary/uacpromptforadmin.PNG" width="450" border="0" />
        </p>
        <p>
Now, I am fine with prompting the user to enter administrative credentials. However,
I am not fine with providing the user with the name of the administrative user(s)
on that machine. In my opinion, this is giving away security-related information without
need.
</p>
        <p>
          <strong>Update</strong> Of course you can always use <em>net localgroup Administrators</em> to
get a list of the members of the Administrators group (Markus pinged me on that
one). This feature has been available for ages, true. However, I am not convinced
that the UAC convenience of providing the administrative accounts on a silver platter
is really necessary.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=a89c7ed2-0fb1-45bf-8132-0c8a366f3ed0" />
      </body>
      <title>UAC Prompts &amp; Security</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,a89c7ed2-0fb1-45bf-8132-0c8a366f3ed0.aspx</guid>
      <link>http://chrison.net/UACPromptsSecurity.aspx</link>
      <pubDate>Wed, 31 May 2006 12:46:05 GMT</pubDate>
      <description>&lt;p&gt;
When you run an application that needs administrative rights (in this specific case
via a manifest file), you are prompted with an UAC dialog to allow this operation:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/uacpromptdefaultuser.PNG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
This is the&amp;nbsp;dialog you get for the "default" user, the one you create during
setup that is a member of the Administrators group. Contrast that to the dialog a
standard user is presented with:
&lt;/p&gt;
&lt;p&gt;
&lt;img height=360 alt=uacpromptforadmin.PNG src="http://chrison.net/content/binary/uacpromptforadmin.PNG" width=450 border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Now, I am fine with prompting the user to enter administrative credentials. However,
I am not fine with providing the user with the name of the administrative user(s)
on that machine. In my opinion, this is giving away security-related information without
need.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Update&lt;/strong&gt; Of course you can always use &lt;em&gt;net localgroup Administrators&lt;/em&gt; to
get a list of&amp;nbsp;the members of the Administrators group (Markus pinged me on that
one). This feature has been available for ages, true. However, I am not convinced
that the UAC convenience of providing the administrative accounts on a silver platter
is really necessary.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=a89c7ed2-0fb1-45bf-8132-0c8a366f3ed0" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,a89c7ed2-0fb1-45bf-8132-0c8a366f3ed0.aspx</comments>
      <category>Security</category>
      <category>this</category>
      <category>Vista</category>
    </item>
  </channel>
</rss>