Eryk Sun <eryk...@gmail.com> added the comment:

Why doesn't SuppressCrashReport suppress the hard error dialog (i.e. 
SEM_FAILCRITICALERRORS)? This dialog gets created by the NtRaiseHardError 
system call. For example:

    >>> NtRaiseHardError = ctypes.windll.ntdll.NtRaiseHardError
    >>> response = (ctypes.c_ulong * 1)()

With the default OS error mode, the following raises a hard error dialog for 
STATUS_UNSUCCESSFUL (0xC0000001), with abort/retry/ignore options:

    >>> NtRaiseHardError(0xC000_0001, 0, 0, None, 0, response)
    0
    >>> response[0]
    2

The response value is limited to abort (2), retry (7), ignore (4) -- or simply 
returned (0) when the process hard error mode is disabled: 

    >>> msvcrt.SetErrorMode(msvcrt.SEM_FAILCRITICALERRORS)
    0
    >>> NtRaiseHardError(0xC000_0001, 0, 0, None, 0, response)
    0
    >>> response[0]
    0

NtRaiseHardError also checks for an error-mode override flag (0x1000_0000) in 
the status code, which is used in cases such as WinAPI FatalAppExitW. For 
example, the following will raise the dialog regardless of the hard error mode:

    >>> NtRaiseHardError(0xC000_0001 | 0x1000_0000, 0, 0, None, 0, response)
    0
    >>> response[0]
    2

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40826>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to