Results 1 to 7 of 7

Thread: how to terminate debugee in safe mode

  1. #1
    zqBugZ
    Guest

    how to terminate debugee in safe mode

    Hi there,
    I have another question to ask about termination of debugee. Commonly I used TerminateProcess the debugee. For some applications, It complains that it terminated abnormally last time, and asks for recovery. How can I do to make the debugee exit gracefully more than terminating immediately?

    Thanks a lot!
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  2. #2
    Jakor
    Guest
    uh... close the program regularly. Most likely they have a couple ways to exit the program from inside. aka:

    Code:
    Die proc eCode:DWORD
    invoke ExitProcess,eCode
    Die endp
    
    Shutdown proc eCode:DWORD
    invoke ShutdownGFX
    invoke ShutdownSound
    invoke ShutdownWinsock
    invoke SaveConfiguration,eCode
    invoke ExitProcess,eCode
    Shutdown endp
    now this isn't exact, but as you can see one cleans itself up and the otherone just exits. Lets say their initialization check for "SaveConfiguration" to have been last called with "ERR_NOERROR" or "ERR_FIRSTRUN" and displays an abnormal shutdown if neither of these are found. After checking for that, it runs "SaveConfiguration,ERR_APPRUNNING" so that it can tell whether "Die" is called or "Shutdown,ERR_NOERROR" and change for the next time. Now when you "TerminateProcess" this would be the same as "Die" as you do not save the fact that you ended correctly.

    so really if you end like this, just ignore the fact that it ended abnormally because it DID end "abnormally"
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  3. #3
    zqBugZ
    Guest
    Quote Originally Posted by Jakor View Post
    ...
    so really if you end like this, just ignore the fact that it ended abnormally because it DID end "abnormally"
    is there anyway to let it exit by itself? Like send it a WM_CLOSE something like that? sorry I am not a windows guy, please forgive me if that is stupid.
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  4. #4
    Administrator dELTA's Avatar
    Join Date
    Oct 2000
    Location
    Ring -1
    Posts
    4,204
    Blog Entries
    5
    Yes. that would probably be recommended way. That could result in interactive messages from the program though (like "Do you want to save the unsaved xxx?). It will be equal to clicking the "X" in the program's main window.
    "Give a man a quote from the FAQ, and he'll ignore it. Print the FAQ, shove it up his ass, kick him in the balls, DDoS his ass and kick/ban him, and the point usually gets through eventually."

  5. #5
    zqBugZ
    Guest
    Thanks a lot! that is really helpful. But I notice that SendMessage uses HWND as parameter. How can I get it given thread id or process id? is FindWindowA the only way to get a hwnd?
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  6. #6
    Go back the other way - GetWindowThreadProcessId()

    *edit* should have made that clearer, enumerate all the windows and then use that function to compare ids...
    Still here...

  7. #7
    zqBugZ
    Guest
    Great!, it works now. Thanks a lot, guys!
    I promise that I have read the FAQ and tried to use the Search to answer my question.

Similar Threads

  1. Replies: 13
    Last Post: January 24th, 2008, 02:03
  2. Replies: 0
    Last Post: January 12th, 2008, 00:08
  3. Replies: 0
    Last Post: January 12th, 2008, 00:08
  4. Replies: 0
    Last Post: January 12th, 2008, 00:08
  5. Replies: 0
    Last Post: January 12th, 2008, 00:08

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •