C++ Protect Process from being suspended

前端 未结 2 1582
天涯浪人
天涯浪人 2021-01-15 04:00

Is there any possible way to protect an exe from being suspended ?

Note that the i\'m the owner of the application.

相关标签:
2条回答
  • 2021-01-15 04:19

    According to msdn. You need to disable the THREAD_SUSPEND_RESUME access right when creating the thread. This will prevent it from being suspended

    0 讨论(0)
  • 2021-01-15 04:20

    There are tools such as Sysinternals ProcessExpert that allows you to suspend any process. If the user has admin authorisations there is no way to avoid this.

    This SO answer shows three solutions to suspend a windows process.

    However there is a way to make this extremely difficult : the solution consist of having a shadow process for your application. The application and the shadow process then shall monitor each other's suspension status and resume the suspended process if necessary:

    • as processes have to be suspended one after the other, this twin approach ensures that one of the two process is active and can prevent the suspension.

    • however this constant monitoring is CPU consuming, so you'd really think whether it's necessary to do so, and acceptable for your application's performance.

    If you want to prevent suspension to avoid reverse engineering of your code with a debugger, you have another more effective option. You insert several timer calls throughout your critical pieces of code, and check if abnormal execution time reveals suspension/debugging and if it's the case, you stop your code.

    0 讨论(0)
提交回复
热议问题