summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2011-08-18 22:51:41 +0000
committercliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2011-08-18 22:51:41 +0000
commitf7721db43929b2290594c9ab6daef197ca87c814 (patch)
tree8189e923e370552742009e9de4377634a2b836ee
parent4f848d4c46c769aee1b4e754aef85d1cbecf3e79 (diff)
downloadpyserial-f7721db43929b2290594c9ab6daef197ca87c814.tar.gz
fix usage of types to gain 64 bit Windows compatibility
git-svn-id: http://svn.code.sf.net/p/pyserial/code/trunk/pyserial@413 f19166aa-fa4f-0410-85c2-fa1106f25c8a
-rw-r--r--CHANGES.txt1
-rw-r--r--LICENSE.txt2
-rw-r--r--README.txt2
-rw-r--r--serial/tools/list_ports_windows.py36
-rw-r--r--serial/win32.py13
5 files changed, 35 insertions, 19 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 77bfe58..70ddba6 100644
--- a/CHANGES.txt
+++ b/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/LICENSE.txt b/LICENSE.txt
index 6462232..7bfac33 100644
--- a/LICENSE.txt
+++ b/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/README.txt b/README.txt
index d256f67..d6317e1 100644
--- a/README.txt
+++ b/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/serial/tools/list_ports_windows.py b/serial/tools/list_ports_windows.py
index 8f1e3fe..f17db07 100644
--- a/serial/tools/list_ports_windows.py
+++ b/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/serial/win32.py b/serial/win32.py
index 0634c77..eaa31f3 100644
--- a/serial/win32.py
+++ b/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):