
    !hi)                     V    d dl Zd dlZdZdZdZd ZdZd Zd Z	ddZ
d	 Zdd
Zd Zd Zy)    N         sz  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
      </requestedPrivileges>
    </security>
  </trustInfo>
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>
      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS>
      <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>
      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS>
      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS>
    </application>
  </compatibility>
  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
    </windowsSettings>
  </application>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>
c                     | j                   D cg c]F  }|j                  t        j                  j                  j
                  k(  s5|j                  |k(  sE|H c}S c c}w )zH
    Find all elements with given tag under the given root element.
    )
childNodesnodeTypexmldomNodeELEMENT_NODEtagName)roottagnodes      OC:\des-py\Monitor\venv\Lib\site-packages\PyInstaller/utils/win32/winmanifest.py_find_elements_by_tagr   >   sD     "__sTAZAZ0Z_c_k_kor_rDssss   6AAAc                 |    t        | |      }t        |      dkD  rt        d|dt        |       d      |sy|d   S )z
    Attempt to find a single element with given tag under the given root element, and return None if no such element
    is found. Raises an error if multiple elements are found.
    r   zExpected a single z element, found z element(s)!Nr   )r   len
ValueError)r   r   elementss      r   _find_element_by_tagr   E   sM    
 %T3/H
8}q-cW4DS]OS_`aaA;    c                 
   t        |d      }|s4| j                  d      }|j                  dd       |j                  |       t        |d      }|s"| j                  d      }|j                  |       t        |d      }|s"| j                  d      }|j                  |       t        |d      }|s"| j                  d      }|j                  |       |j                  d|rdnd	       |j                  d
|rd       yd       y)z
    Find <security> -> <requestedPrivileges> -> <requestedExecutionLevel> element, and set its `level` and `uiAccess`
    attributes based on supplied arguments. Create the XML elements if necessary, as they are optional.
    	trustInfoxmlnsz urn:schemas-microsoft-com:asm.v3securityrequestedPrivilegesrequestedExecutionLevellevelrequireAdministrator	asInvokeruiAccesstruefalseN)r   createElementsetAttributeappendChild)manifest_domroot_element	uac_adminuac_uiaccesstrust_info_elementsecurity_elementrequested_privileges_element!requested_execution_level_elements           r   _set_execution_levelr0   U   s    .lKH)77D''1ST  !34 ,,>
K'55jA&&'78 $88HJ_#` ''3'A'ABW'X$$$%AB )==Y[t(u%,,8,F,FG`,a)$001RS%227V_<Repq%22:vc[bcr   c                 >   t        |d      }|D ]:  }t        |d      }t        |d      }|j                  d   j                  dk(  s8|} ng | j	                  d      }|j                  |       | j	                  d      }|j                  |       | j	                  d      }|j                  |       |j                  dd       |j                  dd       |j                  dd	       |j                  d
d       |j                  dd       |j                  dd       y)a  
    Scan <dependency> elements for the one whose <<dependentAssembly> -> <assemblyIdentity> corresponds to the
    `Microsoft.Windows.Common-Controls`. If found, overwrite its properties. If not, create new <dependency>
    element with corresponding sub-elements and attributes.
    
dependencydependentAssemblyassemblyIdentitynamez!Microsoft.Windows.Common-Controlstypewin32versionz6.0.0.0processorArchitecture*publicKeyToken6595b64144ccf1dflanguageN)r   r   
attributesvaluer%   r'   r&   )r(   r)   dependency_elementsdependency_elementdependent_assembly_elementassembly_identity_elementcommon_controls_elements          r   "_ensure_common_controls_dependencyrE   x   s,    0lK1 H%9:LNa%b"$89SUg$h!$//7==Add&?#H *77E  !34%1%?%?@S%T"&&'AB"."<"<=O"P"../FG((9((1TU((I>(()@#F(()9;MN((S9r   c                    | t         } t        j                  j                  j	                  |       5 }|j
                  }|j                  dk(  sJ |j                  dk(  sJ |j                  d   j                  dk(  sJ t        ||||       t        ||       |j                  dd      }ddd       j                         D cg c]  }|j                         s| }}d	|d
<   dj                  |      }|S # 1 sw Y   OxY wc c}w )a5  
    Create application manifest, from built-in or custom manifest XML template. If provided, `manifest_xml` must be
    a string or byte string containing XML source. The returned manifest is a byte string, encoded in UTF-8.

    This function sets the attributes of `requestedExecutionLevel` based on provided `uac_admin` and `auc_uiacces`
    arguments (creating the parent elements in the XML, if necessary). It also scans `dependency` elements for the
    entry corresponding to `Microsoft.Windows.Common-Controls` and creates or modifies it as necessary.
    Nassemblyz urn:schemas-microsoft-com:asm.v1manifestVersionz1.0z  zUTF-8)indentencodings7   <?xml version="1.0" encoding="UTF-8" standalone="yes"?>r      
)_DEFAULT_MANIFEST_XMLr	   r
   minidomparseStringdocumentElementr   namespaceURIr>   r?   r0   rE   toprettyxml
splitlinesstripjoin)manifest_xmlr*   r+   r(   r)   outputlines          r   create_application_manifestrX      s    ,		$	$\	2 Il#33 ##z111((,NNNN&&'89??5HHH 	\<LQ*<F )))HI   &002CtdjjldCFC OF1IZZFM1I I  Ds   A:C:DD:Dc                 `    ddl m} t        g}t        dg}|j	                  | |t
        ||       y)zV
    Write the given manifest XML to the given executable's RT_MANIFEST resource.
    r   winresourcer:   N)PyInstaller.utils.win32r[   "CREATEPROCESS_MANIFEST_RESOURCE_IDLANG_NEUTRALadd_or_update_resourceRT_MANIFEST)filenamerU   r[   names	languagess        r   write_manifest_to_executablerd      s4     4 00E s#I&&x{ES\]r   c                 2   ddl m} |j                  | t        g      }t        |vrt	        d| d      |t           }t
        |vrt	        d| d      |t
           }t        |v r|t           }|}|S t        t        |j                                     }|}|S )z3
    Read manifest from the given executable."
    r   rZ   z"No RT_MANIFEST resources found in .zJNo RT_MANIFEST resource named CREATEPROCESS_MANIFEST_RESOURCE_ID found in )
r\   r[   get_resourcesr`   r   r]   r^   nextiteritems)ra   r[   	resourcesrU   s       r   read_manifest_from_executablerl      s     4))([MBI )#=h\KLL+&I *:efneqqrstt<=I y l+	 L ioo/01	Lr   )FF)NFF)xml.domr	   xml.dom.minidomr`   r]   #ISOLATIONAWARE_MANIFEST_RESOURCE_IDr^   rL   r   r   r0   rE   rX   rd   rl    r   r   <module>rq      s[       &' "&' #
 Ft
  dF":J%P^ r   