- #include "stdafx.h"
- #include <string.h>
- #include <iostream.h>
- #include<stdio.h>
- #include <stdlib.h>
- #include <windows.h>
- #pragma comment(lib,"Kernel32.lib")
- #include <winbase.h>
- int main(int argc, char* argv[])
- {
- BOOL res=FALSE;
- HANDLE hjob=CreateJobObject(NULL,TEXT("killrav")); //建立job对象,命名为killrav
- HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS,0,atoi(argv[1]));//打开进程
- if (hProcess==NULL) //打开失败
- {
- printf("/t/t OpenProcessError!please Look up your Privilege first ^_^/n");
- return 0;
- }
- AssignProcessToJobObject(hjob,hProcess);//将进程和对象关联起来
- res=TerminateJobObject(hjob,0);//结束对象
- if (res==FALSE) printf("/t/t Sorry ,can't kill the process you want /n");
- else
- printf("/t/t Ok ,Now you can check if the process still exists /n");
- return 0;
- }
结束瑞星进程
最新推荐文章于 2022-03-01 17:34:55 发布