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. The only that I found searching for a solution is this post written 11 years ago!
Asked
Active
Viewed 2,351 times
1 Answers
7
The only way to do this is with CreateProcess
. The .net Process
class does not offer the functionality. Either p/invoke CreateProcess
or use a mixed mode C++/CLI assembly to call the same.

David Heffernan
- 601,492
- 42
- 1,072
- 1,490
-
Does C++/CLI has more interoperability with WinAPI? May be it's worth to create a "proxy" assembly in C++ for using from C#. – SerG Mar 21 '14 at 22:31
-
A mixed mode C++/CLI assembly can include the windows headers, and link directly to unmanaged libraries. All can be done with pinvoke just easier with C++/CLI. – David Heffernan Mar 21 '14 at 22:34