mirror of https://github.com/python/cpython
Add some windows datatypes that were missing from this file, and add
the aliases defined in windows header files for the structures.
This commit is contained in:
parent
6d3d339d21
commit
a7e823fd2c
|
@ -1,63 +1,107 @@
|
|||
######################################################################
|
||||
# This file should be kept compatible with Python 2.3, see PEP 291. #
|
||||
######################################################################
|
||||
# XXX This module needs cleanup.
|
||||
|
||||
# The most useful windows datatypes
|
||||
from ctypes import *
|
||||
|
||||
DWORD = c_ulong
|
||||
WORD = c_ushort
|
||||
BYTE = c_byte
|
||||
WORD = c_ushort
|
||||
DWORD = c_ulong
|
||||
|
||||
BOOLEAN = BYTE
|
||||
BOOL = c_long
|
||||
VARIANT_BOOL = c_short
|
||||
|
||||
ULONG = c_ulong
|
||||
LONG = c_long
|
||||
|
||||
# in the windows header files, these are structures.
|
||||
LARGE_INTEGER = c_longlong
|
||||
ULARGE_INTEGER = c_ulonglong
|
||||
|
||||
|
||||
HANDLE = c_ulong # in the header files: void *
|
||||
|
||||
HWND = HANDLE
|
||||
HDC = HANDLE
|
||||
HMODULE = HANDLE
|
||||
HINSTANCE = HANDLE
|
||||
HRGN = HANDLE
|
||||
HTASK = HANDLE
|
||||
HKEY = HANDLE
|
||||
HPEN = HANDLE
|
||||
HGDIOBJ = HANDLE
|
||||
HMENU = HANDLE
|
||||
|
||||
LCID = DWORD
|
||||
LPCOLESTR = LPOLESTR = OLESTR = c_wchar_p
|
||||
LPCWSTR = LPWSTR = c_wchar_p
|
||||
LPCSTR = LPSTR = c_char_p
|
||||
|
||||
WPARAM = c_uint
|
||||
LPARAM = c_long
|
||||
|
||||
BOOL = c_long
|
||||
VARIANT_BOOL = c_short
|
||||
ATOM = WORD
|
||||
LANGID = WORD
|
||||
|
||||
LPCOLESTR = LPOLESTR = OLESTR = c_wchar_p
|
||||
LPCWSTR = LPWSTR = c_wchar_p
|
||||
COLORREF = DWORD
|
||||
LGRPID = DWORD
|
||||
LCTYPE = DWORD
|
||||
|
||||
LPCSTR = LPSTR = c_char_p
|
||||
LCID = DWORD
|
||||
|
||||
################################################################
|
||||
# HANDLE types
|
||||
HANDLE = c_ulong # in the header files: void *
|
||||
|
||||
HACCEL = HANDLE
|
||||
HBITMAP = HANDLE
|
||||
HBRUSH = HANDLE
|
||||
HCOLORSPACE = HANDLE
|
||||
HDC = HANDLE
|
||||
HDESK = HANDLE
|
||||
HDWP = HANDLE
|
||||
HENHMETAFILE = HANDLE
|
||||
HFONT = HANDLE
|
||||
HGDIOBJ = HANDLE
|
||||
HGLOBAL = HANDLE
|
||||
HHOOK = HANDLE
|
||||
HICON = HANDLE
|
||||
HINSTANCE = HANDLE
|
||||
HKEY = HANDLE
|
||||
HKL = HANDLE
|
||||
HLOCAL = HANDLE
|
||||
HMENU = HANDLE
|
||||
HMETAFILE = HANDLE
|
||||
HMODULE = HANDLE
|
||||
HMONITOR = HANDLE
|
||||
HPALETTE = HANDLE
|
||||
HPEN = HANDLE
|
||||
HRGN = HANDLE
|
||||
HRSRC = HANDLE
|
||||
HSTR = HANDLE
|
||||
HTASK = HANDLE
|
||||
HWINSTA = HANDLE
|
||||
HWND = HANDLE
|
||||
SC_HANDLE = HANDLE
|
||||
SERVICE_STATUS_HANDLE = HANDLE
|
||||
|
||||
################################################################
|
||||
# Some important structure definitions
|
||||
|
||||
class RECT(Structure):
|
||||
_fields_ = [("left", c_long),
|
||||
("top", c_long),
|
||||
("right", c_long),
|
||||
("bottom", c_long)]
|
||||
RECTL = RECT
|
||||
tagRECT = _RECTL = RECTL = RECT
|
||||
|
||||
class _SMALL_RECT(Structure):
|
||||
_fields_ = [('Left', c_short),
|
||||
('Top', c_short),
|
||||
('Right', c_short),
|
||||
('Bottom', c_short)]
|
||||
SMALL_RECT = _SMALL_RECT
|
||||
|
||||
class _COORD(Structure):
|
||||
_fields_ = [('X', c_short),
|
||||
('Y', c_short)]
|
||||
|
||||
class POINT(Structure):
|
||||
_fields_ = [("x", c_long),
|
||||
("y", c_long)]
|
||||
POINTL = POINT
|
||||
tagPOINT = _POINTL = POINTL = POINT
|
||||
|
||||
class SIZE(Structure):
|
||||
_fields_ = [("cx", c_long),
|
||||
("cy", c_long)]
|
||||
SIZEL = SIZE
|
||||
tagSIZE = SIZEL = SIZE
|
||||
|
||||
def RGB(red, green, blue):
|
||||
return red + (green << 8) + (blue << 16)
|
||||
|
@ -65,6 +109,7 @@ def RGB(red, green, blue):
|
|||
class FILETIME(Structure):
|
||||
_fields_ = [("dwLowDateTime", DWORD),
|
||||
("dwHighDateTime", DWORD)]
|
||||
_FILETIME = FILETIME
|
||||
|
||||
class MSG(Structure):
|
||||
_fields_ = [("hWnd", HWND),
|
||||
|
@ -73,6 +118,7 @@ class MSG(Structure):
|
|||
("lParam", LPARAM),
|
||||
("time", DWORD),
|
||||
("pt", POINT)]
|
||||
tagMSG = MSG
|
||||
MAX_PATH = 260
|
||||
|
||||
class WIN32_FIND_DATAA(Structure):
|
||||
|
|
Loading…
Reference in New Issue