|
53 | 53 | from .windows_eventqueue import EventQueue |
54 | 54 |
|
55 | 55 | try: |
56 | | - from ctypes import get_last_error, WinDLL, windll, WinError # type: ignore[attr-defined] |
| 56 | + from ctypes import get_last_error, WinDLL, WinError # type: ignore[attr-defined] |
57 | 57 | except: |
58 | 58 | # Keep MyPy happy off Windows |
59 | | - from ctypes import CDLL as WinDLL, cdll as windll |
| 59 | + from ctypes import CDLL as WinDLL |
60 | 60 |
|
61 | 61 | def get_last_error() -> int: |
62 | 62 | return 42 |
@@ -796,11 +796,11 @@ class INPUT_RECORD(Structure): |
796 | 796 | STD_OUTPUT_HANDLE = -11 |
797 | 797 |
|
798 | 798 | if sys.platform == "win32": |
| 799 | + import _winapi |
| 800 | + |
799 | 801 | _KERNEL32 = WinDLL("kernel32", use_last_error=True) |
800 | 802 |
|
801 | | - GetStdHandle = windll.kernel32.GetStdHandle |
802 | | - GetStdHandle.argtypes = [DWORD] |
803 | | - GetStdHandle.restype = HANDLE |
| 803 | + GetStdHandle = _winapi.GetStdHandle |
804 | 804 |
|
805 | 805 | GetConsoleScreenBufferInfo = _KERNEL32.GetConsoleScreenBufferInfo |
806 | 806 | GetConsoleScreenBufferInfo.argtypes = [ |
@@ -836,9 +836,7 @@ class INPUT_RECORD(Structure): |
836 | 836 | FlushConsoleInputBuffer.argtypes = [HANDLE] |
837 | 837 | FlushConsoleInputBuffer.restype = BOOL |
838 | 838 |
|
839 | | - WaitForSingleObject = _KERNEL32.WaitForSingleObject |
840 | | - WaitForSingleObject.argtypes = [HANDLE, DWORD] |
841 | | - WaitForSingleObject.restype = DWORD |
| 839 | + WaitForSingleObject = _winapi.WaitForSingleObject |
842 | 840 |
|
843 | 841 | OutHandle = GetStdHandle(STD_OUTPUT_HANDLE) |
844 | 842 | InHandle = GetStdHandle(STD_INPUT_HANDLE) |
|
0 commit comments