<?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 - Security</title>
    <link>http://chrison.net/</link>
    <description />
    <language>en-us</language>
    <copyright>Christoph Wille</copyright>
    <lastBuildDate>Wed, 19 Nov 2008 18:20:45 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=00384b7a-52d6-455e-bf51-7668159debb3</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,00384b7a-52d6-455e-bf51-7668159debb3.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,00384b7a-52d6-455e-bf51-7668159debb3.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=00384b7a-52d6-455e-bf51-7668159debb3</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <p>
No, this time it is not Microsoft - it is NetGear that is not providing an x64-capable
version of their software. The very latest VPN client software for a ProSafe router
(FVS338) doesn't work (install) on Vista x64: 
</p>
        <p>
          <img src="http://chrison.net/content/binary/netgearvpnclient_x64.png" border="0" />
        </p>
        <p>
I think it is needless to say that I am not amused. Who are you kidding in late 2008?
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=00384b7a-52d6-455e-bf51-7668159debb3" />
      </body>
      <title>Latest ProSafe VPN Firewall Client on x64</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,00384b7a-52d6-455e-bf51-7668159debb3.aspx</guid>
      <link>http://chrison.net/LatestProSafeVPNFirewallClientOnX64.aspx</link>
      <pubDate>Wed, 19 Nov 2008 18:20:45 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
No, this time it is not Microsoft - it is NetGear that is not providing an x64-capable
version of their software. The very latest VPN client software for a ProSafe router
(FVS338) doesn't work (install) on Vista x64:&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/netgearvpnclient_x64.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
I think it is needless to say that I am not amused. Who are you kidding in late 2008?
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=00384b7a-52d6-455e-bf51-7668159debb3" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,00384b7a-52d6-455e-bf51-7668159debb3.aspx</comments>
      <category>Security</category>
      <category>this</category>
      <category>x64</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=f6b17a37-1eef-48e8-b6ff-5150b750df4f</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,f6b17a37-1eef-48e8-b6ff-5150b750df4f.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,f6b17a37-1eef-48e8-b6ff-5150b750df4f.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=f6b17a37-1eef-48e8-b6ff-5150b750df4f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A friend of mine lent me his copy of <a href="http://www.amazon.com/dp/B000EPFVWS/">Crypto</a> (by
Steven Levy) last week, today I got around to finish reading it (been pretty busy
lately as you can tell from close to zero new posts on this blog). 
</p>
        <p>
What's especially interesting about this book is the history, the background. In
the past, I have read a couple of technical-level books, even attended Crypto conference
in Santa Barbara in 1997. What this book highlights are the connections between the
acting persons (mathematicans may forgive me) as well as the whole shenanigans of
trying to put the genie back in the bottle. I do remember some of those (PGP, low
international key strengths, Clipper), but never read about them in such detail. 
</p>
        <p>
If you have some time to spare, definitely worth your time to understand how cryptography
went public.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=f6b17a37-1eef-48e8-b6ff-5150b750df4f" />
      </body>
      <title>Crypto</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,f6b17a37-1eef-48e8-b6ff-5150b750df4f.aspx</guid>
      <link>http://chrison.net/Crypto.aspx</link>
      <pubDate>Thu, 01 May 2008 14:18:27 GMT</pubDate>
      <description>&lt;p&gt;
A friend of mine lent me his copy of &lt;a href="http://www.amazon.com/dp/B000EPFVWS/"&gt;Crypto&lt;/a&gt; (by
Steven Levy) last week, today I got around to finish reading it (been pretty busy
lately as you can tell from close to zero new posts on this blog). 
&lt;/p&gt;
&lt;p&gt;
What's especially interesting about this book is the history, the background.&amp;nbsp;In
the past, I have read a couple of technical-level books, even attended Crypto conference
in Santa Barbara in 1997. What this book highlights are the connections between the
acting persons (mathematicans may forgive me) as well as the whole shenanigans of
trying to put the genie back in the bottle. I do remember some of those (PGP, low
international key strengths, Clipper), but never read about them in such detail. 
&lt;/p&gt;
&lt;p&gt;
If you have some time to spare, definitely worth your time to understand how cryptography
went public.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=f6b17a37-1eef-48e8-b6ff-5150b750df4f" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,f6b17a37-1eef-48e8-b6ff-5150b750df4f.aspx</comments>
      <category>Books</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=cad71ee8-c091-4feb-8e4b-592bd6052ce8</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,cad71ee8-c091-4feb-8e4b-592bd6052ce8.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,cad71ee8-c091-4feb-8e4b-592bd6052ce8.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=cad71ee8-c091-4feb-8e4b-592bd6052ce8</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Yesterday, we found ourselves at the receiving end of an attack against one of our
German Wikis that are running the <a href="http://www.screwturn.eu/">ScrewTurn</a> Wiki
software. Turns out that it was a security issue even with the then latest version
2.0.23. Dario Solera - the maintainer of ScrewTurn - acted real fast when I informed
him about the root cause of the attack and released v2.0.24 yesterday night. 
</p>
        <p>
Please <a href="http://www.screwturn.eu/download.ashx">download</a> and upgrade immediately!
The issue is being actively exploited (zero day if you so will).
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=cad71ee8-c091-4feb-8e4b-592bd6052ce8" />
      </body>
      <title>Important Security Fix for ScrewTurn</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,cad71ee8-c091-4feb-8e4b-592bd6052ce8.aspx</guid>
      <link>http://chrison.net/ImportantSecurityFixForScrewTurn.aspx</link>
      <pubDate>Fri, 08 Feb 2008 06:54:08 GMT</pubDate>
      <description>&lt;p&gt;
Yesterday, we found ourselves at the receiving end of an attack against one of our
German Wikis that are running the &lt;a href="http://www.screwturn.eu/"&gt;ScrewTurn&lt;/a&gt; Wiki
software. Turns out that it was a security issue even with the then latest version
2.0.23. Dario Solera - the maintainer of ScrewTurn - acted real fast when I informed
him about the root cause of the attack and released v2.0.24 yesterday night. 
&lt;/p&gt;
&lt;p&gt;
Please &lt;a href="http://www.screwturn.eu/download.ashx"&gt;download&lt;/a&gt; and upgrade immediately!
The issue is being actively exploited (zero day if you so will).
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=cad71ee8-c091-4feb-8e4b-592bd6052ce8" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,cad71ee8-c091-4feb-8e4b-592bd6052ce8.aspx</comments>
      <category>ASP.NET</category>
      <category>Security</category>
      <category>this</category>
      <category>Use the source Luke</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=4dba1166-1d1f-4d5d-aa83-e98e58649987</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,4dba1166-1d1f-4d5d-aa83-e98e58649987.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,4dba1166-1d1f-4d5d-aa83-e98e58649987.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=4dba1166-1d1f-4d5d-aa83-e98e58649987</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <em>XSSDetect is a static code analysis tool that helps identify Cross-Site Scripting
