-
-
[求助]ZwTerminateProcess返回STATUS_PROCESS_IS_TERMINATING
-
发表于:
2016-12-9 17:25
3642
-
[求助]ZwTerminateProcess返回STATUS_PROCESS_IS_TERMINATING
首先我调用了一次ZwTerminateProcess结束了一个进程,然后重新打开这个进程,再次调用ZwTerminateProcess进行结束,返回STATUS_PROCESS_IS_TERMINATING,说进程已经被结束了???
贴出代码:
void KillProcess(unsigned long Pid)
{
HANDLE hProcess = NULL;
CLIENT_ID ClientId;
OBJECT_ATTRIBUTES oa;
NTSTATUS status;
DbgPrint("kill now!\r\n");
ClientId.UniqueProcess = (HANDLE)Pid;
ClientId.UniqueThread = 0;
oa.Length = sizeof(oa);
oa.RootDirectory = 0;
oa.ObjectName = 0;
oa.Attributes = 0;
oa.SecurityDescriptor = 0;
oa.SecurityQualityOfService = 0;
//打开进程,如果句柄有效,则结束进程
ZwOpenProcess(&hProcess, 1, &oa, &ClientId);
DbgPrint("%x\r\n", status);
if (hProcess)
{
ZwTerminateProcess(hProcess, 0);
DbgPrint("%x---hprocess:%x\r\n", status,hProcess);
ZwClose(hProcess);
};
}
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)