private static bool DisableKey(IntPtr wp, IntPtr lp)
 {
     SebKeyCapture.KBDLLHOOKSTRUCT structure = (SebKeyCapture.KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lp, typeof(SebKeyCapture.KBDLLHOOKSTRUCT));
     try
     {
         if (!(bool)SEBClientInfo.getSebSetting("enableEsc")["enableEsc"] && structure.key == Keys.Escape || !(bool)SEBClientInfo.getSebSetting("enableCtrlEsc")["enableCtrlEsc"] && structure.flags == 0 && structure.key == Keys.Escape || (!(bool)SEBClientInfo.getSebSetting("enableAltEsc")["enableAltEsc"] && structure.flags == 32 && structure.key == Keys.Escape || !(bool)SEBClientInfo.getSebSetting("enableAltTab")["enableAltTab"] && structure.flags == 32 && structure.key == Keys.Tab) || (!(bool)SEBClientInfo.getSebSetting("enablePrintScreen")["enablePrintScreen"] && structure.key == Keys.Snapshot || !(bool)SEBClientInfo.getSebSetting("enableRightMouse")["enableRightMouse"] && structure.key == Keys.Apps))
         {
             return(true);
         }
         int num = (bool)SEBClientInfo.getSebSetting("enableAltTab")["enableAltTab"] ? 1 : 0;
         if (!(bool)SEBClientInfo.getSebSetting("enableAltF4")["enableAltF4"] && structure.flags == 32 && structure.key == Keys.F4 || !(bool)SEBClientInfo.getSebSetting("enableF1")["enableF1"] && structure.key == Keys.F1 || (!(bool)SEBClientInfo.getSebSetting("enableF2")["enableF2"] && structure.key == Keys.F2 || !(bool)SEBClientInfo.getSebSetting("enableF3")["enableF3"] && structure.key == Keys.F3) || (!(bool)SEBClientInfo.getSebSetting("enableF4")["enableF4"] && structure.key == Keys.F4 || !(bool)SEBClientInfo.getSebSetting("enableF5")["enableF5"] && structure.key == Keys.F5 || (!(bool)SEBClientInfo.getSebSetting("enableF6")["enableF6"] && structure.key == Keys.F6 || !(bool)SEBClientInfo.getSebSetting("enableF7")["enableF7"] && structure.key == Keys.F7)) || (!(bool)SEBClientInfo.getSebSetting("enableF8")["enableF8"] && structure.key == Keys.F8 || !(bool)SEBClientInfo.getSebSetting("enableF9")["enableF9"] && structure.key == Keys.F9 || (!(bool)SEBClientInfo.getSebSetting("enableF10")["enableF10"] && structure.key == Keys.F10 || !(bool)SEBClientInfo.getSebSetting("enableF11")["enableF11"] && structure.key == Keys.F11)))
         {
             return(true);
         }
         if (!(bool)SEBClientInfo.getSebSetting("enableF12")["enableF12"])
         {
             if (structure.key == Keys.F12)
             {
                 return(true);
             }
         }
     }
     catch (Exception ex)
     {
         Logger.AddError("DisableKey: Failed with error. " + ex.Message, (object)null, ex, (string)null);
     }
     return(false);
 }
Пример #2
0
        protected override void OnCreateMainForm()
        {
            MainForm = SEBClientInfo.SebWindowsClientForm;
            string[] arguments = Environment.GetCommandLineArgs();
            // Logger.AddInformation("KeyKitePassword: "******"REDACTED")
            {
                Logger.AddInformation("returning false, not correct config file.");
                //  return;
            }
            if (arguments.Count() == 1)
            {
                var splashThread = new Thread(SebWindowsClientMain.StartSplash);
                splashThread.Start();

                try
                {
                    SebWindowsClientMain.InitSEBDesktop();
                }
                catch (Exception ex)
                {
                    Logger.AddError("Unable to InitSEBDesktop", null, ex);
                }

                if (!SEBClientInfo.SebWindowsClientForm.OpenSEBForm())
                {
                    Logger.AddError("Unable to OpenSEBForm", null, null);
                }

                SebWindowsClientMain.CloseSplash();
            }
        }
