Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 3rd, 2008, 2:36 AM   #1
cwl157
Professional Programmer
 
Join Date: Feb 2005
Posts: 345
Rep Power: 4 cwl157 is on a distinguished road
suspending a process in windows

Is there a windows system function that will let me suspend a process? Like pause and resume it? If not is there another way this can be done? Thanks.
cwl157 is offline   Reply With Quote
Old Jul 11th, 2008, 1:21 AM   #2
hirashgeff
Newbie
 
Join Date: Jul 2008
Posts: 2
Rep Power: 0 hirashgeff is on a distinguished road
Re: suspending a process in windows

reffer http://msdn.microsoft.com/en-us/libr...45(VS.85).aspx

The main problem is: there is no SuspendProcess API function. And there is no documented or safe way of doing this.

The only simple way of doing this is via SuspendThread/ResumeThread. This pair of API functions allows you to suspend and resume a thread. More than that, for the sake of safety, they maintain an internal "suspend count'. Each time you call SuspendThread, it increments this counter. ResumeThread, on the other hand, decreases this counter. If this was not done this way, the caller of SuspendThread would have no way of knowing how to restore the original state of the thread. Calling ResumeThread after calling SuspendThread effectively restores the original thread's state.

Knowing this, it is very straightforward suspending a process: it is just a matter of listing all the threads on a process, opening a handle for each of them and calling SuspendThread. The resuming is done the same way.
hirashgeff is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows XP Activation Loop... Ghost Coder's Corner Lounge 3 Jan 24th, 2008 4:28 PM
Inspecting process' memory on Windows magnus.therning C 7 Jul 26th, 2006 1:11 PM
Suspending another process in win32 coder0xff C++ 4 May 28th, 2006 12:33 PM
Process injection jayme C++ 3 Jan 28th, 2006 7:05 AM
Windows Hook on Win9x system dc2000 C++ 0 Jul 4th, 2005 6:27 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:48 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC