Index: Lib/ctypes/wintypes.py =================================================================== --- Lib/ctypes/wintypes.py (revision 65908) +++ Lib/ctypes/wintypes.py (working copy) @@ -3,51 +3,51 @@ ###################################################################### # The most useful windows datatypes -from ctypes import * +import ctypes as _ctypes -BYTE = c_byte -WORD = c_ushort -DWORD = c_ulong +BYTE = _ctypes.c_byte +WORD = _ctypes.c_ushort +DWORD = _ctypes.c_ulong -WCHAR = c_wchar -UINT = c_uint -INT = c_int +CHAR = _ctypes.c_char +WCHAR = _ctypes.c_wchar +UINT = _ctypes.c_uint +INT = _ctypes.c_int -DOUBLE = c_double -FLOAT = c_float +DOUBLE = _ctypes.c_double +FLOAT = _ctypes.c_float BOOLEAN = BYTE -BOOL = c_long +BOOL = _ctypes.c_long -from ctypes import _SimpleCData -class VARIANT_BOOL(_SimpleCData): +class VARIANT_BOOL(_ctypes._SimpleCData): _type_ = "v" def __repr__(self): return "%s(%r)" % (self.__class__.__name__, self.value) -ULONG = c_ulong -LONG = c_long +ULONG = _ctypes.c_ulong +LONG = _ctypes.c_long -USHORT = c_ushort -SHORT = c_short +USHORT = _ctypes.c_ushort +SHORT = _ctypes.c_short # in the windows header files, these are structures. -_LARGE_INTEGER = LARGE_INTEGER = c_longlong -_ULARGE_INTEGER = ULARGE_INTEGER = c_ulonglong +_LARGE_INTEGER = LARGE_INTEGER = _ctypes.c_longlong +_ULARGE_INTEGER = ULARGE_INTEGER = _ctypes.c_ulonglong -LPCOLESTR = LPOLESTR = OLESTR = c_wchar_p -LPCWSTR = LPWSTR = c_wchar_p -LPCSTR = LPSTR = c_char_p -LPCVOID = LPVOID = c_void_p +LPCOLESTR = LPOLESTR = OLESTR = _ctypes.c_wchar_p +LPCWSTR = LPWSTR = _ctypes.c_wchar_p +LPCSTR = LPSTR = _ctypes.c_char_p +LPCVOID = LPVOID = _ctypes.c_void_p # WPARAM is defined as UINT_PTR (unsigned type) # LPARAM is defined as LONG_PTR (signed type) -if sizeof(c_long) == sizeof(c_void_p): - WPARAM = c_ulong - LPARAM = c_long -elif sizeof(c_longlong) == sizeof(c_void_p): - WPARAM = c_ulonglong - LPARAM = c_longlong +if _ctypes.sizeof(_ctypes.c_long) == _ctypes.sizeof(_ctypes.c_void_p): + WPARAM = _ctypes.c_ulong + LPARAM = _ctypes.c_long +elif _ctypes.sizeof(_ctypes.c_longlong) == _ctypes.sizeof(_ctypes.c_void_p): + WPARAM = _ctypes.c_ulonglong + LPARAM = _ctypes.c_longlong ATOM = WORD LANGID = WORD @@ -60,7 +60,7 @@ ################################################################ # HANDLE types -HANDLE = c_void_p # in the header files: void * +HANDLE = _ctypes.c_void_p # in the header files: void * HACCEL = HANDLE HBITMAP = HANDLE @@ -97,45 +97,45 @@ ################################################################ # Some important structure definitions -class RECT(Structure): - _fields_ = [("left", c_long), - ("top", c_long), - ("right", c_long), - ("bottom", c_long)] +class RECT(_ctypes.Structure): + _fields_ = [("left", LONG), + ("top", LONG), + ("right", LONG), + ("bottom", LONG)] tagRECT = _RECTL = RECTL = RECT -class _SMALL_RECT(Structure): - _fields_ = [('Left', c_short), - ('Top', c_short), - ('Right', c_short), - ('Bottom', c_short)] +class _SMALL_RECT(_ctypes.Structure): + _fields_ = [('Left', SHORT), + ('Top', SHORT), + ('Right', SHORT), + ('Bottom', SHORT)] SMALL_RECT = _SMALL_RECT -class _COORD(Structure): - _fields_ = [('X', c_short), - ('Y', c_short)] +class _COORD(_ctypes.Structure): + _fields_ = [('X', SHORT), + ('Y', SHORT)] -class POINT(Structure): - _fields_ = [("x", c_long), - ("y", c_long)] +class POINT(_ctypes.Structure): + _fields_ = [("x", LONG), + ("y", LONG)] tagPOINT = _POINTL = POINTL = POINT -class SIZE(Structure): - _fields_ = [("cx", c_long), - ("cy", c_long)] +class SIZE(_ctypes.Structure): + _fields_ = [("cx", LONG), + ("cy", LONG)] tagSIZE = SIZEL = SIZE def RGB(red, green, blue): return red + (green << 8) + (blue << 16) -class FILETIME(Structure): +class FILETIME(_ctypes.Structure): _fields_ = [("dwLowDateTime", DWORD), ("dwHighDateTime", DWORD)] _FILETIME = FILETIME -class MSG(Structure): +class MSG(_ctypes.Structure): _fields_ = [("hWnd", HWND), - ("message", c_uint), + ("message", UINT), ("wParam", WPARAM), ("lParam", LPARAM), ("time", DWORD), @@ -143,7 +143,7 @@ tagMSG = MSG MAX_PATH = 260 -class WIN32_FIND_DATAA(Structure): +class WIN32_FIND_DATAA(_ctypes.Structure): _fields_ = [("dwFileAttributes", DWORD), ("ftCreationTime", FILETIME), ("ftLastAccessTime", FILETIME), @@ -152,10 +152,10 @@ ("nFileSizeLow", DWORD), ("dwReserved0", DWORD), ("dwReserved1", DWORD), - ("cFileName", c_char * MAX_PATH), - ("cAlternateFileName", c_char * 14)] + ("cFileName", CHAR * MAX_PATH), + ("cAlternateFileName", CHAR * 14)] -class WIN32_FIND_DATAW(Structure): +class WIN32_FIND_DATAW(_ctypes.Structure): _fields_ = [("dwFileAttributes", DWORD), ("ftCreationTime", FILETIME), ("ftLastAccessTime", FILETIME), @@ -164,22 +164,7 @@ ("nFileSizeLow", DWORD), ("dwReserved0", DWORD), ("dwReserved1", DWORD), - ("cFileName", c_wchar * MAX_PATH), - ("cAlternateFileName", c_wchar * 14)] + ("cFileName", WCHAR * MAX_PATH), + ("cAlternateFileName", WCHAR * 14)] -__all__ = ['ATOM', 'BOOL', 'BOOLEAN', 'BYTE', 'COLORREF', 'DOUBLE', 'DWORD', - 'FILETIME', 'FLOAT', 'HACCEL', 'HANDLE', 'HBITMAP', 'HBRUSH', - 'HCOLORSPACE', 'HDC', 'HDESK', 'HDWP', 'HENHMETAFILE', 'HFONT', - 'HGDIOBJ', 'HGLOBAL', 'HHOOK', 'HICON', 'HINSTANCE', 'HKEY', - 'HKL', 'HLOCAL', 'HMENU', 'HMETAFILE', 'HMODULE', 'HMONITOR', - 'HPALETTE', 'HPEN', 'HRGN', 'HRSRC', 'HSTR', 'HTASK', 'HWINSTA', - 'HWND', 'INT', 'LANGID', 'LARGE_INTEGER', 'LCID', 'LCTYPE', - 'LGRPID', 'LONG', 'LPARAM', 'LPCOLESTR', 'LPCSTR', 'LPCVOID', - 'LPCWSTR', 'LPOLESTR', 'LPSTR', 'LPVOID', 'LPWSTR', 'MAX_PATH', - 'MSG', 'OLESTR', 'POINT', 'POINTL', 'RECT', 'RECTL', 'RGB', - 'SC_HANDLE', 'SERVICE_STATUS_HANDLE', 'SHORT', 'SIZE', 'SIZEL', - 'SMALL_RECT', 'UINT', 'ULARGE_INTEGER', 'ULONG', 'USHORT', - 'VARIANT_BOOL', 'WCHAR', 'WIN32_FIND_DATAA', 'WIN32_FIND_DATAW', - 'WORD', 'WPARAM', '_COORD', '_FILETIME', '_LARGE_INTEGER', - '_POINTL', '_RECTL', '_SMALL_RECT', '_ULARGE_INTEGER', 'tagMSG', - 'tagPOINT', 'tagRECT', 'tagSIZE'] +del _ctypes