§
    3xÅjQ  ã                   ó  — d Z ddlZddlZddlZddlZddlmZ ddlm	Z	 ddl
ZddlmZ dZdZd	Zd
„ Zd„ Z ej        ¦   «         d         dk    rej        Znej        Z G d„ dej        ¦  «        Zd„ Z G d„ d¦  «        ZdS )zP
Functions for communicating with Pageant, the basic windows ssh agent program.
é    N)Ú	zero_byte)Úbé   )Ú_winapil   ºPœ  i    éJ   c                  óL   — t           j        j                             dd¦  «        S )Ns   Pageant)ÚctypesÚwindllÚuser32ÚFindWindowA© ó    úEC:\Projects\Historical\venv\Lib\site-packages\paramiko/win_pageant.pyÚ_get_pageant_window_objectr   +   s   € ÝŒ=Ô×+Ò+¨J¸
ÑCÔCÐCr   c                  ó8   — t          t          ¦   «         ¦  «        S )zÂ
    Check to see if there is a "Pageant" agent we can talk to.

    This checks both if we have the required libraries (win32all or ctypes)
    and if there is a Pageant currently running.
    )Úboolr   r   r   r   Úcan_talk_to_agentr   /   s   € õ Õ*Ñ,Ô,Ñ-Ô-Ð-r   Ú64bitc                   óF   — e Zd ZdZdefdej        j        fdej        fgZ	dS )ÚCOPYDATASTRUCTzy
    ctypes implementation of
    http://msdn.microsoft.com/en-us/library/windows/desktop/ms649010%28v=vs.85%29.aspx
    Únum_dataÚ	data_sizeÚdata_locN)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	ULONG_PTRr	   ÚwintypesÚDWORDÚc_void_pÚ_fields_r   r   r   r   r   ?   s@   € € € € € ðð ð 
�YÐØ	�f”oÔ+Ð,Ø	�V”_Ð%ð€H€H€Hr   r   c           	      ó>  — t          ¦   «         }|sdS dt          j        ¦   «         d›�}t          j        |t
          t          j        ¦   «         ¦  «        }|5  |                     | ¦  «         t          j        dt          |¦  «        t          z   ¦  «        }|                     ¦   «         \  }}t          t          ||¦  «        }t          j        j                             |t$          t          j        |¦  «        t          j        |¦  «        ¦  «        }|dk    ri|                     d¦  «         |                     d¦  «        }	t/          j        d|	¦  «        d         }
|	|                     |
¦  «        z   cddd¦  «         S 	 ddd¦  «         dS # 1 swxY w Y   dS )za
    Communication with the Pageant process is done through a shared
    memory-mapped file.
    NÚPageantRequestÚ08xr   r   é   z>I)r   ÚthreadÚ	get_identr   Ú	MemoryMapÚ_AGENT_MAX_MSGLENÚ get_security_attributes_for_userÚwriteÚarrayr   r   Úbuffer_infor   Ú_AGENT_COPYDATA_IDr	   r
   r   ÚSendMessageAÚwin32con_WM_COPYDATAÚsizeofÚbyrefÚseekÚreadÚstructÚunpack)ÚmsgÚhwndÚmap_nameÚpymapÚchar_bufferÚchar_buffer_addressÚchar_buffer_sizeÚcdsÚresponseÚdatalenÚretlens              r   Ú_query_pageantrC   L   sÞ  € õ
 &Ñ'Ô'€DØð àˆtð 9¥Ô 0Ñ 2Ô 2Ð8Ð8Ð8€HåÔØÕ#¥WÔ%MÑ%OÔ%Oñô €Eð 
ð ð Ø�Š�CÑÔÐå”k #¥q¨¡{¤{µYÑ'>Ñ?Ô?ˆØ0;×0GÒ0GÑ0IÔ0IÑ-ÐÐ-åÝÐ 0Ð2Eñ
ô 
ˆõ ”=Ô'×4Ò4ØÕ&­¬°cÑ(:Ô(:½F¼LÈÑ<MÔ<Mñ
ô 
ˆð �aŠ<ˆ<Ø�JŠJ�q‰MŒMˆMØ—j’j ‘m”mˆGÝ”] 4¨Ñ1Ô1°!Ô4ˆFØ˜UŸZšZ¨Ñ/Ô/Ñ/ð%ð ð ð ñ ô ð ð ð& ð'ð ð ñ ô ð ð ð ð ð ð ð øøøð ð ð ð ð ð s   ÁDFÆFÆFÆFc                   ó*   — e Zd ZdZd„ Zd„ Zd„ Zd„ ZdS )ÚPageantConnectiona  
    Mock "connection" to an agent which roughly approximates the behavior of
    a unix local-domain socket (as used by Agent).  Requests are sent to the
    pageant daemon via special Windows magick, and responses are buffered back
    for subsequent reads.
    c                 ó   — d | _         d S ©N©Ú	_response©Úselfs    r   Ú__init__zPageantConnection.__init__z   s   € ØˆŒˆˆr   c                 ó.   — t          |¦  «        | _        d S rG   )rC   rI   )rK   Údatas     r   ÚsendzPageantConnection.send}   s   € Ý'¨Ñ-Ô-ˆŒˆˆr   c                 ó‚   — | j         €dS | j         d |…         }| j         |d …         | _         | j         dk    rd | _         |S )NÚ rH   )rK   ÚnÚrets      r   ÚrecvzPageantConnection.recv€   sJ   € ØŒ>Ð!Ø�2ØŒn˜R˜a˜RÔ ˆØœ¨¨¨Ô+ˆŒØŒ>˜RÒÐØ!ˆDŒNØˆ
r   c                 ó   — d S rG   r   rJ   s    r   ÚclosezPageantConnection.close‰   s   € Øˆr   N)r   r   r   r   rL   rO   rT   rV   r   r   r   rE   rE   r   sZ   € € € € € ðð ðð ð ð.ð .ð .ðð ð ðð ð ð ð r   rE   )r   r-   Úctypes.wintypesr	   Úplatformr6   Úparamiko.commonr   Úparamiko.utilr   Ú_threadr'   rQ   r   r/   r*   r1   r   r   ÚarchitectureÚc_uint64r   Úc_uint32Ú	Structurer   rC   rE   r   r   r   ú<module>r`      sM  ðð(ð ð €€€Ø Ð Ð Ð Ø €€€Ø €€€Ø %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð à Ð Ð Ð à Ð Ð Ð Ð Ð ð  Ð ØÐ ð Ð ðDð Dð Dð.ð .ð .ð €8ÔÑÔ˜1Ô Ò(Ð(Ø”€I€Ià”€Ið
ð 
ð 
ð 
ð 
�VÔ%ñ 
ô 
ð 
ð#ð #ð #ðLð ð ð ð ñ ô ð ð ð r   