Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow clean shutdown of applications #15

Open
SkyLined opened this issue Jul 25, 2016 · 4 comments
Open

Allow clean shutdown of applications #15

SkyLined opened this issue Jul 25, 2016 · 4 comments
Assignees

Comments

@SkyLined
Copy link
Owner

It should be possible for BugId to cleanly terminate an application by sending WM_CLOSE message to all windows associated with the processes it is debugging. A user should be able to trigger this by calling a method of BugId when a test is finished and the user wants to make sure the application can be closed without triggering any bugs during shutdown.

@SkyLined
Copy link
Owner Author

Set by step implementation plan: https://support.microsoft.com/en-us/kb/178893

  1. Use EnumWindows to enumerate windows
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms633497(v=vs.85).aspx
  2. Use GetWindowThreadProcessID to get the process id for each window
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms633522(v=vs.85).aspx
  3. Ignore windows with a process id not in BugId's list of running processes.
  4. Use PostMessage or SendMessageTimeout to send WM_CLOSE to remaining windows.
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms644944(v=vs.85).aspx
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms644952(v=vs.85).aspx
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms632617(v=vs.85).aspx

@SkyLined
Copy link
Owner Author

It would make sense to implement most of the C code in Kill, so I've opened a bug at https://github.com/SkyLined/Kill/issues/1

@SkyLined
Copy link
Owner Author

Code will probably need to set a timeout using
https://github.com/SkyLined/BugId/blob/master/src/cCdbWrapper.py#L329
then after the timeout, enumerate processes in cdb.exe and do the stuff mentioned above.

@SkyLined SkyLined self-assigned this Dec 31, 2017
@SkyLined
Copy link
Owner Author

SkyLined commented Dec 31, 2017

Kill is no longer used by cBugId, but I could add the relevant APIs to mWindowsAPI and make direct calls. Since cCdbWrapper has a list of all running processes associated with the application at all times, I could close the application by sending a WM_CLOSE message to all Windows in all relevant processes without having to interrupt it in the debugger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant