private static void KillExplorerShell() { SEBClientInfo.ExplorerShellWasKilled = false; //Minimize all Open Windows try { SEBWindowHandler.MinimizeAllOpenWindows(); } catch (Exception ex) { Logger.AddError("Unable to MinimizeAllOpenWindows", null, ex); } //Kill the explorer Shell try { SEBClientInfo.ExplorerShellWasKilled = SEBProcessHandler.KillExplorerShell(); } catch (Exception ex) { Logger.AddError("Unable to KillExplorerShell", null, ex); } }
public static bool InitSEBDesktop() { Logger.AddInformation("Attempting to InitSEBDesktop", (object)null, (Exception)null, (string)null); SEBDesktopWallpaper.BlankWallpaper(); SEBClipboard.CleanClipboard(); Logger.AddInformation("Clipboard cleaned.", (object)null, (Exception)null, (string)null); SEBWindowHandler.AllowedExecutables.Clear(); SEBWindowHandler.AllowedExecutables.Add("safeexambrowser"); foreach (Dictionary <string, object> permittedProcess in SEBSettings.permittedProcessList) { if ((bool)permittedProcess["active"]) { SEBWindowHandler.AllowedExecutables.Add(((string)permittedProcess["executable"]).ToLower()); if (!string.IsNullOrWhiteSpace(permittedProcess["windowHandlingProcess"].ToString())) { SEBWindowHandler.AllowedExecutables.Add(((string)permittedProcess["windowHandlingProcess"]).ToLower()); } } } if ((bool)SEBClientInfo.getSebSetting("monitorProcesses")["monitorProcesses"]) { try { SEBWindowHandler.EnableForegroundWatchDog(); } catch (Exception ex) { Logger.AddError("Unable to EnableForegroundWatchDog", (object)null, ex, (string)null); } SEBProcessHandler.ProhibitedExecutables.Clear(); foreach (Dictionary <string, object> prohibitedProcess in SEBSettings.prohibitedProcessList) { if ((bool)prohibitedProcess["active"]) { SEBProcessHandler.ProhibitedExecutables.Add(((string)prohibitedProcess["executable"]).ToLower()); } } try { SEBProcessHandler.EnableProcessWatchDog(); } catch (Exception ex) { Logger.AddError("Unable to EnableProcessWatchDog", (object)null, ex, (string)null); } } SEBClientInfo.ExplorerShellWasKilled = false; if ((bool)SEBClientInfo.getSebSetting("killExplorerShell")["killExplorerShell"]) { try { SEBWindowHandler.MinimizeAllOpenWindows(false); } catch (Exception ex) { Logger.AddError("Unable to MinimizeAllOpenWindows", (object)null, ex, (string)null); } try { SEBClientInfo.ExplorerShellWasKilled = SEBProcessHandler.KillExplorerShell(); } catch (Exception ex) { Logger.AddError("Unable to KillExplorerShell", (object)null, ex, (string)null); } } Logger.AddInformation("Successfully InitSEBDesktop", (object)null, (Exception)null, (string)null); return(true); }
/// ---------------------------------------------------------------------------------------- /// <summary> /// Create and initialize new desktop. /// </summary> /// <returns>true if succeeded</returns> /// ---------------------------------------------------------------------------------------- public static bool InitSEBDesktop() { //Info: For reverting this actions see SebWindowsClientForm::CloseSEBForm() Logger.AddInformation("Attempting to InitSEBDesktop"); //Blank the Wallpaper SEBDesktopWallpaper.BlankWallpaper(); // Clean clipboard SEBClipboard.CleanClipboard(); Logger.AddInformation("Clipboard cleaned.", null, null); //Search for permitted Applications (used in Taskswitcher (ALT-TAB) and in foreground watchdog SEBWindowHandler.AllowedExecutables.Clear(); //Add the SafeExamBrowser to the allowed executables SEBWindowHandler.AllowedExecutables.Add("safeexambrowser"); //Add allowed executables from all allowedProcessList foreach (Dictionary <string, object> process in SEBSettings.permittedProcessList) { if ((bool)process[SEBSettings.KeyActive]) { //First add the executable itself SEBWindowHandler.AllowedExecutables.Add( ((string)process[SEBSettings.KeyExecutable]).ToLower()); if (!String.IsNullOrWhiteSpace(process[SEBSettings.KeyWindowHandlingProcess].ToString())) { SEBWindowHandler.AllowedExecutables.Add( ((string)process[SEBSettings.KeyWindowHandlingProcess]).ToLower()); } } } #if DEBUG //Add visual studio to allowed executables for debugging SEBWindowHandler.AllowedExecutables.Add("devenv"); #endif //Process watching if ((Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyMonitorProcesses)[SEBSettings.KeyMonitorProcesses] || (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyKillExplorerShell)[SEBSettings.KeyKillExplorerShell]) { #region Foreground Window Watching (Allowed Executables) //This prevents the not allowed executables from poping up try { SEBWindowHandler.EnableForegroundWatchDog(); } catch (Exception ex) { Logger.AddError("Unable to EnableForegroundWatchDog", null, ex); } #endregion #region Prohibited Executables watching //Handle prohibited executables watching SEBProcessHandler.ProhibitedExecutables.Clear(); //Add prohibited executables foreach (Dictionary <string, object> process in SEBSettings.prohibitedProcessList) { if ((bool)process[SEBSettings.KeyActive]) { //First add the executable itself SEBProcessHandler.ProhibitedExecutables.Add( ((string)process[SEBSettings.KeyExecutable]).ToLower()); } } //This prevents the prohibited executables from starting up try { SEBProcessHandler.EnableProcessWatchDog(); } catch (Exception ex) { Logger.AddError("Unable to EnableProcessWatchDog", null, ex); } #endregion } //Kill Explorer Shell // Global variable indicating if the explorer shell has been killed SEBClientInfo.ExplorerShellWasKilled = false; if ((Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyKillExplorerShell)[SEBSettings.KeyKillExplorerShell]) { //Minimize all Open Windows try { SEBWindowHandler.MinimizeAllOpenWindows(); } catch (Exception ex) { Logger.AddError("Unable to MinimizeAllOpenWindows", null, ex); } //Kill the explorer Shell try { SEBClientInfo.ExplorerShellWasKilled = SEBProcessHandler.KillExplorerShell(); } catch (Exception ex) { Logger.AddError("Unable to KillExplorerShell", null, ex); } } Logger.AddInformation("Successfully InitSEBDesktop"); return(true); }