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ƒZhegjijjZjddilmkZkmlZld�djdk„Zme3eBƒe3eNƒk�r\eBZneAZon6e3e@ƒe3eNƒk�rxe@Zne?Zone3eGƒe3eNƒk�r’eGZneFZoddllmpZpmqZqmrZrmsZse*eNeNeNenƒepƒZte*eNeNeAenƒeqƒZudmdn„ZveveeBe@eGfD]@Z†e3e†ƒdhk�rðe†ZŠn&e3e†ƒd|k�re†Z‹ne3e†ƒdk�rØe†ZŒ�qØ[†eVƒdS)„z,create and manipulate C data types in PythonéNz1.1.0)ÚUnionÚ StructureÚArray)Ú_Pointer)ÚCFuncPtr)Ú __version__)Ú RTLD_LOCALÚ RTLD_GLOBAL)Ú ArgumentError©ÚcalcsizezVersion number mismatchÚnt)Ú FormatErrorÚposixÚdarwinÚ.é)ÚFUNCFLAG_CDECLÚFUNCFLAG_PYTHONAPIÚFUNCFLAG_USE_ERRNOÚFUNCFLAG_USE_LASTERRORcCszt|tƒrD|durt|ƒd}t d||¡t|}|ƒ}||_|St|tƒrnt dd|¡t|}|ƒ}|St|ƒ‚dS)zªcreate_string_buffer(aBytes) -> character array create_string_buffer(anInteger) -> character array create_string_buffer(aBytes, anInteger) -> character array Nézctypes.create_string_buffer) Ú isinstanceÚbytesÚlenÚ_sysÚauditÚc_charÚvalueÚintÚ TypeError©ÚinitÚsizeZbuftypeÚbuf©r%ú'/usr/lib64/python3.9/ctypes/__init__.pyÚcreate_string_buffer0s   r'cCs t||ƒS©N)r')r"r#r%r%r&Úc_bufferDsr)cs’t‰| dd¡rˆtO‰| dd¡r,ˆtO‰|r@td| ¡ƒ‚ztˆˆˆfWStyŒG‡‡‡fdd„dtƒ}|tˆˆˆf<|YS0dS)aÉCFUNCTYPE(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_errnoFÚuse_last_errorú!unexpected keyword argument(s) %scseZdZ”Z”Z”ZdS)z CFUNCTYPE..CFunctionTypeN©Ú__name__Ú __module__Ú __qualname__Ú _argtypes_Ú _restype_Ú_flags_r%©ÚargtypesÚflagsÚrestyper%r&Ú CFunctionTypefsr8N) Ú_FUNCFLAG_CDECLÚpopÚ_FUNCFLAG_USE_ERRNOÚ_FUNCFLAG_USE_LASTERRORÚ ValueErrorÚkeysÚ_c_functype_cacheÚKeyErrorÚ _CFuncPtr)r7r5Úkwr8r%r4r&Ú CFUNCTYPELs   rC)Ú LoadLibrary)ÚFUNCFLAG_STDCALLcs’t‰| dd¡rˆtO‰| dd¡r,ˆtO‰|r@td| ¡ƒ‚ztˆˆˆfWStyŒG‡‡‡fdd„dtƒ}|tˆˆˆf<|YS0dS)Nr*Fr+r,cseZdZ”Z”Z”ZdS)z$WINFUNCTYPE..WinFunctionTypeNr-r%r4r%r&ÚWinFunctionType~srF) Ú_FUNCFLAG_STDCALLr:r;r<r=r>Ú_win_functype_cacher@rA)r7r5rBrFr%r4r&Ú WINFUNCTYPErs   rI)Údlopen)ÚsizeofÚbyrefÚ addressofÚ alignmentÚresize)Ú get_errnoÚ set_errno)Ú _SimpleCDatacCsJddlm}|dur|j}t|ƒ||ƒ}}||krFtd|||fƒ‚dS)Nrr z"sizeof(%s) wrong: %d instead of %d)Ústructr Ú_type_rKÚ SystemError)ÚtypÚtypecoder ÚactualÚrequiredr%r%r&Ú _check_sizeŽs ÿrZcs eZdZdZ‡fdd„Z‡ZS)Ú py_objectÚOcs2z tƒ ¡WSty,dt|ƒjYS0dS)Nz %s())ÚsuperÚ__repr__r=Útyper.©Úself©Ú __class__r%r&r^œs  zpy_object.__repr__)r.r/r0rTr^Ú __classcell__r%r%rbr&r[šsr[ÚPc@seZdZdZdS)Úc_shortÚhN©r.r/r0rTr%r%r%r&rf£srfc@seZdZdZdS)Úc_ushortÚHNrhr%r%r%r&ri§sric@seZdZdZdS)Úc_longÚlNrhr%r%r%r&rk«srkc@seZdZdZdS)Úc_ulongÚLNrhr%r%r%r&rm¯srmÚirlc@seZdZdZdS)Úc_introNrhr%r%r%r&rp¸srpc@seZdZdZdS)Úc_uintÚINrhr%r%r%r&rq¼srqc@seZdZdZdS)Úc_floatÚfNrhr%r%r%r&rsÀsrsc@seZdZdZdS)Úc_doubleÚdNrhr%r%r%r&ruÄsruc@seZdZdZdS)Ú c_longdoubleÚgNrhr%r%r%r&rwÈsrwÚqc@seZdZdZdS)Ú c_longlongryNrhr%r%r%r&rzÒsrzc@seZdZdZdS)Ú c_ulonglongÚQNrhr%r%r%r&r{Ösr{c@seZdZdZdS)Úc_ubyteÚBNrhr%r%r%r&r}Ýsr}c@seZdZdZdS)Úc_byteÚbNrhr%r%r%r&räsrc@seZdZdZdS)rÚcNrhr%r%r%r&résrc@seZdZdZdd„ZdS)Úc_char_pÚzcCsd|jjt |¡jfS©Nz%s(%s)©rcr.Úc_void_pZ from_bufferrr`r%r%r&r^ðszc_char_p.__repr__N©r.r/r0rTr^r%r%r%r&r‚îsr‚c@seZdZdZdS)r†reNrhr%r%r%r&r†ôsr†c@seZdZdZdS)Úc_boolú?Nrhr%r%r%r&rˆùsrˆ)ÚPOINTERÚpointerÚ_pointer_type_cachec@seZdZdZdd„ZdS)Ú c_wchar_pÚZcCsd|jjt |¡jfSr„r…r`r%r%r&r^szc_wchar_p.__repr__Nr‡r%r%r%r&r�þsr�c@seZdZdZdS)Úc_wcharÚuNrhr%r%r%r&r�sr�cCsFt ¡t ¡tjdkr"t ¡tjtt ƒ_t jtt ƒ_t td<dS)Nr ) rŒÚclearr?Ú_osÚnamerHr�Z from_paramrŠr�r‚rr†r%r%r%r&Ú _reset_caches   r”cCsžt|tƒrh|durBttƒdkr6tdd„|Dƒƒd}n t|ƒd}t d||¡t|}|ƒ}||_|St|t ƒr’t dd|¡t|}|ƒ}|St |ƒ‚dS)z¯create_unicode_buffer(aString) -> character array create_unicode_buffer(anInteger) -> character array create_unicode_buffer(aString, anInteger) -> character array Nécss"|]}t|ƒdkrdndVqdS)iÿÿr•rN)Úord)Ú.0r�r%r%r&Ú óz(create_unicode_buffer..rzctypes.create_unicode_buffer) rÚstrrKr�Úsumrrrrrr r!r%r%r&Úcreate_unicode_buffers     rœcCsLt |d¡durtdƒ‚t|ƒtvr,tdƒ‚| |¡|t|<tt|ƒ=dS)Nz%This type already exists in the cachezWhat's this???)rŒÚgetÚ RuntimeErrorÚidZset_type)r‹Úclsr%r%r&ÚSetPointerType/s  r¡cCs||Sr(r%)rVrr%r%r&ÚARRAY9sr¢c@sPeZdZdZeZeZdZdZ dZ e ddddfdd„Z dd „Z d d „Zd d „ZdS)ÚCDLLaÆAn 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‰|rˆtO‰|r$ˆtO‰tj d¡rV|rV| d¡rVd|vrV|tj tj BO}tj dkr¤|durn|}n6ddl }|j }d|vsŒd|vr¤| ˆj¡ˆ_||jO}G‡‡fdd „d tƒ}|ˆ_|durØtˆj|ƒˆ_n|ˆ_dS) NZaixú)z.a(r rú/ú\cseZdZ”Z”jZdS)zCDLL.__init__.._FuncPtrN)r.r/r0r3Ú_func_restype_r2r%©r6rar%r&Ú_FuncPtrpsr©)Ú_nameÚ _func_flags_r;r<rÚplatformÚ startswithÚendswithr’Z RTLD_MEMBERÚRTLD_NOWr“r Z!_LOAD_LIBRARY_SEARCH_DEFAULT_DIRSZ_getfullpathnameZ!_LOAD_LIBRARY_SEARCH_DLL_LOAD_DIRrAr©Ú_dlopenÚ_handle) rar“ÚmodeÚhandler*r+Zwinmoder r©r%r¨r&Ú__init__Ts,   z CDLL.__init__cCs8d|jj|j|jtjdd@t|ƒtjdd@fS)Nz<%s '%s', handle %x at %#x>r•r)rcr.rªr±rÚmaxsizerŸr`r%r%r&r^zs  þÿz CDLL.__repr__cCs6| d¡r| d¡rt|ƒ‚| |¡}t|||ƒ|S)NÚ__)r­r®ÚAttributeErrorÚ __getitem__Úsetattr)rar“Úfuncr%r%r&Ú __getattr__€s   zCDLL.__getattr__cCs"| ||f¡}t|tƒs||_|Sr()r©rrr.)raZname_or_ordinalrºr%r%r&r¸‡s zCDLL.__getitem__)r.r/r0Ú__doc__r9r«rpr§rªr±r©Ú DEFAULT_MODEr´r^r»r¸r%r%r%r&r£?s ý &r£c@seZdZdZeeBZdS)ÚPyDLLz¯This 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/r0r¼r9Ú_FUNCFLAG_PYTHONAPIr«r%r%r%r&r¾�sr¾c@seZdZdZeZdS)ÚWinDLLznThis class represents a dll exporting functions using the Windows stdcall calling convention. N)r.r/r0r¼rGr«r%r%r%r&rÀ–srÀ)Ú_check_HRESULTrRc@seZdZdZeZdS)ÚHRESULTrlN)r.r/r0rTrÁZ_check_retval_r%r%r%r&rŸs rÂc@seZdZdZeZeZdS)ÚOleDLLzÚThis 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/r0r¼rGr«rÂr§r%r%r%r&rìsrÃc@s6eZdZdd„Zdd„Zdd„Zdd„Zeej ƒZ d S) Ú LibraryLoadercCs ||_dSr(©Ú_dlltype)raZdlltyper%r%r&r´¶szLibraryLoader.__init__cCs.|ddkrt|ƒ‚| |¡}t|||ƒ|S)NrÚ_)r·rÆr¹)rar“Zdllr%r%r&r»¹s    zLibraryLoader.__getattr__cCs t||ƒSr()Úgetattr©rar“r%r%r&r¸ÀszLibraryLoader.__getitem__cCs | |¡Sr(rÅrÉr%r%r&rDÃszLibraryLoader.LoadLibraryN) r.r/r0r´r»r¸rDÚ classmethodÚ_typesÚ GenericAliasÚ__class_getitem__r%r%r%r&rĵs rÄz python dllÚcygwinzlibpython%d.%d.dllr•)Úget_last_errorÚset_last_errorcCs0|durtƒ}|dur"t|ƒ ¡}td|d|ƒSr()Ú GetLastErrorrÚstripÚOSError)ÚcodeZdescrr%r%r&ÚWinErrorÚs  rÕ)Ú _memmove_addrÚ _memset_addrÚ_string_at_addrÚ _cast_addrcsG‡‡fdd„dtƒ}|S)NcseZdZ”Z”ZeeBZdS)z!PYFUNCTYPE..CFunctionTypeN)r.r/r0r1r2r9r¿r3r%©r5r7r%r&r8ösr8)rA)r7r5r8r%rÚr&Ú PYFUNCTYPEõsrÛcCs t|||ƒSr()Ú_cast)ÚobjrVr%r%r&ÚcastýsrÞéÿÿÿÿcCs t||ƒS)zAstring_at(addr[, size]) -> string Return the string at addr.)Ú _string_at©Zptrr#r%r%r&Ú string_atsrâ)Ú_wstring_at_addrcCs t||ƒS)zFwstring_at(addr[, size]) -> string Return the string at addr.)Ú _wstring_atrár%r%r&Ú wstring_at sråcCs@ztdtƒtƒdgƒ}Wnty,YdS0| |||¡SdS)Núcomtypes.server.inprocserverÚ*i€)Ú __import__ÚglobalsÚlocalsÚ ImportErrorÚDllGetClassObject)ZrclsidZriidZppvÚccomr%r%r&rìs  rìcCs6ztdtƒtƒdgƒ}Wnty,YdS0| ¡S)Nrærçr)rèrérêrëÚDllCanUnloadNow)rír%r%r&rîs  rî)ÚBigEndianStructureÚLittleEndianStructureé)N)N)N)N)NN)rß)rß)�r¼Úosr’ÚsysrÚtypesrËrZ_ctypesrrrrrrAZ_ctypes_versionrr r rSr Z _calcsizeÚ Exceptionr“rr½r¬rÚunameÚreleaseÚsplitrr9rr¿rr;rr<r'r)r?rCrDr°rErGrHrIÚreplacerJrKrLrMrNrOrPrQrRrZr[rfrirkrmrprqrsrurwrzr{r}Z __ctype_le__Z __ctype_be__rrr‚r†Zc_voidprˆrŠr‹rŒr�r�r”rœr¡r¢Úobjectr£r¾rÀrÁrÂrÃrÄZcdllZpydllZ dllhandleZ pythonapiÚ version_infoZwindllZoledllZkernel32rÑrÏrÐrÕZc_size_tZ c_ssize_trÖr×rØrÙZmemmoveZmemsetrÛrÜrÞràrârãrërärårìrîZctypes._endianrïrðZc_int8Zc_uint8ÚkindZc_int16Zc_int32Zc_int64Zc_uint16Zc_uint32Zc_uint64r%r%r%r&Ús*          !              N