Update: UltraVNC 1.4.3.6 and UltraVNC SC 1.4.3.6: https://forum.uvnc.com/viewtopic.php?t=37885
Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864

Join us on social networks and share our announcements:
- Website: https://uvnc.com/
- GitHub: https://github.com/ultravnc
- Mastodon: https://mastodon.social/@ultravnc
- Facebook: https://www.facebook.com/ultravnc1
- X/Twitter: https://x.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc

My Upgrade (disable UAC, runas admin, multilanguage support)

Simple, Free, Open Source UltraVNC Wrapper Supporting Windows and Mac OSX
Post Reply
okinobk
8
8
Posts: 8
Joined: 2008-06-19 20:44

My Upgrade (disable UAC, runas admin, multilanguage support)

Post by okinobk »

Hello,

first of all I want to thank to supercoe for the BEST and FREE open source instant support program.

I work in IT support company engaged in open source solutions and really needed alternative to instant support to connect to clients if they are not in their offices. TeamViewer is good, no problematic program but price is not acceptable for my and it's not open source.

I started testing ChunckVNC a few months ago (UltraVNC we are using a few years in local networks). But I stuck on some problems:
1. using ChunkVNC on computer with UltraVNC installed as service (setup for local network only, without encryption, with MSLogon etc.)
2. UAC - on Windows VIsta and 7
3. users, that run exe file, don't have administrator rights, so can't install ChunkVNC as service to disable UAC
4. some client don't understand English

So I needed to rewrite source code and I repaired all these problems (with support from people on the forum).
1. run InstalSupportVNC.exe with added parameters: -sc_prompt, -multi
2. online disable UAC from trayicon, change registers and run program as Local System Account
3. if user don't have admin rights that ChunkVNC ask you for admin credentials before close VNC connection and use it for rerun as admin
4. check OS language and choose right language strings (I made only English and Slovak support, but it's not limited)
5. some new bugfixes and notifications windows


What do you need to change?
Change SRC/InstantSupport.au3 to my (below) and download psexec.exe from PsTools to SRC/InstantSupport_Files/ from this link

Code: Select all

http://technet.microsoft.com/en-us/sysinternals/bb897553

I hope that this help to somebody. If you have any questions I will try to answer it (but as you see, my English is not really good :) ). If you find any bug please write it below and I will try to find the time to resolve it.

okinobk
http://www.allit.sk
http://www.allit.sk/en


There is my new source code of InstantSupport.au3. I'm sorry but it is translated for company and our clients, so you need to translate to basic ChunkVNC by yourself.

Code: Select all

#AutoIt3Wrapper_Run_Obfuscator=Y
#Obfuscator_Parameters=/StripOnly

; Disable the scripts ability to pause.
Break(0)

#include "Aut2Exe\Include\GUIConstantsEx.au3"
#include "Aut2Exe\Include\StaticConstants.au3"
#include "Aut2Exe\Include\WindowsConstants.au3"
#include "Aut2Exe\Include\ServiceControl.au3"


; Exit if the script hasn't been compiled
If Not @Compiled Then
	MsgBox(0, "ERROR", 'Script must be compiled before running!', 5)
	Exit
EndIf