Пример #3
0
        public static void CheckServicePolicy(bool isServiceAvailable)
        {
            int forceService = (Int32)SEBClientInfo.getSebSetting(SEBSettings.KeySebServicePolicy)[SEBSettings.KeySebServicePolicy];

            switch (forceService)
            {
            case (int)sebServicePolicies.ignoreService:
                break;

            case (int)sebServicePolicies.indicateMissingService:
                if (!isServiceAvailable)
                {
                    //SEBClientInfo.SebWindowsClientForm.Activate();
                    SEBMessageBox.Show(SEBUIStrings.indicateMissingService, SEBUIStrings.indicateMissingServiceReason, MessageBoxIcon.Error, MessageBoxButtons.OK);
                }
                break;

            case (int)sebServicePolicies.forceSebService:
                if (!isServiceAvailable)
                {
                    //SEBClientInfo.SebWindowsClientForm.Activate();
                    SEBMessageBox.Show(SEBUIStrings.indicateMissingService, SEBUIStrings.forceSebServiceMessage, MessageBoxIcon.Error, MessageBoxButtons.OK);
                    Logger.AddError("SEB Windows service is not available and sebServicePolicies is set to forceSebService", null, null);
                    Logger.AddInformation("SafeExamBrowser is exiting", null, null);
                    throw new SEBNotAllowedToRunEception("SEB Windows service is not available and sebServicePolicies is set to forceSebService");
                }
                break;
            }
        }
