ยปCore Development>Code coverage>Lib/ctypes/wintypes.py

Python code coverage for Lib/ctypes/wintypes.py

#countcontent
1n/a# The most useful windows datatypes
2n/aimport ctypes
3n/a
4n/aBYTE = ctypes.c_byte
5n/aWORD = ctypes.c_ushort
6n/aDWORD = ctypes.c_ulong
7n/a
8n/a#UCHAR = ctypes.c_uchar
9n/aCHAR = ctypes.c_char
10n/aWCHAR = ctypes.c_wchar
11n/aUINT = ctypes.c_uint
12n/aINT = ctypes.c_int
13n/a
14n/aDOUBLE = ctypes.c_double
15n/aFLOAT = ctypes.c_float
16n/a
17n/aBOOLEAN = BYTE
18n/aBOOL = ctypes.c_long
19n/a
20n/aclass VARIANT_BOOL(ctypes._SimpleCData):
21n/a _type_ = "v"
22n/a def __repr__(self):
23n/a return "%s(%r)" % (self.__class__.__name__, self.value)
24n/a
25n/aULONG = ctypes.c_ulong
26n/aLONG = ctypes.c_long
27n/a
28n/aUSHORT = ctypes.c_ushort
29n/aSHORT = ctypes.c_short
30n/a
31n/a# in the windows header files, these are structures.
32n/a_LARGE_INTEGER = LARGE_INTEGER = ctypes.c_longlong
33n/a_ULARGE_INTEGER = ULARGE_INTEGER = ctypes.c_ulonglong
34n/a
35n/aLPCOLESTR = LPOLESTR = OLESTR = ctypes.c_wchar_p
36n/aLPCWSTR = LPWSTR = ctypes.c_wchar_p
37n/aLPCSTR = LPSTR = ctypes.c_char_p
38n/aLPCVOID = LPVOID = ctypes.c_void_p
39n/a
40n/a# WPARAM is defined as UINT_PTR (unsigned type)
41n/a# LPARAM is defined as LONG_PTR (signed type)
42n/aif ctypes.sizeof(ctypes.c_long) == ctypes.sizeof(ctypes.c_void_p):
43n/a WPARAM = ctypes.c_ulong
44n/a LPARAM = ctypes.c_long
45n/aelif ctypes.sizeof(ctypes.c_longlong) == ctypes.sizeof(ctypes.c_void_p):
46n/a WPARAM = ctypes.c_ulonglong
47n/a LPARAM = ctypes.c_longlong
48n/a
49n/aATOM = WORD
50n/aLANGID = WORD
51n/a
52n/aCOLORREF = DWORD
53n/aLGRPID = DWORD
54n/aLCTYPE = DWORD
55n/a
56n/aLCID = DWORD
57n/a
58n/a################################################################
59n/a# HANDLE types
60n/aHANDLE = ctypes.c_void_p # in the header files: void *
61n/a
62n/aHACCEL = HANDLE
63n/aHBITMAP = HANDLE
64n/aHBRUSH = HANDLE
65n/aHCOLORSPACE = HANDLE
66n/aHDC = HANDLE
67n/aHDESK = HANDLE
68n/aHDWP = HANDLE
69n/aHENHMETAFILE = HANDLE
70n/aHFONT = HANDLE
71n/aHGDIOBJ = HANDLE
72n/aHGLOBAL = HANDLE
73n/aHHOOK = HANDLE
74n/aHICON = HANDLE
75n/aHINSTANCE = HANDLE
76n/aHKEY = HANDLE
77n/aHKL = HANDLE
78n/aHLOCAL = HANDLE
79n/aHMENU = HANDLE
80n/aHMETAFILE = HANDLE
81n/aHMODULE = HANDLE
82n/aHMONITOR = HANDLE
83n/aHPALETTE = HANDLE
84n/aHPEN = HANDLE
85n/aHRGN = HANDLE
86n/aHRSRC = HANDLE
87n/aHSTR = HANDLE
88n/aHTASK = HANDLE
89n/aHWINSTA = HANDLE
90n/aHWND = HANDLE
91n/aSC_HANDLE = HANDLE
92n/aSERVICE_STATUS_HANDLE = HANDLE
93n/a
94n/a################################################################
95n/a# Some important structure definitions
96n/a
97n/aclass RECT(ctypes.Structure):
98n/a _fields_ = [("left", LONG),
99n/a ("top", LONG),
100n/a ("right", LONG),
101n/a ("bottom", LONG)]
102n/atagRECT = _RECTL = RECTL = RECT
103n/a
104n/aclass _SMALL_RECT(ctypes.Structure):
105n/a _fields_ = [('Left', SHORT),
106n/a ('Top', SHORT),
107n/a ('Right', SHORT),
108n/a ('Bottom', SHORT)]
109n/aSMALL_RECT = _SMALL_RECT
110n/a
111n/aclass _COORD(ctypes.Structure):
112n/a _fields_ = [('X', SHORT),
113n/a ('Y', SHORT)]
114n/a
115n/aclass POINT(ctypes.Structure):
116n/a _fields_ = [("x", LONG),
117n/a ("y", LONG)]
118n/atagPOINT = _POINTL = POINTL = POINT
119n/a
120n/aclass SIZE(ctypes.Structure):
121n/a _fields_ = [("cx", LONG),
122n/a ("cy", LONG)]
123n/atagSIZE = SIZEL = SIZE
124n/a
125n/adef RGB(red, green, blue):
126n/a return red + (green << 8) + (blue << 16)
127n/a
128n/aclass FILETIME(ctypes.Structure):
129n/a _fields_ = [("dwLowDateTime", DWORD),
130n/a ("dwHighDateTime", DWORD)]
131n/a_FILETIME = FILETIME
132n/a
133n/aclass MSG(ctypes.Structure):
134n/a _fields_ = [("hWnd", HWND),
135n/a ("message", UINT),
136n/a ("wParam", WPARAM),
137n/a ("lParam", LPARAM),
138n/a ("time", DWORD),
139n/a ("pt", POINT)]
140n/atagMSG = MSG
141n/aMAX_PATH = 260
142n/a
143n/aclass WIN32_FIND_DATAA(ctypes.Structure):
144n/a _fields_ = [("dwFileAttributes", DWORD),
145n/a ("ftCreationTime", FILETIME),
146n/a ("ftLastAccessTime", FILETIME),
147n/a ("ftLastWriteTime", FILETIME),
148n/a ("nFileSizeHigh", DWORD),
149n/a ("nFileSizeLow", DWORD),
150n/a ("dwReserved0", DWORD),
151n/a ("dwReserved1", DWORD),
152n/a ("cFileName", CHAR * MAX_PATH),
153n/a ("cAlternateFileName", CHAR * 14)]
154n/a
155n/aclass WIN32_FIND_DATAW(ctypes.Structure):
156n/a _fields_ = [("dwFileAttributes", DWORD),
157n/a ("ftCreationTime", FILETIME),
158n/a ("ftLastAccessTime", FILETIME),
159n/a ("ftLastWriteTime", FILETIME),
160n/a ("nFileSizeHigh", DWORD),
161n/a ("nFileSizeLow", DWORD),
162n/a ("dwReserved0", DWORD),
163n/a ("dwReserved1", DWORD),
164n/a ("cFileName", WCHAR * MAX_PATH),
165n/a ("cAlternateFileName", WCHAR * 14)]
166n/a
167n/a################################################################
168n/a# Pointer types
169n/a
170n/aLPBOOL = PBOOL = ctypes.POINTER(BOOL)
171n/aPBOOLEAN = ctypes.POINTER(BOOLEAN)
172n/aLPBYTE = PBYTE = ctypes.POINTER(BYTE)
173n/aPCHAR = ctypes.POINTER(CHAR)
174n/aLPCOLORREF = ctypes.POINTER(COLORREF)
175n/aLPDWORD = PDWORD = ctypes.POINTER(DWORD)
176n/aLPFILETIME = PFILETIME = ctypes.POINTER(FILETIME)
177n/aPFLOAT = ctypes.POINTER(FLOAT)
178n/aLPHANDLE = PHANDLE = ctypes.POINTER(HANDLE)
179n/aPHKEY = ctypes.POINTER(HKEY)
180n/aLPHKL = ctypes.POINTER(HKL)
181n/aLPINT = PINT = ctypes.POINTER(INT)
182n/aPLARGE_INTEGER = ctypes.POINTER(LARGE_INTEGER)
183n/aPLCID = ctypes.POINTER(LCID)
184n/aLPLONG = PLONG = ctypes.POINTER(LONG)
185n/aLPMSG = PMSG = ctypes.POINTER(MSG)
186n/aLPPOINT = PPOINT = ctypes.POINTER(POINT)
187n/aPPOINTL = ctypes.POINTER(POINTL)
188n/aLPRECT = PRECT = ctypes.POINTER(RECT)
189n/aLPRECTL = PRECTL = ctypes.POINTER(RECTL)
190n/aLPSC_HANDLE = ctypes.POINTER(SC_HANDLE)
191n/aPSHORT = ctypes.POINTER(SHORT)
192n/aLPSIZE = PSIZE = ctypes.POINTER(SIZE)
193n/aLPSIZEL = PSIZEL = ctypes.POINTER(SIZEL)
194n/aPSMALL_RECT = ctypes.POINTER(SMALL_RECT)
195n/aLPUINT = PUINT = ctypes.POINTER(UINT)
196n/aPULARGE_INTEGER = ctypes.POINTER(ULARGE_INTEGER)
197n/aPULONG = ctypes.POINTER(ULONG)
198n/aPUSHORT = ctypes.POINTER(USHORT)
199n/aPWCHAR = ctypes.POINTER(WCHAR)
200n/aLPWIN32_FIND_DATAA = PWIN32_FIND_DATAA = ctypes.POINTER(WIN32_FIND_DATAA)
201n/aLPWIN32_FIND_DATAW = PWIN32_FIND_DATAW = ctypes.POINTER(WIN32_FIND_DATAW)
202n/aLPWORD = PWORD = ctypes.POINTER(WORD)