security flaws found within Web applications. It is able to scan compiled managed
assemblies (C#, Visual Basic .NET, J#) and analyze dataflow paths from sources of
user-controlled input to vulnerable outputs. It also detects whether proper encoding
or filtering has been applied to the data and will ignore such "sanitized" paths.</em>
          <a href="http://www.microsoft.com/downloads/details.aspx?familyid=19A9E348-BDB9-45B3-A1B7-44CCDCB7CFBE&amp;displaylang=en">Download</a>
        </p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=4dba1166-1d1f-4d5d-aa83-e98e58649987" />
      </body>
      <title>XSS Detect Beta Code Analysis Tool</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,4dba1166-1d1f-4d5d-aa83-e98e58649987.aspx</guid>
      <link>http://chrison.net/XSSDetectBetaCodeAnalysisTool.aspx</link>
      <pubDate>Fri, 02 Nov 2007 11:51:21 GMT</pubDate>
      <description>&lt;p&gt;
&lt;em&gt;XSSDetect is a static code analysis tool that helps identify Cross-Site Scripting
security flaws found within Web applications. It is able to scan compiled managed
assemblies (C#, Visual Basic .NET, J#) and analyze dataflow paths from sources of
user-controlled input to vulnerable outputs. It also detects whether proper encoding
or filtering has been applied to the data and will ignore such "sanitized" paths.&lt;/em&gt; &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=19A9E348-BDB9-45B3-A1B7-44CCDCB7CFBE&amp;amp;displaylang=en"&gt;Download&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=4dba1166-1d1f-4d5d-aa83-e98e58649987" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,4dba1166-1d1f-4d5d-aa83-e98e58649987.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET</category>
      <category>Security</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=25ec2ef9-d32e-40ac-a496-a79b16abaab7</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,25ec2ef9-d32e-40ac-a496-a79b16abaab7.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,25ec2ef9-d32e-40ac-a496-a79b16abaab7.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=25ec2ef9-d32e-40ac-a496-a79b16abaab7</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Been on holidays, at conferences (eg last week Ask The Experts @ XTOPIA in Berlin),
and worked on various projects - a couple of reasons it was rather quiet lately in
this blog.
</p>
        <p>
Yesterday I decided I needed a simple guestbook application for a to-be-developed
private Web site, and because I didn't find anything that fit my needs I decided to
write one myself with the goal of (ab)using XLinq in the course of this endeavour:
</p>
        <p>
          <a href="http://chrison.net/content/binary/Guestbook_XLINQ.zip">Guestbook_XLINQ.zip
(7.09 KB)</a>
        </p>
        <p>
Caveat emptor: I am no designer (surprise!). But thanks to no design it should be
easy for you to add your own design. However, as <a href="http://msdn.microsoft.com/msdnmag/issues/07/09/">this
month's MSDN magazine is all about security</a>, I decided to make the application
production-ready security-wise. You'll find a lot of parsing plus XSRF protection
(note: this version does not check for integer overflow in calculating the start row).
</p>
        <p>
Missing features: this guestbook is not prepared for localization, nor does it use
a control-based approach (where you drop those in your pages and get an in-place guestbook).
</p>
        <p>
          <strong>Update</strong> a version of this application for VS2008 RTM is available <a href="http://chrison.net/XlinqGuestbookForVS2008RTM.aspx">here</a>.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=25ec2ef9-d32e-40ac-a496-a79b16abaab7" />
      </body>
      <title>Really Simple Guestbook - With XLinq</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,25ec2ef9-d32e-40ac-a496-a79b16abaab7.aspx</guid>
      <link>http://chrison.net/ReallySimpleGuestbookWithXLinq.aspx</link>
      <pubDate>Mon, 15 Oct 2007 07:56:36 GMT</pubDate>
      <description>&lt;p&gt;
Been on holidays, at conferences (eg last week Ask The Experts @ XTOPIA in Berlin),
and worked on various projects - a couple of reasons it was rather quiet lately in
this blog.
&lt;/p&gt;
&lt;p&gt;
Yesterday I decided&amp;nbsp;I needed a simple guestbook application for a to-be-developed
private Web site, and because I didn't find anything that fit my needs I decided to
write one myself with the goal of (ab)using XLinq in the course of this endeavour:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://chrison.net/content/binary/Guestbook_XLINQ.zip"&gt;Guestbook_XLINQ.zip
(7.09 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Caveat emptor: I am no designer (surprise!). But thanks to no design it should be
easy for you to add your own design. However, as &lt;a href="http://msdn.microsoft.com/msdnmag/issues/07/09/"&gt;this
month's MSDN magazine is all about security&lt;/a&gt;, I decided to make the application
production-ready security-wise. You'll find a lot of parsing plus XSRF protection
(note: this version does not check for integer overflow in calculating the start row).
&lt;/p&gt;
&lt;p&gt;
Missing features: this guestbook is not prepared for localization, nor does it use
a control-based approach (where you drop those in your pages and get an in-place&amp;nbsp;guestbook).
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Update&lt;/strong&gt; a version of this application for VS2008 RTM is available &lt;a href="http://chrison.net/XlinqGuestbookForVS2008RTM.aspx"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=25ec2ef9-d32e-40ac-a496-a79b16abaab7" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,25ec2ef9-d32e-40ac-a496-a79b16abaab7.aspx</comments>
      <category>3.5</category>
      <category>ASP.NET</category>
      <category>Security</category>
      <category>Use the source Luke</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=82529b90-2d14-4fd2-a7b3-0e624c599648</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,82529b90-2d14-4fd2-a7b3-0e624c599648.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,82529b90-2d14-4fd2-a7b3-0e624c599648.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=82529b90-2d14-4fd2-a7b3-0e624c599648</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Version 2 of the IE7 Desktop Security Guide
is <a href="http://www.microsoft.com/downloads/details.aspx?familyid=6aa4c1da-6021-468e-a8cf-af4afe4c84b2&amp;displaylang=en&amp;tm">available
for download</a>. If you are interested in locking down IE7, then you will need this
document.<img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=82529b90-2d14-4fd2-a7b3-0e624c599648" /></body>
      <title>Internet Explorer 7 Desktop Security Guide</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,82529b90-2d14-4fd2-a7b3-0e624c599648.aspx</guid>
      <link>http://chrison.net/InternetExplorer7DesktopSecurityGuide.aspx</link>
      <pubDate>Fri, 10 Aug 2007 07:55:34 GMT</pubDate>
      <description>Version 2 of the IE7 Desktop Security Guide is &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=6aa4c1da-6021-468e-a8cf-af4afe4c84b2&amp;amp;displaylang=en&amp;amp;tm"&gt;available
for download&lt;/a&gt;. If you are interested in locking down IE7, then you will need this
document.&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=82529b90-2d14-4fd2-a7b3-0e624c599648" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,82529b90-2d14-4fd2-a7b3-0e624c599648.aspx</comments>
      <category>Administration</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=dc041e3d-aa39-45a3-9226-e77ff602dffd</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,dc041e3d-aa39-45a3-9226-e77ff602dffd.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,dc041e3d-aa39-45a3-9226-e77ff602dffd.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=dc041e3d-aa39-45a3-9226-e77ff602dffd</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I set aside the entire day for reading the book <a href="http://www.microsoft.com/MSPress/books/10723.aspx">Writing
Secure Code for Windows Vista</a>. And I was already able to put it back into the
bookshelf thanks to its concise nature. The authors only tell the reader about "What's
new and changed", without having people wade through tons of stuff they already know.
I really greatly appreciate that the authors did not do a third edition of Writing
Secure Code just for bringing developers up to speed on Vista security.
</p>
        <p>
Hint to book publishers: other areas would also benefit from this approach. There
is only so much time to read books, and I don't want to skim through information I
already know. Please consider catering to non-noobs by offering more of these "What's
new and changed" types of books to us old dogs.
</p>
        <p>
PS: Way cool to be mentioned in a security book! (p27)
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=dc041e3d-aa39-45a3-9226-e77ff602dffd" />
      </body>
      <title>Writing Secure Code for Windows Vista</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,dc041e3d-aa39-45a3-9226-e77ff602dffd.aspx</guid>
      <link>http://chrison.net/WritingSecureCodeForWindowsVista.aspx</link>
      <pubDate>Mon, 06 Aug 2007 14:57:06 GMT</pubDate>
      <description>&lt;p&gt;
I set aside the entire day for reading the book &lt;a href="http://www.microsoft.com/MSPress/books/10723.aspx"&gt;Writing
Secure Code for Windows Vista&lt;/a&gt;. And I was already able to put it back into the
bookshelf thanks to its concise nature. The authors only tell the reader about "What's
new and changed", without having people wade through tons of stuff they already know.
I really greatly appreciate that the authors did not do a third edition of Writing
Secure Code just for bringing developers up to speed on Vista security.
&lt;/p&gt;
&lt;p&gt;
Hint to book publishers: other areas would also benefit from this approach. There
is only so much time to read books, and I don't want to skim through information I
already know. Please consider catering to non-noobs by offering more of these "What's
new and changed" types of books to us old dogs.
&lt;/p&gt;
&lt;p&gt;
PS: Way cool to be mentioned in a security book! (p27)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=dc041e3d-aa39-45a3-9226-e77ff602dffd" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,dc041e3d-aa39-45a3-9226-e77ff602dffd.aspx</comments>
      <category>Books</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=f64a11af-bcc7-44c8-9b1b-32ded356f8a3</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,f64a11af-bcc7-44c8-9b1b-32ded356f8a3.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,f64a11af-bcc7-44c8-9b1b-32ded356f8a3.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=f64a11af-bcc7-44c8-9b1b-32ded356f8a3</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I got myself an eval kit for RSA SecurID tokens to see how easy / hard this would
be to deploy via AD. Well, I didn't get very far, that is, installation failed spectacularly
in the early stages:
</p>
        <p>
          <img src="http://chrison.net/content/binary/securidinstall1.png" border="0" />
        </p>
        <p>
After this "helpful" message box setup decided to be more specific:
</p>
        <p>
          <img src="http://chrison.net/content/binary/securidinstall2.png" border="0" />
        </p>
        <p>
Ohh-Kay. Let's go to RSA and their support center (it takes roughly five clicks to
get to online support, but that's another usability story) - sign in required. Hmmm.
How about creating an account? 
</p>
        <p>
The <a href="https://knowledge.rsasecurity.com/registration.asp">eligibility</a> is
a real joke: "RSA customers who have a trial product (This does not include two user
demos)". Excuse moi? On the Web site you told me that I was <a href="https://www.rsa.com/go/profile2.asp">ordering
a trial</a> and in actuality it turned out to be a "2-User Promo Kit" (the moment
I needed support I looked more closely on the package...) without support. 
</p>
        <p>
Maybe it's the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=77f24c9d-b4b8-4f73-99e3-c66f80e415b6&amp;DisplayLang=en">Microsoft
Windows Server 2003 R2 Enterprise Edition VHD</a> I am using?
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=f64a11af-bcc7-44c8-9b1b-32ded356f8a3" />
      </body>
      <title>Support? Not If You Evaluate the Product!</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,f64a11af-bcc7-44c8-9b1b-32ded356f8a3.aspx</guid>
      <link>http://chrison.net/SupportNotIfYouEvaluateTheProduct.aspx</link>
      <pubDate>Mon, 23 Jul 2007 18:54:49 GMT</pubDate>
      <description>&lt;p&gt;
I got myself an eval kit for RSA SecurID tokens&amp;nbsp;to see how easy / hard this would
be to deploy via AD. Well, I didn't get very far, that is, installation failed spectacularly
in the early stages:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/securidinstall1.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
After this "helpful" message box setup decided to be more specific:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/securidinstall2.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Ohh-Kay. Let's go to RSA and their support center (it takes roughly five clicks to
get to online support, but that's another usability story) - sign in required. Hmmm.
How about creating an account? 
&lt;/p&gt;
&lt;p&gt;
The &lt;a href="https://knowledge.rsasecurity.com/registration.asp"&gt;eligibility&lt;/a&gt; is
a real joke: "RSA customers who have a trial product (This does not include two user
demos)". Excuse moi? On the Web site you told me that I was &lt;a href="https://www.rsa.com/go/profile2.asp"&gt;ordering
a trial&lt;/a&gt; and in actuality it turned out to be a "2-User Promo Kit" (the moment
I needed support I looked more closely on the package...) without support. 
&lt;/p&gt;
&lt;p&gt;
Maybe it's the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=77f24c9d-b4b8-4f73-99e3-c66f80e415b6&amp;amp;DisplayLang=en"&gt;Microsoft
Windows Server 2003 R2 Enterprise Edition VHD&lt;/a&gt; I am using?
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=f64a11af-bcc7-44c8-9b1b-32ded356f8a3" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,f64a11af-bcc7-44c8-9b1b-32ded356f8a3.aspx</comments>
      <category>Administration</category>
      <category>Security</category>
      <category>this</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=039d2339-3ee1-43f7-a3dd-86b62383cbf5</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,039d2339-3ee1-43f7-a3dd-86b62383cbf5.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,039d2339-3ee1-43f7-a3dd-86b62383cbf5.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=039d2339-3ee1-43f7-a3dd-86b62383cbf5</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A default install of Windows Server 2003 ships with a locked-down Internet Explorer,
in a so-called enhanced security configuration. Getting rid of it was done via configuring
the Windows components. Not so on <a href="http://www.microsoft.com/windowsserver2008/default.mspx">Windows
Server 2008</a>. At first of course I looked in all the wrong places (after all who
reads a text they "know"?), until I found it in Server Manager:
</p>
        <p>
          <img src="http://chrison.net/content/binary/ieesc1.png" border="0" />
        </p>
        <p>
You can turn it on / off separately for administrator or users:
</p>
        <p>
          <img src="http://chrison.net/content/binary/ieesc2.png" border="0" />
        </p>
        <p>
Why did I turn it off? Because when it is on, you cannot view IIS7 FREB log files
- the XSL has code in it that won't run in any browser but IE. At least at Beta 3
of Longhorn, that is.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=039d2339-3ee1-43f7-a3dd-86b62383cbf5" />
      </body>
      <title>Internet Explorer Enhanced Security Configuration (IE ESC) &amp; Windows Server 2008 ("Longhorn")</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,039d2339-3ee1-43f7-a3dd-86b62383cbf5.aspx</guid>
      <link>http://chrison.net/InternetExplorerEnhancedSecurityConfigurationIEESCWindowsServer2008Longhorn.aspx</link>
      <pubDate>Mon, 25 Jun 2007 08:18:45 GMT</pubDate>
      <description>&lt;p&gt;
A default install of Windows Server 2003 ships with a locked-down Internet Explorer,
in a so-called enhanced security configuration. Getting rid of it was done via configuring
the Windows components. Not so on &lt;a href="http://www.microsoft.com/windowsserver2008/default.mspx"&gt;Windows
Server 2008&lt;/a&gt;. At first of course I looked in all the wrong places (after all who
reads a text they "know"?), until I found it in Server Manager:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/ieesc1.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
You can turn it on / off separately for administrator or users:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/ieesc2.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Why did I turn it off? Because when it is on, you cannot view IIS7 FREB log files
- the XSL has code in it that won't run in any browser but IE. At least at Beta 3
of Longhorn, that is.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=039d2339-3ee1-43f7-a3dd-86b62383cbf5" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,039d2339-3ee1-43f7-a3dd-86b62383cbf5.aspx</comments>
      <category>IIS</category>
      <category>Longhorn</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=9602ce91-3feb-4087-b457-67d907e3e450</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,9602ce91-3feb-4087-b457-67d907e3e450.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,9602ce91-3feb-4087-b457-67d907e3e450.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=9602ce91-3feb-4087-b457-67d907e3e450</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A couple of notes to self:
</p>
        <ul>
          <li>
            <a href="http://www.cacert.org/help.php?id=4">Creating a CSR</a> (the short version)</li>
          <li>
            <a href="http://www.madboa.com/geek/openssl/#cert-request">How do I generate a certificate
request?</a> (more detailed if you want to change RSA key lengths which I would
recommend)</li>
          <li>
            <a href="http://www.stunnel.org/faq/stunnel.html#certificates">Contents of .pem file
for Stunnel</a>
          </li>
        </ul>
        <p>
The latter is especially important if one fails to grasp how to turn the private key
plus the certificate into the .pem for Stunnel. By the way, I was using <a href="http://www.cacert.org/">CAcert</a>.
That works just fine for internal email servers.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=9602ce91-3feb-4087-b457-67d907e3e450" />
      </body>
      <title>Stunnel / OpenSSL Notes</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,9602ce91-3feb-4087-b457-67d907e3e450.aspx</guid>
      <link>http://chrison.net/StunnelOpenSSLNotes.aspx</link>
      <pubDate>Sat, 02 Jun 2007 15:22:41 GMT</pubDate>
      <description>&lt;p&gt;
A couple of notes to self:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://www.cacert.org/help.php?id=4"&gt;Creating a CSR&lt;/a&gt;&amp;nbsp;(the short version)&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.madboa.com/geek/openssl/#cert-request"&gt;How do I generate a certificate
request?&lt;/a&gt;&amp;nbsp;(more detailed if you want to change RSA key lengths which I would
recommend)&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.stunnel.org/faq/stunnel.html#certificates"&gt;Contents of .pem file
for Stunnel&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The latter is especially important if one fails to grasp how to turn the private key
plus the certificate into the .pem for Stunnel. By the way, I was using &lt;a href="http://www.cacert.org/"&gt;CAcert&lt;/a&gt;.
That works just fine for internal email servers.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=9602ce91-3feb-4087-b457-67d907e3e450" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,9602ce91-3feb-4087-b457-67d907e3e450.aspx</comments>
      <category>Administration</category>
      <category>Security</category>
      <category>this</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=f519f650-4fd4-4cc0-bd9a-afde3873875f</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,f519f650-4fd4-4cc0-bd9a-afde3873875f.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,f519f650-4fd4-4cc0-bd9a-afde3873875f.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=f519f650-4fd4-4cc0-bd9a-afde3873875f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://www.fiddlertool.com/fiddler/">Fiddler</a> is a HTTP debugging proxy.
Although it is easy to use (a very good thing!), it is also very powerful. Point in
case and why I am writing about it today is that I stumbled across a drive-by-download
site (stumble is the wrong word, the URL came with what seemed like a phishing mail
and that piqued my interest):
</p>
        <p>
          <img src="http://chrison.net/content/binary/fiddler_target.png" border="0" />
        </p>
        <p>
That site is actually quite clever though: when you go there the second time, it detects
that it tried to infect you before and tells you that your IP is blocked. And it doesn't
send a peep to a browser other than IE. Plus - and that takes the biscuit - it also
verifies the referer.
</p>
        <p>
But I still wanted the code, so I reset my router and started Fiddler:
</p>
        <p>
          <img src="http://chrison.net/content/binary/fiddler_trace.png" border="0" />
        </p>
        <p>
Although Fiddler has tons more features, this did the trick for me in this case (if
you want to learn what Fiddler can do, <a href="http://www.fiddlertool.com/Fiddler/help/">look
here</a>).
</p>
        <p>
So what's the obfuscated script about? The short version: it is a variant of the <a href="http://isc2.sans.org/diary.html?storyid=1948">ASUS
download server drive-by download incident</a>. The actual code can be found in a
discussion on our German .NET community site <a href="http://glengamoi.com/forums/permalink/16421/16423/ShowThread.aspx#16423">here</a>.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=f519f650-4fd4-4cc0-bd9a-afde3873875f" />
      </body>
      <title>From the Useful Tools Department: Fiddler</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,f519f650-4fd4-4cc0-bd9a-afde3873875f.aspx</guid>
      <link>http://chrison.net/FromTheUsefulToolsDepartmentFiddler.aspx</link>
      <pubDate>Wed, 28 Feb 2007 14:26:38 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://www.fiddlertool.com/fiddler/"&gt;Fiddler&lt;/a&gt; is a HTTP debugging proxy.
Although it is easy to use (a very good thing!), it is also very powerful. Point in
case and why I am writing about it today is that I stumbled across a drive-by-download
site (stumble is the wrong word, the URL came with what seemed like a phishing mail
and that piqued my interest):
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/fiddler_target.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
That site is actually quite clever though: when you go there the second time, it detects
that it tried to infect you before and tells you that your IP is blocked. And it doesn't
send a peep to a browser other than IE. Plus - and that takes the biscuit - it also
verifies the referer.
&lt;/p&gt;
&lt;p&gt;
But I still wanted the code, so I reset my router and started Fiddler:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/fiddler_trace.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Although Fiddler has tons more features, this did the trick for me in this case (if
you want to learn what Fiddler can do, &lt;a href="http://www.fiddlertool.com/Fiddler/help/"&gt;look
here&lt;/a&gt;).
&lt;/p&gt;
&lt;p&gt;
So what's the obfuscated script about? The short version: it is a variant of the &lt;a href="http://isc2.sans.org/diary.html?storyid=1948"&gt;ASUS
download server drive-by download incident&lt;/a&gt;. The actual code can be found in a
discussion on our German .NET community site &lt;a href="http://glengamoi.com/forums/permalink/16421/16423/ShowThread.aspx#16423"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=f519f650-4fd4-4cc0-bd9a-afde3873875f" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,f519f650-4fd4-4cc0-bd9a-afde3873875f.aspx</comments>
      <category>Cool Download</category>
      <category>Security</category>
      <category>this</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=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=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=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=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=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=ebc8c0ba-d1cf-47a8-a662-47b805fd6c36</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,ebc8c0ba-d1cf-47a8-a662-47b805fd6c36.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,ebc8c0ba-d1cf-47a8-a662-47b805fd6c36.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=ebc8c0ba-d1cf-47a8-a662-47b805fd6c36</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I have been promoting this tool more than once on this blog, so this time just the <a href="http://www.microsoft.com/downloads/details.aspx?familyid=59888078-9daf-4e96-b7d1-944703479451&amp;displaylang=en">download
link for version 2.1</a>.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=ebc8c0ba-d1cf-47a8-a662-47b805fd6c36" />
      </body>
      <title>Microsoft Threat Analysis &amp; Modeling v2.1</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,ebc8c0ba-d1cf-47a8-a662-47b805fd6c36.aspx</guid>
      <link>http://chrison.net/MicrosoftThreatAnalysisModelingV21.aspx</link>
      <pubDate>Wed, 29 Nov 2006 08:33:58 GMT</pubDate>
      <description>&lt;p&gt;
I have been promoting this tool more than once on this blog, so this time just the &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=59888078-9daf-4e96-b7d1-944703479451&amp;amp;displaylang=en"&gt;download
link for version 2.1&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=ebc8c0ba-d1cf-47a8-a662-47b805fd6c36" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,ebc8c0ba-d1cf-47a8-a662-47b805fd6c36.aspx</comments>
      <category>Cool Download</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=29315c32-6296-4467-966d-2c32a76bd9cb</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,29315c32-6296-4467-966d-2c32a76bd9cb.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,29315c32-6296-4467-966d-2c32a76bd9cb.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=29315c32-6296-4467-966d-2c32a76bd9cb</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I admit it: I am a regular reader of the event log. In doing so, I came across an
error message last week that I rarely get to see - invalid Viewstate:
</p>
        <p>
          <img src="http://chrison.net/content/binary/spaminviewstate.png" border="0" />
        </p>
        <p>
Now, that wouldn't be a problem, usually at least. However, in this special case I
went WTF? when I looked at the description more closely, especially at the PersistedState
information:
</p>
        <pre>PersistedState: a<br />
Content-Transfer-Encoding: 8bit<br />
Content-Type: text/plain<br />
X-Mailer: EMUmail 4.5<br />
Subject: jam n<br />
bcc: &lt;list of addresse removed by me /&gt;</pre>
        <pre>comes from the loin in the middle of the back of the pig. t is a lean meaty 
<br />
cut of bacon, with relatively less fat compared to other cuts. iddle bacon 
<br />
is much like back bacon</pre>
        <pre> </pre>
        <pre> </pre>
        <pre> </pre>
        <pre>daa6c5071189f202ceb370d0e9d38c33<br />
.</pre>
        <p>
Come again - spam in Viewstate? What would be the point of this? After some research
together with <a href="http://alexonasp.net/">Alex</a> I came across this article: <a href="http://www.anders.com/cms/75/Crack.Attempt/Spam.Relay">Interesting
Crack Attempt to Relay Spam</a> (a more detailed article is available too: <a href="http://www.anders.com/projects/sysadmin/formPostHijacking/">Form
Post Hijacking</a>). How did I manage to not take notice of this attack vector any
earlier I don't know, but I have to admit that the idea is pretty clever. 
</p>
        <p>
Counter-measures in general? Well, either don't allow users input in the headers at
all, or vet the form fields for carriage return / line feeds. Note that I did not
verify if any of the available mail components for .NET would be actually susceptible
to this kind of attack.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=29315c32-6296-4467-966d-2c32a76bd9cb" />
      </body>
      <title>Spam in ASP.NET Viewstate?</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,29315c32-6296-4467-966d-2c32a76bd9cb.aspx</guid>
      <link>http://chrison.net/SpamInASPNETViewstate.aspx</link>
      <pubDate>Wed, 22 Nov 2006 08:47:35 GMT</pubDate>
      <description>&lt;p&gt;
I admit it: I am a regular reader of the event log. In doing so, I came across an
error message last week that I rarely get to see - invalid Viewstate:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/spaminviewstate.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Now, that wouldn't be a problem, usually at least. However, in this special case I
went WTF? when I looked at the description more closely, especially at the PersistedState
information:
&lt;/p&gt;
&lt;pre&gt;PersistedState: a&lt;br&gt;
Content-Transfer-Encoding: 8bit&lt;br&gt;
Content-Type: text/plain&lt;br&gt;
X-Mailer: EMUmail 4.5&lt;br&gt;
Subject: jam n&lt;br&gt;
bcc: &amp;lt;list&gt;&amp;nbsp;of addresse removed by me /&amp;gt;&lt;/pre&gt;&lt;pre&gt;comes from the loin in the middle of the back of the pig. t is a lean meaty 
&lt;br&gt;
cut of bacon, with relatively less fat compared to other cuts. iddle bacon 
&lt;br&gt;
is much like back bacon&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;daa6c5071189f202ceb370d0e9d38c33&lt;br&gt;
.&lt;/pre&gt;
&lt;p&gt;
Come again - spam in Viewstate? What would be the point of this? After some research
together with &lt;a href="http://alexonasp.net/"&gt;Alex&lt;/a&gt; I came across this article: &lt;a href="http://www.anders.com/cms/75/Crack.Attempt/Spam.Relay"&gt;Interesting
Crack Attempt to Relay Spam&lt;/a&gt;&amp;nbsp;(a more detailed article is available too: &lt;a href="http://www.anders.com/projects/sysadmin/formPostHijacking/"&gt;Form
Post Hijacking&lt;/a&gt;). How did I manage to not take notice of this attack vector any
earlier I don't know, but I have to admit that the idea is pretty clever. 
&lt;/p&gt;
&lt;p&gt;
Counter-measures in general? Well, either don't allow users input in the headers at
all, or vet the form fields for carriage return / line feeds. Note that I did not
verify if any of the available mail components for .NET would be actually susceptible
to this kind of attack.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=29315c32-6296-4467-966d-2c32a76bd9cb" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,29315c32-6296-4467-966d-2c32a76bd9cb.aspx</comments>
      <category>ASP.NET</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=25b01b24-efb4-4d10-8623-7b8ebf15ae4e</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,25b01b24-efb4-4d10-8623-7b8ebf15ae4e.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,25b01b24-efb4-4d10-8623-7b8ebf15ae4e.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=25b01b24-efb4-4d10-8623-7b8ebf15ae4e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
At next year's <a href="http://www.vsone.de/">VSone</a> in Munich (a German developer
conference taking place in February), I will be doing three talks:
</p>
        <ul>
          <li>
