views:

307

answers:

2

I can suspend a thread of another process by using SuspendThread(). Is there any way to also suspend the execution of that process altogether? If yes, please post code.

Thanks.

PS: Since you will ask "Why do you want to do this" I'll post it here. I am dealing with legacy software that is not maintained anymore. I don't have access to the source code. Right now I need it to pause until a file is filled with data and then resume the execution.

+1  A: 

The only way is to suspend all threads of that process.

If you want to see actual code, check the sample here.

Kirill V. Lyadvinsky
would that suspend the process itself? I tried suspending all thread but the main process is still active.
wonderer
A process includes one or more threads that actually execute the code in the process (technically, processes don’t run, threads do).
Kirill V. Lyadvinsky
Great. Thanks for the explanation
wonderer
A: 

> The only way is to suspend all threads of that process.

No.
Use Undocumented Kernel apis (exported since NT 3.1) to suspend the Pid.

thanks for the comments, but just saying "use undocumented API" won't give me any answer. If you know of any undocumented API please post it and give some sample code.
wonderer