#include #include #include Opt('GUIOnEventMode', 1) Opt("TrayAutoPause", 0) HotKeySet("{ESCAPE}","_EXIT") ;~ $sFilePath = "D:\kiosk\" local $Form1,$blockctrlaltdel Global Const $VK_F4 = 0x73 Global $winlockdll = DllOpen(@ScriptDir&"\WinLockDll.dll") kullanimkapat() #region ; WinEventHook Global Const $EVENT_OPEN_DESKTOP_CHANGED = 0x0020 $h_DLL_User32 = DllOpen("User32.dll") $h_WinEventHook_Proc = DllCallbackRegister("_WinEventHook_Proc", "none", "hwnd;int;hwnd;long;long;int;int") If @error Then ConsoleWrite("Error DllCallbackRegister(_WinEventHook_Proc) did not succeed. FFH will exit now.") Exit EndIf $h_Hook = _WinEventHook_Set(0x0020, 0x0020, $h_DLL_User32) If @error Then ConsoleWrite("Error _WinEventHook_Set() did not succeed. FFH will exit now.") Exit EndIf OnAutoItExitRegister("_WinEventHook_UnSet") #endregion ; WinEventHook Global $winlockdll = DllOpen(@ScriptDir&"\WinLockDll.dll") Func kullanimkapat() $blockctrlaltdel = 1 Global $hHookProc = DllCallbackRegister("_KeyboardProc", "long", "int;wparam;lparam") Global $hHookKeyboard = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hHookProc), _WinAPI_GetModuleHandle(0), 0) Global $hSysTray_Handle = DllCall("user32.dll", "HWND", "FindWindow", "str", "Shell_TrayWnd", "str", "") _WinAPI_ShellChangeNotify($SHCNE_ASSOCCHANGED, 0, 0, 0) _SendMessage($hSysTray_Handle[0], 0x5B4, 0, 0) DllCall($winlockdll, "Int", "Keys_Enable_Disable ", "Int", "1") DllCall($winlockdll, "Int", "TaskManager_Enable_Disable", "Int", "0") DllCall($winlockdll, "Int", "TaskSwitching_Enable_Disable", "Int", "0") DllCall($winlockdll, "Int", "Keys_Enable_Disable", "Int", "1") RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', 'DisableChangePassword',"REG_DWORD",0x00000001) RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System', 'HideFastUserSwitching', "REG_DWORD",0x00000001) RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', 'NoLogoff',"REG_DWORD",0x00000001) RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', 'NoClose',"REG_DWORD",0x00000001) RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', 'DisableTaskMgr',"REG_DWORD",0x00000001) RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', 'DisableLockWorkstation',"REG_DWORD",0x00000001) FileDelete ( @LocalAppDataDir&"\Google\Chrome\User Data\Default\Preferences" ) ;~ Local $hFileOpen = FileOpen($sFilePath,BitOR(8,2)) ;~ FileWrite($hFileOpen,'*
'&@ComputerName&'
"') ;~ FileClose($hFileOpen);kiosk html writed Run("taskkill /im chrome.exe /f /t") Sleep(3000) ;~ Run(@HomeDrive&"\Program Files (x86)\Google\Chrome\Application\chrome.exe --kiosk "&$sFilePath) Run(@HomeDrive&"\Program Files (x86)\Google\Chrome\Application\chrome.exe --kiosk https://www.autoitscript.com/autoit3/files/graphics/autoit_10_wall_1920x1200.jpg") WinMinimizeAll() Global $hSplash = GuiCreate("", @DesktopWidth+5, @DesktopHeight+5, -5, -5,$WS_POPUP,$WS_THICKFRAME) ;invinsible fullscreen gui on top google chrome. GUISetBkColor (0xf0f8ff) WinSetTrans($hSplash, "", 5) GUISetState() WinSetOnTop($hSplash, "", 1) EndFunc Func kullanimAc() FileDelete ( @LocalAppDataDir&"\Google\Chrome\User Data\Default\Preferences" ) $blockctrlaltdel = 0 DllCallbackFree($hHookProc) If Not IsHWnd($hSysTray_Handle[0]) Then ShellExecute(@WindowsDir & "\Explorer.exe") DllCall($winlockdll, "Int", "Keys_Enable_Disable ", "Int", "0") DllCall($winlockdll, "Int", "TaskManager_Enable_Disable", "Int", "1") DllCall($winlockdll, "Int", "TaskSwitching_Enable_Disable", "Int", "1") DllCall($winlockdll, "Int", "Keys_Enable_Disable ", "Int", "0") RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System','DisableChangePassword') RegDelete('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System', 'HideFastUserSwitching') RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', 'NoLogoff') RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', 'NoClose') RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', 'DisableTaskMgr') RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', 'DisableLockWorkstation') Run("taskkill /im chrome.exe /f /t") Sleep(500) GUIDelete($hSplash) Sleep(500) EndFunc Func _KeyboardProc($nCode, $wParam, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam) Switch $wParam Case $WM_KEYDOWN, $WM_SYSKEYDOWN, $WM_KEYUP, $WM_SYSKEYUP Local $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) Local $vKode = DllStructGetData($tKEYHOOKS, "vkCode") Local $iFlags = DllStructGetData($tKEYHOOKS, "flags") Switch $vKode Case $VK_F4 If BitAND($iFlags, $LLKHF_ALTDOWN) Then Return -1 Else Return _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam) EndIf EndSwitch EndSwitch Return _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam) EndFunc #region ; WinEventHook Functions Func _WinEventHook_Proc($h_Hook, $iEvent, $hWnd, $idObject, $idChild, $iEventThread, $iEventTime) ;ConsoleWrite($hWnd & @TAB & $idObject & @CRLF) ConsoleWrite(TimerInit() & @tab & hex($iEvent,4) & @tab & "IsDesktopLocked()" & @tab & IsDesktopLocked() & @crlf) EndFunc ;==>_WinEventHook_Proc Func _WinEventHook_Set($iEventMin, $iEventMax, $hDLLUser32) Local $aRet Local Const $WINEVENT_OUTOFCONTEXT = 0x0 Local Const $WINEVENT_SKIPOWNPROCESS = 0x2 If Not $hDLLUser32 Or $hDLLUser32 = -1 Then $hDLLUser32 = "User32.dll" $aRet = DllCall($hDLLUser32, "hwnd", "SetWinEventHook", _ "uint", $iEventMin, _ "uint", $iEventMax, _ "hwnd", 0, _ "ptr", DllCallbackGetPtr($h_WinEventHook_Proc), _ "int", 0, _ "int", 0, _ "uint", $WINEVENT_OUTOFCONTEXT) ; BitOR($WINEVENT_OUTOFCONTEXT, $WINEVENT_SKIPOWNPROCESS) If @error Then Return SetError(@error, 0, 0) Return $aRet[0] EndFunc ;==>_WinEventHook_Set Func _WinEventHook_UnSet() If $h_WinEventHook_Proc Then DllCallbackFree($h_WinEventHook_Proc) EndIf If $h_Hook Then DllCall($h_DLL_User32, "int", "UnhookWinEvent", "hwnd", $h_Hook) If $h_DLL_User32 Then DllClose($h_DLL_User32) EndFunc ;==>_WinEventHook_UnSet #endregion ; WinEventHook Functions Func IsDesktopLocked() Local $hDesktop Local $iRet Local $iRC Local $sMsg Local Const $DESKTOP_SWITCHDESKTOP = 0x100 $hDesktop = DllCall("User32.dll", "int", "OpenDesktop", "str", "Default", "int", 0, "int", 0, "int", $DESKTOP_SWITCHDESKTOP) $iRet = DllCall("User32.dll", "int", "SwitchDesktop", "int", $hDesktop[0]) If IsArray($iRet) Then If $iRet[0] = 0 Then if $blockctrlaltdel = 1 Then Run("rundll32.exe user32.dll,LockWorkStation") EndIf $iRC = 1 ElseIf $iRet[0] = 1 Then $iRC = 0 EndIf Else EndIf DllCall("User32.dll", "int", "CloseDesktop", "int", $hDesktop[0]);<-- handle returned by "OpenDesktop" ;$iRet = DllCall("User32.dll", "int", "CloseDesktop", "int", $iRet[0]) Return ($iRC) EndFunc ;==>IsDesktopLocked Func _EXIT() kullanimAc() HotKeySet("{ESCAPE}") Exit EndFunc While 1 Sleep(100) WEnd