Visual Studio 2005 Team Edition for Database Professionals 
</li>
          <li>
User Account Control (UAC) in Your Applications 
</li>
          <li>
Advanced Code Access Security (CAS)</li>
        </ul>
        <p>
Two security topics, one team-development focused. See you in Munich!
</p>
        <p>
          <a href="http://www.vsone.de/">
            <img src="http://chrison.net/content/binary/VSonespeaker.gif" border="0" />
          </a>
        </p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=25b01b24-efb4-4d10-8623-7b8ebf15ae4e" />
      </body>
      <title>Three Talks at Next Year's VSone Conference</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,25b01b24-efb4-4d10-8623-7b8ebf15ae4e.aspx</guid>
      <link>http://chrison.net/ThreeTalksAtNextYearsVSoneConference.aspx</link>
      <pubDate>Tue, 21 Nov 2006 15:21:21 GMT</pubDate>
      <description>&lt;p&gt;
At next year's &lt;a href="http://www.vsone.de/"&gt;VSone&lt;/a&gt; in Munich (a German developer
conference taking place in February), I will be doing three talks:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Visual Studio 2005 Team Edition for Database Professionals 
&lt;li&gt;
User Account Control (UAC) in Your Applications 
&lt;li&gt;
Advanced Code Access Security (CAS)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Two security topics, one team-development focused. See you in Munich!
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.vsone.de/"&gt;&lt;img src="http://chrison.net/content/binary/VSonespeaker.gif" border=0&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=25b01b24-efb4-4d10-8623-7b8ebf15ae4e" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,25b01b24-efb4-4d10-8623-7b8ebf15ae4e.aspx</comments>
      <category>Security</category>
      <category>Team System</category>
      <category>this</category>
      <category>Training and Conferences</category>
      <category>Visual Studio</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=a0a62372-1488-4d98-b714-173ce90996a4</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,a0a62372-1488-4d98-b714-173ce90996a4.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,a0a62372-1488-4d98-b714-173ce90996a4.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=a0a62372-1488-4d98-b714-173ce90996a4</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
