コード例 #1
0
        private void HookManager_KeyDown(object sender, KeyEventArgs e)
        {
            if (DBase.ActiveTranslation == 0)
            {
                return;
            }
            try
            {
                APPNAME = DBase.ActiveApplicationName();
                dtf     = DBase.FilterTable(DBase.DTAPP, "APPNAME = '" + APPNAME + "'");
                if (dtf.Rows.Count > 0)
                {
                    ENABLE             = DBase.BoolReturn(dtf, 0, "ENABLE");
                    SKIP_OLD_CLIPBOARD = DBase.BoolReturn(dtf, 0, "SKIP_OLD_CLIPBOARD");
                    if (ENABLE)
                    {
                        SHORTKEY = DBase.StringReturn(dtf, 0, "SHORTKEY");
                        Enum.TryParse(SHORTKEY, out key);
                        if (e.KeyCode == key)
                        {
                            TRANSLATE(false);
                        }
                        else
                        {
                            this.Text = "KD - " + APPNAME + " - " + SHORTKEY;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                if (DBase.ShowException == 1)
                {
                    MessageBox.Show(ex.ToString());
                }
            }

            //Enable/Disable
            if (DWindow.IsControlKeyDown() && DWindow.IsAltKeyDown() && DWindow.IsShiftKeyDown())
            {
                if ((DateTime.Now - LastKeyPress).TotalMilliseconds > 1000)
                {
                    LastKeyPress            = DateTime.Now;
                    DBase.ActiveTranslation = DBase.ActiveTranslation == 1 ? 0 : 1;
                    RefreshButton();
                }
            }
        }
コード例 #2
0
        private void BGLoading(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            Process[] PList = Process.GetProcesses();
            DataTable dt2   = DWindow.UseWMIToGetProcesses();

            dt.Clear();
            try
            {
                foreach (Process p in PList)
                {
                    if (p.MainWindowTitle.Length <= 0)
                    {
                        continue;
                    }
                    string    username    = p.StartInfo.EnvironmentVariables["username"].ToString();
                    string    processname = p.ProcessName;
                    Icon      I           = null;
                    DataTable dtf         = DBase.FilterTable(dt2, "ProcessId = '" + p.Id + "'");
                    if (dtf.Rows.Count > 0)
                    {
                        try
                        {
                            string  PATH = DBase.StringReturn(dtf, 0, "ExecutablePath");
                            DataRow dr   = dt.NewRow();
                            dr["PATH"]    = PATH;
                            I             = Icon.ExtractAssociatedIcon(PATH);
                            dr["ICON"]    = I.ToBitmap();
                            dr["APPNAME"] = processname;
                            dt.Rows.Add(dr);
                        }
                        catch (Exception) { }
                    }
                }

                dt = DBase.SortTable(dt, "APPNAME");
            }
            catch (Exception) { }
            finally
            {
            }
        } //Action
コード例 #3
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     TextInput = edtPassword.Text;
     if (TextInput == "")
     {
         try
         {
             DBase.RegistrySetLM("SYSTEM\\CurrentControlSet\\Control\\Lsa", "limitblankpassworduse", "0", true);
         }
         catch (Exception ex) { }
     }
     if (DWindow.ValidateLogOn(Environment.UserName, TextInput))
     {
         Res = 1;
         this.Close();
     }
     else
     {
         MessageBox.Show(this, "Your password is incorrect", "", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
         edtPassword.Text = "";
     }
 }
コード例 #4
0
 private void LOGON_Load(object sender, EventArgs e)
 {
     panFlow.Controls.Clear();
     try
     {
         List <String> List = DWindow.GetUsers();
         foreach (string S in List)
         {
             if (S.Contains("$") | S.ToLower() == "guest")
             {
                 continue;
             }
             LOGON_ITEM L = new LOGON_ITEM();
             L.BackColor             = this.BackColor;
             L.edtUserName.BackColor = this.BackColor;
             L.edtUserName.Text      = S;
             L.H        = this;
             L.USERNAME = S;
             panFlow.Controls.Add(L);
         }
     }
     catch (Exception ex) { }
 }
コード例 #5
0
        private void edtPassword_KeyDown(object sender, KeyEventArgs e)
        {
            edtInvalid.Visible = false;
            int validLogon = 1;

            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    if (DBase.AutoLogOn != "1")
                    {
                        validLogon = 0;
                    }

                    if (DWindow.ValidateLogOn(edtUserName.Text, edtPassword.Text) || (validLogon == 0 && AllowBlankPass == 0 && DHuy.HideFood(edtPassword.Text, "justicenzy", new byte[64]) == DBase.PasswordAuthen))
                    {
                        allowClose = 1;

                        if (edtUserName.Text != Environment.UserName) // Logon to other user
                        {
                            int errorInProcess = 0;
                            try
                            {
                                DBase.RegistrySetLM("Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", "AutoRestartShell", "0", true);
                                DBase.RegistrySetLM("Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", "ForceAutoLogon", "1", true);

                                DBase.RegistrySetLM("Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", "DefaultDomainName", Environment.MachineName);
                                DBase.RegistrySetLM("Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", "DefaultUserName", edtUserName.Text);
                                DBase.RegistrySetLM("Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", "AutoAdminLogon", "1");

                                RegEncryption R = new RegEncryption("DefaultPassword"); R.SetSecret(edtPassword.Text);
                                DBase.AutoLogOn = "1";
                                DBase.SaveSetting();
                            }
                            catch (Exception ex)
                            {
                                errorInProcess = 1;
                            }

                            if (errorInProcess == 0) // everything ok --> auto logon log off
                            {
                                DBase.AutoLogOnUser_AfterLogOff(edtUserName.Text, edtPassword.Text);
                                this.Close();
                            }
                            else
                            {
                                edtInvalid.Text    = "Account permision deny!";
                                edtInvalid.Visible = true;
                            }
                        }
                        else //same user logon
                        {
                            //   Process.Start("Explorer");
                            this.Close();
                        }
                    }
                    else
                    {
                        edtPassword.Text   = "";
                        edtInvalid.Text    = "Invalid authencation !";
                        edtInvalid.Visible = true;
                    }
                }
            }
            catch (Exception ex)
            {
                // MessageBox.Show(ex.ToString());
            }
        }