I'm writing an application in C# and for security reasons it is important for me to know when its process(Process A) has been killed or closed.
My first thought is to make another process (Process B) watch Process A and react accordingly if this process no longer exists. The problem is obvious, though: Closing Process B will make it possible to close Process A.
This is probably a (kind of)common situation and as such, there is likely already a solution for it. Unfortunately I wasn't able to find one.
What are common ways to achieve this?