Thread: Stoping A Process

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    265

    Stoping A Process

    How can i go about writing a program that could put a complete HAULT to another processes. I dont want to terminate it, however i want to totally freeze it. What information about the window would i need? Do i have to target individual threads or can i feed it a process's name and use that? If there is a program out there that i could select a window or type in its executable name and hit FREEZE this is what im looking for. If i cant find one ill write it myself. If that doesnt work ill format the drive and not reinstall windows.

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    265
    Isnt there a simple window message like WM_STOP_PROCESSING_RIGHT_NOW_YOU_DUMB_PROCESS or something? If debuggers can do that and more (softice? non-ide debuggers?) why cant any window cause it to happen?

  3. #3
    Anon.
    Guest
    Google Search:suspendprocess msdn
    Result:
    http://www.google.com/search?q=suspendprocess+msdn

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    SuspendThread. You need to get a thread handle, you can either get the main thread or all threads (I guess the first is easier and more effective).
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Registered User
    Join Date
    Feb 2003
    Posts
    265
    very interesting, but is there any way to get working VC++6 code out of it? This is all .net garbage.

  6. #6
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    SuspendThread() has been around for a LONG time, before they even thought about making .NET. I think you need to listen to what people tell you.
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  7. #7
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Try these functions:

    FindWindow()
    GetWindowThreadProcessID()
    OpenThread()
    SuspendThread()
    ResumeThread()
    CloseHandle()
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  8. #8
    Registered User
    Join Date
    Feb 2003
    Posts
    265
    ... before they even thought about making .NET. I think you need to listen to what people tell ...
    If YOU listened to what other people said, MY reply was in reference to the link posted "http://www.google.com/search?q=suspendprocess+msdn" Which yeilds only one link, That link only provides source code that compiles clean under .NET, which when put in context with MY reply says that i want to know how to get that code compiling under VC++6 and not .NET. Thus "very interesting, but is there any way to get working VC++6 code out of it? This is all .net garbage." All of a sudden changes meaning. I hope that clears up any ambiguity with your internal compiler. Im obviously aware there are obviously ways of doing this before .net.

  9. #9
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Basically it's that you replied to the post previous to mine and not mine.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  10. #10
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Sorry, you'll have to try to be more specific in your responses in future. As your post followed CornedBee's statement about SuspendThread(), and you didn't elaborate, I naturally assumed you were responding to him.

    I did have a look around MSDN, and came up empty handed. Since code execution is a thread matter, not a process matter, there is no function made for your purpose. There are also, as far as I could find, no functions for enumerating the threads related to a particular process, so I have no idea how you would be able to suspend every thread related to the target process. Hopefully, there is only one thread you need to suspend, and in that case, use those functions I listed before.
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  11. #11
    Registered User
    Join Date
    Feb 2003
    Posts
    265
    The binary provided in that link is .NET and it can take a PID and suspend it. Im trying to port over what i recognise however i cant even find what header OpenThread is in. I obviously tried windows.h and winbase.h and a few others but my compiler is still saying OpenThread is an undeclaired identifier. I believe the program just loops through an enumerated process list identifies all threads in a process and suspends them. Thx for your replys.

  12. #12
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    It's windows.h, but you need to play with WINVER, _WIN32_WINNT etc.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. init adopts zombie process?
    By password636 in forum Linux Programming
    Replies: 4
    Last Post: 07-01-2009, 10:05 AM
  2. create a child process that creates a child process
    By cus in forum Linux Programming
    Replies: 9
    Last Post: 01-13-2009, 02:14 PM
  3. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  4. Problem with forking a process
    By Unitedroad in forum C Programming
    Replies: 10
    Last Post: 10-04-2007, 01:43 AM
  5. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM