From d78e72595a044a426f07d5b06b4410b89a40b3c9 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Sat, 9 Jan 2021 18:19:09 -0500 Subject: [PATCH] Use SetErrorMode and related constants from pywin32 --- src/allmydata/windows/fixups.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/allmydata/windows/fixups.py b/src/allmydata/windows/fixups.py index e7f045b95..a7552b377 100644 --- a/src/allmydata/windows/fixups.py +++ b/src/allmydata/windows/fixups.py @@ -11,19 +11,19 @@ def initialize(): import codecs, re 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.encodingutil import canonical_encoding # - SetErrorMode = WINFUNCTYPE( - UINT, UINT, - use_last_error=True - )(("SetErrorMode", windll.kernel32)) - - SEM_FAILCRITICALERRORS = 0x0001 - SEM_NOOPENFILEERRORBOX = 0x8000 + from win32api import ( + SetErrorMode, + ) + from win32con import ( + SEM_FAILCRITICALERRORS, + SEM_NOOPENFILEERRORBOX, + ) SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX)