Use SetErrorMode and related constants from pywin32

This commit is contained in:
Jean-Paul Calderone 2021-01-09 18:19:09 -05:00
parent 891ef3eefd
commit d78e72595a

View File

@ -11,19 +11,19 @@ def initialize():
import codecs, re import codecs, re
from ctypes import WINFUNCTYPE, WinError, windll, POINTER, byref, c_int, get_last_error from ctypes import WINFUNCTYPE, WinError, windll, POINTER, byref, c_int, get_last_error
from ctypes.wintypes import BOOL, HANDLE, DWORD, UINT, LPWSTR, LPCWSTR, LPVOID from ctypes.wintypes import BOOL, HANDLE, DWORD, LPWSTR, LPCWSTR, LPVOID
from allmydata.util import log from allmydata.util import log
from allmydata.util.encodingutil import canonical_encoding from allmydata.util.encodingutil import canonical_encoding
# <https://msdn.microsoft.com/en-us/library/ms680621%28VS.85%29.aspx> # <https://msdn.microsoft.com/en-us/library/ms680621%28VS.85%29.aspx>
SetErrorMode = WINFUNCTYPE( from win32api import (
UINT, UINT, SetErrorMode,
use_last_error=True )
)(("SetErrorMode", windll.kernel32)) from win32con import (
SEM_FAILCRITICALERRORS,
SEM_FAILCRITICALERRORS = 0x0001 SEM_NOOPENFILEERRORBOX,
SEM_NOOPENFILEERRORBOX = 0x8000 )
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX) SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX)