I have a HANDLE of someone else's process, how can I pause this process and then continue it? PS windows.

    1 answer 1

    The process can not be paused. You can pause the flow, freeze it, so to speak. As you know, the process without a single stream, that the apple tree without a caterpillar. There is no benefit from such a process and the Windows system automatically deletes it, or rather the Windows garbage collector (at the system level). Everyone knows that the underlying process of any process is its main thread, which controls all the threads created in REALTIME MODE if any, of course. So, freeze the main thread using standard Windows functions: SuspendThread / ResumeThread . The process itself will create the illusion of a "foot", but in fact, its main flow will be frozen.

    • one
      In fact, you should not get hung up on the flow verb, especially since all frameworks have a main thread UI. It would be more logical to fall asleep all the threads of the process. - karmadro4
    • And if the flow, say 50? This is somehow "in the forehead." - Free_man
    • 3
      @Dexter - In the forehead, rather, the fact that freezing WinAPI one of the threads of someone else's application when there are other threads is not a bad step towards undefined behavior . How can you know that such interference in someone else's process will not lead to its crash'у or out of sync? “It is for this reason that there is a way to atomically заsuspend'ить process — NtSuspendProcess . - I don’t know how barley [ Win32::Process::Suspend, ] [1] works, but perhaps it makes sense to look at its contents. [1]: search.cpan.org/~rootkwok/Win32-Process-Suspend-0.0642/lib/… - Costantino Rupert