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yZ{ddudvZ|ejd kr`dwdxZ}dydzZ~dd{lmZmZeIZeFZe;e?e=eDfD]@Ze1edhkreZn&e1ed|kreZne1edkreZqeeEfD]@Ze1edhkreZn&e1ed|kreZne1edkreZq[eTdS)z,create and manipulate C data types in PythonNz1.1.0)Union StructureArray)_Pointer)CFuncPtr) __version__) RTLD_LOCAL RTLD_GLOBAL) ArgumentErrorcalcsizezVersion number mismatchnt) FormatErrorposixdarwin.)FUNCFLAG_CDECLFUNCFLAG_PYTHONAPIFUNCFLAG_USE_ERRNOFUNCFLAG_USE_LASTERRORcCszt|trD|dkrt|d}td||t|}|}||_|St|trntdd|t|}|}|St|dS)zcreate_string_buffer(aBytes) -> character array create_string_buffer(anInteger) -> character array create_string_buffer(aBytes, anInteger) -> character array Nzctypes.create_string_buffer) isinstancebyteslen_sysauditc_charvalueint TypeErrorinitsizeZbuftypeZbufr$'/usr/lib64/python3.8/ctypes/__init__.pycreate_string_buffer/s   r&cCs t||SN)r&)r"r#r$r$r%c_bufferCsr(cst|ddrtO|ddr,tO|r@td|ztfWStk rGfdddt}|tf<|YSXdS)aCFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False) -> function prototype. restype: the result type argtypes: a sequence specifying the argument types The function prototype can be called in different ways to create a callable object: prototype(integer address) -> foreign function prototype(callable) -> create and return a C callable function from callable prototype(integer index, method name[, paramflags]) -> foreign function calling a COM method prototype((ordinal number, dll object)[, paramflags]) -> foreign function exported by ordinal prototype((function name, dll object)[, paramflags]) -> foreign function exported by name use_errnoFuse_last_error!unexpected keyword argument(s) %scseZdZZZZdS)z CFUNCTYPE..CFunctionTypeN__name__ __module__ __qualname__ _argtypes_ _restype__flags_r$argtypesflagsrestyper$r% CFunctionTypeesr7N) _FUNCFLAG_CDECLpop_FUNCFLAG_USE_ERRNO_FUNCFLAG_USE_LASTERROR ValueErrorkeys_c_functype_cacheKeyError _CFuncPtr)r6r4kwr7r$r3r% CFUNCTYPEKs  rB) LoadLibrary)FUNCFLAG_STDCALLcst|ddrtO|ddr,tO|r@td|ztfWStk rGfdddt}|tf<|YSXdS)Nr)Fr*r+cseZdZZZZdS)z$WINFUNCTYPE..WinFunctionTypeNr,r$r3r$r%WinFunctionType}srE) _FUNCFLAG_STDCALLr9r:r;r<r=_win_functype_cacher?r@)r6r4rArEr$r3r% WINFUNCTYPEqs  rH)dlopen)sizeofbyref addressof alignmentresize) get_errno set_errno) _SimpleCDatacCsJddlm}|dkr|j}t|||}}||krFtd|||fdS)Nrr z"sizeof(%s) wrong: %d instead of %d)structr _type_rJ SystemError)typtypecoder ZactualZrequiredr$r$r% _check_sizes rWcs eZdZdZfddZZS) py_objectOcs4z tWStk r.dt|jYSXdS)Nz %s())super__repr__r<typer-self __class__r$r%r[s zpy_object.__repr__)r-r.r/rSr[ __classcell__r$r$r_r%rXsrXPc@seZdZdZdS)c_shorthNr-r.r/rSr$r$r$r%rcsrcc@seZdZdZdS)c_ushortHNrer$r$r$r%rfsrfc@seZdZdZdS)c_longlNrer$r$r$r%rhsrhc@seZdZdZdS)c_ulongLNrer$r$r$r%rjsrjiric@seZdZdZdS)c_intrlNrer$r$r$r%rmsrmc@seZdZdZdS)c_uintINrer$r$r$r%rnsrnc@seZdZdZdS)c_floatfNrer$r$r$r%rpsrpc@seZdZdZdS)c_doubledNrer$r$r$r%rrsrrc@seZdZdZdS) c_longdoublegNrer$r$r$r%rtsrtqc@seZdZdZdS) c_longlongrvNrer$r$r$r%rwsrwc@seZdZdZdS) c_ulonglongQNrer$r$r$r%rxsrxc@seZdZdZdS)c_ubyteBNrer$r$r$r%rzsrzc@seZdZdZdS)c_bytebNrer$r$r$r%r|sr|c@seZdZdZdS)rcNrer$r$r$r%rsrc@seZdZdZddZdS)c_char_pzcCsd|jjt|jfSNz%s(%s)r`r-c_void_pZ from_bufferrr]r$r$r%r[szc_char_p.__repr__Nr-r.r/rSr[r$r$r$r%rsrc@seZdZdZdS)rrbNrer$r$r$r%rsrc@seZdZdZdS)c_bool?Nrer$r$r$r%rsr)POINTERpointer_pointer_type_cachec@seZdZdZddZdS) c_wchar_pZcCsd|jjt|jfSrrr]r$r$r%r[szc_wchar_p.__repr__Nrr$r$r$r%rsrc@seZdZdZdS)c_wcharuNrer$r$r$r%rsrcCsFtttjdkr"ttjtt _t jtt _t td<dS)Nr ) rclearr>_osnamerGrZ from_paramrrrrrr$r$r$r% _reset_caches   rcCst|trh|dkrBttdkr6tdd|Dd}n t|d}td||t|}|}||_|St|t rtdd|t|}|}|St |dS)zcreate_unicode_buffer(aString) -> character array create_unicode_buffer(anInteger) -> character array create_unicode_buffer(aString, anInteger) -> character array Ncss"|]}t|dkrdndVqdS)irrN)ord).0r~r$r$r% sz(create_unicode_buffer..rzctypes.create_unicode_buffer) rstrrJrsumrrrrrr r!r$r$r%create_unicode_buffers     rcCsLt|ddk rtdt|tkr,td|||t|<tt|=dS)Nz%This type already exists in the cachezWhat's this???)rget RuntimeErroridZset_type)rclsr$r$r%SetPointerType.s  rcCs||Sr'r$)rUrr$r$r%ARRAY8src@sPeZdZdZeZeZdZdZ dZ e ddddfddZ dd Z d d Zd d ZdS)CDLLaAn instance of this class represents a loaded dll/shared library, exporting functions using the standard C calling convention (named 'cdecl' on Windows). The exported functions can be accessed as attributes, or by indexing with the function name. Examples: .qsort -> callable object ['qsort'] -> callable object Calling the functions releases the Python GIL during the call and reacquires it afterwards. zrNFc s|_j|rtO|r$tOtjdrV|rV|drVd|krV|tj tj BO}tj dkr|dk rn|}n6ddl }|j }d|ksd|kr|j_||jO}Gfdd d t}|_|dkrtj|_n|_dS) NZaix)z.a(r r/\cseZdZZjZdS)zCDLL.__init__.._FuncPtrN)r-r.r/r2_func_restype_r1r$r5r^r$r%_FuncPtrosr)_name _func_flags_r:r;rplatform startswithendswithrZ RTLD_MEMBERRTLD_NOWrr Z!_LOAD_LIBRARY_SEARCH_DEFAULT_DIRSZ_getfullpathnameZ!_LOAD_LIBRARY_SEARCH_DLL_LOAD_DIRr@r_dlopen_handle) r^rmodeZhandler)r*Zwinmoder rr$rr%__init__Ss,   z CDLL.__init__cCs8d|jj|j|jtjdd@t|tjdd@fS)Nz<%s '%s', handle %x at %#x>rr)r`r-rrrmaxsizerr]r$r$r%r[ys  z CDLL.__repr__cCs6|dr|drt|||}t||||S)N__)rrAttributeError __getitem__setattr)r^rfuncr$r$r% __getattr__s   zCDLL.__getattr__cCs"|||f}t|ts||_|Sr')rrrr-)r^Zname_or_ordinalrr$r$r%rs zCDLL.__getitem__)r-r.r/__doc__r8rrmrrrr DEFAULT_MODErr[rrr$r$r$r%r>s  &rc@seZdZdZeeBZdS)PyDLLzThis class represents the Python library itself. It allows accessing Python API functions. The GIL is not released, and Python exceptions are handled correctly. N)r-r.r/rr8_FUNCFLAG_PYTHONAPIrr$r$r$r%rsrc@seZdZdZeZdS)WinDLLznThis class represents a dll exporting functions using the Windows stdcall calling convention. N)r-r.r/rrFrr$r$r$r%rsr)_check_HRESULTrQc@seZdZdZeZdS)HRESULTriN)r-r.r/rSrZ_check_retval_r$r$r$r%rs rc@seZdZdZeZeZdS)OleDLLzThis class represents a dll exporting functions using the Windows stdcall calling convention, and returning HRESULT. HRESULT error values are automatically raised as OSError exceptions. N)r-r.r/rrFrrrr$r$r$r%rsrc@s,eZdZddZddZddZddZd S) LibraryLoadercCs ||_dSr'_dlltype)r^Zdlltyper$r$r%rszLibraryLoader.__init__cCs.|ddkrt|||}t||||S)Nr_)rrr)r^rZdllr$r$r%rs    zLibraryLoader.__getattr__cCs t||Sr')getattrr^rr$r$r%rszLibraryLoader.__getitem__cCs ||Sr'rrr$r$r%rCszLibraryLoader.LoadLibraryN)r-r.r/rrrrCr$r$r$r%rsrz python dllcygwinzlibpython%d.%d.dllr)get_last_errorset_last_errorcCs0|dkrt}|dkr"t|}td|d|Sr') GetLastErrorrstripOSError)codeZdescrr$r$r%WinErrors  r) _memmove_addr _memset_addr_string_at_addr _cast_addrcsGfdddt}|S)NcseZdZZZeeBZdS)z!PYFUNCTYPE..CFunctionTypeN)r-r.r/r0r1r8rr2r$r4r6r$r%r7sr7)r@)r6r4r7r$rr% PYFUNCTYPEsrcCs t|||Sr')_cast)objrUr$r$r%castsrcCs t||S)zAstring_at(addr[, size]) -> string Return the string at addr.) _string_atZptrr#r$r$r% string_atsr)_wstring_at_addrcCs t||S)zFwstring_at(addr[, size]) -> string Return the string at addr.) _wstring_atrr$r$r% wstring_at srcCsBztdttdg}Wntk r.YdSX||||SdS)Ncomtypes.server.inprocserver*i) __import__globalslocals ImportErrorDllGetClassObject)ZrclsidZriidZppvccomr$r$r%rs rcCs8ztdttdg}Wntk r.YdSX|S)Nrrr)rrrrDllCanUnloadNow)rr$r$r%rs r)BigEndianStructureLittleEndianStructure)N)N)N)N)NN)r)r)rosrsysrrZ_ctypesrrrrrr@Z_ctypes_versionrr r rRr Z _calcsize Exceptionrrrrrunamereleasesplitrr8rrrr:rr;r&r(r>rBrCrrDrFrGrHreplacerIrJrKrLrMrNrOrPrQrWrXrcrfrhrjrmrnrprrrtrwrxrzZ __ctype_le__Z __ctype_be__r|rrrZc_voidprrrrrrrrrrobjectrrrrrrrZcdllZpydllZ dllhandleZ pythonapi version_infoZwindllZoledllZkernel32rrrrZc_size_tZ c_ssize_trrrrZmemmoveZmemsetrrrrrrrrrrrZctypes._endianrrZc_int8Zc_uint8ZkindZc_int16Zc_int32Zc_int64Zc_uint16Zc_uint32Zc_uint64r$r$r$r%s4          !              N