private void confirmButton_Click(object sender, EventArgs e) { if (FilteringSystem.IsAdminPassword(passTB.Text)) { //Unlock the system Program.menuForm.unlockForm(); //Release the internet blocking ServiceAdapter.CustomCommend("GUIAdapter", (int)ServiceAdapter.CustomCommends.releaseScheduelBlocking); } else { if (attempts > 1) { attempts--; attemptsLable.Text = attempts.ToString(); attemptsLable.ForeColor = attempts == 1 ? System.Drawing.Color.Red : attemptsLable.ForeColor; label4.ForeColor = attempts == 1 ? System.Drawing.Color.Red : attemptsLable.ForeColor; } else { label4.ForeColor = System.Drawing.Color.Red; label4.Text = "התראה על שימוש בסיסמה שגויה נשלחה למנהל המערכת"; label5.Text = "הגלישה ברשת במחשב זה נחסמה."; attemptsLable.Visible = false; label2.Visible = false; ServiceAdapter.CustomCommend("GUIAdapter", (int)ServiceAdapter.CustomCommends.startScheduelBlocking); //tell the service to bloke the internt MessageBox.Show("התראה על שימוש בסיסמה שגויה נשלחה למנהל המערכת", "סיסמה שגויה!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } passTB.Text = ""; }
public static Boolean IsRunInSafeMode() { string minimalSafeMode = GetRegistryKeyValue(RegistryHive.LocalMachine, @"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\GUIAdapter", ""); string networkSafeMode = GetRegistryKeyValue(RegistryHive.LocalMachine, @"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\GUIAdapter", ""); if (minimalSafeMode != null && networkSafeMode != null) { if (minimalSafeMode == "Service" && networkSafeMode == "Service") { return(true); } return(false); } else { ServiceAdapter.CustomCommend((int)ServiceAdapter.CustomCommends.addToSafeMode); return(false); } }