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.
Running PsSuspend with a process ID directs it to suspend or resume the process of that ID on the local computer. If you specify a process name PsSuspend will suspend or resume all processes that have that name. Specify the -r switch to resume suspended processes.
If a thread is created in a suspended state (with the CREATE_SUSPENDED flag), it does not begin to execute until another thread calls the ResumeThread function with a handle to the suspended thread. This can be useful for initializing the thread's state before it begins to execute.
How to kill process on remote computer? In Windows, we can kill processes running on a remote computer using the taskkill command. We can specify process id/image file name/user name to identify the processes that need to be killed.
Today, we’ll show you seven ways you can “manage” Windows processes remotely in general. By manage we mean start, query, and kill a remote Windows process. Keep in mind pretty much all of these tools and techniques here assume you have appropriate permissions on the remote computer. 1. PsExec, PowerShell, and WMI
Without interactively connecting to a remote Windows computer you can easily query its current list of processes with a variety of tools. Since Windows XP there is a built-in command line utility named “ tasklist “.
A thread can suspend and resume the execution of another thread. While a thread is suspended, it is not scheduled for time on the processor. If a thread is created in a suspended state (with the CREATE_SUSPENDED flag), it does not begin to execute until another thread calls the ResumeThread function with a handle to the suspended thread.
The only way is to suspend all threads of that process.
If you want to see actual code, check the sample here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With