Exemple #1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormOpenProcess fop = new FormOpenProcess();

            fop.ShowDialog();

            if (fop.p != null)
            {
                bool r = true;

                try
                {
                    r = fop.p.Start();
                }
                catch
                {
                    //MessageBox.Show(ex.Message);
                    r = false;
                }

                if (r == false)
                {
                    MessageBox.Show("Error starting " + fop.p.StartInfo.FileName);
                }
                else
                {
                    try
                    {
                        // Puede dar una excepcion si la app no tiene una interfaz grafica
                        fop.p.WaitForInputIdle(1000);
                    }
                    catch
                    {
                    }

                    foreach (NktProcess process in Program.hook.spyMgr.Processes())
                    {
                        if (process.Id == fop.p.Id)
                        {
                            bool hookedSuccessful = Program.hook.HookProcess(process);

                            if (hookedSuccessful)
                            {
                                FormInfo fInfo = new FormInfo("Hook successful", 0, FormInfo.IconType.OK);
                                fInfo.StartPosition = FormStartPosition.CenterParent;
                                fInfo.Show(Program.formMain);

                                Program.LogThis("Core", "Process " + process.Name + " hooked successfully");
                            }
                            else
                            {
                                FormInfo fInfo = new FormInfo("Error hooking", 0, FormInfo.IconType.Error);
                                fInfo.StartPosition = FormStartPosition.CenterParent;
                                fInfo.Show(Program.formMain);

                                Program.LogThis("Core", "Error hooking " + process.Name);
                            }
                            break;
                        }
                    }
                }
            }
        }
Exemple #2
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
      
            FormOpenProcess fop = new FormOpenProcess();
            fop.ShowDialog();

            if (fop.p != null)
            {
                bool r = true;

                try
                {
                   r = fop.p.Start();
                }
                catch
                {
                    //MessageBox.Show(ex.Message);
                    r = false;
                }

                if (r == false)
                    MessageBox.Show("Error starting " + fop.p.StartInfo.FileName);
                else
                {
                    try
                    {
                        // Puede dar una excepcion si la app no tiene una interfaz grafica
                        fop.p.WaitForInputIdle(1000);
                    }
                    catch
                    {
                        
                    }

                    foreach (NktProcess process in Program.hook.spyMgr.Processes())
                    {
                        if (process.Id == fop.p.Id)
                        {
                            bool hookedSuccessful = Program.hook.HookProcess(process);

                            if (hookedSuccessful)
                            {
                                FormInfo fInfo = new FormInfo("Hook successful", 0, FormInfo.IconType.OK);
                                fInfo.StartPosition = FormStartPosition.CenterParent;
                                fInfo.Show(Program.formMain);

                                Program.LogThis("Core", "Process " + process.Name + " hooked successfully");
                            }
                            else
                            {
                                FormInfo fInfo = new FormInfo("Error hooking", 0, FormInfo.IconType.Error);
                                fInfo.StartPosition = FormStartPosition.CenterParent;
                                fInfo.Show(Program.formMain);

                                Program.LogThis("Core", "Error hooking " + process.Name);
                            }
                            break;
                        }
                    }
                    
                }
            }
        }