Windows:自动挂起整个进程?
使用 Win32 API 只能使用 SuspendThread()
暂停单个线程,但不能在一次调用中暂停整个进程。
迭代进程线程并一次挂起它们并不是一个好的选择,因为它可能会导致死锁和意外行为。
这应该是在内核中使用 DDK 中的函数(我不记得它的名字)可以实现的事情。
如何将这个函数暴露给用户模式呢?
有没有其他方法可以在不进入内核的情况下实现此目的?
SysInternals 进程资源管理器有一个暂停进程的选项。它是如何做到的?
Using Win32 API it is only possible to suspend a single thread using SuspendThread()
but not a complete process in one call.
Iterating over a process threads and suspending them one at a time is not a good option since it may cause dead-locks and unexpected behavior.
This is supposed to be something that is possible in kernel using a function from the DDK (which I don't remember its name).
How is it possible to expose this function to user mode?
Is there any other way to achieve this without going to the kernel?
SysInternals process explorer has an option to suspend process. How does it do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,这正是
MiniDumpWriteDump
似乎是这样做的 - 它在创建转储之前单独挂起进程中的所有线程(调用线程除外)。仅此一项不应导致死锁或意外行为,尽管显然最好从单独的进程中执行此操作。
Actually thats exactly what
MiniDumpWriteDump
appears to do - it individually suspends all threads in the process (except for the calling thread) before it creates a dump.This alone shouldn't cause a deadlock or unexpected behaviour, although obviously its probably best to do this from a separate process.