This Q&amp;A item is part of the <a href="http://msdn.microsoft.com/msdnmag/issues/06/11/SecurityBriefs/default.aspx">current
MSDN magazine's Security Brief's column</a> by <a href="http://www.pluralsight.com/blogs/keith/default.aspx">Keith
Brown</a>. I am pretty sure that this problem will rear its head sooner or later on
every developers machine, that's why I am 'pinning' the link in my blog for my own
reference too.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=a0a62372-1488-4d98-b714-173ce90996a4" />
      </body>
      <title>Security Brief: Why won't my simple WCF service start when I run it as a non-administrator?</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,a0a62372-1488-4d98-b714-173ce90996a4.aspx</guid>
      <link>http://chrison.net/SecurityBriefWhyWontMySimpleWCFServiceStartWhenIRunItAsANonadministrator.aspx</link>
      <pubDate>Sun, 12 Nov 2006 15:41:26 GMT</pubDate>
      <description>&lt;p&gt;
This Q&amp;amp;A item is part of the &lt;a href="http://msdn.microsoft.com/msdnmag/issues/06/11/SecurityBriefs/default.aspx"&gt;current
MSDN magazine's Security Brief's column&lt;/a&gt; by &lt;a href="http://www.pluralsight.com/blogs/keith/default.aspx"&gt;Keith
Brown&lt;/a&gt;. I am pretty sure that this problem will rear its head sooner or later on
every developers machine, that's why I am 'pinning' the link in my blog for my own
reference too.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=a0a62372-1488-4d98-b714-173ce90996a4" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,a0a62372-1488-4d98-b714-173ce90996a4.aspx</comments>
      <category>.NET</category>
      <category>IIS</category>
      <category>Security</category>
      <category>3.0</category>
      <category>WCF</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=767750a1-d605-4b74-992a-e0282878ec06</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,767750a1-d605-4b74-992a-e0282878ec06.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,767750a1-d605-4b74-992a-e0282878ec06.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=767750a1-d605-4b74-992a-e0282878ec06</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The <a href="http://msdn.microsoft.com/msdnmag/issues/06/11/default.aspx">November
2006</a> issue has lots of good security articles, which are available online too.
Check out <a href="http://msdn.microsoft.com/msdnmag/issues/06/11/SecureHabits/default.aspx">Security
Habits</a>, <a href="http://msdn.microsoft.com/msdnmag/issues/06/11/ThreatModeling/default.aspx">Threat
Modeling (STRIDE approach)</a>, <a href="http://msdn.microsoft.com/msdnmag/issues/06/11/ExtendingSDL/default.aspx">Extending
SDL</a> or <a href="http://msdn.microsoft.com/msdnmag/issues/06/11/SQLSecurity/default.aspx">SQL
Security</a> to name a few.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=767750a1-d605-4b74-992a-e0282878ec06" />
      </body>
      <title>The Yearly MSDN Magazine Security Issue Has Landed</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,767750a1-d605-4b74-992a-e0282878ec06.aspx</guid>
      <link>http://chrison.net/TheYearlyMSDNMagazineSecurityIssueHasLanded.aspx</link>
      <pubDate>Wed, 01 Nov 2006 12:56:55 GMT</pubDate>
      <description>&lt;p&gt;
The &lt;a href="http://msdn.microsoft.com/msdnmag/issues/06/11/default.aspx"&gt;November
2006&lt;/a&gt; issue has lots of good security articles, which are available online too.
Check out &lt;a href="http://msdn.microsoft.com/msdnmag/issues/06/11/SecureHabits/default.aspx"&gt;Security
Habits&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/msdnmag/issues/06/11/ThreatModeling/default.aspx"&gt;Threat
Modeling (STRIDE approach)&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/msdnmag/issues/06/11/ExtendingSDL/default.aspx"&gt;Extending
SDL&lt;/a&gt; or &lt;a href="http://msdn.microsoft.com/msdnmag/issues/06/11/SQLSecurity/default.aspx"&gt;SQL
Security&lt;/a&gt; to name a few.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=767750a1-d605-4b74-992a-e0282878ec06" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,767750a1-d605-4b74-992a-e0282878ec06.aspx</comments>
      <category>.NET</category>
      <category>Security</category>
      <category>SQL Server</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=5598e23e-647a-4ac8-8196-d180569fee67</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,5598e23e-647a-4ac8-8196-d180569fee67.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,5598e23e-647a-4ac8-8196-d180569fee67.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=5598e23e-647a-4ac8-8196-d180569fee67</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Last Tuesday, I held the talk "Advanced Code Access Security" at UG Styria in Graz.
This talk was originally part of the MSDN Security Briefings held in Austria earlier
this year, for which MS Austria had asked MVPs to help create and deliver security
content. Advanced CAS seemed an interesting enough developer topic to re-run at user
groups, and <a href="http://blogs.msdn.com/mszcool/">Mario</a> (the author of this
session) has allowed me to publish the slide deck and demos for the general public.
</p>
        <p>
          <a href="http://chrison.net/content/binary/AdvancedCodeAccessSecurity.pdf">AdvancedCodeAccessSecurity.pdf
(4542 KB)</a>
        </p>
        <p>
          <a href="http://chrison.net/content/binary/AdvancedCAS.zip">AdvancedCAS.zip (599.6
KB)</a>
        </p>
        <p>
Please note that I have published only demos four (setting CAS via setup) and
six (using CAS in addin application) - those are the "completed" versions of
the demos.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=5598e23e-647a-4ac8-8196-d180569fee67" />
      </body>
      <title>Advanced Code Access Security</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,5598e23e-647a-4ac8-8196-d180569fee67.aspx</guid>
      <link>http://chrison.net/AdvancedCodeAccessSecurity.aspx</link>
      <pubDate>Mon, 30 Oct 2006 08:10:54 GMT</pubDate>
      <description>&lt;p&gt;
