diff options
Diffstat (limited to 'platform_utils_win32.py')
-rw-r--r-- | platform_utils_win32.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/platform_utils_win32.py b/platform_utils_win32.py index e20755a4..8eb3d2c3 100644 --- a/platform_utils_win32.py +++ b/platform_utils_win32.py | |||
@@ -19,13 +19,18 @@ import errno | |||
19 | from pyversion import is_python3 | 19 | from pyversion import is_python3 |
20 | from ctypes import WinDLL, get_last_error, FormatError, WinError, addressof | 20 | from ctypes import WinDLL, get_last_error, FormatError, WinError, addressof |
21 | from ctypes import c_buffer | 21 | from ctypes import c_buffer |
22 | from ctypes.wintypes import BOOL, BOOLEAN, LPCWSTR, DWORD, HANDLE, POINTER, c_ubyte | 22 | from ctypes.wintypes import BOOL, BOOLEAN, LPCWSTR, DWORD, HANDLE |
23 | from ctypes.wintypes import WCHAR, USHORT, LPVOID, Structure, Union, ULONG | 23 | from ctypes.wintypes import WCHAR, USHORT, LPVOID, ULONG |
24 | from ctypes.wintypes import byref | 24 | if is_python3(): |
25 | from ctypes import c_ubyte, Structure, Union, byref | ||
26 | from ctypes.wintypes import LPDWORD | ||
27 | else: | ||
28 | # For legacy Python2 different imports are needed. | ||
29 | from ctypes.wintypes import POINTER, c_ubyte, Structure, Union, byref | ||
30 | LPDWORD = POINTER(DWORD) | ||
25 | 31 | ||
26 | kernel32 = WinDLL('kernel32', use_last_error=True) | 32 | kernel32 = WinDLL('kernel32', use_last_error=True) |
27 | 33 | ||
28 | LPDWORD = POINTER(DWORD) | ||
29 | UCHAR = c_ubyte | 34 | UCHAR = c_ubyte |
30 | 35 | ||
31 | # Win32 error codes | 36 | # Win32 error codes |