Пример #4
0
        /// <summary>
        /// Disable ot enabled Mouse Buttons from SebClient configuration
        ///</summary>
        private static bool DisableMouseButton(int nCode, IntPtr wp, IntPtr lp)
        {
            MSLLHOOKSTRUCT MouseButtonInfo = (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lp, typeof(MSLLHOOKSTRUCT));

            if (!(Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyEnableRightMouse)[SEBSettings.KeyEnableRightMouse])
            {
                //Console.WriteLine(String.Format("NCode: {0}, wp; {1} {2}",nCode,wp,(MouseMessages)wp));
                if (nCode >= 0 &&
                    (MouseMessages.WM_RBUTTONDOWN == (MouseMessages)wp ||
                     MouseMessages.WM_RBUTTONUP == (MouseMessages)wp))
                {
                    return(true);
                }
            }
            if (
                !(Boolean)
                SEBClientInfo.getSebSetting(SEBSettings.KeyEnableAltMouseWheel)[SEBSettings.KeyEnableAltMouseWheel])
            {
                KBDLLHOOKSTRUCT KeyInfo = (KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lp, typeof(KBDLLHOOKSTRUCT));
                if ((Control.ModifierKeys & Keys.Alt) != 0 && KeyInfo.flags < 0)
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #5
0
        public static string ShowPasswordDialogForm(string title, string passwordRequestText)
        {
            // If we are running in SebWindowsClient we need to activate it before showing the password dialog
            if (SEBClientInfo.SebWindowsClientForm != null)
            {
                SebWindowsClientMain.SEBToForeground();
            }

            //No longer necessary as you cannot switch from not-create-new-desktop to create-new-desktop and the other way around
            // Check if SEB is running on a separate desktop
            if (SebWindowsClientMain.sessionCreateNewDesktop)              //Switch to default desktop: SEBDesktopController.Show(SEBClientInfo.OriginalDesktop.DesktopName);
            {
                // SEB is already running on a separate desktop: we can show the password entry dialog without a separate thread
                return(SebPasswordDialogForm.ShowPasswordDialogForm(title, passwordRequestText));
            }
            //In Touch Mode, do not use the threaded Dialog because we know we can't use it
            else if (SEBSettings.settingsCurrent.Count > 0 && (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyTouchOptimized)[SEBSettings.KeyTouchOptimized])
            {
                return(SebPasswordDialogForm.ShowPasswordDialogForm(title, passwordRequestText));
            }
            else
            {
                // SEB isn't running on a separate desktop (or not yet):
                // We need to show the password dialog in a separate thread to avoid hooks/references for the current main thread
                // (this makes switching desktops impossible in case it would be necessary later)

                // Create the thread object. This does not start the thread.
                Worker workerObject = new Worker();
                Thread workerThread = new Thread(workerObject.ShowPasswordDialogInThread);

                workerThread.SetApartmentState(ApartmentState.STA);
                workerObject.dialogTitle = title;
                workerObject.dialogText  = passwordRequestText;

                // Start the worker thread.
                workerThread.Start();

                // Loop until worker thread activates.
                while (!workerThread.IsAlive)
                {
                    ;
                }

                // Request that the worker thread stop itself:
                //workerObject.RequestStop();

                // Use the Join method to block the current thread
                // until the object's thread terminates.
                workerThread.Join();

                // Switch to new desktop
                if (SebWindowsClientMain.sessionCreateNewDesktop)
                {
                    SEBDesktopController.Show(SEBClientInfo.SEBNewlDesktop.DesktopName);
                }

                return(workerObject.dialogResultText);
            }
        }
 public static void StartSplash()
 {
     if ((bool)SEBClientInfo.getSebSetting("createNewDesktop")["createNewDesktop"])
     {
         SEBDesktopController.SetCurrent(SEBClientInfo.SEBNewlDesktop);
     }
     SebWindowsClientMain.splash = new SEBSplashScreen();
     Application.Run((Form)SebWindowsClientMain.splash);
 }
Пример #7
0
 private void ShowWindow(IntPtr windowHandle)
 {
     windowHandle.BringToTop(true);
     if ((bool)SEBClientInfo.getSebSetting("touchOptimized")["touchOptimized"])
     {
         this._openedWindows.First <KeyValuePair <IntPtr, string> >().Key.MaximizeWindow();
     }
     this.Close();
 }
 public static void CheckIfInsideVirtualMachine()
 {
     if (SebWindowsClientMain.IsInsideVM() && !(bool)SEBClientInfo.getSebSetting("allowVirtualMachine")["allowVirtualMachine"])
     {
         int num = (int)SEBMessageBox.Show(SEBUIStrings.detectedVirtualMachine, SEBUIStrings.detectedVirtualMachineForbiddenMessage, MessageBoxIcon.Hand, MessageBoxButtons.OK, false);
         Logger.AddError("Forbidden to run SEB on a virtual machine!", (object)null, (Exception)null, (string)null);
         Logger.AddInformation("Safe Exam Browser is exiting", (object)null, (Exception)null, (string)null);
         throw new SEBNotAllowedToRunEception("Forbidden to run SEB on a virtual machine!");
     }
 }
Пример #9
0
        /// <summary>
        /// Capture keystrokes and filter which key events are permitted to continue.
        /// </summary>
        private static IntPtr CaptureKey(int nCode, IntPtr wp, IntPtr lp)
        {
            try
            {
                // If the nCode is non-negative, filter the keqy stroke.
                if (nCode >= 0)
                {
                    TestAppExitSequences(wp, lp);

                    KBDLLHOOKSTRUCT KeyInfo =
                        (KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lp, typeof(KBDLLHOOKSTRUCT));

                    //Console.WriteLine(String.Format("Ncode: {0}, wp:{1}, Key:{2}, KeyInt:{3}, flags: {4}",nCode, wp, KeyInfo.key, (int)KeyInfo.key, KeyInfo.flags));

                    if ((Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyEnableAltTab)[SEBSettings.KeyEnableAltTab])
                    {
                        //ALT-TAB for App-Switcher (wp 260 = keydown, wp 257 = keyup)
                        if (KeyInfo.key == Keys.Tab && KeyInfo.flags == 32 && (int)wp == 260)
                        {
                            if (Tab_Pressed_First_Time && (int)wp == 260)
                            {
                                SEBClientInfo.SebWindowsClientForm.ShowApplicationChooserForm();
                                if (Tab_Pressed_First_Time)
                                {
                                    Tab_Pressed_First_Time = false;
                                }
                                return((IntPtr)1);
                            }
                            else if (!Tab_Pressed_First_Time && (int)wp == 260)
                            {
                                SEBClientInfo.SebWindowsClientForm.SelectNextListItem();
                                return((IntPtr)1);
                            }
                        }
                        if (((KeyInfo.key == Keys.LMenu && KeyInfo.flags == 128) || (KeyInfo.key == Keys.RMenu && KeyInfo.flags == 129)) && (int)wp == 257)
                        {
                            SEBClientInfo.SebWindowsClientForm.HideApplicationChooserForm();
                            Tab_Pressed_First_Time = true;
                        }
                    }

                    //Reject any key that's not on our list.
                    if (DisableKey(wp, lp))
                    {
                        return((IntPtr)1);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.AddError("Error in KeyCapture", null, ex);
            }
            // Pass the event to the next hook in the chain.
            return(CallNextHookEx(ptrKeyboardHook, nCode, wp, lp));
        }
Пример #10
0
        public SEBRestartExamToolStripButton()
        {
            string examDefaultTitle = (string)SEBClientInfo.getSebSetting("restartExamText")["restartExamText"];

            if (string.IsNullOrEmpty(examDefaultTitle))
            {
                examDefaultTitle = SEBUIStrings.restartExamDefaultTitle;
            }
            this.ToolTipText = examDefaultTitle;
            this.Image       = (Image)Resources.ResourceManager.GetObject("restartExam");
            this.Alignment   = ToolStripItemAlignment.Right;
        }
Пример #11
0
 public SebCloseDialogForm()
 {
     this.InitializeComponent();
     if ((bool)SEBClientInfo.getSebSetting("touchOptimized")["touchOptimized"])
     {
         this.InitializeForTouch();
     }
     else
     {
         this.InitializeForNonTouch();
     }
 }
Пример #12
0
        public static void StartSplash()
        {
            // Set the threads desktop to the new desktop if "Create new Desktop" is activated
            if ((Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyCreateNewDesktop)[SEBSettings.KeyCreateNewDesktop])
            {
                SEBDesktopController.SetCurrent(SEBClientInfo.SEBNewlDesktop);
            }

            // Instance a splash form given the image names
            splash = new SEBSplashScreen();
            // Run the form
            Application.Run(splash);
        }
Пример #13
0
        /// ----------------------------------------------------------------------------------------
        /// <summary>
        /// Check if running in VM and if SEB Windows Service is running or not.
        /// </summary>
        /// <returns>true if both checks are positive, false means SEB needs to quit.</returns>
        /// ----------------------------------------------------------------------------------------
        public static void CheckIfInsideVirtualMachine()
        {
            // Test if run inside virtual machine
            bool allowVirtualMachine = (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyAllowVirtualMachine)[SEBSettings.KeyAllowVirtualMachine];

            if (IsInsideVM() && (!allowVirtualMachine))
            {
                SEBMessageBox.Show(SEBUIStrings.detectedVirtualMachine, SEBUIStrings.detectedVirtualMachineForbiddenMessage, MessageBoxIcon.Error, MessageBoxButtons.OK);
                Logger.AddError("Forbidden to run SEB on a virtual machine!", null, null);
                Logger.AddInformation("Safe Exam Browser is exiting", null, null);
                throw new SEBNotAllowedToRunEception("Forbidden to run SEB on a virtual machine!");
            }
        }
Пример #14
0
 public static void StartLoading()
 {
     if ((bool)SEBClientInfo.getSebSetting("createNewDesktop")["createNewDesktop"] || SEBClientInfo.CreateNewDesktopOldValue)
     {
         SEBDesktopController.SetCurrent(SEBClientInfo.SEBNewlDesktop);
     }
     else
     {
         SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop);
     }
     SEBLoading.loading = new SEBLoading();
     Application.Run((Form)SEBLoading.loading);
 }
Пример #15
0
 public SebCloseDialogForm()
 {
     InitializeComponent();
     if ((Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyTouchOptimized)[SEBSettings.KeyTouchOptimized] ==
         true)
     {
         InitializeForTouch();
     }
     else
     {
         InitializeForNonTouch();
     }
 }
Пример #16
0
 public static void StartSplash()
 {
     if (SEBClientInfo.SEBNewlDesktop != null && (bool)SEBClientInfo.getSebSetting("createNewDesktop")["createNewDesktop"])
     {
         SEBDesktopController.SetCurrent(SEBClientInfo.SEBNewlDesktop);
     }
     else
     {
         SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop);
     }
     SEBSplashScreen.splash = new SEBSplashScreen();
     Application.Run((Form)SEBSplashScreen.splash);
 }
        public static bool InitSebSettings()
        {
            Logger.AddInformation("Attempting to InitSebSettings", (object)null, (Exception)null, (string)null);
            if (!SebWindowsClientMain._loadingSebFile && !SebWindowsClientMain.clientSettingsSet)
            {
                if (!SEBClientInfo.SetSebClientConfiguration())
                {
                    int num = (int)SEBMessageBox.Show(SEBUIStrings.ErrorCaption, SEBUIStrings.ErrorWhenOpeningSettingsFile, MessageBoxIcon.Hand, MessageBoxButtons.OK, false);
                    Logger.AddError("Error when opening the file SebClientSettings.seb!", (object)null, (Exception)null, (string)null);
                    return(false);
                }
                SebWindowsClientMain.clientSettingsSet = true;
                Logger.AddError("SEB client configuration set in InitSebSettings().", (object)null, (Exception)null, (string)null);
            }
            if (!SEBClientInfo.SetSystemVersionInfo())
            {
                int num = (int)SEBMessageBox.Show(SEBUIStrings.ErrorCaption, SEBUIStrings.OSNotSupported, MessageBoxIcon.Hand, MessageBoxButtons.OK, false);
                Logger.AddError("Unknown OS. Exiting SEB.", (object)null, (Exception)null, (string)null);
                return(false);
            }

            /*if (SEBClientInfo.IsNewOS)
             * {
             * SebWindowsClientMain.sessionCreateNewDesktop = (bool) SEBClientInfo.getSebSetting("createNewDesktop")["createNewDesktop"];
             * if (SebWindowsClientMain.sessionCreateNewDesktop)
             * {
             *  SEBClientInfo.OriginalDesktop = SEBDesktopController.GetCurrent();
             *  SEBDesktopController.OpenInputDesktop();
             *  SEBClientInfo.SEBNewlDesktop = SEBDesktopController.CreateDesktop("SEBDesktop");
             *  SEBDesktopController.Show(SEBClientInfo.SEBNewlDesktop.DesktopName);
             *  if (!SEBDesktopController.SetCurrent(SEBClientInfo.SEBNewlDesktop))
             *  {
             *    Logger.AddError("SetThreadDesktop failed! Looks like the thread has hooks or windows in the current desktop.", (object) null, (Exception) null, (string) null);
             *    SEBDesktopController.Show(SEBClientInfo.OriginalDesktop.DesktopName);
             *    SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop);
             *    SEBClientInfo.SEBNewlDesktop.Close();
             *    int num = (int) SEBMessageBox.Show(SEBUIStrings.createNewDesktopFailed, SEBUIStrings.createNewDesktopFailedReason, MessageBoxIcon.Hand, MessageBoxButtons.OK, false);
             *    return false;
             *  }
             *  SEBClientInfo.DesktopName = "SEBDesktop";
             * }
             * else
             * {
             *  SEBClientInfo.OriginalDesktop = SEBDesktopController.GetCurrent();
             *  SEBClientInfo.DesktopName = SEBClientInfo.OriginalDesktop.DesktopName;
             * }
             * }*/
            Logger.AddInformation("Successfully InitSebSettings", (object)null, (Exception)null, (string)null);
            return(true);
        }
Пример #18
0
        public SEBRestartExamToolStripButton()
        {
            // Get text (title/tool tip) for restarting exam
            string restartExamTitle = (String)SEBClientInfo.getSebSetting(SEBSettings.KeyRestartExamText)[SEBSettings.KeyRestartExamText];

            // If there was no individual restart exam text set, we use the default text (which is localized)
            if (String.IsNullOrEmpty(restartExamTitle))
            {
                restartExamTitle = SEBUIStrings.restartExamDefaultTitle;
            }
            this.ToolTipText = restartExamTitle;
            base.Image       = (Bitmap)Resources.ResourceManager.GetObject("skipBack");
            this.Alignment   = ToolStripItemAlignment.Right;
        }
Пример #19
0
        /// <summary>
        /// Shows the window
        /// </summary>
        /// <param name="windowHandle"></param>
        private void ShowWindow(IntPtr windowHandle)
        {
            windowHandle.BringToTop();

            //If we are working in touch optimized mode, open every window in full screen (e.g. maximized), except XULRunner because it seems not to accept the working area property and resizes to fully fullscreen
            if ((Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyTouchOptimized)[SEBSettings.KeyTouchOptimized]
                //            && !_process.ProcessName.Contains("xulrunner"))
                )
            {
                _openedWindows.First().Key.MaximizeWindow();
            }

            this.Close();
        }
Пример #20
0
        private void ShowMessageOrPasswordDialog(string processName)
        {
            var quitPassword = (String)SEBClientInfo.getSebSetting(SEBSettings.KeyHashedQuitPassword)[SEBSettings.KeyHashedQuitPassword];

            if (!string.IsNullOrEmpty(quitPassword))
            {
                ShowPasswordDialog(processName, quitPassword);
            }
            else
            {
                SEBMessageBox.Show(SEBUIStrings.prohibitedProcessDetectedTitle,
                                   SEBUIStrings.prohibitedProcessDetectedText + processName,
                                   MessageBoxIcon.Error, MessageBoxButtons.OK);
            }
        }
Пример #21
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     if (string.Compare((string)SEBClientInfo.getSebSetting("hashedQuitPassword")["hashedQuitPassword"], SEBProtectionController.ComputePasswordHash(this.txtQuitPassword.Text), StringComparison.OrdinalIgnoreCase) != 0)
     {
         this.Hide();
         int num = (int)SEBMessageBox.Show(SEBUIStrings.quittingFailed, SEBUIStrings.quittingFailedReason, MessageBoxIcon.Hand, MessageBoxButtons.OK, false);
         this.txtQuitPassword.Text = "";
         this.Visible = false;
     }
     else
     {
         this.Visible = false;
         SEBClientInfo.SebWindowsClientForm.ExitApplication(true);
     }
 }
Пример #22
0
        /// <summary>
        /// Call via separate thread
        /// var thread = new Thread(SEBLoading.StartSplash);
        /// thread.Start();
        /// </summary>
        public static void StartSplash()
        {
            // Set the threads desktop to the new desktop if "Create new Desktop" is activated
            if (SEBClientInfo.SEBNewlDesktop != null && (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyCreateNewDesktop)[SEBSettings.KeyCreateNewDesktop])
            {
                SEBDesktopController.SetCurrent(SEBClientInfo.SEBNewlDesktop);
            }
            else
            {
                SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop);
            }

            // Instance a splash form given the image names
            splash = new SEBSplashScreen();
            splash.ShowDialog();
        }
Пример #23
0
        /// ----------------------------------------------------------------------------------------
        /// <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");
            SEBDesktopWallpaper.BlankWallpaper();

            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(new ExecutableInfo("PLTW Kite Student Portal", "PLTW Kite Student Portal"));
            SEBWindowHandler.AllowedExecutables.Add(new ExecutableInfo("KiteStudentPortal", "KiteStudentPortal"));
            //Add allowed executables from all allowedProcessList
            foreach (Dictionary <string, object> process in SEBSettings.permittedProcessList)
            {
                if ((bool)process[SEBSettings.KeyActive])
                {
                    var processName         = Path.GetFileNameWithoutExtension(((string)process[SEBSettings.KeyExecutable] ?? string.Empty).ToLower());
                    var originalProcessName = Path.GetFileNameWithoutExtension(((string)process[SEBSettings.KeyOriginalName] ?? string.Empty).ToLower());

                    SEBWindowHandler.AllowedExecutables.Add(new ExecutableInfo(processName, originalProcessName));

                    if (!String.IsNullOrWhiteSpace(process[SEBSettings.KeyWindowHandlingProcess].ToString()))
                    {
                        processName = Path.GetFileNameWithoutExtension(((string)process[SEBSettings.KeyWindowHandlingProcess]).ToLower());
                        SEBWindowHandler.AllowedExecutables.Add(new ExecutableInfo(processName));
                    }
                }
            }