Last Tuesday, I held the talk "Advanced Code Access Security" at UG Styria in Graz.
This talk was originally part of the MSDN Security Briefings held in Austria earlier
this year, for which MS Austria had asked MVPs to help create and deliver security
content. Advanced CAS seemed an interesting enough developer topic to re-run at user
groups, and &lt;a href="http://blogs.msdn.com/mszcool/"&gt;Mario&lt;/a&gt; (the author of this
session) has allowed me to publish the slide deck and demos for the general public.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://chrison.net/content/binary/AdvancedCodeAccessSecurity.pdf"&gt;AdvancedCodeAccessSecurity.pdf
(4542 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://chrison.net/content/binary/AdvancedCAS.zip"&gt;AdvancedCAS.zip (599.6
KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Please note that I have published only demos four (setting CAS via setup)&amp;nbsp;and
six (using CAS in addin application)&amp;nbsp;- those are the "completed" versions of
the demos.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=5598e23e-647a-4ac8-8196-d180569fee67" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,5598e23e-647a-4ac8-8196-d180569fee67.aspx</comments>
      <category>.NET</category>
      <category>2 Ohhhh</category>
      <category>Community</category>
      <category>Cool Download</category>
      <category>Security</category>
      <category>this</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=d759175d-ec15-478b-bd79-4df0f5812915</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,d759175d-ec15-478b-bd79-4df0f5812915.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,d759175d-ec15-478b-bd79-4df0f5812915.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=d759175d-ec15-478b-bd79-4df0f5812915</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
This is a whitepaper published by MS (<a href="http://www.microsoft.com/downloads/details.aspx?familyid=05033e55-aa96-4d49-8f57-c47664107938&amp;displaylang=en">download
here</a>). From the download page: 
</p>
        <p>
          <span>
            <em>Gain valuable information about the concepts of social engineering within
the IT security workspace. In section one, the guide provides a working definition
of social engineering that can be used within a company's security policies and is
meaningful to non-IT security staff. The guide describes the aims and objectives of
an attacker and shows how social engineering, like hacking, is a threat to all businesses,
not just enterprise or government institutions. The guide will also cover: </em>
          </span>
        </p>
        <ul>
          <li>
            <em>Social engineering and the defense-in-depth layered model </em>
          </li>
          <li>
            <em>Social engineering threats and defense </em>
          </li>
          <li>
            <em>Online, telephone-based, and waste management threats </em>
          </li>
          <li>
            <em>Personal approaches </em>
          </li>
          <li>
            <em>Reverse social engineering </em>
          </li>
          <li>
            <em>Designing and implementing defenses against social engineering threats </em>
          </li>
          <li>
            <em>Developing a security management framework </em>
          </li>
          <li>
            <em>Risk management </em>
          </li>
          <li>
            <em>Social engineering in the organizational security policy </em>
          </li>
          <li>
            <em>Awareness </em>
          </li>
          <li>
            <em>Managing incidents </em>
          </li>
          <li>
            <em>Operational considerations </em>
          </li>
          <li>
            <em>Security policy for social engineering threat checklists</em>
          </li>
        </ul>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=d759175d-ec15-478b-bd79-4df0f5812915" />
      </body>
      <title>How to Protect Insiders from Social Engineering Threats</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,d759175d-ec15-478b-bd79-4df0f5812915.aspx</guid>
      <link>http://chrison.net/HowToProtectInsidersFromSocialEngineeringThreats.aspx</link>
      <pubDate>Mon, 21 Aug 2006 13:17:11 GMT</pubDate>
      <description>&lt;p&gt;
This is a whitepaper published by MS (&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=05033e55-aa96-4d49-8f57-c47664107938&amp;amp;displaylang=en"&gt;download
here&lt;/a&gt;). From the download page: 
&lt;/p&gt;
&lt;p&gt;
&lt;span&gt;&lt;em&gt;Gain valuable information about the concepts of social engineering within
the IT security workspace. In section one, the guide provides a working definition
of social engineering that can be used within a company's security policies and is
meaningful to non-IT security staff. The guide describes the aims and objectives of
an attacker and shows how social engineering, like hacking, is a threat to all businesses,
not just enterprise or government institutions. The guide will also cover: &lt;/em&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Social engineering and the defense-in-depth layered model &lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Social engineering threats and defense &lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Online, telephone-based, and waste management threats &lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Personal approaches &lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Reverse social engineering &lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Designing and implementing defenses against social engineering threats &lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Developing a security management framework &lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Risk management &lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Social engineering in the organizational security policy &lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Awareness &lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Managing incidents &lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Operational considerations &lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Security policy for social engineering threat checklists&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;
&gt;&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=d759175d-ec15-478b-bd79-4df0f5812915" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,d759175d-ec15-478b-bd79-4df0f5812915.aspx</comments>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=29b709fa-f725-49d5-84b7-29c30db32bd4</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,29b709fa-f725-49d5-84b7-29c30db32bd4.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,29b709fa-f725-49d5-84b7-29c30db32bd4.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=29b709fa-f725-49d5-84b7-29c30db32bd4</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://www.microsoft.com/downloads/details.aspx?familyid=c5d2a236-9e4b-46d6-9ef4-12edbe08968e&amp;displaylang=en">Get
it here</a>
        </p>
        <p>
Currently reading: <a href="http://www.microsoft.com/MSPress/books/8753.asp">The Security
Development Lifecycle</a></p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=29b709fa-f725-49d5-84b7-29c30db32bd4" />
      </body>
      <title>Microsoft Threat Analysis &amp; Modeling v2.0 RC2</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,29b709fa-f725-49d5-84b7-29c30db32bd4.aspx</guid>
      <link>http://chrison.net/MicrosoftThreatAnalysisModelingV20RC2.aspx</link>
      <pubDate>Thu, 29 Jun 2006 05:47:25 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=c5d2a236-9e4b-46d6-9ef4-12edbe08968e&amp;amp;displaylang=en"&gt;Get
it here&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Currently reading: &lt;a href="http://www.microsoft.com/MSPress/books/8753.asp"&gt;The Security
Development Lifecycle&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=29b709fa-f725-49d5-84b7-29c30db32bd4" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,29b709fa-f725-49d5-84b7-29c30db32bd4.aspx</comments>
      <category>.NET</category>
      <category>Project Management</category>
      <category>Security</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>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=42a62abf-f9e9-4b76-be1c-bd14d762636f</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,42a62abf-f9e9-4b76-be1c-bd14d762636f.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,42a62abf-f9e9-4b76-be1c-bd14d762636f.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=42a62abf-f9e9-4b76-be1c-bd14d762636f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Michael Howard plugged his latest book <a href="http://www.microsoft.com/MSPress/books/8753.asp">The
Security Development Lifecycle</a> in his blog back in April (<a href="http://blogs.msdn.com/michael_howard/archive/2006/04/28/586233.aspx">A
New Book: The Security Development Lifecycle</a>). It isn't yet available in stores,
but I decided to preorder because I'm really looking forward to this book. Why? Because
it describes a security process in development that works - the SDL @ Microsoft.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=42a62abf-f9e9-4b76-be1c-bd14d762636f" />
      </body>
      <title>Preordered: The Security Development Lifecycle</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,42a62abf-f9e9-4b76-be1c-bd14d762636f.aspx</guid>
      <link>http://chrison.net/PreorderedTheSecurityDevelopmentLifecycle.aspx</link>
      <pubDate>Wed, 24 May 2006 06:40:22 GMT</pubDate>
      <description>&lt;p&gt;
Michael Howard plugged his latest book &lt;a href="http://www.microsoft.com/MSPress/books/8753.asp"&gt;The
Security Development Lifecycle&lt;/a&gt;&amp;nbsp;in his blog back in April (&lt;a href="http://blogs.msdn.com/michael_howard/archive/2006/04/28/586233.aspx"&gt;A
New Book: The Security Development Lifecycle&lt;/a&gt;). It isn't yet available in stores,
but I decided to preorder because I'm really looking forward to this book. Why? Because
it describes a security process in development that works - the SDL @ Microsoft.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=42a62abf-f9e9-4b76-be1c-bd14d762636f" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,42a62abf-f9e9-4b76-be1c-bd14d762636f.aspx</comments>
      <category>Books</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=82d8da7f-ea33-4808-86c8-6fc7d7347d7a</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,82d8da7f-ea33-4808-86c8-6fc7d7347d7a.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,82d8da7f-ea33-4808-86c8-6fc7d7347d7a.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=82d8da7f-ea33-4808-86c8-6fc7d7347d7a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A <a href="http://slashdot.org">/.</a> article pointed me to the blog post <a href="http://www.cerias.purdue.edu/weblogs/pmeunier/policies-law/post-38/">Reporting
Vulnerabilities is for the Brave</a>. Sounds familiar. Been there, done that.
A customer had a Web site, and I told them about a problem. They told their vendor.
And the vendor went after me - probably because, like most security-unconscious companies
they felt threatened in one way or another.
</p>
        <p>
Therefore I wholeheartedly agree with the instructions outlined, plus: lean back,
and enjoy when the bad guys whack that company. Yes, this is controversial, but as
long as companies don't "get it" that there are people that want to help them when
reporting vulnerabilities, it is definitely better to keep your trap shut.
</p>
        <p>
Aside from the cynical advice in the above paragraph, here is something to consider
for your company: establish a policy - and publish it! - that you welcome security
reports by security researchers (and Joe Average for that matter). This goes
a long way to getting the threats mitigated before they are exploited.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=82d8da7f-ea33-4808-86c8-6fc7d7347d7a" />
      </body>
      <title>Reporting Vulnerabilities is for the Brave</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,82d8da7f-ea33-4808-86c8-6fc7d7347d7a.aspx</guid>
      <link>http://chrison.net/ReportingVulnerabilitiesIsForTheBrave.aspx</link>
      <pubDate>Tue, 23 May 2006 08:12:41 GMT</pubDate>
      <description>&lt;p&gt;
A &lt;a href="http://slashdot.org"&gt;/.&lt;/a&gt; article pointed me to the blog post &lt;a href="http://www.cerias.purdue.edu/weblogs/pmeunier/policies-law/post-38/"&gt;Reporting
Vulnerabilities is for the Brave&lt;/a&gt;.&amp;nbsp;Sounds familiar. Been there, done that.
A customer had a Web site, and I told them about a problem. They told their vendor.
And the vendor went after me - probably because, like most security-unconscious companies
they felt threatened in one way or another.
&lt;/p&gt;
&lt;p&gt;
Therefore I wholeheartedly agree with the instructions outlined, plus: lean back,
and enjoy when the bad guys whack that company. Yes, this is controversial, but as
long as companies don't "get it" that there are people that want to help them when
reporting vulnerabilities, it is definitely better to keep your trap shut.
&lt;/p&gt;
&lt;p&gt;
Aside from the cynical advice in the above paragraph, here is something to consider
for your company: establish a policy - and publish it! - that you welcome security
reports by&amp;nbsp;security researchers (and Joe Average for that matter). This goes
a long way to getting the threats mitigated before they are exploited.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=82d8da7f-ea33-4808-86c8-6fc7d7347d7a" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,82d8da7f-ea33-4808-86c8-6fc7d7347d7a.aspx</comments>
      <category>Newsbites</category>
      <category>Security</category>
      <category>this</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=96d53ce1-1227-4ecb-ac41-f9fb9658696c</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,96d53ce1-1227-4ecb-ac41-f9fb9658696c.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,96d53ce1-1227-4ecb-ac41-f9fb9658696c.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=96d53ce1-1227-4ecb-ac41-f9fb9658696c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The TAM tool is now <a href="http://www.microsoft.com/downloads/details.aspx?familyid=570dccd9-596a-44bc-bed7-1f6f0ad79e3d&amp;displaylang=en">available
as release candidate 1</a>. If you don't know it (already), here is the quick scoop
from the download page: <em>Microsoft Threat Analysis &amp; Modeling tool allows non-security
subject matter experts to enter already known information including business requirements
and application architecture which is then used to produce a feature-rich threat model.
Along with automatically identifying threats, the tool can produce valuable security
artifacts such as:</em></p>
        <ul>
          <li>
            <em>Data access control matrix</em>
          </li>
          <li>
            <em>Component access control matrix</em>
          </li>
          <li>
            <em>Subject-object matrix</em>
          </li>
          <li>
            <em>Data Flow</em>
          </li>
          <li>
            <em>Call Flow</em>
          </li>
          <li>
            <em>Trust Flow</em>
          </li>
          <li>
            <em>Attack Surface</em>
          </li>
          <li>
            <em>Focused reports</em>
          </li>
        </ul>
        <p>
By the way, <a href="http://www.microsoft.com/downloads/results.aspx?pocId=&amp;freetext=Creating%20a%20Threat%20Model&amp;DisplayLang=en">use
this link to search for the video series on threat modeling</a> in the Download Center! 
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=96d53ce1-1227-4ecb-ac41-f9fb9658696c" />
      </body>
      <title>Microsoft Threat Analysis &amp; Modeling v2.0 RC1</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,96d53ce1-1227-4ecb-ac41-f9fb9658696c.aspx</guid>
      <link>http://chrison.net/MicrosoftThreatAnalysisModelingV20RC1.aspx</link>
      <pubDate>Sun, 21 May 2006 10:30:05 GMT</pubDate>
      <description>&lt;p&gt;
The TAM tool is now &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=570dccd9-596a-44bc-bed7-1f6f0ad79e3d&amp;amp;displaylang=en"&gt;available
as release candidate 1&lt;/a&gt;. If you don't know it (already), here is the quick scoop
from the download page: &lt;em&gt;Microsoft Threat Analysis &amp;amp; Modeling tool allows non-security
subject matter experts to enter already known information including business requirements
and application architecture which is then used to produce a feature-rich threat model.
Along with automatically identifying threats, the tool can produce valuable security
artifacts such as:&lt;/em&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Data access control matrix&lt;/em&gt; 
&lt;li&gt;
&lt;em&gt;Component access control matrix&lt;/em&gt; 
&lt;li&gt;
&lt;em&gt;Subject-object matrix&lt;/em&gt; 
&lt;li&gt;
&lt;em&gt;Data Flow&lt;/em&gt; 
&lt;li&gt;
&lt;em&gt;Call Flow&lt;/em&gt; 
&lt;li&gt;
&lt;em&gt;Trust Flow&lt;/em&gt; 
&lt;li&gt;
&lt;em&gt;Attack Surface&lt;/em&gt; 
&lt;li&gt;
&lt;em&gt;Focused reports&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
By the way, &lt;a href="http://www.microsoft.com/downloads/results.aspx?pocId=&amp;amp;freetext=Creating%20a%20Threat%20Model&amp;amp;DisplayLang=en"&gt;use
this link to search for the video series on threat modeling&lt;/a&gt; in the Download Center! 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=96d53ce1-1227-4ecb-ac41-f9fb9658696c" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,96d53ce1-1227-4ecb-ac41-f9fb9658696c.aspx</comments>
      <category>Cool Download</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=3e6d2583-5409-47c3-a4a0-0ee9d3a8687e</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,3e6d2583-5409-47c3-a4a0-0ee9d3a8687e.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,3e6d2583-5409-47c3-a4a0-0ee9d3a8687e.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=3e6d2583-5409-47c3-a4a0-0ee9d3a8687e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Tracking down the URL for the Webcast <a href="http://www.microsoft.com/seminar/shared/asp/view.asp?url=/seminar/en/20030424vcon66/manifest.xml">Detecting
and Debugging Common Application Issues Using the Windows Application Verifier</a> really
turned into a scavenger hunt today... if you don't know what AppVerifier is, download
it <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=bd02c19c-1250-433c-8c1b-2619bd93b3a2&amp;DisplayLang=en">here</a>,
and read more <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsecure/html/appverifier_sdl.asp">here</a>.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=3e6d2583-5409-47c3-a4a0-0ee9d3a8687e" />
      </body>
      <title>Webcast Scavenger Hunt</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,3e6d2583-5409-47c3-a4a0-0ee9d3a8687e.aspx</guid>
      <link>http://chrison.net/WebcastScavengerHunt.aspx</link>
      <pubDate>Wed, 17 May 2006 19:07:47 GMT</pubDate>
      <description>&lt;p&gt;
Tracking down the URL for the Webcast &lt;a href="http://www.microsoft.com/seminar/shared/asp/view.asp?url=/seminar/en/20030424vcon66/manifest.xml"&gt;Detecting
and Debugging Common Application Issues Using the Windows Application Verifier&lt;/a&gt; really
turned into a scavenger hunt today... if you don't know what AppVerifier is, download
it &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=bd02c19c-1250-433c-8c1b-2619bd93b3a2&amp;amp;DisplayLang=en"&gt;here&lt;/a&gt;,
and read more &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsecure/html/appverifier_sdl.asp"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=3e6d2583-5409-47c3-a4a0-0ee9d3a8687e" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,3e6d2583-5409-47c3-a4a0-0ee9d3a8687e.aspx</comments>
      <category>Security</category>
      <category>Team System</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=dc83ef5d-29d2-4758-850e-d546e0acd9d4</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,dc83ef5d-29d2-4758-850e-d546e0acd9d4.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,dc83ef5d-29d2-4758-850e-d546e0acd9d4.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=dc83ef5d-29d2-4758-850e-d546e0acd9d4</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
On Tuesday I was presenting a Windows Vista security session, which included UAC (user
account control) and respective demos. One part was showing UAC data redirection,
and for this blog post I will stick with the registry side of things.
</p>
        <p>
Why this redirection in the first place? Well, old legacy applications do tend to
assume that you are running as admin on your box. Thus, those apps simply store "stuff"
in the HKLM hive of the registry, instead of HKCU. To allow such misguided apps to
run on Vista smoothly, UAC automagically redirects write operations from the actual
HKLM location to a VirtualStore branch of the current user's profile.
</p>
        <p>
Let's look at an example of a classic no-no:
</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">try</span>
            <br />
{<br />
  RegistryKey MyTest <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Registry.LocalMachine.OpenSubKey(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Software\\Microsoft\\Microsoft
SDKs\\.NETFramework\\v2.0"</span>, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>);<br />
  MyTest.SetValue(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"InstallationFolder"</span>,
ContentsText.Text, RegistryValueKind.String);<br />
  MyTest.Close();<br />
  ResultsLabel.Text <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">"Successfully
written to registry!"</span>;<br />
}<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">catch</span> (Exception
ex)<br />
{<br />
  ResultsLabel.Text <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">"Unable
to write to registry: "</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> ex.Message;<br />
}</span>
        </p>
        <p>
On XP, being non-admin, you would end up in the catch block. Not so on Vista. With
Vista, this will work out ok, and the data will be stored like this:
</p>
        <p>
          <img src="http://chrison.net/content/binary/VirtualStore.PNG" border="0" />
        </p>
        <p>
Nice indeed. Or is it actually nice? Let's look at the code for reading the value
again:
</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">try</span>
            <br />
{<br />
  RegistryKey MyTest <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Registry.LocalMachine.OpenSubKey(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Software\\Microsoft\\Microsoft
SDKs\\.NETFramework\\v2.0"</span>, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>);<br />
  ContentsText.Text <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> MyTest.GetValue(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"InstallationFolder"</span>) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">as</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span>;<br />
  ResultsLabel.Text <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">"Successfully
read from registry!"</span>;<br />
}<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">catch</span> (Exception
ex)<br />
{<br />
  ResultsLabel.Text <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">"Unable
to read from registry: "</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">+</span> ex.Message;<br />
}</span>
        </p>
        <p>
So what's your guess where the value will come from - the original HKLM location or
the redirected HKCU VirtualStore location? Right, the VirtualStore is the winner.
</p>
        <p>
Now, I intentionally picked an existing value in the registry to "overwrite". Imagine
somebody writing a "fuzzer" to go over every single value in HKLM and write back gibberish
for every value it finds. The original application will now too see this gibberish
instead of the original good values. 
</p>
        <p>
Time will tell whether virtualizing based on user and not application will create
more havoc than do good. Because thanks to UAC malware needs no extra rights to botch
up your registry...
</p>
        <p>
          <strong>Update</strong> Yes, sure, you can turn off this virtualization. Check out
the blog entry <a href="http://blogs.msdn.com/uac/archive/2006/01/22/516066.aspx">User
Account Control Windows Vista Policies</a>.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=dc83ef5d-29d2-4758-850e-d546e0acd9d4" />
      </body>
      <title>UAC Redirection 4 Fun &amp; Profit</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,dc83ef5d-29d2-4758-850e-d546e0acd9d4.aspx</guid>
      <link>http://chrison.net/UACRedirection4FunProfit.aspx</link>
      <pubDate>Thu, 11 May 2006 12:42:03 GMT</pubDate>
      <description>&lt;p&gt;
On Tuesday I was presenting a Windows Vista security session, which included UAC&amp;nbsp;(user
account control)&amp;nbsp;and respective demos. One part was showing UAC data redirection,
and for this blog post I will stick with the registry side of things.
&lt;/p&gt;
&lt;p&gt;
Why this redirection in the first place? Well, old legacy applications do tend to
assume that you are running as admin on your box. Thus, those apps simply store "stuff"
in the HKLM hive of the registry, instead of HKCU. To allow such misguided apps to
run on Vista smoothly, UAC automagically redirects write operations from the actual
HKLM location to a VirtualStore branch of the current user's profile.
&lt;/p&gt;
&lt;p&gt;
Let's look at an example of a classic no-no:
&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;try&lt;/span&gt;
&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; RegistryKey MyTest &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; Registry.LocalMachine.OpenSubKey(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Software\\Microsoft\\Microsoft
SDKs\\.NETFramework\\v2.0"&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; MyTest.SetValue(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"InstallationFolder"&lt;/span&gt;,
ContentsText.Text, RegistryValueKind.String);&lt;br&gt;
&amp;nbsp; MyTest.Close();&lt;br&gt;
&amp;nbsp; ResultsLabel.Text &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;"Successfully
written to registry!"&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;catch&lt;/span&gt; (Exception
ex)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; ResultsLabel.Text &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;"Unable
to write to registry: "&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; ex.Message;&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
On XP, being non-admin, you would end up in the catch block. Not so on Vista. With
Vista, this will work out ok, and the data will be stored like this:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/VirtualStore.PNG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Nice indeed. Or is it actually nice? Let's look at the code for reading the value
again:
&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;try&lt;/span&gt;
&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; RegistryKey MyTest &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; Registry.LocalMachine.OpenSubKey(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Software\\Microsoft\\Microsoft
SDKs\\.NETFramework\\v2.0"&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; ContentsText.Text &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; MyTest.GetValue(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"InstallationFolder"&lt;/span&gt;) &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;as&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt;;&lt;br&gt;
&amp;nbsp; ResultsLabel.Text &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;"Successfully
read from registry!"&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;catch&lt;/span&gt; (Exception
ex)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; ResultsLabel.Text &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;"Unable
to read from registry: "&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/span&gt; ex.Message;&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
So what's your guess where the value will come from - the original HKLM location or
the redirected HKCU VirtualStore location? Right, the VirtualStore is the winner.
&lt;/p&gt;
&lt;p&gt;
Now, I intentionally picked an existing value in the registry to "overwrite". Imagine
somebody writing a "fuzzer" to go over every single value in HKLM and write back gibberish
for every value it finds. The original application will now too see this gibberish
instead of the original good values. 
&lt;/p&gt;
&lt;p&gt;
Time will tell whether virtualizing based on user and not application will create
more havoc than do good. Because thanks to UAC malware needs no extra rights to botch
up your registry...
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Update&lt;/strong&gt; Yes, sure, you can turn off this virtualization. Check out
the blog entry &lt;a href="http://blogs.msdn.com/uac/archive/2006/01/22/516066.aspx"&gt;User
Account Control Windows Vista Policies&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=dc83ef5d-29d2-4758-850e-d546e0acd9d4" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,dc83ef5d-29d2-4758-850e-d546e0acd9d4.aspx</comments>
      <category>Longhorn</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=157117e3-0d4b-4461-933a-8266d9a993f9</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,157117e3-0d4b-4461-933a-8266d9a993f9.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,157117e3-0d4b-4461-933a-8266d9a993f9.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=157117e3-0d4b-4461-933a-8266d9a993f9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Next week, I am doing the first in a series of security on-site briefings for
