Tyleo-Dev-AutoIT-Oldies/AutoLogon Manager/AutoLogon Manager.au3

208 lines
7.3 KiB
AutoIt
Raw Permalink Normal View History

2024-02-18 21:17:39 +00:00
#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=AutoLogon Manager.ico
#AutoIt3Wrapper_Outfile_x64=..\..\Logiciels\AutoLogon Manager.exe
#AutoIt3Wrapper_Res_Comment=Autologon Manager
#AutoIt3Wrapper_Res_Description=Autologon Manager
#AutoIt3Wrapper_Res_Fileversion=1.0.4.12
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_ProductName=Autologon Manager
#AutoIt3Wrapper_Res_ProductVersion=1.0.0.0
#AutoIt3Wrapper_Res_CompanyName=Tyleo Softwares
#AutoIt3Wrapper_Res_LegalCopyright=Tyleo Softwares
#AutoIt3Wrapper_Res_LegalTradeMarks=Tyleo Softwares
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include "MetroGUI-UDF\MetroGUI_UDF.au3"
#include "TyleoAboutMe.au3"
$CurrentVer = FileGetVersion(@AutoItExe)
$ProgName = "Autologon Manager " & $CurrentVer
#cs
Tyleo Software Project Base v1
Created With CNP and DevTools Base Folder
All Softwares created with this base are Free and Open Sourced.
Join our Guilded Server ! https://www.guilded.gg/i/2DRlM7Mp
#ce
$NoticeConfirm = _Metro_MsgBox(4,"NOTICE - TYLEO SOFTWARES FOR ADMIN'S","WARNING - THIS SOFTWARE CAN CREATE AND MANAGE AUTOMATIC LOGON. THE USE OF THIS SOFTWARE IS AT YOUR OWN RISK. WE STRONGLY DONT RECOMMEND TO CONFIGURE AN AUTOLOGON ON AN ADMINISTRATOR ACCOUNT, AND EVEN MORE DOMAIN ADMIN ACCOUNT. THIS SOFTWARE ARE PROVIDED WITH THE AS-IS BASIS. SELECT YES/OUI IF YOU UNDERSTAND THE RISK.")
if $NoticeConfirm = "No" Then
Exit(0)
EndIf
$Win_Logon = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
$Win_AutoUser = "DefaultUserName"
$Win_AutoPass = "DefaultPassword"
$Win_AutoDomain = "DefaultDomainName"
$Win_AutologonActivation = "AutoAdminLogon"
$Win_Enabled = "1"
$Win_Disabled = "0"
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("Autologon Manager " & $CurrentVer, 483, 163, 236, 242)
GUISetFont(14, 400, 0, "Segoe UI")
Global $Label1 = GUICtrlCreateLabel("Username", 8, 8, 94, 29)
Global $Label2 = GUICtrlCreateLabel("Password", 8, 48, 94, 29)
Global $Label3 = GUICtrlCreateLabel("Domain", 8, 88, 94, 29)
Global $AutoUser = GUICtrlCreateInput("", 104, 8, 273, 28)
GUICtrlSetFont(-1, 11, 400, 0, "Segoe UI Light")
Global $AutoPass = GUICtrlCreateInput("", 104, 48, 273, 28)
GUICtrlSetFont(-1, 11, 400, 0, "Segoe UI Light")
Global $AutoDomain = GUICtrlCreateInput("", 104, 88, 273, 28)
GUICtrlSetFont(-1, 11, 400, 0, "Segoe UI Light")
Global $OneClear = GUICtrlCreateButton("🧹", 384, 8, 25, 25)
GUICtrlSetTip(-1,"Clear Input")
GUICtrlSetCursor(-1,0)
Global $OneRead = GUICtrlCreateButton("🔽", 416, 8, 25, 25)
GUICtrlSetTip(-1,"Get Active Value")
GUICtrlSetCursor(-1,0)
Global $OneRemove = GUICtrlCreateButton("", 448, 8, 25, 25)
GUICtrlSetTip(-1,"Remove Key")
GUICtrlSetCursor(-1,0)
Global $TwoClear = GUICtrlCreateButton("🧹", 384, 48, 25, 25)
GUICtrlSetTip(-1,"Clear Input")
GUICtrlSetCursor(-1,0)
Global $TwoRead = GUICtrlCreateButton("🔽", 416, 48, 25, 25)
GUICtrlSetTip(-1,"Get Active Value")
GUICtrlSetCursor(-1,0)
Global $TwoRemove = GUICtrlCreateButton("", 448, 48, 25, 25)
GUICtrlSetTip(-1,"Remove Key")
GUICtrlSetCursor(-1,0)
Global $ThreeClear = GUICtrlCreateButton("🧹", 384, 88, 25, 25)
GUICtrlSetTip(-1,"Clear Input")
GUICtrlSetCursor(-1,0)
Global $ThreeRead = GUICtrlCreateButton("🔽", 416, 88, 25, 25)
GUICtrlSetTip(-1,"Get Active Value")
GUICtrlSetCursor(-1,0)
Global $ThreeRemove = GUICtrlCreateButton("", 448, 88, 25, 25)
GUICtrlSetTip(-1,"Remove Key")
GUICtrlSetCursor(-1,0)
Global $AutologonState = GUICtrlCreateButton("STATE : OFF", 380, 120, 90, 33)
GUICtrlSetTip(-1,"Cancel and Exit")
GUICtrlSetFont(-1, 8,900)
GUICtrlSetBkColor(-1,0xCC0000)
GUICtrlSetColor(-1,0xFFFFFF)
Global $ApplyEnable = GUICtrlCreateButton("APPLY && ENABLE", 252, 120, 120, 33)
GUICtrlSetTip(-1,"Save Configuration and Enable Autologon")
GUICtrlSetCursor(-1,0)
GUICtrlSetFont(-1, 8,900)
Global $AutologonDisable = GUICtrlCreateButton("DISABLE", 8, 120, 120, 33)
GUICtrlSetTip(-1,"Disable Autologon")
GUICtrlSetCursor(-1,0)
GUICtrlSetFont(-1, 8,900)
Global $Exit = GUICtrlCreateButton("CANCEL", 130, 120, 120, 33)
GUICtrlSetTip(-1,"Cancel and Exit")
GUICtrlSetCursor(-1,0)
GUICtrlSetFont(-1, 8,900)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
AutologonStateCheck()
$OneReg = RegRead($Win_Logon,$Win_AutoUser)
GUICtrlSetData($AutoUser,$OneReg)
$TwoReg = RegRead($Win_Logon,$Win_AutoPass)
GUICtrlSetData($AutoPass,$TwoReg)
$ThreeReg = RegRead($Win_Logon,$Win_AutoDomain)
GUICtrlSetData($AutoDomain,$ThreeReg)
While 1
$nMsg = GUIGetMsg()
AutologonStateCheck()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $Exit
Exit
Case $OneClear
GUICtrlSetData($AutoUser,"")
Case $TwoClear
GUICtrlSetData($AutoPass,"")
Case $ThreeClear
GUICtrlSetData($AutoDomain,"")
Case $OneRead
$OneReg = RegRead($Win_Logon,$Win_AutoUser)
GUICtrlSetData($AutoUser,$OneReg)
Case $TwoRead
$TwoReg = RegRead($Win_Logon,$Win_AutoPass)
GUICtrlSetData($AutoPass,$TwoReg)
Case $ThreeRead
$ThreeReg = RegRead($Win_Logon,$Win_AutoDomain)
GUICtrlSetData($AutoDomain,$ThreeReg)
Case $OneRemove
RegDelete($Win_Logon,$Win_AutoUser)
MsgBox(0,"Removed","Key " & $Win_Logon & "\" & $Win_AutoUser & " Removed.", 2)
GUICtrlSetData($AutoUser,"")
Case $TwoRemove
RegDelete($Win_Logon,$Win_AutoPass)
MsgBox(0,"Removed","Key " & $Win_Logon & "\" & $Win_AutoPass & " Removed.", 2)
GUICtrlSetData($AutoPass,"")
Case $ThreeRemove
RegDelete($Win_Logon,$Win_AutoDomain)
MsgBox(0,"Removed","Key " & $Win_Logon & "\" & $Win_AutoDomain & " Removed.", 2)
GUICtrlSetData($AutoDomain,"")
Case $AutologonDisable
RegWrite($Win_Logon,$Win_AutologonActivation,"REG_SZ","0")
Case $ApplyEnable
$Apply_AutoUser = GUICtrlRead($AutoUser)
$Apply_AutoPass = GUICtrlRead($AutoPass)
$Apply_AutoDomain = GUICtrlRead($AutoDomain)
if $Apply_AutoUser = "" Then
MsgBox(0+16,"No Username Provided","No username provided. You cannot apply Automatic Logon without username.",3)
Else
RegWrite($Win_Logon,$Win_AutologonActivation,"REG_SZ","1")
RegWrite($Win_Logon,$Win_AutoUser,"REG_SZ",$Apply_AutoUser)
RegWrite($Win_Logon,$Win_AutoPass,"REG_SZ",$Apply_AutoPass)
RegWrite($Win_Logon,$Win_AutoDomain,"REG_SZ",$Apply_AutoDomain)
AutologonStateCheck()
$RebootAsk = MsgBox(4,"Success","Autologon Applied and Activated." & @CRLF & "Start a try ? (Reboot after 5 seconds)")
; ConsoleWrite($RebootAsk)
if $RebootAsk = "6" Then
Run("shutdown -r -t 5")
Exit(0)
EndIf
EndIf
EndSwitch
WEnd
Func AutologonStateCheck()
$ALState = RegRead($Win_Logon,$Win_AutologonActivation)
if $ALState = "1" Then
GUICtrlSetData($AutologonState,"STATE : ON")
GUICtrlSetBkColor($AutologonState,0x09A600)
Else
GUICtrlSetData($AutologonState,"STATE : OFF")
GUICtrlSetBkColor($AutologonState,0xD50000)
EndIf
Sleep(40)
Return True
EndFunc