; Language strings. Check OS language and set strings.
; If OS language is Slovak set these strings.
If @OSLang = "041b" Then
	$str_Program_Title = 						"Allit Vzdialená Podpora"
	$str_Button_InstallService = 				"Inštalovať ako službu"
	$str_Button_DisableUAC =					"Vypnúť UAC"
	$str_Button_Exit =						"Exit"
	$str_MsgBox_Information = 				"Info"
	$str_MsgBox_ExitInstantSupport = 			"Vypnúť Allit Vzdialenú Podporu?"
	$str_MsgBox_ServiceInstallation = 			"Inštalácia služby"
	$str_MsgBox_Error =						"Chyba"
	$str_MsgBox_RemoveService =				"Odstrániť službu a odinštalovať?"
	$str_ServiceEnterAnIDNumber = 			"Zadajte ID číslo:"
	$str_ServiceInvalidID = 					"Zadané nevyhovujúce ID, zrušená inštalácia služby."
	$str_ServiceProxy =						"Inštalácia služby nie je podporovaná pri využívaní HTTP Proxy."
	$str_ErrorInstallService =					"Inštalácia služby vyžaduje administrátorské práva."
	$str_ErrorStopService =					"Zastavnie služby vyžaduje administrátorské práva."
	$str_ErrorDisableUAC =					"Vypnutie UAC vyžaduje administrátorské práva."
	$str_ErrorUnknownCommand =				"Neznámy príkaz."
	$str_ErrorRepeaterConnectionFailed = 		"Nepodarilo sa nadviazať spojenie so serverom."
	$str_EndSupportSession =					"Skutočne ukončiť vzdialenú podporu?"
	$str_CloseOtherVNCServers =				"Iná Allit Vzdialená Podpora už beží. Skúsiť zastaviť bežiacu Vzdialenú Podporu?"
	$str_ServiceEnterDomain =					"Zadajte názov domény alebo názov počítača, v prípade lokálne účtu."
	$str_ServiceEnterAdminName =				"Zadajte meno administrátora."
	$str_ServiceEnterAdminPass =				"zadajte heslo administrátora."
	$str_ServiceInstallQuestion =				"Inštalovať Allit Vzdialenú Podporu ako službu?"
	$str_ServiceUninstallShortcut =				"Odinštalovať Allit Podporu"
Else
	$str_Program_Title = 						"Allit Instant Support"
	$str_Button_InstallService = 				"Install Service"
	$str_Button_DisableUAC =					"Disable UAC"
	$str_Button_Exit =						"Exit"
	$str_MsgBox_Information = 				"Information"
	$str_MsgBox_ExitInstantSupport = 			"Exit Allit Instant Support?"
	$str_MsgBox_ServiceInstallation = 			"Service Installation"
	$str_MsgBox_Error =						"Error"
	$str_MsgBox_RemoveService =				"Remove Service and Uninstall?"
	$str_ServiceEnterAnIDNumber = 			"Enter an ID number:"
	$str_ServiceInvalidID = 					"Invalid ID entered, service installation canceled."
	$str_ServiceProxy =						"Service installation not supported when using HTTP Proxy."
	$str_ErrorInstallService =					"Installing service requires administrator privileges."
	$str_ErrorStopService =					"Stopping VNC services requires administrator privileges."
	$str_ErrorDisableUAC =					"Disabling UAC requires administrator privileges."
	$str_ErrorUnknownCommand =				"Unknown command."
	$str_ErrorRepeaterConnectionFailed = 		"Connection to the repeater was not possible."
	$str_EndSupportSession =					"Are you sure you want to end this support session?"
	$str_CloseOtherVNCServers =				"Another Allit Instant Support is running which must be stopped. Try to stop other Allit Instant Support?"
	$str_ServiceEnterDomain =					"Enter Domain Name or Hostname if Local Account."
	$str_ServiceEnterAdminName =				"Enter Administrator Username."
	$str_ServiceEnterAdminPass =				"Enter Administrator Password."
	$str_ServiceInstallQuestion =				"Install Allit Instant Support as service?"
	$str_ServiceUninstallShortcut =				"Uninstall Allit Support"
EndIf


; Global Vars.
Global $ExtractFiles = True
Global $GenerateID = True
Global $LanMode = False
Global $IDNumber = 123456
Global $WorkingPath = @AppDataDir & "\InstantSupport_Temp_Files"
Global $ProxyEnabled = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable")
Global $ServiceName = "InstantSupport"
Global $ServiceDisplayName = "Allit Instant Support"
Global $ServiceDescription = "Provides secure remote desktop sharing"
Global $UACDisabled = False


; Create unique working path if our default directory already exists. (Possible InstantSupport is already running)
If FileExists( @AppDataDir & "\InstantSupport_Temp_Files" ) Then
	$WorkingPath = @AppDataDir & "\InstantSupport_Temp_Files_" & Random( 100000, 999999,1 )
EndIf


