Various ctypes improvements (#11186)

Mostly more attention paid to which classes are actually the same class
This commit is contained in:
Stephen Morton
2024-01-30 22:18:00 -08:00
committed by GitHub
parent 8010e9fef0
commit 9877ed8092
4 changed files with 153 additions and 67 deletions

View File

@@ -186,53 +186,113 @@ class WIN32_FIND_DATAW(Structure):
cFileName: _CField[Array[WCHAR], str, str]
cAlternateFileName: _CField[Array[WCHAR], str, str]
class PBOOL(_Pointer[BOOL]): ...
class LPBOOL(_Pointer[BOOL]): ...
class PBOOLEAN(_Pointer[BOOLEAN]): ...
class PBYTE(_Pointer[BYTE]): ...
class LPBYTE(_Pointer[BYTE]): ...
class PCHAR(_Pointer[CHAR]): ...
class LPCOLORREF(_Pointer[COLORREF]): ...
class PDWORD(_Pointer[DWORD]): ...
class LPDWORD(_Pointer[DWORD]): ...
class PFILETIME(_Pointer[FILETIME]): ...
class LPFILETIME(_Pointer[FILETIME]): ...
class PFLOAT(_Pointer[FLOAT]): ...
class PHANDLE(_Pointer[HANDLE]): ...
class LPHANDLE(_Pointer[HANDLE]): ...
class PHKEY(_Pointer[HKEY]): ...
class LPHKL(_Pointer[HKL]): ...
class PINT(_Pointer[INT]): ...
class LPINT(_Pointer[INT]): ...
class PLARGE_INTEGER(_Pointer[LARGE_INTEGER]): ...
class PLCID(_Pointer[LCID]): ...
class PLONG(_Pointer[LONG]): ...
class LPLONG(_Pointer[LONG]): ...
class PMSG(_Pointer[MSG]): ...
class LPMSG(_Pointer[MSG]): ...
class PPOINT(_Pointer[POINT]): ...
class LPPOINT(_Pointer[POINT]): ...
class PPOINTL(_Pointer[POINTL]): ...
class PRECT(_Pointer[RECT]): ...
class LPRECT(_Pointer[RECT]): ...
class PRECTL(_Pointer[RECTL]): ...
class LPRECTL(_Pointer[RECTL]): ...
class LPSC_HANDLE(_Pointer[SC_HANDLE]): ...
# These are all defined with the POINTER() function, which keeps a cache and will
# return a previously created class if it can. The self-reported __name__
# of these classes is f"LP_{typ.__name__}", where typ is the original class
# passed in to the POINTER() function.
# LP_c_short
class PSHORT(_Pointer[SHORT]): ...
class PSIZE(_Pointer[SIZE]): ...
class LPSIZE(_Pointer[SIZE]): ...
class PSIZEL(_Pointer[SIZEL]): ...
class LPSIZEL(_Pointer[SIZEL]): ...
class PSMALL_RECT(_Pointer[SMALL_RECT]): ...
class PUINT(_Pointer[UINT]): ...
class LPUINT(_Pointer[UINT]): ...
class PULARGE_INTEGER(_Pointer[ULARGE_INTEGER]): ...
class PULONG(_Pointer[ULONG]): ...
# LP_c_ushort
class PUSHORT(_Pointer[USHORT]): ...
PWORD = PUSHORT
LPWORD = PUSHORT
# LP_c_long
class PLONG(_Pointer[LONG]): ...
LPLONG = PLONG
PBOOL = PLONG
LPBOOL = PLONG
# LP_c_ulong
class PULONG(_Pointer[ULONG]): ...
PDWORD = PULONG
LPDWORD = PDWORD
LPCOLORREF = PDWORD
PLCID = PDWORD
# LP_c_int (or LP_c_long if int and long have the same size)
class PINT(_Pointer[INT]): ...
LPINT = PINT
# LP_c_uint (or LP_c_ulong if int and long have the same size)
class PUINT(_Pointer[UINT]): ...
LPUINT = PUINT
# LP_c_float
class PFLOAT(_Pointer[FLOAT]): ...
# LP_c_longlong (or LP_c_long if long and long long have the same size)
class PLARGE_INTEGER(_Pointer[LARGE_INTEGER]): ...
# LP_c_ulonglong (or LP_c_ulong if long and long long have the same size)
class PULARGE_INTEGER(_Pointer[ULARGE_INTEGER]): ...
# LP_c_byte types
class PBYTE(_Pointer[BYTE]): ...
LPBYTE = PBYTE
PBOOLEAN = PBYTE
# LP_c_char
class PCHAR(_Pointer[CHAR]): ...
# LP_c_wchar
class PWCHAR(_Pointer[WCHAR]): ...
# LP_c_void_p
class PHANDLE(_Pointer[HANDLE]): ...
LPHANDLE = PHANDLE
PHKEY = PHANDLE
LPHKL = PHANDLE
LPSC_HANDLE = PHANDLE
# LP_FILETIME
class PFILETIME(_Pointer[FILETIME]): ...
LPFILETIME = PFILETIME
# LP_MSG
class PMSG(_Pointer[MSG]): ...
LPMSG = PMSG
# LP_POINT
class PPOINT(_Pointer[POINT]): ...
LPPOINT = PPOINT
PPOINTL = PPOINT
# LP_RECT
class PRECT(_Pointer[RECT]): ...
LPRECT = PRECT
PRECTL = PRECT
LPRECTL = PRECT
# LP_SIZE
class PSIZE(_Pointer[SIZE]): ...
LPSIZE = PSIZE
PSIZEL = PSIZE
LPSIZEL = PSIZE
# LP__SMALL_RECT
class PSMALL_RECT(_Pointer[SMALL_RECT]): ...
# LP_WIN32_FIND_DATAA
class PWIN32_FIND_DATAA(_Pointer[WIN32_FIND_DATAA]): ...
class LPWIN32_FIND_DATAA(_Pointer[WIN32_FIND_DATAA]): ...
LPWIN32_FIND_DATAA = PWIN32_FIND_DATAA
# LP_WIN32_FIND_DATAW
class PWIN32_FIND_DATAW(_Pointer[WIN32_FIND_DATAW]): ...
class LPWIN32_FIND_DATAW(_Pointer[WIN32_FIND_DATAW]): ...
class PWORD(_Pointer[WORD]): ...
class LPWORD(_Pointer[WORD]): ...
LPWIN32_FIND_DATAW = PWIN32_FIND_DATAW