Microsoft Austria. <a href="http://blogs.msdn.com/mszcool/">Mario</a> has blogged
about our TTT event in two entries <a href="http://blogs.msdn.com/mszcool/archive/2006/04/10/572606.aspx">Security
Technical Briefings - Train-The-Trainer... a looong evening (Part 1)</a> and <a href="http://blogs.msdn.com/mszcool/archive/2006/04/17/577712.aspx">Security
Technical Briefings - Part 2</a>. Thanks to the workshop character, no two briefings
will be alike. 
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=157117e3-0d4b-4461-933a-8266d9a993f9" />
      </body>
      <title>Security Technical Briefings</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,157117e3-0d4b-4461-933a-8266d9a993f9.aspx</guid>
      <link>http://chrison.net/SecurityTechnicalBriefings.aspx</link>
      <pubDate>Fri, 05 May 2006 06:41:52 GMT</pubDate>
      <description>&lt;p&gt;
Next week, I am doing the first in a series of&amp;nbsp;security on-site briefings for
Microsoft Austria. &lt;a href="http://blogs.msdn.com/mszcool/"&gt;Mario&lt;/a&gt; has blogged
about our TTT event in two entries &lt;a href="http://blogs.msdn.com/mszcool/archive/2006/04/10/572606.aspx"&gt;Security
Technical Briefings - Train-The-Trainer... a looong evening (Part 1)&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/mszcool/archive/2006/04/17/577712.aspx"&gt;Security
Technical Briefings - Part 2&lt;/a&gt;. Thanks to the workshop character, no two briefings
will be alike. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=157117e3-0d4b-4461-933a-8266d9a993f9" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,157117e3-0d4b-4461-933a-8266d9a993f9.aspx</comments>
      <category>Security</category>
      <category>this</category>
      <category>Training and Conferences</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=b0c75364-5c56-4ebf-90ba-ac805de0dd9b</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,b0c75364-5c56-4ebf-90ba-ac805de0dd9b.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,b0c75364-5c56-4ebf-90ba-ac805de0dd9b.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=b0c75364-5c56-4ebf-90ba-ac805de0dd9b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <em>The process of threat modeling is built on a simple principle: To build a feasibly
secure system, one must understand all the threats in that system. The challenge,
however, is in making threat modeling more accessible to non-specialists. Microsoft
has developed a process through which minimal input can produce a feature-rich threat
model that identifies a wide range of critical information including contextual threats,
trust boundaries, fracture points, attack surfaces, and direct and transitive access
control. This podcast describes and demonstrates this threat modeling process, outlines
its benefits, and shows how threat modeling fits into the Microsoft Security Development
Lifecycle.</em>
        </p>
        <p>
          <a href="http://www.microsoft.com/downloads/details.aspx?familyid=d637db50-0572-437c-ab18-ed124c24fa29&amp;displaylang=en">Download
&amp; Listen</a>
        </p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=b0c75364-5c56-4ebf-90ba-ac805de0dd9b" />
      </body>
      <title>How Microsoft IT Does Threat Modeling</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,b0c75364-5c56-4ebf-90ba-ac805de0dd9b.aspx</guid>
      <link>http://chrison.net/HowMicrosoftITDoesThreatModeling.aspx</link>
      <pubDate>Thu, 04 May 2006 08:28:20 GMT</pubDate>
      <description>&lt;p&gt;
