<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Vista Compatibility Team Blog : Vista application compatibility XP port</title><link>http://blogs.msdn.com/vistacompatteam/archive/tags/Vista+application+compatibility+XP+port/default.aspx</link><description>Tags: Vista application compatibility XP port</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Creating System DSNs on Vista</title><link>http://blogs.msdn.com/vistacompatteam/archive/2007/02/07/creating-system-dsns-on-vista.aspx</link><pubDate>Thu, 08 Feb 2007 01:39:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1622328</guid><dc:creator>VistaCompatTeam</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/vistacompatteam/comments/1622328.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vistacompatteam/commentrss.aspx?PostID=1622328</wfw:commentRss><description>&lt;p&gt;As stated in the &lt;a href="http://msdn2.microsoft.com/fr-fr/library/aa965884.aspx"&gt;MSDN article&lt;/a&gt; that all Keys under HKLM\Software are virtualized, there is still the HKLM\Software\ODBC\ODBC.INI key (For creating System DSNs) that will &lt;span style="text-decoration:underline"&gt;NOT&lt;/span&gt; be virtualized.
&lt;/p&gt;&lt;p&gt;The rationale behind this was that – Creating a System DSN would essentially be a task of an Administrator and so when you write to this location as a Standard User you will get an exception as the Registry entry is marked for no virtualization
&lt;/p&gt;&lt;p&gt;To view these settings, in the Command prompt type in 
&lt;/p&gt;&lt;p&gt;REG FLAGS HKLM\Software\ODBC\ODBC.INI
&lt;/p&gt;&lt;p&gt;And this will output -&amp;gt;
&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;
			&lt;span style="color:red"&gt;REG_KEY_DONT_VIRTUALIZE: SET
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;        REG_KEY_DONT_SILENT_FAIL: SET
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New"&gt;        REG_KEY_RECURSE_FLAG: SET
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;Vineet&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1622328" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vistacompatteam/archive/tags/Vista+application+compatibility+XP+port/default.aspx">Vista application compatibility XP port</category></item><item><title>Why you don't want to launch a process with a filtered token from a full token</title><link>http://blogs.msdn.com/vistacompatteam/archive/2006/10/10/Why-you-don_2700_t-want-to-launch-a-process-with-a-filtered-token-from-a-full-token.aspx</link><pubDate>Wed, 11 Oct 2006 00:40:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:814625</guid><dc:creator>VistaCompatTeam</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/vistacompatteam/comments/814625.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vistacompatteam/commentrss.aspx?PostID=814625</wfw:commentRss><description>&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;Our team works extensively with ISVs on Vista application compatibility – porting XP applications to Windows Vista. We frequently get the question "How can I launch a program with a filtered token from a program with a full token?" Although there sure are ways to do this, there is a slight caveat&amp;nbsp;with this scenario. What happens if a standard user is logged in and the program that requires admin privileges is launched? You will get the credentials dialog so that an administrator (e.g. member of the administrators group) can provide credentials for the program to run. The classic example is a child that wants to install a program but doesn't have the permissions to do so. In this scenario, a parent comes over, provides credentials to install the program and the child can then use it. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;/SPAN&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;But what happens if from the elevated process launched by the parent, the secondary process is started under a filtered token? We have a process running with a filtered admin token of the parent running in the child's session and desktop. This possibly leads to all kinds of confusion (for example, program settings and documents go to the parent's folder, etc.) Clearly not a desired scenario. So what should we do?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;One should have a small bootstrapper program running as the logged in user. From the bootstrapper, the elevated process can be launched for example with ShellExecute (the program either has to be manifested with requestedExecutionLevel or runLevel verb has to be specified). When the elevated process is done, the bootstrapper can then launch the second program with the reduced privileges of the logged-in user. In case the logged-in user is member of Administrators, all is well. In case she's just a standard user, all is well too. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;Maarten&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=814625" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vistacompatteam/archive/tags/Vista+application+compatibility+XP+port/default.aspx">Vista application compatibility XP port</category></item><item><title>Command line application with manifest asInvoker</title><link>http://blogs.msdn.com/vistacompatteam/archive/2006/10/05/Command-line-application-with-manifest-asInvoker.aspx</link><pubDate>Fri, 06 Oct 2006 01:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:794780</guid><dc:creator>VistaCompatTeam</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/vistacompatteam/comments/794780.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vistacompatteam/commentrss.aspx?PostID=794780</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;The recommendation for command line applications is to use requestedExecutionLevel=asInvoker in the manifest. If you would mark your console application as “requireAdministrator” (or “highestAvailable” and you are a member of the administrators group) and launch it &amp;nbsp;from a filtered token prompt, you will see a new console window popping up. All the output will go to that console and when your app is done the window will disappear. Hardly useful if you need to see the output. &lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;The reason for this is that command line applications share the UI with the cmd.exe console that hosts the command line app. Since we can’t change the token mid-flight we have to open a new console if the launched application requires a full administrator and the token of the original prompt is the filtered admin token. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;So the guidance is to mark your application with asInvoker in the manifest. If you need to perform tasks in the application that require admin privileges, you can check with IsUserAnAdmin() or GetTokenInformation whether you have those privileges. If you don’t, you can prompt the user to launch the application from an elevated command prompt. Chkdsk.exe is a nice example on how it should be done. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;Maarten&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=794780" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vistacompatteam/archive/tags/Vista+application+compatibility+XP+port/default.aspx">Vista application compatibility XP port</category></item><item><title>CoCreateInstanceAsAdmin or CreateElevatedComObject sample</title><link>http://blogs.msdn.com/vistacompatteam/archive/2006/09/28/CoCreateInstanceAsAdmin-or-CreateElevatedComObject-sample.aspx</link><pubDate>Fri, 29 Sep 2006 00:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:776067</guid><dc:creator>VistaCompatTeam</dc:creator><slash:comments>12</slash:comments><comments>http://blogs.msdn.com/vistacompatteam/comments/776067.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vistacompatteam/commentrss.aspx?PostID=776067</wfw:commentRss><description>&lt;FONT size=2&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial&gt;The &lt;/FONT&gt;&lt;A title=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/html/1595ebb8-65af-4609-b3e7-a21209e64391.asp href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/html/1595ebb8-65af-4609-b3e7-a21209e64391.asp" mce_href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/html/1595ebb8-65af-4609-b3e7-a21209e64391.asp"&gt;&lt;FONT face=Arial&gt;COM elevation moniker&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial&gt; is one of the three recommended ways to have a user application do tasks that require admin privileges. The &lt;/FONT&gt;&lt;A title=http://download.microsoft.com/download/5/6/a/56a0ed11-e073-42f9-932b-38acd478f46d/WindowsVistaUACDevReqs.doc href="http://download.microsoft.com/download/5/6/a/56a0ed11-e073-42f9-932b-38acd478f46d/WindowsVistaUACDevReqs.doc" mce_href="http://download.microsoft.com/download/5/6/a/56a0ed11-e073-42f9-932b-38acd478f46d/WindowsVistaUACDevReqs.doc"&gt;&lt;FONT face=Arial&gt;UAC document from September 2006&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial&gt; refers to it as the Admin COM Object model under the section “Key Decisions for Designing Administrator-Only Applications”. &amp;nbsp;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial&gt;Apparently CoCreateInstanceAsAdmin from the &lt;/FONT&gt;&lt;A title=http://windowssdk.msdn.microsoft.com/en-us/library/ms679687.aspx href="http://windowssdk.msdn.microsoft.com/en-us/library/ms679687.aspx" mce_href="http://windowssdk.msdn.microsoft.com/en-us/library/ms679687.aspx"&gt;&lt;FONT face=Arial&gt;SDK documentation&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial&gt; has been rebranded as CreateElevatedComObject in the UAC doc. I have a sample with an ATL component and a console client attached that show this working. (Disclaimer: It is for demo purposes only and the code does not do any error or exception handling.) &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial&gt;The only changes I had to make was in the two rgs files. In order to make the inproc COM component run in the dllhost.exe surrogate, I had to add this to MyElevatedCOM.rgs:&lt;/FONT&gt; &lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;val DllSurrogate = s ''&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial&gt;I also had to add this to the MyElevated.rgs file to make it both Elevation capable and MUI aware respectively:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Elevation&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val Enabled = d 1&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val LocalizedString = s &amp;nbsp;&lt;A href="mailto:'@%MODULE%,-101'" mce_href="mailto:'@%MODULE%,-101'"&gt;&lt;FONT color=#000000&gt;'@%MODULE%,-101'&lt;/FONT&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;/SPAN&gt;&lt;FONT face=Arial&gt;Finally to match up the LocalizedString entry with an entry from the resource, I added a new string in the String table with a matching entry of 101. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial&gt;The client side is literally copied from the SDK docs. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial&gt;[updated]&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial&gt;If you try to launch this application from a real standard user (so not a filtered admin), you will get an E_ACCESSDENIED on the actual method call. In order to get around this you will need to give the interactive user access permission to the COM component. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;Steps:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal&gt;Launch COM+ explorer (start, run, dcomcnfg)&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal&gt;Navigate to Component Services\Computers\My Computer\DCOM Config and get to MyElevatedCOM (for this demo app that is)&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal&gt;Select Properties and go to security tab.&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal&gt;Under Access Permissions, select the Customize button radio button and click Edit. &lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal&gt;Click Add. Change the "locations" to the local machine. &lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal&gt;Enter "Interactive" and OK out of all the dialogs.&lt;/DIV&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial&gt;If you need to script this you can use DCOMPERM from the platform SDK. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial&gt;Maarten&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=776067" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/vistacompatteam/attachment/776067.ashx" length="14748" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/vistacompatteam/archive/tags/Vista+application+compatibility+XP+port/default.aspx">Vista application compatibility XP port</category></item></channel></rss>