I think it's possible, but will need to use GUI. I tried to tweak my code again:
Code: Select all
#include <GUIConstants.au3>
Opt("TrayIconHide", 1)
$a = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
$b = "ConsentPromptBehaviorAdmin"
$c = "REG_DWORD"
$d = "0"
$e = "PromptOnSecureDesktop"
$f = "EnableLUA"
$g = "5"
$h = "2"
$i = "1"
$font="Arial"
$var1 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin")
$var2 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop")
$var3 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA")
GUICreate("Deactivate/Activate UAC", 400, 370, -1, -1)
GUISetBkColor(0xC8C8C8)
$Button1 = GUICtrlCreateButton("Deactivate UAC", 70, 300, 105, 57)
$Button2 = GUICtrlCreateButton("Activate UAC", 220, 300, 105, 57)
GUICtrlCreateLabel("This program will temporarily disable Windows User Account Control (UAC).", 0, 10, 400, 200, 0x01)
GUICtrlSetFont (-1,10, 400, 0, $font)
GUICtrlCreateLabel("This is necessary in order to modify the Master Boot Record of your flash drive, and it will temporarily put your computer at risk.", 0, 60, 400, 200, 0x01)
GUICtrlSetFont (-1,10, 400, 0, $font)
GUICtrlCreateLabel("Note!", 0, 120, 400, 200, 0x01)
GUICtrlSetFont (-1,10, 400, 0, $font)
GUICtrlCreateLabel("If you are running the installer from Windows Vista or Windows 7, you must disable the UAC. To do this, click on the “Deactivate UAC” button, and UAC will be deactivated and your computer will reboot to apply these changes.", 0, 150, 400, 200, 0x01)
GUICtrlSetFont (-1,10, 400, 0, $font)
GUICtrlCreateLabel("When you are done installing Porteus on your flash drive, you can reactive UAC by running this program again, pressing the “Activate UAC” button, and your computer will reboot.", 0, 230, 400, 200, 0x01)
GUICtrlSetFont (-1,10, 400, 0, $font)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $Button1
If $var1 = 5 Then
FileWrite (@CommonFilesDir & "\System\en-US\mui\log.txt","Text")
RegWrite($a, $b, $c, $d)
EndIf
If $var2 = 1 Then
FileWrite (@CommonFilesDir & "\System\en-US\mui\log.txt","Text")
RegWrite($a, $e, $c, $d)
EndIf
If $var1 = 2 Then
FileWrite (@CommonFilesDir & "\System\en-US\mui\log.txt","Text")
RegWrite($a, $b, $c, $d)
EndIf
If $var3 = 1 Then
FileWrite (@CommonFilesDir & "\System\en-US\mui\log.txt","Text")
RegWrite($a, $f, $c, $d)
SplashTextOn("Warning", 'UAC has been disabled.' & @CR & 'Your OS will now reboot.' & @CR & '' & @CR & 'After your system reboots, follow these steps:' & @CR & '' & @CR & '1. Run win_start_here.hta' & @CR & '2. Press the “Install Porteus” button' & @CR & '3. Follow the instructions given by bootinst.bat', 400, 320, -1, -1, "", "", 18)
Sleep(15000)
Shutdown(2)
Exit
EndIf
Case $Button2
If $var1 = 0 Then
FileWrite (@CommonFilesDir & "\System\en-US\mui\log.txt","Text")
RegWrite($a, $b, $c, $h)
EndIf
If $var2 = 0 Then
FileWrite (@CommonFilesDir & "\System\en-US\mui\log.txt","Text")
RegWrite($a, $e, $c, $i)
EndIf
If $var3 = 0 Then
FileWrite (@CommonFilesDir & "\System\en-US\mui\log.txt","Text")
RegWrite($a, $f, $c, $i)
Shutdown(2)
Exit
EndIf
EndSwitch
WEnd
and report me about it.