Exchange of experiences / Erfahrungsaustausch / Get Help
You are not logged in.
Pages: 1
Hello
My primary goal was:
I have an ActiveX.dll, which I wanted to call from a VB6 project, getting the elevation prompt for Standard Users for "Highest" or "requireAdministrator"..
There seems to be a way with ActiveX .exe:
http://www.xtremevbtalk.com/showthread.php?t=281431
http://www.xtremevbtalk.com/archive/ind … 89099.html
Well, I did not succeed with a DLL - the restriction is clearly, that DLL are running in the same thread as the calling program (which can't elevate itself)!
Here some code, how to use ActiveX .exe - perhaps you can convert your DLL to an ActiveX .exe and call it:
Set m_obj= CreateObject("Elevation:Highest!new:Test2.Test")
Set m_obj= CreateObject("Elevation:Administrator!new:{76D3822A-DE66-5338-934E-5F0868BE2CBA}")
Standard *.exe or *.bat are easy to elevate by assembly manifest files (trustinfo) or by calling Shellexecute with "runas" verb..
Private Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub runas(ByVal hwnd As Long, ByVal x As String, ByVal c As String)
Dim APIReturnCode As Long
APIReturnCode = ShellExecute(hwnd, "runas", x, c, vbNull, 0) ' SW_HIDE=0
If APIReturnCode < 33 Then MsgBox "(Access denied.. " & Format$(APIReturnCode) & ")", vbCritical + vbOKOnly, TITEL
End Sub
For special tasks, like copying files under C:\Program Files\, my "practical solution" is using NSIS (Nullsoft Installer) exe packages, which I call by ShellExecute (using in nsis "RequestExecutionLevel admin", "SilentInstall silent" and $EXEDIR)
For Vista Task Scheduler (V2), I'm using schtasks.exe with ShellExecute, too.
Here some interesting links:
http://www.vbforums.com/showthread.php?t=558385
http://technet.microsoft.com/en-us/maga … ation.aspx
.NET http://www.codeproject.com/KB/vista-sec … vator.aspx (http://www.tweak-uac.com/home/)
http://huddledmasses.org/vista-setuid-h … prompting/
Cheers
Roland
Offline
Pages: 1