防止 C# 应用程序终止进程 [英] Prevent C# app from process kill

查看:25
本文介绍了防止 C# 应用程序终止进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何保护我的 C# 应用程序免遭他人通过 taskman 或以编程方式终止其进程?

How can I protect my C# app from someone killing its process via taskman or programmatically?

这是我的场景:

App A 是另一个团队开发的 MFC 应用.它有一个未发布的基于文本的远程界面,通过后门启用.

App A is an MFC app developed by another team. It has an unpublished text-based remote interface that is enabled via a backdoor.

我正在开发应用程序 B,这是一个与 A 交互的 C# WinForms 应用程序.B 在需要远程访问时启用 A 的后门,并在完成(或失败时)关闭它.

I'm developing app B, a C# WinForms app which interacts with A. B enables A's backdoor when it needs remote access closes it when finished (or on failure).

我正在探索用户可以滥用 B 以访问 A 隐藏功能的方式,例如在启用 A 的远程接口后终止 B 的进程.当这种情况发生时,我希望有最后一次机会让 B 关闭 A 的后门.

I'm exploring ways users could abuse B in order to gain access to A's hidden functionality, such as killing B's process after it has enabled A's remote interface. I'd like have one last chance for B to close A's backdoor when that happens.

B 使用 localhost 与 A 交互,所以我不担心掉电的情况.

B uses localhost to interact with A, so I'm not worried about the power-down scenario.

我正在寻找不涉及更改 A 的解决方案.

I'm looking for a solution that doesn't involve changing A.

我不希望能够阻止 Dark Tangent(尽管这将是一个奖励),但现在脚本小子可以用这种设计来做他的方式:)

I'm not expecting to be able to stop Dark Tangent (though that would be a bonus), but right now a script kiddie could have his way with this design :)

这些应用程序在 Windows XP 上运行,但很快也将支持 Vista 和7.

These apps run on Windows XP, but will also soon support Vista & 7.

提前致谢,吉姆

推荐答案

你不能——只要用户有权在你的程序上调用 TerminateProcess,你就不能阻止 End Process 在任务中立即杀死你经理.Raymond Chen 前段时间在此发帖:程序和用户之间的军备竞赛

You can't - as long as the user has the right to call TerminateProcess on your program, you can't prevent End Process from killing you immediately in task manager. Raymond Chen posted on this some time ago: The arms race between programs and users

这篇关于防止 C# 应用程序终止进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