public bool HookProcess(int pid) { for (int i = 0; i < spyMgr.Processes().Count; i++) { NktProcess p = (NktProcess)spyMgr.Processes().GetAt(i); if (p.Id == pid) { return(HookProcess(p)); } } return(false); }
private bool HookProcess(string proccessName) { NktProcessesEnum enumProcess = _spyMgr.Processes(); NktProcess tempProcess = enumProcess.First(); while (tempProcess != null) { if (tempProcess.Name.Equals(proccessName, StringComparison.InvariantCultureIgnoreCase) && tempProcess.PlatformBits > 0 && tempProcess.PlatformBits <= IntPtr.Size * 8) { _process = tempProcess; NktModule module = _process.ModuleByName("mshtml.dll"); if (module != null) { IntPtr EA = (IntPtr) new IntPtr(module.BaseAddress.ToInt32() + _RVA.ToInt32()); NktHook hook = _spyMgr.CreateHookForAddress(EA, "mshtml.dll!CStyleSheet::Notify", (int)(eNktHookFlags.flgRestrictAutoHookToSameExecutable | eNktHookFlags.flgOnlyPreCall | eNktHookFlags.flgDontCheckAddress)); hook.Attach(_process, true); hook.Hook(true); } } tempProcess = enumProcess.Next(); } _process = null; return(false); }
private void Form1_Load(object sender, EventArgs e) { NktHook hook = _spyMgr.CreateHook("WINMM.dll!timeGetTime", (int)(eNktHookFlags.flgOnlyPostCall)); hook.Hook(true); bool bProcessFound = false; NktProcessesEnum enumProcess = _spyMgr.Processes(); NktProcess tempProcess = enumProcess.First(); while (tempProcess != null) { if (tempProcess.Name.Equals("iexplore.exe", StringComparison.InvariantCultureIgnoreCase) && tempProcess.PlatformBits == 32) { hook.Attach(tempProcess, true); bProcessFound = true; } tempProcess = enumProcess.Next(); } if (!bProcessFound) { MessageBox.Show("Please run \"iexplore.exe\" before!", "Error"); Environment.Exit(0); } }
private static void KillRunningInternetExplorerInstances() { foreach (NktProcess proc in spyMgr.Processes()) { if (proc.Name.ToLower().EndsWith("iexplore.exe") != false) { proc.Terminate(-1); } } }
public void FindSqlService() { NktProcessesEnum pEnum = _spyMgr.Processes(); _sqlServerProcess = pEnum.GetByName("sqlservr.exe"); if (_sqlServerProcess == null) { throw new SqlServiceNotFoundException(); } }
private NktProcess GetProcess(string proccessName) { NktProcessesEnum enumProcess = _spyMgr.Processes(); NktProcess tempProcess = enumProcess.First(); while (tempProcess != null) { if (tempProcess.Name.Equals(proccessName, StringComparison.InvariantCultureIgnoreCase)) { return(tempProcess); } tempProcess = enumProcess.Next(); } return(null); }
private bool GetProcess(string proccessName) { NktProcessesEnum enumProcess = _spyMgr.Processes(); NktProcess tempProcess = enumProcess.First(); while (tempProcess != null) { if (tempProcess.Name.Equals(proccessName, StringComparison.InvariantCultureIgnoreCase) && tempProcess.PlatformBits > 0 && tempProcess.PlatformBits <= IntPtr.Size * 8) { _process = tempProcess; return(true); } tempProcess = enumProcess.Next(); } _process = null; return(false); }
private bool GetProcess(string proccessName) { NktProcessesEnum enumProcess = _spyMgr.Processes(); NktProcess tempProcess = enumProcess.First(); while (tempProcess != null) { //Console.Out.WriteLine(tempProcess.Name); if (tempProcess.Name.Contains(proccessName) && tempProcess.PlatformBits > 0 && tempProcess.PlatformBits <= IntPtr.Size * 8) { _process = tempProcess; return(true); } tempProcess = enumProcess.Next(); } _process = null; return(false); }
public IEnumerable <IRunningProcess> RunningProcesses() { return(RunningProcess.From(_manager.Processes().CollectAll(), this)); }