Sáb Oct 02, 2010 4:45 pm
- Código:
//process killer by crAcker
#include <windows.h>
#include <iostream>
#include <tlhelp32.h>
using namespace std;
HANDLE hProcessSnap;
HANDLE hProcess;
PROCESSENTRY32 pe32;
char Report[6];
BOOL KillProcess(char *Process)
{
hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
pe32.dwSize = sizeof(PROCESSENTRY32);
Process32First(hProcessSnap, &pe32);
while(Process32Next(hProcessSnap, &pe32))
{
if(!strcmp(pe32.szExeFile, Process))
{
strcpy(Report, "Found");
hProcess = OpenProcess(PROCESS_TERMINATE, 0, pe32.th32ProcessID);
if(TerminateProcess(hProcess, 0) == 0)
{
cout<<"process failed.......";
cin.get();
}
else
{
cout<<"process terminated.....";
cin.get();
}
}
}
CloseHandle(hProcess);
CloseHandle(hProcessSnap);
if(strcmp(Report, "Found"))
cout<<"the process isn't open u moron!";
cin.get();
strcpy(Report, "");
return 0;
}
int main()
{
char* process[10];
cout<<"Enter name of process: ";
cin>>process[10];
KillProcess(process[10]);
return 0;
}