Skip to content

Instantly share code, notes, and snippets.

@bionicbeagle
Last active December 14, 2015 13:29
Show Gist options
  • Save bionicbeagle/5094066 to your computer and use it in GitHub Desktop.
Save bionicbeagle/5094066 to your computer and use it in GitHub Desktop.
So GetExitCodeProcess() returns TRUE (for success) even if you pass it a non-process handle. Thanks, I guess! This in conjunction with another bug which caused some code to keep using (and keep CLOSING) a process handle which had already been closed caused random lock-ups in an application and I spent several days looking for the root cause :/ B…
HANDLE h = CreateEvent(NULL, TRUE, FALSE, NULL);
DWORD dwExitCode = 9999;
if (GetExitCodeProcess(h, &dwExitCode))
{
printf("Developers, developers, developers!");
CloseHandle(h);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment