How do I protect my process or thread from being suspended / paused or terminated?

You need to handle OnProcessHandleOperation event. This event is fired when some process opens a handle to your process, which you want to protect.

To prevent process termination, remove PROCESS_TERMINATE flag from AllowedAccess parameter.
To prevent process suspension, remove PROCESS_SUSPEND_RESUME flag from AllowedAccess parameter.

Use the same approach for protecting individual threads (use OnThreadHandleOperation event for this).

ProcessManager sample, included with CBFS Process, shows how to perform these operations.

Ready to get started?

Learn more about Callback Technologies or download a free trial.

Download Now