Jump to content
Sign in to follow this  

Vista UAC

Recommended Posts



This article: How to Start a non-elevated process

discusses the EXACT issue I have encountered with Vista.

The requirement: to launch a process from an application running with elevated (post-UAC dialog credentials), but to have the launched process run with the original user credentials (pre-UAC dialog credentials).

The solution provided by the article does indeed work under Vista. The quotes can be cumbersome, so for anyone who wishes to use this solution, this code works:

Local $Path = FileGetShortName ($Install_Path & "\" & $User_Process), _
      $DLLName = FileGetShortName ($Install_Path) & 'VistaLib32.dll,RunNonElevated', _
      $Argument1 = 1, _
      $Argument2 = '"' & 'This argument contains spaces' & '"', _
      $Argument3 = 3, _
      $Arguments = $Argument1 & ' ' & $Argument2 & ' ' & $Argument3
RunWait ('rundll32.exe' & ' ' & $DLLName & ' "' & $Path & '" ' & $Parameters)

If @error Then...careful, read discussion below

I have tested the above solution on two different machines running Vista, and it works fine.

HOWEVER, contrary to what the article implies, I have tested it on four different machines running XP and, rather strangely

it works on one of them and fails on the others.

I realize I could solve THAT problem by looking at @OSVersion and only using VistLib32 on Vista, but I'm just wondering if there is a way to accomplish this in native AutoIt, and if not, it would be great if someone could construct the DLLCall to invoke the RunNonElevated method of VistaLib32 directly (the above code excerpt could be misleading because @error is set ONLY if rundll32.exe is not successfully launched).

The article I referred to above is over a year old, so I wonder if this problem has been solved and I'm just missing something.

Surprisingly, a search of the forum didn't turn up anything on this (although this post: Run As Local Service discusses a related topic.

Not finding any other posts makes me think I am missing something because I would think others would have encountered this problem (although I do realize the Wise and Inno Installers provide the ability to launch the application with the original user credentials after Setup has completed).

You comments and advice are appreciated.



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this