简体   繁体   English

如何在没有P / Invoke的情况下从c#创建挂起的进程?

[英]How to create suspended process from c# without P/Invoke?

WinAPI CreateProcess has the flag CREATE_SUSPENDED so it's possible to attach process to JobObject before it has done something and then to call ResumeThread for its main thread. WinAPI CreateProcess具有标志CREATE_SUSPENDED,因此可以在完成某些操作之前将进程附加到JobObject,然后为其主线程调用ResumeThread。 The only that I found searching for a solution is this post written 11 years ago! 我找到的唯一一个寻找解决方案的是11年前写的这篇文章

The only way to do this is with CreateProcess . 执行此操作的唯一方法是使用CreateProcess The .net Process class does not offer the functionality. .net Process类不提供该功能。 Either p/invoke CreateProcess or use a mixed mode C++/CLI assembly to call the same. p / invoke CreateProcess或使用混合模式C ++ / CLI程序集来调用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM