1

hi,
I want c# source code for process killer as task manger
-> it forcefully kill the process which i want
<->it may be system process

3
Contributors
11
Replies
13
Views
6 Years
Discussion Span
Last Post by privatevoid
Featured Replies
  • sir when i am using this code when i kill the process of system volume information i get an error which show access denied can u help me again You are realy my great teacher Thank's Again:) Read More

0

This reeks of "virus". You'll now have to convince me otherwise, or this thread is closed.

Edited by Nick Evan: n/a

0

I am developing an anti-virus in which i want to use this code.
it's only for ethical purpose
i can tell u complete detail of this software what i want to do with it.


1->when a virus found the system will check about the file name and the dependent process of file and forcefully close it.i want want to do only this its not for unethical purpose
2-> And also it's not against the rules

Thanks

0

Have a look at the below, the System.Diagnostics.Process class.

Process[] processes = Process.GetProcesses();
...                      
Process p = Process.GetProcessesByName("aname");
p.Kill();
0

I am also using the same code but

->i didn't know how to get the file name of a process
that's main problem occurring know

0

You mean like this:

foreach(Process p in Process.GetProcesses())
{
    ProcessModule pm = p.MainModule;
    if(pm.FileName == "aname")
    {
        p.Kill();
    }
}
0

If thats not good enough you could look at using wmi like this

private void wmiProcessDetails()
        {
            string queryString = "SELECT * FROM Win32_Process";

            SelectQuery query = new SelectQuery(queryString);

            ManagementObjectSearcher searcher = new ManagementObjectSearcher(queryString);
            ManagementObjectCollection processes = searcher.Get();


            foreach (ManagementObject mo in processes)
            {
                messageView.AppendText(String.Format("Name:\t{0} {1}\n", mo["Name"], mo["Handle"]));
                messageView.AppendText(String.Format("Path:\t{0}\n", mo["ExecutablePath"]));
                messageView.AppendText(String.Format("Install Date:\t{0}\n", mo["InstallDate"]));
                messageView.AppendText(String.Format("Command Line:\t{0}\n", mo["CommandLine"]));
                messageView.AppendText(String.Format("Caption:\t{0}\n\n",mo["Caption"]));
            }
        }
1

sir when i am using this code when i kill the process of system volume information i get an error which show access denied

can u help me again

You are realy my great teacher
Thank's Again:)

Edited by onlinessp: spell mistake

0

According to microsoft the user account used by the program must either of created a process or be an administrator to kill it.

That basically means that you will have to run the program using an admin account and if its vista or Win 7 using run as administrator.

0

But Dear Sir,


According to my information anti virus are doing scanning from limited user are able to kill that process then how they do it?

Thanks Again,

0

But Dear Sir,


According to my information anti virus are doing scanning from limited user are able to kill that process then how they do it?

Thanks Again,

2

Most AntiVirus programs run a number of services on the System account and a tray app within the current user. Look at "Inter Process Communication (IPC)" or using a intermediate database to do this.

The actual thread killing part will have to be in an admin account for your purposes.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.