#if DEBUG
            //Add visual studio to allowed executables for debugging
            SEBWindowHandler.AllowedExecutables.Add(new ExecutableInfo("devenv"));
#endif

            if ((Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyKillExplorerShell)[SEBSettings.KeyKillExplorerShell])
            {
                KillExplorerShell();
            }

            Logger.AddInformation("Successfully InitSEBDesktop");

            return(true);
        }
Пример #24
0
        /// <summary>
        /// Call via separate thread
        /// var thread = new Thread(SEBLoading.StartLoading);
        /// thread.Start();
        /// </summary>
        public static void StartLoading()
        {
            SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop);

            // Set the threads desktop to the new desktop if "Create new Desktop" is activated
            if ((Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyCreateNewDesktop)[SEBSettings.KeyCreateNewDesktop] || SEBClientInfo.CreateNewDesktopOldValue)
            {
                SEBDesktopController.SetCurrent(SEBClientInfo.SEBNewlDesktop);
            }
            else
            {
                SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop);
            }

            loading = new SEBLoading();
            loading.ShowDialog();
        }
Пример #25
0
        /// <summary>
        /// Call via separate thread
        /// var thread = new Thread(SEBLoading.StartLoading);
        /// thread.Start();
        /// </summary>
        static public void StartLoading()
        {
            // Set the threads desktop to the new desktop if "Create new Desktop" is activated
            if ((Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyCreateNewDesktop)[SEBSettings.KeyCreateNewDesktop] || SEBClientInfo.CreateNewDesktopOldValue)
            {
                SEBDesktopController.SetCurrent(SEBClientInfo.SEBNewlDesktop);
            }
            else
            {
                SEBDesktopController.SetCurrent(SEBClientInfo.OriginalDesktop);
            }

            // Instance a loading screen form given the image names
            loading = new SEBLoading();
            // Run the form
            Application.Run(loading);
        }
Пример #26
0
 public static bool SetRegistryAccordingToConfiguration()
 {
     return(SebWindowsServiceHandler.SetRegistryAccordingToConfiguration(new Dictionary <RegistryIdentifiers, object>()
     {
         {
             RegistryIdentifiers.DisableLockWorkstation,
             (object)((bool)SEBClientInfo.getSebSetting("insideSebEnableLockThisComputer")["insideSebEnableLockThisComputer"] ? 0 : 1)
         },
         {
             RegistryIdentifiers.DisableChangePassword,
             (object)((bool)SEBClientInfo.getSebSetting("insideSebEnableChangeAPassword")["insideSebEnableChangeAPassword"] ? 0 : 1)
         },
         {
             RegistryIdentifiers.DisableTaskMgr,
             (object)((bool)SEBClientInfo.getSebSetting("insideSebEnableStartTaskManager")["insideSebEnableStartTaskManager"] ? 0 : 1)
         },
         {
             RegistryIdentifiers.HideFastUserSwitching,
             (object)((bool)SEBClientInfo.getSebSetting("insideSebEnableSwitchUser")["insideSebEnableSwitchUser"] ? 0 : 1)
         },
         {
             RegistryIdentifiers.NoLogoff,
             (object)((bool)SEBClientInfo.getSebSetting("insideSebEnableLogOff")["insideSebEnableLogOff"] ? 0 : 1)
         },
         {
             RegistryIdentifiers.NoClose,
             (object)((bool)SEBClientInfo.getSebSetting("insideSebEnableShutDown")["insideSebEnableShutDown"] ? 0 : 1)
         },
         {
             RegistryIdentifiers.EnableShade,
             (object)((bool)SEBClientInfo.getSebSetting("insideSebEnableVmWareClientShade")["insideSebEnableVmWareClientShade"] ? 1 : 0)
         },
         {
             RegistryIdentifiers.EnableShadeHorizon,
             (object)((bool)SEBClientInfo.getSebSetting("insideSebEnableVmWareClientShade")["insideSebEnableVmWareClientShade"] ? "True" : "False")
         },
         {
             RegistryIdentifiers.EaseOfAccess,
             (object)((bool)SEBClientInfo.getSebSetting("insideSebEnableEaseOfAccess")["insideSebEnableEaseOfAccess"] ? "" : "SebDummy.exe")
         },
         {
             RegistryIdentifiers.DontDisplayNetworkSelectionUI,
             (object)((bool)SEBClientInfo.getSebSetting("insideSebEnableEnableNetworkConnectionSelector")["insideSebEnableEnableNetworkConnectionSelector"] ? 0 : 1)
         }
     }));
 }
