How about suspendProcess


D

Denis @ TheOffice

I see that there is an option to OpenProcess for suspend/resume.
I do not see the SuspendProcess nor ResumeProcess call for it?

In the case that there is no such thing Is there a way to do the equivalent?


Denis
 
Ad

Advertisements

G

Gary Chanson

Denis @ TheOffice said:
I see that there is an option to OpenProcess for suspend/resume.
I do not see the SuspendProcess nor ResumeProcess call for it?

In the case that there is no such thing Is there a way to do the equivalent?

Call SuspendThread for each thread in the process.
 
D

Denis @ TheOffice

Gary Chanson said:
Call SuspendThread for each thread in the process.
I see.

Should I suspend thread in a certain order?
Is there a way to locate the main thread?

Denis
 
G

Gary Chanson

Denis @ TheOffice said:
I see.

Should I suspend thread in a certain order?
Is there a way to locate the main thread?

There is no real concept of a main thread in Windows. When you enumerate
the threads, the first thread will typically be the first one created and is
probably what you might think of as the main thread.

There's no way to know if it matters what order you suspend them in. If
its critical that all threads get suspended at essentially the same time (keep
in mind that this doesn't really mean much in a multitasking environment, but
might in a multiprocessor environment), push up the priority of the thread
doing the suspending so that it won't get preempted while it's working.
 
Ad

Advertisements

B

Ben Voigt

Gary Chanson said:
There is no real concept of a main thread in Windows. When you
enumerate
the threads, the first thread will typically be the first one created and
is
probably what you might think of as the main thread.

There's no way to know if it matters what order you suspend them in.
If
its critical that all threads get suspended at essentially the same time
(keep
in mind that this doesn't really mean much in a multitasking environment,
but
might in a multiprocessor environment), push up the priority of the thread
doing the suspending so that it won't get preempted while it's working.

You could sort them based on the priority of the threads being suspended...
suspend the lowest priority threads first, since that's either essentially a
no-op (a higher priority thread is runnable), or suspends the entire app (if
every higher priority thread is blocking). Or suspend the highest priority
threads first, since those are likely to be watchdog monitors which might
kill the entire process if you get it wrong.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top