; Command line args.
If $cmdline[0] > 0 Then
	Switch $cmdline[1]

		Case "-installservice"
			If IsAdmin() Then

				InstallService()
				Exit

			Else

				MsgBox( 48, $str_MsgBox_Error, $str_ErrorInstallService, 30 )
				Exit

			EndIf

		Case "-removeservice"
			If IsAdmin() Then

				RemoveService()
				Exit

			Else
				; Elevate to admin to remove.
				ShellExecuteWait( @ScriptFullPath, "-removeservice", @ScriptDir, "runas")
				Exit

			EndIf

		Case "-stopservices"
			If IsAdmin() Then

				StopServices()
				Exit

			Else

				MsgBox( 48, $str_MsgBox_Error, $str_ErrorStopService, 30 )
				Exit

			EndIf
			
		Case "-disableuac"
			If IsAdmin() Then

				DisableUAC()

			Else
				
				MsgBox( 48, $str_MsgBox_Error, $str_ErrorDisableUAC, 30 )
				Exit

			EndIf

		Case Else
			MsgBox( 48 , $str_MsgBox_Error, $str_ErrorUnknownCommand, 30 )
			Exit

	EndSwitch
EndIf


; Extract files.
If $ExtractFiles Then

	DirCreate( $WorkingPath )
	FileInstall( "InstantSupport_Files\instantsupport.ini", $WorkingPath & "\instantsupport.ini", 1 )
	FileInstall( "InstantSupport_Files\logo.jpg", $WorkingPath & "\logo.jpg", 1 )
	FileInstall( "InstantSupport_Files\SecureVNCPlugin.dsm", $WorkingPath & "\SecureVNCPlugin.dsm", 1 )
	FileInstall( "InstantSupport_Files\ultravnc.ini", $WorkingPath & "\ultravnc.ini", 1 )
	FileInstall( "InstantSupport_Files\winvnc.exe", $WorkingPath & "\InstantSupportVNC.exe", 1 )
	FileInstall( "InstantSupport_Files\unblock.js", $WorkingPath & "\unblock.js", 1 )
	FileInstall( "InstantSupport_Files\psexec.exe", $WorkingPath & "\psexec.exe", 1 )

	; Unblock InstantSupport.exe to prevent "Windows Security" messages.
	ShellExecuteWait($WorkingPath & "\unblock.js", "", @ScriptDir, "")

	FileCopy( @ScriptDir & "\" & @ScriptName, $WorkingPath & "\InstantSupport.exe", 9 )

EndIf


; Test server port is avaiable.
$RepeaterServerPort = IniRead( $WorkingPath & "\instantsupport.ini", "Repeater", "ServerPort", "" )
TCPStartUp()
$TCPtest = TCPConnect( "127.0.0.1", $RepeaterServerPort )
TCPShutdown()

; Close known VNC servers.
If ProcessExists( "InstantSupportVNC.exe" ) Or $TCPtest <> -1 Then
	If MsgBox( 4, $str_Program_Title, $str_CloseOtherVNCServers ) = 6 Then
		
		If _ServiceRunning("", $ServiceName) Then
			If IsAdmin() Then

				ShellExecuteWait($WorkingPath & "\InstantSupport.exe", "-removeservice", @ScriptDir, "")

			Else

				ShellExecuteWait($WorkingPath & "\InstantSupport.exe", "-removeservice", @ScriptDir, "runas")

			EndIf
			Sleep(10000)
		EndIf

		; Kill user mode VNC servers.
		;Run( $WorkingPath & "\InstantSupportVNC.exe -kill" )
		;Sleep(10000)
		ProcessClose( "InstantSupportVNC.exe" )

		; Wait for the winvnc server to close.
		ProcessWaitClose( "InstantSupportVNC.exe", 15 )
			
		; Kill InstantSupport if running.
		If WinExists( $str_Program_Title ) Then

				WinClose( $str_Program_Title )
				Sleep( 500 )
				Send( "{ENTER}" ) ; Let the other InstantSupport process close normally so it can cleanup.
				Sleep( 500 )

		EndIf

	Else

		_DeleteSelf( $WorkingPath, 5)
		Exit

	EndIf

EndIf


; Read server settings from instantsupport.ini.
$RepeaterAddress = IniRead( $WorkingPath & "\instantsupport.ini", "Repeater", "Address", "" )
$RepeaterAddressLAN = IniRead( $WorkingPath & "\instantsupport.ini", "Repeater", "AddressLAN", "" )
$RepeaterServerPort = IniRead( $WorkingPath & "\instantsupport.ini", "Repeater", "ServerPort", "" )


; Generate a random ID Number between 200,000 and 999,999 or read the installed ID number.
If $GenerateID Then

	$LowerLimit = 200000
	$UpperLimit = 999999
	$IDNumber = Random( $LowerLimit,$UpperLimit,1 )

Else

	$IDNumber = IniRead( $WorkingPath & "\instantsupport.ini", "InstantSupport", "ID", "" )

EndIf


; Create the GUI.
$InstantSupport = GUICreate( $str_Program_Title, 450, 200, -1, -1, BitOR( $WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS,$WS_MINIMIZEBOX ) )
GUISetBkColor( 0xFFFFFF )
$Label2 = GUICtrlCreateLabel( $IDNumber, 0, 100, 450, 100, $SS_CENTER )
GUICtrlSetFont( -1, 50, 800, 0, "Arial Black" )
$Pic1 = GUICtrlCreatePic( $WorkingPath & "\logo.jpg", 0, 0, 450, 90, BitOR( $SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS ) )
GUISetState( @SW_SHOW )
WinSetOnTop( $str_Program_Title, "",1)


; Check to see if the repeater exists unless there is a proxy.
If $ProxyEnabled = False Then

	TCPStartUp()

	; Test WAN address first.
	$socket = TCPConnect( TCPNameToIP( $RepeaterAddress ), $RepeaterServerPort )
	If $socket = -1 Then $LanMode = True

	; Test LAN Address because WAN failed.
	If $LanMode = True Then

		$socket = TCPConnect( TCPNameToIP( $RepeaterAddressLAN ), $RepeaterServerPort )

		If $socket = -1 Then

			; No connections possible, exit.
			WinSetOnTop( $str_Program_Title, "",0 )
			MsgBox( 48, $str_MsgBox_Error, $str_ErrorRepeaterConnectionFailed, 10 )
			InstantSupportExit( True )

		EndIf

	EndIf

	TCPShutdown()

EndIf


; Start the VNC server and make a reverse connection to the repeater.
If $LanMode = True Then
	ShellExecute( $WorkingPath & "\InstantSupportVNC.exe", "-sc_prompt -httpproxy -autoreconnect ID:" & $IDNumber & " -connect " & $RepeaterAddressLAN & ":" & $RepeaterServerPort & " -multi -run" )
Else
	ShellExecute( $WorkingPath & "\InstantSupportVNC.exe", "-sc_prompt -httpproxy -autoreconnect ID:" & $IDNumber & " -connect " & $RepeaterAddress & ":" & $RepeaterServerPort & " -multi -run" )
EndIf


; Create the tray icon. Default tray menu items (Script Paused/Exit) will not be shown.
Opt( "TrayMenuMode", 1 )
$InstallItem = TrayCreateItem( $str_Button_InstallService )
$DisableUACItem = TrayCreateItem( $str_Button_DisableUAC )
$ExitItem = TrayCreateItem( $str_Button_Exit )

If ProcessExists( "WinVNC.exe" ) Then
	TrayItemSetState ( $InstallItem, 128 )
EndIf

If $UACDisabled = True Then
	TrayItemSetState ( $DisableUACItem, 129 )
EndIf

; Enable the scripts ability to pause. (otherwise tray menu is disabled)
Break(1)

; Main loop.
While 1

	; Close any windows firewall messages that popup. The windows firewall doesn't block outgoing connections anyways. ----Does the OS language change this?----
	If WinExists( "Windows Security Alert" ) Then WinClose( "Windows Security Alert" )
 
	; If UltraVNC can't connect to the repeater then exit.
	If WinExists( "Initiate Connection" ) Then

		; Stop the VNC server
		ProcessClose( "InstantSupportVNC.exe" )
		ProcessWaitClose( "InstantSupportVNC.exe" )
		WinSetOnTop( $str_Program_Title, "",0 )
		MsgBox( 48, $str_MsgBox_Error, $str_ErrorRepeaterConnectionFailed )
		InstantSupportExit( True )

	EndIf

	; Check for form events.
	$nMsg = GUIGetMsg()
	Switch $nMsg

		Case $GUI_EVENT_CLOSE

			WinSetOnTop( $str_Program_Title, "",0 )
			If MsgBox( 4, $str_Program_Title, $str_EndSupportSession ) = 6 Then

				InstantSupportExit( True )

			EndIf

	EndSwitch

	; Tray events.
	$nMsg = TrayGetMsg()
	Switch $nMsg		
	
		Case $InstallItem
		
			; Service installation unavailable if using an HTTP Proxy (UltraVNC limitation).
			If $ProxyEnabled = True Then

				WinSetOnTop( $str_Program_Title, "",0 )
				MsgBox( 48, $str_MsgBox_Error, $str_ServiceProxy, 10 )
				ContinueLoop

			Else
			
				; Check Admin Rights.
				$isadmin = IsAdmin()
				If $isadmin <> 1 Then
				
					; Choose ID for service installation.
					WinSetOnTop( $str_Program_Title, "",0 )
					;$IDNumber = InputBox( $str_MsgBox_ServiceInstallation, $str_ServiceEnterAnIDNumber, $IDNumber ) +0
					
					; Set Administration Credentials and Domain.
					$domain = InputBox( $str_MsgBox_ServiceInstallation, $str_ServiceEnterDomain, @ComputerName )
					If @error <> 0 Then ContinueLoop
					$username = InputBox( $str_MsgBox_ServiceInstallation, $str_ServiceEnterAdminName, "administrator" )
					If @error <> 0 Then ContinueLoop
					$password = InputBox( $str_MsgBox_ServiceInstallation, $str_ServiceEnterAdminPass, "", "*" )
					If @error <> 0 Then ContinueLoop
				
					; Check Admin Credentials.
					RunAsWait( $username, $domain, $password, 0, @SystemDir & "\rundll32.exe", @SystemDir, @SW_HIDE )
					If @error = 1 Then
						MsgBox( 48, $str_MsgBox_Error, $str_ErrorInstallService, 30 )
						ContinueLoop
					EndIf
					
				EndIf
				
				; Last question after install service.
				If MsgBox( 1+32+256, $str_MsgBox_ServiceInstallation, $str_ServiceInstallQuestion, 30 ) <> 1 Then ContinueLoop

				If IsNumber($IDNumber) and $IDNumber > 200000 and $IDNumber < 999999 Then

					; Configure ultravnc.ini.
					If $LanMode = True Then

						IniWrite( $WorkingPath & "\ultravnc.ini", "admin", "service_commandline", '-autoreconnect ID:' & $IDNumber & ' -connect ' & $RepeaterAddressLAN & ":" & $RepeaterServerPort & ' -multi' )

					Else

						IniWrite( $WorkingPath & "\ultravnc.ini", "admin", "service_commandline", '-autoreconnect ID:' & $IDNumber & ' -connect ' & $RepeaterAddress & ":" & $RepeaterServerPort & ' -multi' )

					EndIf

					; Configure instantsupport.ini.
					IniWrite( $WorkingPath & "\instantsupport.ini", "InstantSupport", "ID", $IDNumber )

					; Kill the VNC server.
					;$PID = Run( $WorkingPath & "\InstantSupportVNC.exe -kill" )

					; Wait for the winvnc server to close.
					;ProcessWaitClose( $PID, 15 )
					
					; Kill the VNC server.
					ProcessClose( "InstantSupportVNC.exe" )

					; Wait for the winvnc server to close.
					ProcessWaitClose( "InstantSupportVNC.exe", 15 )

					; Run installer after the server exits.
					ProcessWaitClose( "InstantSupportVNC.exe" )
					
					If IsAdmin() Then

						ShellExecute($WorkingPath & "\InstantSupport.exe", "-installservice", @ScriptDir, "")

					Else

						RunAs( $username, $domain, $password, 0, $WorkingPath & "\InstantSupport.exe -installservice", "", @SW_HIDE )

					EndIf

					InstantSupportExit( True )

				Else

					WinSetOnTop( $str_Program_Title, "",0 )
					MsgBox( 0, $str_MsgBox_Information, $str_ServiceInvalidID )
					ContinueLoop

				EndIf

			EndIf
			
			
		Case $DisableUACItem
		
			; Check Admin Rights.
			$isadmin = IsAdmin()
			If $isadmin <> 1 Then
				
				WinSetOnTop( $str_Program_Title, "",0 )
				; Set Administration Credentials and Domain.
				$domain = InputBox( $str_MsgBox_ServiceInstallation, $str_ServiceEnterDomain, @ComputerName )
				If @error <> 0 Then ContinueLoop
				$username = InputBox( $str_MsgBox_ServiceInstallation, $str_ServiceEnterAdminName, "administrator" )
				If @error <> 0 Then ContinueLoop
				$password = InputBox( $str_MsgBox_ServiceInstallation, $str_ServiceEnterAdminPass, "", "*" )
				If @error <> 0 Then ContinueLoop
			
				; Check Admin Credentials.
				RunAsWait( $username, $domain, $password, 0, @SystemDir & "\rundll32.exe", @SystemDir, @SW_HIDE )
				If @error = 1 Then
					MsgBox( 48, $str_MsgBox_Error, $str_ErrorDisableUAC, 30 )
					ContinueLoop
				EndIf
				
			EndIf
			
			; Kill the VNC server.
			ProcessClose( "InstantSupportVNC.exe" )

			; Wait for the winvnc server to close.
			ProcessWaitClose( "InstantSupportVNC.exe", 15 )

			; Run installer after the server exits.
			ProcessWaitClose( "InstantSupportVNC.exe" )

			
			If IsAdmin() Then

						ShellExecute($WorkingPath & "\psexec.exe", ' -accepteula -i -s "' & $WorkingPath & '\InstantSupport.exe" -disableuac', @ScriptDir, "")

					Else

						RunAs( $username, $domain, $password, 0, $WorkingPath & '\psexec.exe -accepteula -i -s "' & $WorkingPath & '\InstantSupport.exe" -disableuac', "", @SW_HIDE )

					EndIf
					
			InstantSupportExit( True )


		Case $ExitItem

			WinSetOnTop( $str_Program_Title, "",0 )
			If MsgBox( 4, $str_Program_Title, $str_EndSupportSession ) = 6 Then

				InstantSupportExit( True )

			EndIf

	EndSwitch

WEnd


Func InstallService()

	; Copy files.
	FileCopy( @ScriptDir & "\*.*", @ProgramFilesDir & "\InstantSupport\", 9 )

	; Create uninstall link on All Users desktop.
	FileCreateShortcut( @ProgramFilesDir & '\InstantSupport\InstantSupport.exe', @DesktopCommonDir & '\' & $str_ServiceUninstallShortcut &'.lnk', "", "-removeservice" )

	; Install VNC Service.
	RunWait( @ComSpec & ' /c sc create ' & $ServiceName & ' binPath= "' & @ProgramFilesDir & '\InstantSupport\InstantSupportVNC.exe -service" start= auto DisplayName= "' & $ServiceDisplayName & '"', "", @SW_HIDE )
	RunWait( @ComSpec & ' /c sc description ' & $ServiceName & ' "' & $ServiceDescription & '"', "", @SW_HIDE )
	RunWait( @ComSpec & ' /c net start ' & $ServiceName, "", @SW_HIDE )

EndFunc


Func RemoveService()

	WinSetOnTop( $str_Program_Title, "",0 )
	If MsgBox( 4, $str_Program_Title, $str_MsgBox_RemoveService ) = 6 Then

		; Remove Uninstaller.
		FileDelete( @DesktopCommonDir & '\Uninstall Instant Support.lnk"' )

		; Remove VNC Service.
		RunWait( @ComSpec & " /c net stop " & $ServiceName, "", @SW_HIDE )
		RunWait( @ComSpec & " /c sc delete " & $ServiceName, "", @SW_HIDE )

		; Remove the InstantSupport Service.
		_DeleteSelf( @ProgramFilesDir & "\InstantSupport", 15 )

	EndIf

EndFunc


Func DisableUAC()

	$admin = RegRead( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin")
	$lua = RegRead( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA")
	$desktop = RegRead( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop")
	
	If ( $admin = "0" And $lua = "0" And $desktop = "0" ) Then
	
		$adminbackup = RegRead( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ASadminbackup")
		$luabackup = RegRead( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ASluabackup")
		$desktopbackup = RegRead( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ASdesktopbackup")
	
		RegWrite( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin", "REG_DWORD", $adminbackup)
		RegWrite( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA", "REG_DWORD", $luabackup)
		RegWrite( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop", "REG_DWORD", $desktopbackup)
		
		RegDelete( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ASadminbackup")
		RegDelete( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ASluabackup")
		RegDelete( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ASdesktopbackup")
	
	Else
	
		RegWrite( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ASadminbackup", "REG_DWORD", $admin)
		RegWrite( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ASluabackup", "REG_DWORD", $lua)
		RegWrite( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ASdesktopbackup", "REG_DWORD", $desktop)
	
		RegWrite( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin", "REG_DWORD", "0")
		RegWrite( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA", "REG_DWORD", "0")
		RegWrite( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop", "REG_DWORD", "0")
		
		$UACDisabled = True
		
	EndIf

EndFunc


Func _DeleteSelf( $Path, $iDelay = 5 )

	Local $sCmdFile

	FileDelete( @TempDir & "\scratch.bat" )


	$sCmdFile = 'PING -n ' & $iDelay & ' 127.0.0.1 > nul' & @CRLF _
			& 'DEL /F /Q "' & $Path & '\InstantSupportVNC.exe"' & @CRLF _
			& 'DEL /F /Q "' & $Path & '\InstantSupport.exe"' & @CRLF _
			& 'DEL /F /Q "' & $Path & '\SecureVNCPlugin.dsm"' & @CRLF _
			& 'DEL /F /Q "' & $Path & '\ultravnc.ini"' & @CRLF _
			& 'DEL /F /Q "' & $Path & '\instantsupport.ini"' & @CRLF _
			& 'DEL /F /Q "' & $Path & '\logo.jpg"' & @CRLF _
			& 'DEL /F /Q "' & $Path & '\unblock.js"' & @CRLF _
 			& 'RMDIR "' & $Path & '"' & @CRLF _
			& 'DEL "' & @TempDir & '\scratch.bat"'

	FileWrite( @TempDir & "\scratch.bat", $sCmdFile )

	Run( @TempDir & "\scratch.bat", @TempDir, @SW_HIDE )

EndFunc


Func InstantSupportExit( $DeleteFiles = False )

	; Kill the VNC server
	ProcessClose( "InstantSupportVNC.exe" )

	; Wait for the winvnc server to close.
	ProcessWaitClose( "InstantSupportVNC.exe", 15 )
	
	; Set default UAC.
	If IsAdmin() Then
		$admin = RegRead( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin")
		$lua = RegRead( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA")
		$desktop = RegRead( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop")
	
		If ( $admin = "0" And $lua = "0" And $desktop = "0" ) Then
	
			$adminbackup = RegRead( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ASadminbackup")
			$luabackup = RegRead( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ASluabackup")
			$desktopbackup = RegRead( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ASdesktopbackup")
	
			RegWrite( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin", "REG_DWORD", $adminbackup)
			RegWrite( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA", "REG_DWORD", $luabackup)
			RegWrite( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop", "REG_DWORD", $desktopbackup)
		
			RegDelete( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ASadminbackup")
			RegDelete( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ASluabackup")
			RegDelete( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ASdesktopbackup")
		
		EndIf
		
	EndIf

	; Remove temp files.
	If $DeleteFiles = True Then _DeleteSelf( $WorkingPath, 5)

	Exit

EndFunc


Func StopServices()

	_StopService("", "uvnc_service")
	_StopService("", "winvnc")
	_StopService("", $ServiceName)

EndFunc

smgerber
8
8
Posts: 28
Joined: 2012-01-29 19:39

Re: My Upgrade (disable UAC, runas admin, multilanguage supp

Post by smgerber »

I'm afraid I didn't understand much of what you did, but your solution solved several different problems. All I'm trying to do is get control over the UAC prompt that appears after I install ChunkVNC as a service. Since I am disconnected at that point I can't respond to the UAC prompt and must depend on the person I'm supporting to do that for me.

Do you know of a workaround so that this prompt can either be avoided or else appear while I'm still connected?

Thanks for any help ... Sam
okinobk
8
8
Posts: 8
Joined: 2008-06-19 20:44

Re: My Upgrade (disable UAC, runas admin, multilanguage supp

Post by okinobk »

Hello Sam,

I solved this by absolute disable UAC and rerun ChunkVNC as special system account. This permit to control screen over UAC. But it's working only in normal program mode, not as a service, activated by trayicon menu. After push at "Disable UAC" system check user rights. If user that run ChunkVNC is admin and if not that ask you for domain, admin, password (without UAC).

You tell that UAC prompt stop you if ChunkVNC is installed as service, but I don't understand why. ChunkVNC (or UltraVNC) as service is running over normal user account and UAC don't affect it.
Netzvamp
8
8
Posts: 9
Joined: 2011-04-06 15:20

Re: My Upgrade (disable UAC, runas admin, multilanguage supp

Post by Netzvamp »

I think it's time, that supercoe thinks about a version control system (like git -> https://github.com ) that more people can contribute to ChunkVNC. At moment the code is forked in many parts and hard to get it back together.
One version control system with supercoe as maintainer would be awesome.
That would boost development and functions for ChunkVNC without loosing control about hundred different "ChunkVNCs" ;)
User avatar
supercoe
400
400
Posts: 1732
Joined: 2009-07-20 21:27
Location: Walker, MN
Contact:

Re: My Upgrade (disable UAC, runas admin, multilanguage supp

Post by supercoe »

I had the project on google code and used TortiseSVN for awhile but I didn't care for it.
If there is interest in getting it on github I can set that up.
http://www.chunkvnc.com - ChunkVNC - Free PC Remote control with the Open Source UltraVNC wrapper InstantSupport!
Netzvamp
8
8
Posts: 9
Joined: 2011-04-06 15:20

Re: My Upgrade (disable UAC, runas admin, multilanguage supp

Post by Netzvamp »

Ok, found it, but can't contribute. I think you have to give access rights to the project. In google code you should also have git as system available. (Don't know why, but i like git more than SVN :P ) I don't know exactly, but there should be a way to get both svn and git running on the same project ...
User avatar
supercoe
400
400
Posts: 1732
Joined: 2009-07-20 21:27
Location: Walker, MN
Contact:

Re: My Upgrade (disable UAC, runas admin, multilanguage supp

Post by supercoe »

Thanks for the info, I'll look into git as an alternative to svn as I've never used it before.
http://www.chunkvnc.com - ChunkVNC - Free PC Remote control with the Open Source UltraVNC wrapper InstantSupport!
Extremo
Posts: 1
Joined: 2012-11-09 08:13

Re: My Upgrade (disable UAC, runas admin, multilanguage supp

Post by Extremo »

Hi there

It works really well! Thanks for publish this possibility!

But one question: Is it maybe possible, to get chunkvnc rerun after uac disbaling under the same id number?
okinobk
8
8
Posts: 8
Joined: 2008-06-19 20:44

Re: My Upgrade (disable UAC, runas admin, multilanguage supp

Post by okinobk »

Hi Extremo,

I was thinking about that, but could not free any time to do it. If you solve this please post it here.
Post Reply