<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fredrik Haglund's blog &#187; User Account Control</title>
	<atom:link href="http://blog.fredrikhaglund.se/blog/tag/user-account-control/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.fredrikhaglund.se</link>
	<description>Chatter about EPiServer, ASP.NET, CSS and Web Development.</description>
	<lastBuildDate>Thu, 15 Apr 2010 09:14:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Vista Enable Your Applications</title>
		<link>http://blog.fredrikhaglund.se/blog/2007/07/18/vista-enable-your-applications/</link>
		<comments>http://blog.fredrikhaglund.se/blog/2007/07/18/vista-enable-your-applications/#comments</comments>
		<pubDate>Wed, 18 Jul 2007 17:03:10 +0000</pubDate>
		<dc:creator>Fredrik Haglund</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CodeGear]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[UAC]]></category>
		<category><![CDATA[User Account Control]]></category>
		<category><![CDATA[Vista, UAC]]></category>

		<guid isPermaLink="false">http://blog.fredrikhaglund.se/?p=26</guid>
		<description><![CDATA[You can watch the recording of my session &#8220;Vista Enable Your Applications&#8221; during the CodeGear European Web Seminar Developer Days. I have also uploaded the slides on code central.

]]></description>
			<content:encoded><![CDATA[<p>You can watch the recording of my session &#8220;<a href="http://cc.codegear.com/item/24730">Vista Enable Your Applications</a>&#8221; during the <a href="http://dn.codegear.com/article/36708">CodeGear European Web Seminar Developer Days</a>. I have also uploaded the <a href="http://cc.codegear.com/item/24730">slides on code central</a>.</p>
<p><img width="1" src="http://blogs.codegear.com/fhaglund/aggbug/37553.aspx" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fredrikhaglund.se/blog/2007/07/18/vista-enable-your-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UAC and Signed Applications</title>
		<link>http://blog.fredrikhaglund.se/blog/2007/06/08/uac-and-signed-applications/</link>
		<comments>http://blog.fredrikhaglund.se/blog/2007/06/08/uac-and-signed-applications/#comments</comments>
		<pubDate>Fri, 08 Jun 2007 15:03:45 +0000</pubDate>
		<dc:creator>Fredrik Haglund</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CodeGear]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[UAC]]></category>
		<category><![CDATA[User Account Control]]></category>
		<category><![CDATA[Vista, UAC]]></category>

		<guid isPermaLink="false">http://blog.fredrikhaglund.se/?p=25</guid>
		<description><![CDATA[I talked about User Account Control in Windows Vista at the Developer Day in Gothenburg yesterday.
One of the topics was about signing you application so a user knows who published it. In earlier windows versions this is something that the user see when he download an application like an installer but in Windows Vista publisher [...]]]></description>
			<content:encoded><![CDATA[<p>I talked about User Account Control in Windows Vista at the Developer Day in Gothenburg yesterday.</p>
<p>One of the topics was about signing you application so a user knows who published it. In earlier windows versions this is something that the user see when he download an application like an installer but in Windows Vista publisher is also showed in the consent dialog every time you start an application elevated (running as administrator).</p>
<p>And there is also one more difference &#8211; if you elevate an unsigned application User Account Control shows a big orange dialog with a lot of threatening text. If it is signed UAC will use a smaller, less threatening dialog similar to the one you see when you elevate applications signed by Microsoft.</p>
<p>Signing your application is also an requirement to get your application Vista Logo compliant.</p>
<p>So how do you get you application signed then? Well, the descriptions you find when you search is really scary.</p>
<p>&#8220;If the programmer uses a Borland product, for example Delphi, the developer has to find those 3 files on the Microsoft web site. Microsoft has removed the file codesigningx86.exe from their web site which contained the 3 files. Now the developer is required to download 19 different files, perform a cab extraction of nearly a GB of files, and install an SDK just to get those 3 files.&#8221;</p>
<p>But I found an exelent small tool that solves the whole process in a minute from <a href="http://www.x2net.com">x2net</a>. It comes with a demo cert to make it easy to test. (If you want the demo cert to work with UAC dialog on Windows Vista you must manually install the demo root certificate into the local machines certificate store)</p>
<p><img width="1" src="http://blogs.codegear.com/fhaglund/aggbug/35729.aspx" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fredrikhaglund.se/blog/2007/06/08/uac-and-signed-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More about BDE</title>
		<link>http://blog.fredrikhaglund.se/blog/2007/05/12/more-about-bde/</link>
		<comments>http://blog.fredrikhaglund.se/blog/2007/05/12/more-about-bde/#comments</comments>
		<pubDate>Sat, 12 May 2007 17:41:06 +0000</pubDate>
		<dc:creator>Fredrik Haglund</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[BDE]]></category>
		<category><![CDATA[CodeGear]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[UAC]]></category>
		<category><![CDATA[User Account Control]]></category>
		<category><![CDATA[Vista, UAC]]></category>

		<guid isPermaLink="false">http://blog.fredrikhaglund.se/?p=24</guid>
		<description><![CDATA[I got some more questions yesterday after bloging about how to get you application using Paradox or dBase tables to function under Windows Vista yesterday.
The first one is how do you add BDE to you installation project? That is easy. Just download the BDE Merge Module and add the MSM-file to you Setup-project.
I read a [...]]]></description>
			<content:encoded><![CDATA[<p>I got some more questions yesterday after bloging about how to <a href="http://blog.fredrikhaglund.se/2007/05/09/small-questions/">get you application using Paradox or dBase tables to function under Windows Vista</a> yesterday.</p>
<p>The first one is how do you add BDE to you installation project? That is easy. Just download the <a href="http://www.codegear.com/downloads/regusers/delphi">BDE Merge Module</a> and add the MSM-file to you Setup-project.</p>
<p>I read a <a href="http://forums.installaware.com/viewtopic.php?p=4773&amp;sid=676c752c20a29c61269887cb9dc999c9">forum post how this can be extended with InstallAware pre-requisites mechanism</a> so the file-set is only downloaded and installed if needed.</p>
<p><img width="1" src="http://blogs.codegear.com/fhaglund/aggbug/34489.aspx" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fredrikhaglund.se/blog/2007/05/12/more-about-bde/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Small questions</title>
		<link>http://blog.fredrikhaglund.se/blog/2007/05/09/small-questions/</link>
		<comments>http://blog.fredrikhaglund.se/blog/2007/05/09/small-questions/#comments</comments>
		<pubDate>Wed, 09 May 2007 17:59:40 +0000</pubDate>
		<dc:creator>Fredrik Haglund</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[BDE]]></category>
		<category><![CDATA[CodeGear]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[UAC]]></category>
		<category><![CDATA[User Account Control]]></category>
		<category><![CDATA[Vista, UAC]]></category>

		<guid isPermaLink="false">http://blog.fredrikhaglund.se/?p=23</guid>
		<description><![CDATA[I get a constant stream of small questions about Delphi in my inbox. Some are easy to answer and usually just send a quick response others are more complicated. But why not share some of those answers with all of you?
1) How can I install an external ActiveX control (.OCX file) in Delphi?

Click File &#62; [...]]]></description>
			<content:encoded><![CDATA[<p>I get a constant stream of small questions about Delphi in my inbox. Some are easy to answer and usually just send a quick response others are more complicated. But why not share some of those answers with all of you?</p>
<p><strong>1) How can I install an external ActiveX control (.OCX file) in Delphi?</strong></p>
<ul>
<li>Click <em>File</em> &gt; <em>New </em>&gt; <em>Package – Delphi for Win32</em></li>
<li>Save the Package project.</li>
<li>Click <em>Component</em> &gt; <em>Import Component…</em></li>
<li>Select <em>Import ActiveX control.</em></li>
<li>Select ActiveX-control in list or click Add and browse the for file.</li>
<li>Fill in component details, like name and palette page.
<ul>
<li>Optionally set unit directory to same location as where you saved the package project.</li>
<li>Optionally check <em>Generate component wrappers</em>.</li>
</ul>
</li>
<li>Select <em>Add unit to Package</em> and <em>Finish</em>.</li>
<li>Right click on<br />
the Package in Project manager to <em>Build</em> and <em>Install </em>package.´</li>
</ul>
<p>Why should I change where the unit is saved? Personally I prefer to have the package and its source in a folder under version control rather than have it stored in Delphi&#8217;s local import folder. It makes it easier for the rest of the team.</p>
<p><strong>Turbo Delphi 2006 Professional users</strong><br />
Import Component and View&gt;Type Library is missing because of a defect. Here is a workaround:</p>
<ul>
<li>Create this directory: $(BDS)\include\atl\</li>
<li>Create an empty file named: ATLBASE.H</li>
</ul>
<p>Turbo Delphi Pro now has the Component/Import Component and View/Type Library menu choices.</p>
<p><strong>2) How do I get my application with Paradox tables to work on Windows Vista?</strong></p>
<p>This one is a little bit tricky. There are several pitfalls here.</p>
<p>First of all you need to install BDE with your applications installer as usual. If you are using a comercial installer or call you installation executable setup.exe, Vista will detect that it is an installer and suggest running it as administrator which is needed to write files in the Program Files folder and the local machine registry.</p>
<p>Secondly, do you add global BDE-aliases for you database? They are stored in idapi.cfg file under Program Files where a standard user does not have the rights needed to alter files. It will work if you do this from the installer since it is running as administrator but if you add aliases from your application there might be trouble ahead! Windows Vista has a nasty compatibility feature called Virtualization or Redirection that will silently create personal copies of files instead of giving you an access denied error. Consider the administrative nightmare when every user has their own copy of idapi.cfg hidden in a personal VirtualStore folder. You can easily turn all compatibility features off by checking <em>Enable runtime themes</em> in <em>Project</em> &gt; <em>Options</em> &gt; <em>Application</em> in Delphi 2007 (or by manually adding a manifest). Remember that should always run the BDE Admin tool and control panel applet as administrator since running them as Standard User also will create a copy of idapi.cfg in the personal VirtualStore.</p>
<p>My suggestion is that you use a <em>TDatabase</em> component in you application instead of using global aliases and create a private alias for you application by setting DatabaseName and use <em>DriverName</em> and <em>Params</em> property instead of <em>Alias</em> property.</p>
<p>Next problem is the location of the database. If you have put you Paradox or dBase files it in the Program Files folder you will trigger Virtualization and then you have parts of the database in each users VirtualStore! Try to mend that mess into one database again. You should follow the steps above to add a manifest to your executable and get access denied errors instead of this mess.</p>
<p>Use the <em>SHGetFolderPath</em> function to get a path to a better location where Standard Users have read and write access. You will find an example of this in the <em>File &gt; New Other…&gt; Win2000 Logo Application.</em> Consider using CSIDL_COMMON_APPDATA if it is a shared database. You can easily get you installer to put you database files here instead by using pre-defined constants (i.e. [CommonAppDataFolder] in InstallShield, $ALLAPPDATA$ in InstallAware).</p>
<p>For Paradox there is the problem with <em>NetFileDir</em>. The default value &#8220;C:\&#8221; will not work. To get around this, add a <em>TSession</em> component to your application and set <em>NetFileDir</em> using a value from the <em>SHGetFolderPath</em> function. Use CSIDL_COMMON_APPDATA.</p>
<p>Finally, consider upgrading your Paradox or dBase database to InterBase instead! <img src='http://blog.fredrikhaglund.se/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fredrikhaglund.se/blog/2007/05/09/small-questions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Vista User Account Control and Command Line Applications</title>
		<link>http://blog.fredrikhaglund.se/blog/2007/03/19/vista-user-account-control-and-command-line-applications/</link>
		<comments>http://blog.fredrikhaglund.se/blog/2007/03/19/vista-user-account-control-and-command-line-applications/#comments</comments>
		<pubDate>Mon, 19 Mar 2007 01:57:27 +0000</pubDate>
		<dc:creator>Fredrik Haglund</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CodeGear]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[UAC]]></category>
		<category><![CDATA[User Account Control]]></category>
		<category><![CDATA[Vista, UAC]]></category>

		<guid isPermaLink="false">http://blog.fredrikhaglund.se/?p=22</guid>
		<description><![CDATA[The last weeks have been quite hectic, I have been face-to-face with over a thousand Delphi developers talking about Delphi 2007 for Win32 in Stockholm, Gothenburg (thanks Karl-Otto for the CodeGeare cap), Budapest, Prauge (see picture), Helsinki, Copenhagen and Oslo.
Jason Vokes tagged me and challenged me to write about five things I like with the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.fredrikhaglund.se/wp-content/uploads/2007/09/prauge.jpg"><img vspace="2" align="right" width="160" src="http://blog.fredrikhaglund.se/wp-content/uploads/2007/09/prauge.jpg" hspace="5" alt="Prauge Delphi Day" /></a>The last weeks have been quite hectic, I have been face-to-face with over a thousand Delphi developers talking about <em>Delphi 2007 for Win32 </em>in Stockholm, Gothenburg (thanks Karl-Otto for the CodeGeare cap), Budapest, Prauge (see picture), Helsinki, Copenhagen and Oslo.</p>
<p><a href="http://blogs.codegear.com/jasonvokes/">Jason Vokes</a> tagged me and challenged me to write about five things I like with the new Delphi release:</p>
<ol>
<li>Like many other already have said, Delphi 2007 launches fast and has a quick and responsive IDE.</li>
<li>Second out are some small debugger features that are really usefull &#8211; You can set breakpoints in the call stack and stop execution when it returns to a specific stack frame and you can also select some code and drag and drop it to the watches windows for evaluation.</li>
<li>All RTL and VCL improvements like the MainFormOnTaskbar property on TApplication that solves the long existing problem with the application context menu, Flip3D and Thumbnail support. Improvement of DoubleBuffered rendering. Usage of themed components in IDE. Updated memory manager, etc.</li>
<li>The much improved help system.</li>
<li>And finally another small productivity feature &#8211; you can save several diffrent configurations of compiler and linker settings and easily switch between them with the Configuration Manager.</li>
</ol>
<p>I talked about <em>User Account Control</em> (UAC) during my CodeRage-session last week. I think UAC is one of the most important features of <em>Windows Vista</em> and if you are not in total control of your users&#8217; environment, sooner or later you will run into questions and support issus related to UAC.</p>
<p><strong>UAC Horror Story<br />
</strong>I heard a real horror story related to UAC from a developer in Sweden last week during the <a href="http://delphi.meetup.com/172">Delphi User Group meeting in Stockholm</a>. Their application has a local database and the database engine is launched by the application. Since UAC made the application start as <em>Standard User</em> the database enginge also started as Standard User. But a Standard User did not have the rights needed to modify the database files where they got installed. You would assume that this would generate an <em>Access Denied</em> error or some other error message? But no, and now the horror begins&#8230;</p>
<p>Since their application did not have required execution level information in the manifest Windows Vista runs the process in compatibility mode. Instead of failing to open the database which the process has no right to modify Windows Vista silently makes a copy of the whole database (to the personal VirtualStore for each user) and saves the changes there instead. The users did not notice anything initally because they work on diffrent projects but after a while they started to wonder why they could not see any changes their colleagues have done.</p>
<p>When they found out what was wrong they had to do a lot of manual work to merge each users&#8217; copy of the database back into one database again&#8230;</p>
<p><strong>Conclusion:</strong> To get rid of the dangerous compatibility feature called Virtualization or Redirection by adding a manifest with required execution level to all you executables immediately! This can be done easily by just recompiling your application in <em>Delphi 2007 for Win32</em> and checking use themes in project options or use the <em>xpman</em> unit in D2007. With an earlier Delphi release you can manually create and include the manifest.</p>
<p><strong>Command Line Applications<br />
</strong>I did not talk so much about command line applications and UAC during my Code-Rage session so I would like to write a little about that.</p>
<p>First, like with all applications targeting Windows Vista, you should have a manifest with required execution level to turn off compatibility mode. But even if you command line tool requires admin privileges you should never set <em>level = &#8220;requireAdministrator&#8221;</em>. The reason for this is that you do not want a batch script to be interrupted with a modal consent dialog, instead Microsoft recommends you to halt execution with an error message and set the exit code to <em>ERROR_ELEVATION_REQUIRED</em>.</p>
<blockquote><p><font size="2" face="Courier New"><strong>program</strong> VistaConsoleApplication;</font></p>
<p><font size="2" face="Courier New">{$APPTYPE CONSOLE}</font></p>
<p><font size="2" face="Courier New">//Include Manifest with trustinfo to make executable Vista Logo Compliant and not run in compatibility mode.<br />
//Console Applications should always run as invoker even if they require admin privileges.<br />
{$R &#8216;ExecutionLevelAsInvokerManifest.res&#8217; &#8216;ExecutionLevelAsInvokerManifest.rc&#8217;}</font></p>
<p><font size="2" face="Courier New"><strong>uses</strong><br />
SysUtils,<br />
UserAccessControlUtils in &#8216;UserAccessControlUtils.pas&#8217;;</font></p>
<p><font size="2" face="Courier New"><strong>begin</strong><br />
</font><font size="2" face="Courier New">//Call function to test we have admin privelieges<br />
</font><font size="2" face="Courier New">RequireAdminConsole;<br />
</font><font size="2" face="Courier New"><br />
//TODO: Your admin tool here&#8230;<br />
</font><font size="2" face="Courier New"><strong>end</strong>.</font></p></blockquote>
<p>The RequireAdminConsole function is really simple and it uses a function IsUserAnAdmin in the WinAPI to test. I have written the code so it binds dynamically. The reason is to make it work on operation systems before Windows 2000. You could also use a <a href="http://www.swissdelphicenter.ch/torry/showcode.php?id=189">NT4 compatible apporoach and check if token has SID for admin group</a> but that would be much more code&#8230;</p>
<blockquote><p><font size="2" face="Courier New"><strong>const</strong><br />
ModName = <font color="#008000">&#8217;shell32.dll&#8217;</font>;<br />
<strong>var</strong><br />
hShell32: HMODULE;<br />
_IsUserAnAdmin: <strong>function</strong>(): BOOL; <strong>stdcall</strong>;</font></p>
<p><font size="2" face="Courier New"><strong>function</strong> IsUserAnAdmin: Boolean;<br />
<strong>begin</strong><br />
<strong>if</strong> Assigned(_IsUserAnAdmin) <strong>then</strong><br />
Result := _IsUserAnAdmin()<br />
<strong>else</strong><br />
<strong>begin</strong><br />
Result := True;<br />
<strong>if</strong> hShell32 = 0 <strong>then</strong><br />
hShell32 := LoadLibrary(ModName);<br />
<strong>if</strong> hShell32 &lt;&gt; 0 <strong>then</strong><br />
<strong>begin</strong><br />
_IsUserAnAdmin := GetProcAddress(hShell32, <font color="#008000">&#8216;IsUserAnAdmin&#8217;</font>); // Do not localize<br />
<strong>if</strong> Assigned(_IsUserAnAdmin) <strong>then</strong><br />
Result := _IsUserAnAdmin();<br />
<strong>end</strong>;<br />
<strong>end</strong>;<br />
<strong>end</strong>;</font></p>
<p><font size="2" face="Courier New"><strong>resourcestring</strong><br />
SErrorElevationRequired = <font color="#008000">&#8216;Access Denied. Administrator permissions are needed to use the selected options. Use an administrator command prompt to complete these tasks.&#8217;</font>;<br />
<strong>const</strong><br />
ERROR_ELEVATION_REQUIRED = 740;</font></p>
<p><font size="2" face="Courier New"><strong>procedure</strong> RequireAdminConsole;<br />
<strong>begin</strong><br />
<strong>if</strong> <strong>not</strong> IsUserAnAdmin <strong>then</strong><br />
<strong>begin</strong><br />
WriteLn(SErrorElevationRequired);<br />
Halt(ERROR_ELEVATION_REQUIRED);<br />
<strong>end</strong>;<br />
<strong>end</strong>;</font></p></blockquote>
<p><strong>A new question</strong><br />
The code above just checks if your process is currently running with admin privileges. But with UAC there is also another question &#8211; <em>can the user become an administrator?</em></p>
<p>Since UAC splits the login token into a user token and a full token during login (if you have admin priveliges) you need to use new WinAPI features to find the answer to this question.</p>
<blockquote><p><font size="2" face="Courier New"><strong>type</strong><br />
<font color="#008000">//Enumeration is mirroring TOKEN_ELEVATION_TYPE in Windows Vista SDK (except first value).</font><br />
TTokenElevationType = (TokenElevationNotAvailable, TokenElevationTypeDefault, TokenElevationTypeFull, TokenElevationTypeLimited);</font></p>
<p><font size="2" face="Courier New"><font color="#008000">//Extend existing enumeration in Windows.pas with new Vista constants</font><br />
TTokenInformationClass = (TokenUser = 1, TokenGroups, TokenPrivileges,<br />
TokenOwner, TokenPrimaryGroup, TokenDefaultDacl, TokenSource, TokenType,<br />
TokenImpersonationLevel, TokenStatistics, TokenRestrictedSids, TokenSessionId,<br />
TokenGroupsAndPrivileges, TokenSessionReference, TokenSandBoxInert, TokenAuditPolicy,<br />
TokenOrigin, TokenElevationType, TokenLinkedToken, TokenElevation, TokenHasRestrictions,<br />
TokenAccessInformation, TokenVirtualizationAllowed, TokenVirtualizationEnabled,<br />
TokenIntegrityLevel, TokenUIAccess, TokenMandatoryPolicy, TokenLogonSid);</font></p>
<p><font size="2" face="Courier New"><strong>function</strong> GetTokenElevationType: TTokenElevationType;<br />
<strong>var</strong><br />
hToken: THandle;<br />
elevationType: Integer;<br />
dwSize: DWORD;<br />
<strong>begin</strong><br />
Result := TokenElevationNotAvailable;<br />
hToken := 0;<br />
Win32Check(OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, hToken));<br />
<strong>if</strong> GetTokenInformation(hToken, Windows.TTokenInformationClass(TokenElevationType), @elevationType, sizeof(elevationType), dwSize) <strong>then</strong><br />
Result := TTokenElevationType(elevationType);<br />
<strong>if</strong> hToken&lt;&gt;0 <strong>then</strong><br />
CloseHandle(hToken);<br />
<strong>end</strong>;</font></p></blockquote>
<p>Call the function GetTokenElevationType above to test the current state of elevation.</p>
<blockquote><p><font size="2" face="Courier New"><strong>case</strong> GetTokenElevationType <strong>of</strong><br />
TokenElevationNotAvailable:<br />
<strong>WriteLn</strong>(<font color="#008000">&#8216;No information about elevation is available. (This is a non-vista machine)&#8217;</font>);<br />
TokenElevationTypeDefault:<br />
<strong>WriteLn</strong>(<font color="#008000">&#8216;TokenElevationTypeDefault &#8211; User is not using a split token.&#8217;</font>);<br />
TokenElevationTypeFull:<br />
<strong>WriteLn</strong>(<font color="#008000">&#8216;TokenElevationTypeFull &#8211; User has a split token, and the process is running elevated.&#8217;</font>);<br />
TokenElevationTypeLimited:<br />
<strong>WriteLn</strong>(<font color="#008000">&#8216;TokenElevationTypeLimited &#8211; User has a split token, but the process is not running elevated.&#8217;</font>);<br />
<strong>end</strong>;</font></p></blockquote>
<p>You can <a href="http://cc.codegear.com/item/24512">download the example application here</a>. Please, share if you find any problems with the code above or if you have your UAC horror stories of you own!</p>
<p><img width="1" src="http://blogs.codegear.com/fhaglund/aggbug/33207.aspx" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fredrikhaglund.se/blog/2007/03/19/vista-user-account-control-and-command-line-applications/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The longest night of the year</title>
		<link>http://blog.fredrikhaglund.se/blog/2006/12/23/the-longest-night-of-the-year/</link>
		<comments>http://blog.fredrikhaglund.se/blog/2006/12/23/the-longest-night-of-the-year/#comments</comments>
		<pubDate>Fri, 22 Dec 2006 23:05:21 +0000</pubDate>
		<dc:creator>Fredrik Haglund</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CodeGear]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[UAC]]></category>
		<category><![CDATA[User Account Control]]></category>
		<category><![CDATA[Vista, UAC]]></category>

		<guid isPermaLink="false">http://blog.fredrikhaglund.se/?p=20</guid>
		<description><![CDATA[This night was the longest night this year in the Nordic countries. In Stockholm the sun raised around nine and it was dark again at three. In the northern part of Norway, Sweden and Finland, above the polar circle, they did not even see the sun at all today.
Flying around
I have been to Oslo, Copenhagen, [...]]]></description>
			<content:encoded><![CDATA[<p>This night was the longest night this year in the Nordic countries. In Stockholm the sun raised around nine and it was dark again at three. In the northern part of Norway, Sweden and Finland, above the polar circle, they did not even see the sun at all today.</p>
<p><strong>Flying around<br />
</strong>I have been to Oslo, Copenhagen, Gothenburg, Helsinki and back to Oslo again the last weeks talking about Migrating from earlier Delphi to the current release and also about what you should do to make your application work on Windows Vista.</p>
<p>I have recorded one of my sessions that I presented at Oslo Delphi Club last week. It is about Windows Vista User Acount Control (UAC) and how you get your Delphi application to work with UAC. You can <a href="http://bdntv.borland.com/pix/fhaglund/VistaUACandDelphi/">watch the recording</a>, download the <a href="http://bdntv.borland.com/pix/fhaglund/VistaUACandDelphi/UAC_Demo.zip">example application</a> or just <a href="http://bdntv.borland.com/pix/fhaglund/VistaUACandDelphi/VistaUACandDelphi.ppt">look at my slide deck</a>.</p>
<p><img width="1" src="http://blogs.codegear.com/fhaglund/aggbug/30838.aspx" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fredrikhaglund.se/blog/2006/12/23/the-longest-night-of-the-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>InterBase on Windows Vista</title>
		<link>http://blog.fredrikhaglund.se/blog/2006/12/18/interbase-on-windows-vista/</link>
		<comments>http://blog.fredrikhaglund.se/blog/2006/12/18/interbase-on-windows-vista/#comments</comments>
		<pubDate>Mon, 18 Dec 2006 18:47:28 +0000</pubDate>
		<dc:creator>Fredrik Haglund</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CodeGear]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[InterBase]]></category>
		<category><![CDATA[UAC]]></category>
		<category><![CDATA[User Account Control]]></category>
		<category><![CDATA[Vista, UAC]]></category>

		<guid isPermaLink="false">http://blog.fredrikhaglund.se/?p=19</guid>
		<description><![CDATA[Here are a few tips if you want to run InterBase on Windows Vista. Last InterBase release was made before Windows Vista so there are a few issues that you must be aware of.
License Management
Does not work as expected at all times. The backward compatibility feature called Virtualization or Redirection in Windows Vista can break [...]]]></description>
			<content:encoded><![CDATA[<p>Here are a few tips if you want to run InterBase on Windows Vista. Last InterBase release was made before Windows Vista so there are a few issues that you must be aware of.</p>
<h2>License Management</h2>
<p>Does not work as expected at all times. The backward compatibility feature called Virtualization or Redirection in Windows Vista can break it if you start the InterBase server or License Manager as a standard user. You risk getting copies of borland.lic, regXXX.txt, etc, in several folders and that makes things complicated.</p>
<p><strong>Workaround: </strong>Check “Run this program as Administrator” on shortcuts to InterBase Server Manager and License Manager. Make sure you do not have files in <em>c:\Users\&lt;username&gt;\AppData\Local\VirtualStore\Program Files\Borland\InterBase\license</em>. If you have, delete all files in licenses and place new copy of your regXXX.txt file to start over.</p>
<h2>Connect to Local Server</h2>
<p>Due to new process isolation in Windows Vista and the fact services starts in different session/desktop than users connecting to InterBase as Local Server in IBConsole and from your applications will not work.</p>
<p><strong>Workaround:</strong> Use Remote Server and TCP/IP protocol instead of Local Server. Connect to 127.0.0.1 or localhost. For you connection string in other applications use “127.0.0.1:” infront of the path to your database file.</p>
<h2>Windows Vista User Account Control (UAC)</h2>
<p>InterBase Server Manager starts as an ordinary user even if you are an administrator. Symptoms of this is that you get access denied if you try to register InterBase to run as a service.</p>
<p><strong>Workaround: </strong>Check “Run this program as Administrator” on shortcuts to InterBase Server Manager. Always check run InterBase server as a Service.</p>
<p>IBConsole saves settings in IBConsole.xml in program files and if you start it as an standard user it does not have write access to this folder so you will get a local copy in <em>c:\Users\&lt;username&gt;\AppData\Local\VirtualStore\Program Files\Borland\InterBase</em> instead. This can be confusing because if you make changes to the on in Program Files as administrator, nothing will happened for users with a local copy.</p>
<p><strong>Workaround:</strong> Change ACL to allow ordinary users to update it or start IBConsole or check “Run this program as Administrator” on shortcut.</p>
<p><img width="1" src="http://blogs.codegear.com/fhaglund/aggbug/30695.aspx" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fredrikhaglund.se/blog/2006/12/18/interbase-on-windows-vista/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