Пример #27
0
 public static void SendRestartExam()
 {
     try
     {
         if (XULRunner != null &&
             (!string.IsNullOrEmpty((String)SEBClientInfo.getSebSetting(SEBSettings.KeyRestartExamURL)[SEBSettings.KeyRestartExamURL]) ||
              (bool)SEBClientInfo.getSebSetting(SEBSettings.KeyRestartExamUseStartURL)[SEBSettings.KeyRestartExamUseStartURL]))
         {
             Console.WriteLine("SEB.Restart Exam sent");
             Logger.AddInformation("WebSocket: Send message: SEB.restartExam");
             XULRunner.Send("SEB.restartExam");
         }
     }
     catch (Exception)
     {
     }
 }
Пример #28
0
 public SebPasswordDialogForm()
 {
     InitializeComponent();
     try
     {
         if ((Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyTouchOptimized)[SEBSettings.KeyTouchOptimized] ==
             true)
         {
             InitializeForTouch();
         }
         else
         {
             InitializeForNonTouch();
         }
     }
     //if used to decrypt the settings, then the settings are not yet initialized...
     catch {}
 }
 public SebPasswordDialogForm()
 {
     this.InitializeComponent();
     try
     {
         if ((bool)SEBClientInfo.getSebSetting("touchOptimized")["touchOptimized"])
         {
             this.InitializeForTouch();
         }
         else
         {
             this.InitializeForNonTouch();
         }
     }
     catch
     {
     }
 }
        /// <summary>
        /// Calls the windows service to set the registry values to the insideSeb Settings
        /// Throws Exception
        /// </summary>
        /// <returns>succeded or not</returns>
        public static bool SetRegistryAccordingToConfiguration()
        {
            var valuesToSet = new Dictionary <RegistryIdentifiers, object>
            {
                { RegistryIdentifiers.DisableLockWorkstation, (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyInsideSebEnableLockThisComputer)[SEBSettings.KeyInsideSebEnableLockThisComputer] ? 0 : 1 },
                { RegistryIdentifiers.DisableChangePassword, (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyInsideSebEnableChangeAPassword)[SEBSettings.KeyInsideSebEnableChangeAPassword] ? 0 : 1 },
                { RegistryIdentifiers.DisableTaskMgr, (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyInsideSebEnableStartTaskManager)[SEBSettings.KeyInsideSebEnableStartTaskManager] ? 0 : 1 },
                { RegistryIdentifiers.HideFastUserSwitching, (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyInsideSebEnableSwitchUser)[SEBSettings.KeyInsideSebEnableSwitchUser] ? 0 : 1 },
                { RegistryIdentifiers.NoLogoff, (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyInsideSebEnableLogOff)[SEBSettings.KeyInsideSebEnableLogOff] ? 0 : 1 },
                { RegistryIdentifiers.NoClose, (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyInsideSebEnableShutDown)[SEBSettings.KeyInsideSebEnableShutDown] ? 0 : 1 },
                { RegistryIdentifiers.EnableShade, (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyInsideSebEnableVmWareClientShade)[SEBSettings.KeyInsideSebEnableVmWareClientShade] ? 1 : 0 },
                { RegistryIdentifiers.EnableShadeHorizon, (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyInsideSebEnableVmWareClientShade)[SEBSettings.KeyInsideSebEnableVmWareClientShade] ? "True" : "False" },
                { RegistryIdentifiers.EaseOfAccess, (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyInsideSebEnableEaseOfAccess)[SEBSettings.KeyInsideSebEnableEaseOfAccess] ? "" : "SebDummy.exe" },
                { RegistryIdentifiers.DontDisplayNetworkSelectionUI, (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyInsideSebEnableNetworkConnectionSelector)[SEBSettings.KeyInsideSebEnableNetworkConnectionSelector] ? 0 : 1 },
            };

            return(SetRegistryAccordingToConfiguration(valuesToSet));
        }