Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 1
    I don't think that pOpenThread.Equals(null) will ever return true. It should be pOpenThread == IntPtr.Zero IMO. The rest works just fine! Thanks! Commented Sep 16, 2008 at 13:49
  • 1
    Why break; and not continue; ? Commented Nov 25, 2013 at 12:47
  • From MSDN: When you are finished with the handle, be sure to close it by using the CloseHandle function. Commented Jun 21, 2014 at 17:35
  • 1
    In case of errors this code ignores them and continues. This is quite dangerous. It can half-suspend processes without any warning and it can lead to bugs being undetected during testing. Just letting you know. Commented May 30, 2016 at 11:35
  • 2
    Also, the resume loop means that already suspended threads will be woken up. This messes with internal state of the target process and likely corrupts it. The correct way would be to store a list of IDs that were suspended and resume them once. Commented May 30, 2016 at 11:36