Skip to content

bpo-36965: include windows.h to be able to use STATUS_CONTROL_C_EXIT #13421

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

Merged
merged 4 commits into from
May 21, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Modules/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
#if defined(HAVE_GETPID) && defined(HAVE_UNISTD_H)
# include <unistd.h> /* getpid() */
#endif
#ifdef _MSC_VER
# include <crtdbg.h> /* STATUS_CONTROL_C_EXIT */
#ifdef MS_WINDOWS
# include <winternl.h> /* NTSTATUS */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what this include is needed, the file doesn't use NTSTATUS.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ntstatus.h contains the value of STATUS_CONTROL_C_EXIT, and that value is of type NTSTATUS.

however ntstatus.h does not contain the definition of NTSTATUS and neither does it include that definition. So, only including ntstatus.h will not compile. I found the documentation linked above that specifies that one should include ntdef.h to have the definition of NTSTATUS.

but then again, that seems to have been deprecated, and I found comments in the headers that winternl.h should be used instead of ntdef.h

(I'm not much of a windows developer, so I only tried to parse the available documentation)

# include <ntstatus.h> /* STATUS_CONTROL_C_EXIT */
#endif
/* End of includes for exit_sigint() */

Expand Down