开发者

find a process to terminate after a security event

开发者 https://www.devze.com 2023-01-24 00:02 出处:网络
I run a process by CreateProcess(...). I get and keep the PROCESS_INFORMATION. In a normal situation, I\'m waiting for the process to be finished by:

I run a process by CreateProcess(...). I get and keep the PROCESS_INFORMATION. In a normal situation, I'm waiting for the process to be finished by:

HANDLE hProcess = pWaitingThreadData->GetProcessHandle();
::WaitForSingleObject (hProcess, INFINITE);

I also have a security function, that got a message if a security event occurs. In this security function, I want to terminate immediately the process I have ran before.

the security function can occur anytime (not just while the process is open) and it's a general function. I call it with the MESSAGE_MAP by: ON_REGISTERED_THREAD_MESSAGE(WM_SECEVENT, OnThreadSecEvent). So I can't pass a paremeter of the process to the security function.

The problem is, in the security function I don't have the processID or threadID of that process.

How开发者_StackOverflow can I find and terminate that process?

Thanks


One way would be to send the processID as part of the message to your security function.

0

精彩评论

暂无评论...
验证码 换一张
取 消