Stoping A Process

This is a discussion on Stoping A Process within the Windows Programming forums, part of the Platform Specific Boards category; How can i go about writing a program that could put a complete HAULT to another processes. I dont want ...

  1. #1
    That Creepy Network Guy DeepBlackMagic's Avatar
    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
    That Creepy Network Guy DeepBlackMagic's Avatar
    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,893
    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
    That Creepy Network Guy DeepBlackMagic's Avatar
    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.
    benforbes@optusnet.com.au
    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()
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  8. #8
    That Creepy Network Guy DeepBlackMagic's Avatar
    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,893
    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.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  11. #11
    That Creepy Network Guy DeepBlackMagic's Avatar
    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,893
    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, 11: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, 10:24 AM
  4. Problem with forking a process
    By Unitedroad in forum C Programming
    Replies: 10
    Last Post: 10-04-2007, 02:43 AM
  5. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 08:53 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21