%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/usr/lib/python2.7/site-packages/salt/utils/pkg/
Upload File :
Create Path :
Current File : //proc/self/root/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyc

�
���^c@@s�dZddlmZmZmZdZddlZddlZddlZddl	Z	ddl
Z
ddlZddl
Z
ddlZddlZddlmZyddlmZWnek
r�ddlZnXyLddlZddlZddlZddlZddlZddlZWn/ek
rUedkrOed��n�nXedkr�e
j�Zeje
jd	��e
j e�Z!e!j"e�e!j#e
j$�ne
j e�Z!ydd
l%m&Z&Wn!ek
r�dd
lm&Z&nXyddl'm(Z(Wn!ek
r1ddl)m(Z(nXde*fd
��YZ+de*fd��YZ,d�Z-edkr}e-�ndS(uP
Collect information about software installed on Windows OS
================

:maintainer: Salt Stack <https://github.com/saltstack>
:codeauthor: Damon Atkins <https://github.com/damon-atkins>
:maturity: new
:depends: pywin32, six
:platform: windows

Known Issue: install_date may not match Control Panel\Programs\Programs and Features
i(tabsolute_importtprint_functiontunicode_literalsu0.1N(t
cmp_to_key(tsixu__main__u Please install pywin32/pypiwin32u[%(levelname)s]: %(message)s(tOrderedDict(tLooseVersiontRegSoftwareInfocB@s�eZdZejd�Zejd�Zejd�ZiZiZ	ie
je
jfd6e
j
d6e
je
je
jfd6e
jd6Zej�dd	kr�ej�r�ide6e
je6Zq�ide6de6Znie
je6de6Zded
�Zd�Zed��Z ed
��Z!e"d��Z#dd�Z$d�Z%dd�Z&e"d��Z'e"d��Z(e"d��Z)e"d��Z*e"d��Z+e"d��Z,e"d��Z-e"d��Z.RS(u�
    Retrieve Registry data on a single installed software item or component.

    Attribute:
        None

    :codeauthor: Damon Atkins <https://github.com/damon-atkins>
    uO^\{(\w{8})-(\w{4})-(\w{4})-(\w\w)(\w\w)-(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)\}$uG^(\w{8})(\w{4})(\w{4})(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)$u$\d+\.\d+\.\d+[\w.-]*|\d+\.\d+[\w.-]*ustrulistuintubytesiu32bitcC@s"||_d|_d|_d|_d|_|jj|�}|dk	r�x?tdd�D]+}|j|j	|�ddd�7_q[Wn|rd|_
t|_d|_
dj||�|_|jr�d	j||j�|_d
j|�|_dj||j�|_q�nsd|_
||_|j||_
d
j|�|_|jr�dj|j�|_d|_dj|j�|_ny8tjtt|j
�|jdtj|j
B�|_WnDtjk
r}|jtjkr�tjd|||�n�nXd|_|jr�y8tjtt|j
�|jdtj|j
B�|_Wq�tjk
r�}|jtjkr�tjd|||�d|_q��q�Xnd|_tj |j�j!dd�}|rt"|d�r�t#j$|j%��|_qt"|d�rt&|�|_qndS(u(
        Initialise against a software item or component.

        All software has a unique "Identifer" within the registry. This can be free
        form text/numbers e.g. "MySoftware" or
        GUID e.g. "{0EAF0D8F-C9CF-4350-BD9A-07EC66929E04}"

        Args:
            key_guid (str): Identifer.
            sid (str): Security IDentifier of the User or None for Computer/Machine.
            use_32bit (bool):
                Regisrty location of the Identifer. ``True`` 32 bit registry only
                meaning fully on 64 bit OS.
        uiiNi����u
HKEY_USERSiu;{0}\Software\Microsoft\Windows\CurrentVersion\Uninstall\{1}u+{0}\Software\Classes\Installer\Products\{1}u-{0}\Software\Microsoft\Installer\UpgradeCodesuUSoftware\Microsoft\Windows\CurrentVersion\Installer\UserData\{0}\Products\{1}\PatchesuHKEY_LOCAL_MACHINEu7Software\Microsoft\Windows\CurrentVersion\Uninstall\{0}u'Software\Classes\Installer\Products\{0}u'Software\Classes\Installer\UpgradeCodesuZSoftware\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\{0}\PatchesuISoftware/Component Not Found  key_guid: '%s', sid: '%s' , use_32bit: '%s'ugSoftware/Component Not Found in Products section of registry key_guid: '%s', sid: '%s', use_32bit: '%s'u
LastWriteTimeuutctimetupleu__int__('t_RegSoftwareInfo__reg_key_guidt_RegSoftwareInfo__squidt#_RegSoftwareInfo__reg_products_patht&_RegSoftwareInfo__reg_upgradecode_pathtNonet_RegSoftwareInfo__patch_listt_RegSoftwareInfo__guid_patterntmatchtrangetgroupt_RegSoftwareInfo__reg_hivetFalset_RegSoftwareInfo__reg_32bitt"_RegSoftwareInfo__reg_32bit_accesstformatt$_RegSoftwareInfo__reg_uninstall_patht"_RegSoftwareInfo__reg_patches_patht"_RegSoftwareInfo__use_32bit_lookuptwin32apitRegOpenKeyExtgetattrtwin32contKEY_READt&_RegSoftwareInfo__reg_uninstall_handlet
pywintypesterrortwinerrortERROR_FILE_NOT_FOUNDtlogt%_RegSoftwareInfo__reg_products_handletdebugt_RegSoftwareInfo__mod_time1970tRegQueryInfoKeyWtgetthasattrttimetmktimetutctimetupletint(tselftkey_guidtsidt	use_32bitt
guid_matchtindextexctmod_win_time((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt__init__�sz					,										

	cC@s|s
dS|jj|�}d}|dk	r
d|jd�ddd�d|jd�ddd�d|jd�ddd�d|jd	�ddd�|jd
�ddd�d}x7tdd�D]&}||j|�ddd�7}q�W|d
7}n|S(u
        Squished GUID (SQUID) to GUID.

        A SQUID is a Squished/Compressed version of a GUID to use up less space
        in the registry.

        Args:
            squid (str): Squished GUID.

        Returns:
            str: the GUID if a valid SQUID provided.
        uu{iNi����u-iiiiiiu}(t_RegSoftwareInfo__squid_patternRRRR(R/tsquidtsquid_matchtguidR4((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt__squid_to_guid�s
�$
cC@syt|tj�r"|dkr"tSt|tj�rutjd|dtjtj�dk	rutj
|�dkrutStS(u�
        Test for ``1`` as a number or a string and return ``True`` if it is.

        Args:
            value: string or number or None.

        Returns:
            bool: ``True`` if 1 otherwise ``False``.
        iu\d+tflagsu1N(t
isinstanceRt
integer_typestTruetstring_typestreRt
IGNORECASEtUNICODERt	text_typeR(tvalue((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt__one_equals_trues(cC@s�tj||�\}}tjrvt|tj�rvt|tj�rvytj|dd�}Wqvtk
rrqvXn|tj	kr�tj
|�tj}n||fS(uk
        Calls RegQueryValueEx

        If PY2 ensure unicode string and expand REG_EXPAND_SZ before returning
        Remember to catch not found exceptions when calling.

        Args:
            handle (object): open registry handle.
            value_name (str): Name of the value you wished returned

        Returns:
            tuple: type, value
        tencodingumbcs(RtRegQueryValueExRtPY2R>RAREtUnicodeErrorRt
REG_EXPAND_SZtExpandEnvironmentStringstREG_SZ(thandlet
value_namet
item_valuet	item_type((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt__reg_query_values.

cC@s�|j}ytj|jd�\}}Wn/tjk
rY}|jtjkrS|S�nX|tj	kr�y.t
j
j|d�}tj
|j��}Wq�tk
r�q�Xn|S(u�
        Return the install time, or provide an estimate of install time.

        Installers or even self upgrading software must/should update the date
        held within InstallDate field when they change versions. Some installers
        do not set ``InstallDate`` at all so we use the last modified time on the
        registry key.

        Returns:
            int: Seconds since 1970 UTC.
        uInstallDateu%Y%m%d(R'RRIRR R!R"R#RRNtdatetimetstrptimeR+R,t	timetuplet
ValueError(R/ttime1970tdate_stringRRR5tdate_object((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pytinstall_time6s
	
cC@swy|j|j|�\}}Wn/tjk
rP}|jtjkrJdS�nX|rs||j|krsd}n|S(u�
        For the uninstall section of the registry return the name value.

        Args:
            value_name (str): Registry value name.
            wanted_type (str):
                The type of value wanted if the type does not match
                None is return. wanted_type support values are
                ``str`` ``int`` ``list`` ``bytes``.

        Returns:
            value: Value requested or None if not found.
        N(t!_RegSoftwareInfo__reg_query_valueRR R!R"R#Rt_RegSoftwareInfo__reg_types(R/RPtwanted_typeRQRRR5((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pytget_install_valueWs	cC@s|j|j|��S(u�
        For the uninstall section check if name value is ``1``.

        Args:
            value_name (str): Registry value name.

        Returns:
            bool: ``True`` if ``1`` otherwise ``False``.
        (t!_RegSoftwareInfo__one_equals_trueR_(R/tkey((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pytis_install_truers
c	C@s�|js
dStjj|�\}}yr|r{tj|j|dtj|j	B�}|j
||�\}}tj|�ntj|j|�\}}Wn/t
jk
r�}|jtjkr�dS�nX|r�||j|kr�d}n|S(u�
        For the product section of the registry return the name value.

        Args:
            value_name (str): Registry value name.
            wanted_type (str):
                The type of value wanted if the type does not match
                None is return. wanted_type support values are
                ``str`` ``int`` ``list`` ``bytes``.

        Returns:
            value: Value requested or ``None`` if not found.
        iN(R%RtostpathtsplitRRRRRR\tRegCloseKeyRIR R!R"R#R](	R/RPR^tsubkeytsearch_value_nameRORQRRR5((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pytget_product_value~s(		c
	C@s&|js
dSdj|j|j|j�}|jsG|j|jkry5tjt	t
|j�|jdt
j|jB�}WnNt
jk
r�}|jtjkr�tjd|j|j|j�dS�nXttj|��\}}}}||jkr*|j|||fkr*tjd|�dStjd|�x�|D]�}|j|�}tj||dt
j|jB�}	tj|	�\}}
}xIt|
�D];}|jtj|	|�d�}|r�||j|<q�q�Wtj|	�qAWtj|�||f|j|<n|jj|jd�S(u�
        For installers which follow the Microsoft Installer standard, returns
        the ``Upgrade code``.

        Returns:
            value (str): ``Upgrade code`` GUID for installed software.
        uu{0}\{1}\{2}iuNot Found %s\%s 32bit %su/Scan skipped for upgrade codes, no changes (%s)u-Scan for upgrade codes (%s) for product codes(R	RRRRt_RegSoftwareInfo__upgrade_codesRRRRRRRR R!R"R#R$twarningtziptRegEnumKeyExt(_RegSoftwareInfo__upgrade_code_have_scanR&t_RegSoftwareInfo__squid_to_guidtRegQueryInfoKeyRtRegEnumValueRfR)(
R/t
have_scan_keyt	uc_handleR5tsquid_upgrade_code_allt_t
suc_pytimetupgrade_code_squidtupgrade_code_guidt	pc_handletpc_val_countt
item_indextproduct_code_guid((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pytupgrade_code�sN		
!
	
c
C@s�|js
gS|jdkr�y5tjtt|j�|jdtj	|j
B�}WnNtjk
r�}|j
t
jkr�tjd|j|j|j�gS�nXtj|�\}}}|s�gSttj|��\}}}}g}x|D]�}y�tj||dtj	|j
B�}|j|d�\}	}
|j|d�\}}|tjks�t|tj�s�|dks�|
tjkr�w�ntj|�|j|	�Wq�tjk
r�}|j
t
jkr�tjd|�q�n�q�Xq�Wn|S(u�
        For installers which follow the Microsoft Installer standard, returns
        a list of patches applied.

        Returns:
            value (list): Long name of the patch.
        iuNot Found %s\%s 32bit %suDisplayNameuStateiuskipped patch, not found %sN(R	R
RRRRRRRRRR R!R"R#R$RkRRpRlRmR\t	REG_DWORDR>RR?RNRftappendR&(
R/tpat_all_handleR5tpc_sub_key_cntRutsquid_patch_alltrettpatch_squidtpatch_squid_handletpatch_display_nametpatch_display_name_typetpatch_statetpatch_state_type((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pytlist_patches�sX		
!

cC@sdj|j|j�S(u�
        Returns the uninstall path this object is associated with.

        Returns:
            str: <hive>\<uninstall registry entry>
        u{0}\{1}(RRR(R/((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pytregistry_path_text&scC@s|j|jfS(u�
        Returns the uninstall path this object is associated with.

        Returns:
            tuple: hive, uninstall registry entry path.
        (RR(R/((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt
registry_path0scC@s|jS(uT
        Return GUID or Key.

        Returns:
            str: GUID or Key
        (R(R/((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyR;:scC@s|jS(uc
        Return SQUID of the GUID if a valid GUID.

        Returns:
            str: GUID
        (R	(R/((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyR9DscC@s|j|jd��S(u^
        Return package code of the software.

        Returns:
            str: GUID
        uPackageCode(RoRi(R/((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pytpackage_codeNscC@s#y|j|jd�\}}Wn,tjk
rM}|jtjkrNdSnXd}d}|r|tjkr�t|t	j
�r�|}n|rdj|d?d@|d?d@|d@�}d}qq|tjkrt|t	j
�r|jj|�dk	r|jd	�}d
}qn||fS(
u�
        Return version number which is stored in binary format.

        Returns:
            str: <major 0-255>.<minior 0-255>.<build 0-65535> or None if not found
        uversionuu{0}.{1}.{2}ii�ii��ubinary-versionu ubinary-version (string)(uuN(R\RR R!R"R#RR~R>RR?RRNRAt!_RegSoftwareInfo__version_patternRRtstrip(R/RQRRR5tversion_binary_texttversion_srctversion_binary_raw((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pytversion_binaryXs.	
N(/t__name__t
__module__t__doc__RBtcompileRR8R�RjRnRRLRNtREG_MULTI_SZR~tREG_DWORD_BIG_ENDIANt	REG_QWORDt
REG_BINARYR]tplatformtarchitecturetwin32processtIsWow64ProcessR@tKEY_WOW64_64KEYRRRtKEY_WOW64_32KEYR7RotstaticmethodR`R\tpropertyR[R_RbRiR}R�R�R�R;R9R�R�(((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyR]s@

j	!	(@@




tWinSoftwarec
B@seZdZejd�Zejddej�Zdddddd	gfd
ddd
gfdddgfdddgfdddgfdddgfdddgfdddgfdddgfdddgfdddgfgZd dd!gfd"dd#gfd$dd%gfd&dd'gfgZ	e
e
d;d(�Ze
d)��Ze
d*��Zd+�Zd,�Zd-�Zd.�Zd/�Zd;d0�Zed1��Zed2��Zd3�Zd4�Zd5�Zed6��Zd7�Zd8�Zd9�Zd:�Z RS(<u�
    Point in time snapshot of the software and components installed on
    a system.

    Attributes:
        None

    :codeauthor: Damon Atkins <https://github.com/damon-atkins>
    u+^S-\d-\d-\d+$|^S-\d-\d-\d+-\d+-\d+-\d+-\d+$u^\s*$R=uurlustruURLInfoAboutuHelpLinkuMoreInfoUrlu
UrlUpdateInfousizeuintuSizeu
EstimatedSizeuwin_commentsuCommentsuwin_release_typeuReleaseTypeuwin_product_idu	ProductIDuwin_product_codesuProductCodesuwin_package_refsuPackageRefsuwin_install_locationuInstallLocationuwin_install_src_diru
InstallSourceuwin_parent_pkg_uidu
ParentKeyNameuwin_parent_nameuParentDisplayNameuwin_advertise_flagsuAdvertiseFlagsuwin_redeployment_flagsuDeploymentFlagsuwin_instance_typeuInstanceTypeuwin_package_nameuSourceList\PackageNamecC@sJ||_||_i|_|jd|�t|j�|_d|_dS(u

        Point in time snapshot of the software and components installed on
        a system.

        Args:
            version_only (bool): Provide list of versions installed instead of detail.
            user_pkgs (bool): Include software/components installed with user space.
            pkg_obj (object):
                If None (default) return default package naming standard and use
                default version capture methods (``DisplayVersion`` then
                ``Version``, otherwise ``0.0.0.0``)
        t	user_pkgsN(t_WinSoftware__pkg_objt_WinSoftware__version_onlyt_WinSoftware__reg_softwaret"_WinSoftware__get_software_detailstlent_WinSoftware__pkg_cntRt_WinSoftware__iter_list(R/tversion_onlyR�tpkg_obj((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyR7�s
			cC@s|jS(u�
        Returns the raw data

        Returns:
            dict: contents of the dict are dependant on the parameters passed
                when the class was initiated.
        (R�(R/((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pytdata�s	cC@s|jS(u�
        Returns True if class initiated with ``version_only=True``

        Returns:
            bool: The value of ``version_only``
        (R�(R/((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyR��scC@s|jS(u�
        Returns total number of software/components installed.

        Returns:
            int: total number of software/components installed.
        (R�(R/((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt__len__�scC@s*||jkr|j|St|��dS(u�
        Returns information on a package.

        Args:
            pkg_id (str): Package Id of the software/component

        Returns:
            dict or list: List if ``version_only`` is ``True`` otherwise dict
        N(R�tKeyError(R/tpkg_id((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt__getitem__�s
cC@sC|jdk	rtd��ntjt|jj���|_|S(uT
        Standard interation class initialisation over package information.
        u#Can only perform one iter at a timeN(R�RtRuntimeErrortcollectionstdequetsortedR�tkeys(R/((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt__iter__�s!cC@s8y|jj�SWn tk
r3d|_t�nXdS(uX
        Returns next Package Id.

        Returns:
            str: Package Id
        N(R�tpopleftt
IndexErrorRt
StopIteration(R/((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt__next__�s

	cC@s
|j�S(uX
        Returns next Package Id.

        Returns:
            str: Package Id
        (R�(R/((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pytnext�scC@s|jj||�S(u/
        Returns information on a package.

        Args:
            pkg_id (str): Package Id of the software/component.
            default_value: Value to return when the Package Id is not found.

        Returns:
            dict or list: List if ``version_only`` is ``True`` otherwise dict
        (R�R)(R/R�t
default_value((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyR)scC@s t|�t|�krdSdS(uC
        Used for sorting version numbers oldest to latest
        ii����(R(tver1tver2((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt__oldest_to_latest_versionscC@s t|�t|�krdSdS(uD
        Used for sorting version numbers, latest to oldest
        ii����(R(R�R�((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt__latest_to_oldest_versionscC@sf|jj|d�}|sgSt|t�r2|St|jd�j��}t|dt|j��S(u�
        Returns information on a package.

        Args:
            pkg_id (str): Package Id of the software/component.

        Returns:
            list: List of version numbers installed.
        uversionRaN(	R�R)RR>tlistR�R�Rt&_WinSoftware__oldest_to_latest_version(R/R�tpkg_datatinstalled_versions((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pytpkg_version_list#s
cC@s|j|�dS(u
        Returns a package latest version installed out of all the versions
        currently installed.

        Args:
            pkg_id (str): Package Id of the software/component.

        Returns:
            str: Latest/Newest version number installed.
        i����(R�(R/R�((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pytpkg_version_latest9scC@s|j|�dS(u
        Returns a package oldest version installed out of all the versions
        currently installed.

        Args:
            pkg_id (str): Package Id of the software/component.

        Returns:
            str: Oldest version number installed.
        i(R�(R/R�((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pytpkg_version_oldestFscC@sf|dks|dkrdSytj|�}Wn7tjk
rh}tdj||j|j���nXy1tj	d|�\}}}dj||�}WnMtjk
r�}|jtj
kr�|Stdj||j|j���nXytj|tj
tj�}WnVtjk
ra}|jtjtjtj
fkr[dj|j�|j��S�nX|S(u
        Provided with a valid Windows Security Identifier (SID) and returns a Username

        Args:
            sid (str): Security Identifier (SID).

        Returns:
            str: Username in the format of username@realm or username@computer.
        uu2pkg: Software owned by {0} is not valid: [{1}] {2}u{0}\{1}u/Failed looking up sid '{0}' username: [{1}] {2}u{0}@{1}N(Rt
win32securitytGetBinarySidR R!RWRR"tstrerrortLookupAccountSidtERROR_NONE_MAPPEDt
TranslateNameRtNameSamCompatibletNameUserPrincipaltERROR_NO_SUCH_DOMAINtERROR_INVALID_DOMAINNAMEtlower(R1tsid_binR5tnametdomaint
_account_typet	user_nametuser_principal((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt__sid_to_usernameSs6""c
C@s�|r!|jdd�j�}nd}|rH|jdd�j�}nd}|r]d}nd}|rv|d7}n|d|d|}|jr�t|jd�r�|jj||||�}	|	r�|	Sn|S(	u
        Determine the Package ID of a software/component using the
        software/component ``publisher``, ``name``, whether its a software or a
        component, and if its 32bit or 64bit archiecture.

        Args:
            publisher (str): Publisher of the software/component.
            name (str): Name of the software.
            is_component (bool): True if package is a component.
            is_32bit (bool): True if the software/component is 32bit architecture.

        Returns:
            str: Package Id
        u,uuNoValueucompusoftu32u\\u	to_pkg_id(treplaceR�R�R*t	to_pkg_id(
R/t	publisherR�tis_componenttis_32bittpub_lctname_lct	soft_typetdefault_pkg_idR�((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt__software_to_pkg_id�s"	
cC@s6|jr�t|jd�r�|jj||||�\}}}|dkrd|rd|rd|||fS|dkr�tdjtj|j�||||���q�n|r�tjd|dtj	tj
�d
k	r�|}d}nI|rtjd|dtj	tj
�d
k	r|}d}nd}d	}|||fS(u,
        This returns the version and where the version string came from, based on instructions
        under ``version_capture``, if ``version_capture`` is missing, it defaults to
        value of display-version.

        Args:
            pkg_id (str): Publisher of the software/component.
            version_binary (str): Name of the software.
            version_display (str): True if package is a component.
            display_name (str): True if the software/component is 32bit architecture.

        Returns:
            str: Package Id
        uversion_captureuuse-defaultuZversion capture within object '{0}' failed for pkg id: '{1}' it returned '{2}' '{3}' '{4}'u\d+R=udisplay-versionuversion-binaryunoneu	0.0.0.0.0N(R�R*tversion_captureRWRRRERBRRCRDR(R/R�R�tversion_displaytdisplay_nametversion_strtsrctversion_user_str((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt__version_capture_slp�s"$
*.	.	c'C@s�t|||�}|jddd�}|dksE|jj|�rIdS|jddd�}|jddd�}tjd|dtjtj�dk	s�|r�|jdE�s�|r�|dFkr�t	j
d|�dS|jd�}|jd�}	|jd�}
|jd�}|jd�}|jd�}
|jddd�}|	dkrt|
dkrt|dkrt|rtdS|r�|j|�}nd}|j
|||
|�}|j\}}|jddd�}|j||||�\}}}|s�|}n|rdj||�}n|}|jr�||jkr�||j|kr�d}x;|j|D],}t|�t|�kr�Pn|d7}q^W|j|j||�q�t	j
d|||�n|g|j|<dS||jkr�|j|}nt�}|j|<|r%|jidd6�nR|r1dnd }d|krc|d|krwd!|d<qwn|ji|d6�|r�d"|kr�|d"j�|j�kr�d!|d"<q�q�||d"<nd#|kr�|d#|
kr�d|d#<q�n
|
|d#<|ji|d$6�|jd%i�||d%krpd&|d%|kr[|d%|d&cd7<q�d'|d%|d&<nt�|d%|<|d%|}|ji|d(6�|	r�|ji|	d)6�n|
r�|ji|
d*6�n|r�|ji|d+6�n|ji|d,6�|r+|ji|d-6�n|rH|ji|d.6�n|re|ji|d/6�n|s�|	r�tjd0|	dtjtj�r�|jid1d26�ntjd3|tj�dk	s|	r5tjd4|	dtjtj�dk	stjd5|	dtjtj�dk	r5|jid6d26�n�|jd7�rp|jd8dd�rp|jid9d26�nS|	r�tjd:|	dtjtj�r�|jid;d26�n|jidd26�|jd<�}t|tj�r|tjkr|jitj|d=6�n|j }|r7|ji|d>6�n|j!}|r]|ji|d?6�n|jd@�}|r�|ji|dA6�n|j"} | r�|jit#j#j$| �j%�dB6�|jit&| �dC6�nx^|j'D]S\}!}"}#xA|#D]9}$|j|$d|"�}%|%r�|ji|%|!6�Pq�q�Wq�Wxd|j(D]Y\}!}"}#xG|#D]?}$|j)|$d|"�}|dk	r\|ji||!6�Pq\q\WqFW|j*}&|&r�|ji|&dD6�ndS(Gu:
        Update data with the next software found
        uDisplayNameR^ustrNuuReleaseTypeu^{.*\}\.KB\d{6,}$R=uKBukbuKbuHotfixu
Update RollupuSecurity UpdateuServicePacku&skipping hotfix/update/service pack %suNoRemoveuUninstallStringuQuietUninstallStringu
ModifyPathuWindowsInstalleruSystemComponentu	PublisheruDisplayVersionu{};{}iiuHFound extra entries for '%s' with same version '%s', skipping entry '%s'uunknownuarchux86ux64umanyuvendoruwin_system_componentuwin_version_srcuversionuwin_install_countiuwin_display_nameuwin_uninstall_cmduwin_uninstall_quiet_cmduwin_uninstall_no_removeuwin_product_codeuwin_version_displayuwin_version_binaryuwin_version_useruMsiExec.exe\s|MsiExec\suwinmsiuwin_installer_typeuInstallShield_u
InstallShielduisuninst\.exe.*\.isuu
installshieldu_is1uInno Setup: Setup Versionuinnou .*\\uninstall.exe|.*\\uninst.exeunsisuLanguageuwin_languageuwin_package_codeuwin_upgrade_codeuIsMinorUpgradeuwin_is_minor_upgradeuinstall_dateuinstall_date_time_tuwin_patches(uKBukbuKb(uHotfixu
Update RollupuSecurity UpdateuServicePack(+RR_Rt _WinSoftware__whitespace_patternRRBRCRDt
startswithR$R&Rbt_WinSoftware__sid_to_usernamet _WinSoftware__software_to_pkg_idR�t!_WinSoftware__version_capture_slpRR�R�RtinsertRtupdateR�t
setdefaulttsearchtendswithR>RR?tlocaletwindows_localeR�R}R[RTt
fromtimestampt	isoformatR.t#_WinSoftware__uninstall_search_listt"_WinSoftware__products_search_listRiR�('R/R1tkey_softwareR2t
reg_soft_infoR�R�trelease_typetuninstall_no_removetuninstall_stringtuninstall_quiet_stringtuninstall_modify_pathtwindows_installertsystem_componentR�tusernameR�R�R�R�tversion_texttuser_versiontdict_keytinsert_pointtver_itemR�tarch_strtversion_datatlanguage_numberR�R}tis_minor_upgradeR[tinfokeytinfotypet
regfield_listtregfieldtstrvaluet
patch_list((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt__collect_software_info�s(!		

"(("!			&

	cC@s�tj�ddkrhtj�rHidt6tjt6}ttg}q�idt6dt6}tg}n#itj	t6dt6}ttg}x�|D]�}d}t
jd|�tj
tj|dtj||B�}ttj|��\}}}}tj|�x!|D]}	|jd|	|�q	Wq�W|s4dSt
jd�tj
tjddtj�}
g}x:ttj|
�d�D]}|jtj|
|��qWx|D]}
|jj|
�dk	r�dj|
�}ytj
|
|dtj�}WnAtjk
r8}|jtjkr2t
jd	|�q�q9�nXy%ttj|��\}}}}Wn't k
r�t
jd
|�g}nXtj|�x$|D]}	|j|
|	t�q�Wq�q�Wtj|
�dS(u2
        This searches the uninstall keys in the registry to find
        a match in the sub keys, it will return a dict with the
        display name as the key and the version as the value
        .. sectionauthor:: Damon Atkins <https://github.com/damon-atkins>
        .. versionadded:: Carbon
        iu32bitu3Software\Microsoft\Windows\CurrentVersion\UninstalluSYSTEM processing 32bit:%sNu'Processing user software... please waituu7{0}\Software\Microsoft\Windows\CurrentVersion\UninstalluNot Found %suNo Entries Found %s(!R�R�R�R�R@RR�RRR�R$R&RRtHKEY_LOCAL_MACHINERRlRmRft#_WinSoftware__collect_software_infot
HKEY_USERSRRpRt
RegEnumKeyt_WinSoftware__sid_patternRRR R!R"R#RW(R/R�tuse_32bit_lookupt	arch_listt	arch_flagt
key_searchROtreg_key_allRutreg_keyt
handle_sidtsid_allR4R1tuser_uninstall_pathR5((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt__get_software_details�sn
!


 
%




N(!R�R�R�RBR�RRDR�R�R�RRR7R�R�R�R�R�R�R�R�R)R�R�t&_WinSoftware__latest_to_oldest_versionR�R�R�R�R�R�RR�(((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyR��sJ	
						
		
		
	
5	0	+	�c@s�ttj�dkrEtjjdjtjd��tjd�nt�t�tj	tjd�dkrvt
�ntj	tjd�dkr�t
�ndd	l�dd	l}���fd
�}t
dj|j|dd���d	S(
u�This module can also be run directly for testing
        Args:
            detail|list : Provide ``detail`` or version ``list``.
            system|system+user: System installed and System and User installs.
    iu.usage: {0} <detail|list> <system|system+user>
ii@iulistiusystem+userNc@sZtd�d��}t�jjj|jdtdd��tdjt|���dS(uA
        Main run code, when this module is run directly
        R�R�t	sort_keystindentiu	Total: {}N(	R�tprinttutilstjsontdumpsR�R@RR�(tpkg_list(tsaltR�R�(s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pytrun!s(uTime Taken: {}tnumber(R�tsystargvtstderrtwriteRtexitRRRER@tsalt.utils.jsonttimeitR*(R8R0((R/R�R�s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt__mains 		(.R�t
__future__RRRt__version__R2RBR�R�tloggingtos.pathRcRTR+R�t	functoolsRtsalt.extRtImportErrorRRR�R�R R"R�t
StreamHandlertLOG_CONSOLEtsetFormattert	Formattert	getLoggerR$t
addHandlertsetLeveltDEBUGtsalt.utils.odictRtsalt.utils.versionsRtdistutils.versiontobjectRR�R9(((s6/usr/lib/python2.7/site-packages/salt/utils/pkg/win.pyt<module>sf





��+���	

Zerion Mini Shell 1.0