diff options
author | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2011-08-18 22:51:41 +0000 |
---|---|---|
committer | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2011-08-18 22:51:41 +0000 |
commit | de43290c98d644b8b5e62c38c5a1f6209ad5ac31 (patch) | |
tree | d452245d8ad89a383a731f4d7ac2dc9aee7b7763 | |
parent | 08e39a3381978952a34667047e1614e183b3b344 (diff) | |
download | pyserial-git-de43290c98d644b8b5e62c38c5a1f6209ad5ac31.tar.gz |
fix usage of types to gain 64 bit Windows compatibility
-rw-r--r-- | pyserial/CHANGES.txt | 1 | ||||
-rw-r--r-- | pyserial/LICENSE.txt | 2 | ||||
-rw-r--r-- | pyserial/README.txt | 2 | ||||
-rw-r--r-- | pyserial/serial/tools/list_ports_windows.py | 36 | ||||
-rw-r--r-- | pyserial/serial/win32.py | 13 |
5 files changed, 35 insertions, 19 deletions
diff --git a/pyserial/CHANGES.txt b/pyserial/CHANGES.txt index 77bfe58..70ddba6 100644 --- a/pyserial/CHANGES.txt +++ b/pyserial/CHANGES.txt @@ -426,3 +426,4 @@ Bugfixes (win32): - [Bug 3057499] writeTimeoutError when write Timeout is 0 - [Patch 3036175] Windows 98 Support fix - [Patch 3054352] RTS automatic toggle, for RS485 functionality. +- Fix type definitions for 64 bit Windows compatibility diff --git a/pyserial/LICENSE.txt b/pyserial/LICENSE.txt index 6462232..7bfac33 100644 --- a/pyserial/LICENSE.txt +++ b/pyserial/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2001-2010 Chris Liechti <cliechti@gmx.net>; +Copyright (c) 2001-2011 Chris Liechti <cliechti@gmx.net>; All Rights Reserved. This is the Python license. In short, you can use this product in diff --git a/pyserial/README.txt b/pyserial/README.txt index d256f67..d6317e1 100644 --- a/pyserial/README.txt +++ b/pyserial/README.txt @@ -14,7 +14,7 @@ automatically selects the appropriate backend. - SVN repository: http://sourceforge.net/svn/?group_id=46487 - Download Page: http://sourceforge.net/project/showfiles.php?group_id=46487 -BSD license, (C) 2001-2010 Chris Liechti <cliechti@gmx.net> +BSD license, (C) 2001-2011 Chris Liechti <cliechti@gmx.net> Documentation diff --git a/pyserial/serial/tools/list_ports_windows.py b/pyserial/serial/tools/list_ports_windows.py index 8f1e3fe..f17db07 100644 --- a/pyserial/serial/tools/list_ports_windows.py +++ b/pyserial/serial/tools/list_ports_windows.py @@ -7,26 +7,30 @@ def ValidHandle(value): return value
NULL = 0
-HANDLE = ctypes.c_int
+from serial.win32 import ULONG_PTR
+from ctypes.wintypes import HANDLE
+from ctypes.wintypes import BOOL
+from ctypes.wintypes import CHAR
+from ctypes.wintypes import HWND
+from ctypes.wintypes import DWORD
+from ctypes.wintypes import WORD
+from ctypes.wintypes import LONG
+from ctypes.wintypes import ULONG
+from ctypes.wintypes import PDWORD
+from ctypes.wintypes import LPDWORD
+from ctypes.wintypes import PBYTE
+from ctypes.wintypes import LPBYTE
+from ctypes.wintypes import LPCSTR
+from ctypes.wintypes import PHKEY
+from ctypes.wintypes import HKEY
+
+
HDEVINFO = ctypes.c_int
-BOOL = ctypes.c_int
-CHAR = ctypes.c_char
PCTSTR = ctypes.c_char_p
-HWND = ctypes.c_uint
-DWORD = ctypes.c_ulong
-PDWORD = ctypes.POINTER(DWORD)
-LPDWORD = ctypes.POINTER(DWORD)
-LONG = ctypes.c_long
-ULONG = ctypes.c_ulong
-ULONG_PTR = ctypes.POINTER(ULONG)
-#~ PBYTE = ctypes.c_char_p
-PBYTE = ctypes.c_void_p
-LPBYTE = ctypes.c_void_p
+
ACCESS_MASK = DWORD
REGSAM = ACCESS_MASK
-HKEY = HANDLE
-PHKEY = ctypes.POINTER(HKEY)
-LPCSTR = ctypes.c_char_p
+
class GUID(ctypes.Structure):
_fields_ = [
diff --git a/pyserial/serial/win32.py b/pyserial/serial/win32.py index 0634c77..eaa31f3 100644 --- a/pyserial/serial/win32.py +++ b/pyserial/serial/win32.py @@ -10,6 +10,17 @@ from ctypes.wintypes import BYTE INVALID_HANDLE_VALUE = HANDLE(-1).value +# ULONG_PTR is a an ordinary number, not a pointer and contrary to the name it +# is either 32 or 64 bits, depending on the type of windows... +# so test if this a 32 bit windows... +if sizeof(c_ulong) == sizeof(c_void_p): + # 32 bits + ULONG_PTR = c_ulong +else: + # assume 64 bits + ULONG_PTR = c_int64 + + class _SECURITY_ATTRIBUTES(Structure): pass LPSECURITY_ATTRIBUTES = POINTER(_SECURITY_ATTRIBUTES) @@ -197,9 +208,9 @@ EV_EVENT2 = 4096 # Variable c_int EV_CTS = 8 # Variable c_int EV_BREAK = 64 # Variable c_int PURGE_RXCLEAR = 8 # Variable c_int -ULONG_PTR = c_ulong INFINITE = 0xFFFFFFFFL + class N11_OVERLAPPED4DOLLAR_48E(Union): pass class N11_OVERLAPPED4DOLLAR_484DOLLAR_49E(Structure): |