&lt;em&gt;The process of threat modeling is built on a simple principle: To build a feasibly
secure system, one must understand all the threats in that system. The challenge,
however, is in making threat modeling more accessible to non-specialists. Microsoft
has developed a process through which minimal input can produce a feature-rich threat
model that identifies a wide range of critical information including contextual threats,
trust boundaries, fracture points, attack surfaces, and direct and transitive access
control. This podcast describes and demonstrates this threat modeling process, outlines
its benefits, and shows how threat modeling fits into the Microsoft Security Development
Lifecycle.&lt;/em&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=d637db50-0572-437c-ab18-ed124c24fa29&amp;amp;displaylang=en"&gt;Download
&amp;amp; Listen&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=b0c75364-5c56-4ebf-90ba-ac805de0dd9b" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,b0c75364-5c56-4ebf-90ba-ac805de0dd9b.aspx</comments>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=99c87d1a-7307-40bb-a06b-de6f52f420c7</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,99c87d1a-7307-40bb-a06b-de6f52f420c7.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,99c87d1a-7307-40bb-a06b-de6f52f420c7.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=99c87d1a-7307-40bb-a06b-de6f52f420c7</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Found this on <a href="http://blogs.dotnetgerman.com/alexonasp.net/">Alex'</a> blog
(he <a href="http://blogs.dotnetgerman.com/alexonasp.net/PermaLink,guid,f557153a-6b9b-4391-b3ec-069adbb5a345.aspx">posted
it in German</a> last week): Microsoft UK has released a document (PDF) titled
"<a href="http://download.microsoft.com/documents/uk/msdn/devdave/mic472_dev_highway_all.pdf">The
Developer Highway Code</a>" (The drive for safer coding), which covers the following
topics:
</p>
        <ul>
          <li>
Integrating Security into the Lifecycle 
</li>
          <li>
Security Objectives 
</li>
          <li>
Web Application Security Design Guidelines  
</li>
          <li>
Threat Modelling 
</li>
          <li>
Security Architecture and Design 
</li>
          <li>
Security Code Review 
</li>
          <li>
Security Deployment Review 
</li>
        </ul>
        <p>
The document covers v1 and v2 of the .NET Framework, and it does contain useful checklists.
Be sure to grab it!
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=99c87d1a-7307-40bb-a06b-de6f52f420c7" />
      </body>
      <title>The Developer Highway Code</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,99c87d1a-7307-40bb-a06b-de6f52f420c7.aspx</guid>
      <link>http://chrison.net/TheDeveloperHighwayCode.aspx</link>
      <pubDate>Tue, 02 May 2006 13:17:31 GMT</pubDate>
      <description>&lt;p&gt;
Found this on &lt;a href="http://blogs.dotnetgerman.com/alexonasp.net/"&gt;Alex'&lt;/a&gt; blog
(he &lt;a href="http://blogs.dotnetgerman.com/alexonasp.net/PermaLink,guid,f557153a-6b9b-4391-b3ec-069adbb5a345.aspx"&gt;posted
it in German&lt;/a&gt;&amp;nbsp;last week): Microsoft UK has released a document (PDF) titled
"&lt;a href="http://download.microsoft.com/documents/uk/msdn/devdave/mic472_dev_highway_all.pdf"&gt;The
Developer Highway Code&lt;/a&gt;" (The drive for safer coding), which covers the following
topics:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Integrating Security into the Lifecycle 
&lt;li&gt;
Security Objectives 
&lt;li&gt;
Web Application Security Design Guidelines&amp;nbsp; 
&lt;li&gt;
Threat Modelling 
&lt;li&gt;
Security Architecture and Design 
&lt;li&gt;
Security Code Review 
&lt;li&gt;
Security Deployment Review 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The document covers v1 and v2 of the .NET Framework, and it does contain useful checklists.
Be sure to grab it!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=99c87d1a-7307-40bb-a06b-de6f52f420c7" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,99c87d1a-7307-40bb-a06b-de6f52f420c7.aspx</comments>
      <category>.NET</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=7cc51630-782d-4c3b-8889-10ddab9a902d</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,7cc51630-782d-4c3b-8889-10ddab9a902d.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,7cc51630-782d-4c3b-8889-10ddab9a902d.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=7cc51630-782d-4c3b-8889-10ddab9a902d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
During the MVP Open Day in Munich last week (Friday &amp; Saturday), we had a presentation
by Talhah Mir (<a href="http://blogs.msdn.com/ace_team/">ACE Team</a>, <a href="http://blogs.msdn.com/threatmodeling/">Threat
Modeling</a> blogs) on threat modeling - which (I hope) everyone is familiar
by now. During the talk, he pointed us to an interesting resource: <a href="http://www.privacyrights.org/ar/ChronDataBreaches.htm">A
Chronology of Data Breaches</a> from the Privacy Rights Clearinghouse. Quite an interesting
list of incidents, which gives you an idea of the ratio of actual hacking vs dishonest
insider, as well as other types of security breaches.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=7cc51630-782d-4c3b-8889-10ddab9a902d" />
      </body>
      <title>A Chronology of Data Breaches</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,7cc51630-782d-4c3b-8889-10ddab9a902d.aspx</guid>
      <link>http://chrison.net/AChronologyOfDataBreaches.aspx</link>
      <pubDate>Wed, 12 Apr 2006 08:20:38 GMT</pubDate>
      <description>&lt;p&gt;
During the MVP Open Day in Munich last week (Friday &amp;amp; Saturday), we had a presentation
by Talhah Mir (&lt;a href="http://blogs.msdn.com/ace_team/"&gt;ACE Team&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/threatmodeling/"&gt;Threat
Modeling&lt;/a&gt;&amp;nbsp;blogs) on threat modeling - which (I hope) everyone is familiar
by now. During the talk, he pointed us to an interesting resource: &lt;a href="http://www.privacyrights.org/ar/ChronDataBreaches.htm"&gt;A
Chronology of Data Breaches&lt;/a&gt; from the Privacy Rights Clearinghouse. Quite an interesting
list of incidents, which gives you an idea of the ratio of actual hacking vs dishonest
insider, as well as other types of security breaches.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=7cc51630-782d-4c3b-8889-10ddab9a902d" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,7cc51630-782d-4c3b-8889-10ddab9a902d.aspx</comments>
      <category>Community</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=57c1b80b-f1f4-41d1-9460-304a82c65e3e</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,57c1b80b-f1f4-41d1-9460-304a82c65e3e.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,57c1b80b-f1f4-41d1-9460-304a82c65e3e.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=57c1b80b-f1f4-41d1-9460-304a82c65e3e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Aside from disabling UAP, I also went back to THE Administrator account. Doing so
can get quite messy unless you join your Vista box to a domain, as outlined in the
blog entry <a href="http://windowsconnected.com/blogs/jerry/archive/2006/02/22/1028.aspx">Trouble
signing on as THE Administrator on 5308?</a> Now I have access to applicationHost.config
again. Good security does get in the way, but this is just way too onerous.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=57c1b80b-f1f4-41d1-9460-304a82c65e3e" />
      </body>
      <title>Being Administrator Feels Great</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,57c1b80b-f1f4-41d1-9460-304a82c65e3e.aspx</guid>
      <link>http://chrison.net/BeingAdministratorFeelsGreat.aspx</link>
      <pubDate>Wed, 05 Apr 2006 08:20:04 GMT</pubDate>
      <description>&lt;p&gt;
Aside from disabling UAP, I also went back to THE Administrator account. Doing so
can get quite messy unless you join your Vista box to a domain, as outlined in the
blog entry &lt;a href="http://windowsconnected.com/blogs/jerry/archive/2006/02/22/1028.aspx"&gt;Trouble
signing on as THE Administrator on 5308?&lt;/a&gt;&amp;nbsp;Now I have access to applicationHost.config
again. Good security does get in the way, but this is just way too onerous.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=57c1b80b-f1f4-41d1-9460-304a82c65e3e" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,57c1b80b-f1f4-41d1-9460-304a82c65e3e.aspx</comments>
      <category>Longhorn</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=1ff0fd7d-84d5-4690-88b2-16190667c167</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,1ff0fd7d-84d5-4690-88b2-16190667c167.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,1ff0fd7d-84d5-4690-88b2-16190667c167.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=1ff0fd7d-84d5-4690-88b2-16190667c167</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
After 'killing' three Vista installations yesterday, laziness got the better of me.
I launched msconfig.exe, went to the Tools tab, and did this:
</p>
        <p>
          <img src="http://chrison.net/content/binary/DisableUAP.PNG" border="0" />
        </p>
        <p>
A reboot later I am a happy (and no longer annoyed) camper. Security obviously went
out the window, however, I don't think this installation will live long enough either
for this to be an issue.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=1ff0fd7d-84d5-4690-88b2-16190667c167" />
      </body>
      <title>Disable UAP</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,1ff0fd7d-84d5-4690-88b2-16190667c167.aspx</guid>
      <link>http://chrison.net/DisableUAP.aspx</link>
      <pubDate>Wed, 05 Apr 2006 06:48:51 GMT</pubDate>
      <description>&lt;p&gt;
After 'killing' three Vista installations yesterday, laziness got the better of me.
I launched msconfig.exe, went to the Tools tab, and did this:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/DisableUAP.PNG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
A reboot later I am a happy (and no longer annoyed) camper. Security obviously went
out the window, however, I don't think this installation will live long enough either
for this to be an issue.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=1ff0fd7d-84d5-4690-88b2-16190667c167" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,1ff0fd7d-84d5-4690-88b2-16190667c167.aspx</comments>
      <category>Longhorn</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=13fa8796-04fa-416d-92d5-d1e56b951952</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,13fa8796-04fa-416d-92d5-d1e56b951952.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,13fa8796-04fa-416d-92d5-d1e56b951952.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=13fa8796-04fa-416d-92d5-d1e56b951952</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you need to find out just what devices are running Web services in your network (aside
from the obvious Web servers, this includes nowadays printers, access points and many
more), then you should check out <a href="http://net-square.com/httprint/">httprint</a>.
It doesn't rely on server banners or fall for other obfuscation techniques, so it
is quite handy to find out just what software is running on that box.
</p>
        <p>
          <img src="http://chrison.net/content/binary/httprint.png" border="0" />
        </p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=13fa8796-04fa-416d-92d5-d1e56b951952" />
      </body>
      <title>Web Server Fingerprinting</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,13fa8796-04fa-416d-92d5-d1e56b951952.aspx</guid>
      <link>http://chrison.net/WebServerFingerprinting.aspx</link>
      <pubDate>Wed, 29 Mar 2006 13:14:01 GMT</pubDate>
      <description>&lt;p&gt;
If you need to find out just what devices are running Web services in&amp;nbsp;your network&amp;nbsp;(aside
from the obvious Web servers, this includes nowadays printers, access points and many
more), then you should check out &lt;a href="http://net-square.com/httprint/"&gt;httprint&lt;/a&gt;.
It doesn't rely on server banners or fall for other obfuscation techniques, so it
is quite handy to find out just what software is running on that box.
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://chrison.net/content/binary/httprint.png" border=0&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=13fa8796-04fa-416d-92d5-d1e56b951952" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,13fa8796-04fa-416d-92d5-d1e56b951952.aspx</comments>
      <category>Administration</category>
      <category>IIS</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=438d7e3b-3aa5-4cdd-8826-33220e0e7fb2</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,438d7e3b-3aa5-4cdd-8826-33220e0e7fb2.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,438d7e3b-3aa5-4cdd-8826-33220e0e7fb2.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=438d7e3b-3aa5-4cdd-8826-33220e0e7fb2</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In case you need it too: <a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/596b9108-b1a7-494d-885d-f8941b07554c.mspx">Configuring
SSL Host Headers</a> shows you how to get up and running with one IP, port and certificate
but multiple host headers. All you need is a wildcard certificate (<a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/5d0fb4c2-3333-4fec-82fc-6e15d3733937.mspx">learn
more here</a>) and some CLI magic because there is no UI for it. Basically, it boils
down to (for example):
</p>
        <p>
          <font face="Courier New">adsutil.vbs set w3svc/<em>siteid</em>/SecureBindings ":443:<em>host.wildcarddomain.com</em>"</font>
        </p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=438d7e3b-3aa5-4cdd-8826-33220e0e7fb2" />
      </body>
      <title>SSL Host Headers</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,438d7e3b-3aa5-4cdd-8826-33220e0e7fb2.aspx</guid>
      <link>http://chrison.net/SSLHostHeaders.aspx</link>
      <pubDate>Tue, 28 Mar 2006 17:33:32 GMT</pubDate>
      <description>&lt;p&gt;
In case you need it too: &lt;a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/596b9108-b1a7-494d-885d-f8941b07554c.mspx"&gt;Configuring
SSL Host Headers&lt;/a&gt; shows you how to get up and running with one IP, port and certificate
but multiple host headers. All you need is a wildcard certificate (&lt;a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/5d0fb4c2-3333-4fec-82fc-6e15d3733937.mspx"&gt;learn
more here&lt;/a&gt;) and some CLI magic because there is no UI for it. Basically, it boils
down to (for example):
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;adsutil.vbs set w3svc/&lt;em&gt;siteid&lt;/em&gt;/SecureBindings ":443:&lt;em&gt;host.wildcarddomain.com&lt;/em&gt;"&lt;/font&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=438d7e3b-3aa5-4cdd-8826-33220e0e7fb2" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,438d7e3b-3aa5-4cdd-8826-33220e0e7fb2.aspx</comments>
      <category>Administration</category>
      <category>IIS</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=3e7cb488-34d1-4ef0-a85d-a7dbdc5654e8</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,3e7cb488-34d1-4ef0-a85d-a7dbdc5654e8.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,3e7cb488-34d1-4ef0-a85d-a7dbdc5654e8.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=3e7cb488-34d1-4ef0-a85d-a7dbdc5654e8</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Don't know how this one could slip by me - Windows Server 2003 Service Pack 1 (SP1)
shipped a rather important update: you can run SSL in kernel mode (http.sys) instead
of user mode. There are restrictions which are detailed <a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/d5521f19-4f73-48b2-a6e7-fc5a88880d1b.mspx?mfr=true">here</a> (most
B2C SSL sites will do just fine), and the <a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/6df8492c-02d6-45bf-a74e-0990d5654ff5.mspx?mfr=true">procedure
to enable kernel-mode SSL</a> shows how to get up and running in no time. Mostly you
are only dealing with the registry key HKLM\System\CurrentControlSet\Services\HTTP\Parameters\EnableKernelSSL.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=3e7cb488-34d1-4ef0-a85d-a7dbdc5654e8" />
      </body>
      <title>Kernel-Mode SSL in IIS 6.0</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,3e7cb488-34d1-4ef0-a85d-a7dbdc5654e8.aspx</guid>
      <link>http://chrison.net/KernelModeSSLInIIS60.aspx</link>
      <pubDate>Tue, 28 Mar 2006 17:24:04 GMT</pubDate>
      <description>&lt;p&gt;
Don't know how this one could slip by me - Windows Server 2003 Service Pack 1 (SP1)
shipped a rather important update: you can run SSL in kernel mode (http.sys) instead
of user mode. There are restrictions which are detailed &lt;a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/d5521f19-4f73-48b2-a6e7-fc5a88880d1b.mspx?mfr=true"&gt;here&lt;/a&gt;&amp;nbsp;(most
B2C SSL sites will do just fine), and the &lt;a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/6df8492c-02d6-45bf-a74e-0990d5654ff5.mspx?mfr=true"&gt;procedure
to enable kernel-mode SSL&lt;/a&gt; shows how to get up and running in no time. Mostly you
are only dealing with the registry key HKLM\System\CurrentControlSet\Services\HTTP\Parameters\EnableKernelSSL.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=3e7cb488-34d1-4ef0-a85d-a7dbdc5654e8" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,3e7cb488-34d1-4ef0-a85d-a7dbdc5654e8.aspx</comments>
      <category>Administration</category>
      <category>IIS</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=43b823f6-e995-4fa0-bf76-e97f870ad193</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,43b823f6-e995-4fa0-bf76-e97f870ad193.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,43b823f6-e995-4fa0-bf76-e97f870ad193.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=43b823f6-e995-4fa0-bf76-e97f870ad193</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Six short &amp; modular <a href="http://www.microsoft.com/downloads/details.aspx?familyid=5cb327d3-9848-43ee-a5a9-cea690d62c75&amp;displaylang=en">security
training modules</a> have been launched:
</p>
        <ul>
          <li>
Canonicalization Lab</li>
          <li>
Cookies Lab</li>
          <li>
Cross Site Scripting Lab</li>
          <li>
Regular Expressions Lab</li>
          <li>
SQL Injection Lab</li>
          <li>
Validation Controls Lab</li>
        </ul>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=43b823f6-e995-4fa0-bf76-e97f870ad193" />
      </body>
      <title>Patterns &amp; Practices Security Training Modules</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,43b823f6-e995-4fa0-bf76-e97f870ad193.aspx</guid>
      <link>http://chrison.net/PatternsPracticesSecurityTrainingModules.aspx</link>
      <pubDate>Wed, 01 Mar 2006 06:40:45 GMT</pubDate>
      <description>&lt;p&gt;
Six short &amp;amp; modular &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=5cb327d3-9848-43ee-a5a9-cea690d62c75&amp;amp;displaylang=en"&gt;security
training modules&lt;/a&gt; have been launched:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Canonicalization Lab&lt;/li&gt;
&lt;li&gt;
Cookies Lab&lt;/li&gt;
&lt;li&gt;
Cross Site Scripting Lab&lt;/li&gt;
&lt;li&gt;
Regular Expressions Lab&lt;/li&gt;
&lt;li&gt;
SQL Injection Lab&lt;/li&gt;
&lt;li&gt;
Validation Controls Lab&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=43b823f6-e995-4fa0-bf76-e97f870ad193" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,43b823f6-e995-4fa0-bf76-e97f870ad193.aspx</comments>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=9634a971-441f-4f69-9203-8f8890c2c91b</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,9634a971-441f-4f69-9203-8f8890c2c91b.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,9634a971-441f-4f69-9203-8f8890c2c91b.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=9634a971-441f-4f69-9203-8f8890c2c91b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Brought to you by MSDN TV: <em>Watch the White Hats and the Black Hats battle for
the security of Las Vegas, Nevada. Jessi Knapp and Microsoft Security Guru Joe Stagner
narrate as the Hackers try to gain control of The Plaza's online money management
system and our Security Team tries to stay one step ahead.</em><a href="http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20060223CodeRoom3/manifest.xml">Watch</a></p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=9634a971-441f-4f69-9203-8f8890c2c91b" />
      </body>
      <title>The Code Room: Breaking Into Vegas</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,9634a971-441f-4f69-9203-8f8890c2c91b.aspx</guid>
      <link>http://chrison.net/TheCodeRoomBreakingIntoVegas.aspx</link>
      <pubDate>Fri, 24 Feb 2006 01:52:05 GMT</pubDate>
      <description>&lt;p&gt;
Brought to you by MSDN TV: &lt;em&gt;Watch the White Hats and the Black Hats battle for
the security of Las Vegas, Nevada. Jessi Knapp and Microsoft Security Guru Joe Stagner
narrate as the Hackers try to gain control of The Plaza's online money management
system and our Security Team tries to stay one step ahead.&lt;/em&gt; &lt;a href="http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20060223CodeRoom3/manifest.xml"&gt;Watch&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=9634a971-441f-4f69-9203-8f8890c2c91b" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,9634a971-441f-4f69-9203-8f8890c2c91b.aspx</comments>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=edf362a3-ff2c-4d36-9b06-29c4bab6b4d1</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,edf362a3-ff2c-4d36-9b06-29c4bab6b4d1.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,edf362a3-ff2c-4d36-9b06-29c4bab6b4d1.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=edf362a3-ff2c-4d36-9b06-29c4bab6b4d1</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
On my flight to Seattle today (or yesterday, depending on the time zone) I started
to read <a href="http://www.wrox.com/WileyCDA/WroxTitle/productCd-0764596985.html">Professional
ASP.NET 2.0 Security, Membership, and Role Management</a> by Stefan Schackow. The
book definitely is a must-have for every ASP.NET developer, even if you decide to
read one chapter only: A Matter of Trust (#3). This one will save you loads of time
when you have to deploy an application into non-full trust environments. However,
the other chapters are worthwhile too, like #2 which details exactly which identity
is used when by what part of the engine. Bottomline: highly recommended reading.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=edf362a3-ff2c-4d36-9b06-29c4bab6b4d1" />
      </body>
      <title>Professional ASP.NET 2.0 Security, Membership, and Role Management</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,edf362a3-ff2c-4d36-9b06-29c4bab6b4d1.aspx</guid>
      <link>http://chrison.net/ProfessionalASPNET20SecurityMembershipAndRoleManagement.aspx</link>
      <pubDate>Sun, 19 Feb 2006 08:21:00 GMT</pubDate>
      <description>&lt;p&gt;
On my flight to Seattle today (or yesterday, depending on the time zone) I started
to read &lt;a href="http://www.wrox.com/WileyCDA/WroxTitle/productCd-0764596985.html"&gt;Professional
ASP.NET 2.0 Security, Membership, and Role Management&lt;/a&gt; by Stefan Schackow. The
book definitely is a must-have for every ASP.NET developer, even if you decide to
read one chapter only: A Matter of Trust (#3). This one will save you loads of time
when you have to deploy an application into non-full trust environments. However,
the other chapters are worthwhile too, like #2 which details exactly which identity
is used when by what part of the engine. Bottomline: highly recommended reading.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=edf362a3-ff2c-4d36-9b06-29c4bab6b4d1" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,edf362a3-ff2c-4d36-9b06-29c4bab6b4d1.aspx</comments>
      <category>.NET</category>
      <category>2 Ohhhh</category>
      <category>ASP.NET</category>
      <category>Books</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://chrison.net/Trackback.aspx?guid=978abe04-8a7f-478d-ba50-a531fea7f592</trackback:ping>
      <pingback:server>http://chrison.net/pingback.aspx</pingback:server>
      <pingback:target>http://chrison.net/PermaLink,guid,978abe04-8a7f-478d-ba50-a531fea7f592.aspx</pingback:target>
      <dc:creator>Christoph Wille</dc:creator>
      <wfw:comment>http://chrison.net/CommentView,guid,978abe04-8a7f-478d-ba50-a531fea7f592.aspx</wfw:comment>
      <wfw:commentRss>http://chrison.net/SyndicationService.asmx/GetEntryCommentsRss?guid=978abe04-8a7f-478d-ba50-a531fea7f592</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
THE security scanner has been made available in version 4.0. <a href="http://www.insecure.org/nmap/">Nmap</a> is
a tool you should not miss out on when you are in need of scanning networks and hosts.
</p>
        <img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=978abe04-8a7f-478d-ba50-a531fea7f592" />
      </body>
      <title>Nmap 4 Released</title>
      <guid isPermaLink="false">http://chrison.net/PermaLink,guid,978abe04-8a7f-478d-ba50-a531fea7f592.aspx</guid>
      <link>http://chrison.net/Nmap4Released.aspx</link>
      <pubDate>Wed, 01 Feb 2006 07:48:16 GMT</pubDate>
      <description>&lt;p&gt;
THE security scanner has been made available in version 4.0. &lt;a href="http://www.insecure.org/nmap/"&gt;Nmap&lt;/a&gt; is
a tool you should not miss out on when you are in need of scanning networks and hosts.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://chrison.net/aggbug.ashx?id=978abe04-8a7f-478d-ba50-a531fea7f592" /&gt;</description>
      <comments>http://chrison.net/CommentView,guid,978abe04-8a7f-478d-ba50-a531fea7f592.aspx</comments>
      <category>Cool Download</category>
      <category>Security</category>
    </item>
  </channel>
</rss>