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

Handle the OnProcessHandleOperation event. This event is fired when some process opens a handle to a process that you want to protect.

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

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

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

The 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