a „oe50ã@sâddlZddlZddlZddlZdZdZdZdZdd„Zdd „Z d/d d „Z d0d d „Z dd„Z d1dd„Z dd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zd d!„Zd2d#d$„Zd3d%d&„Zd4d'd(„Zd)d*„Zd5d+d,„Zd-d.„ZdS)6éNzRegistry utility errorz&{b51df050-06ae-11cf-ad3b-524153480001}z Python.FilezPython.CompiledFilecCs dtjS)zøBuilds a string containing the path to the current registry key. The Python registry key contains the Python version. This function uses the version of the DLL used by the current process to get the registry key currently in use. zSoftware\Python\PythonCore\)ÚsysÚwinver©rrú2C:\Program Files\Certbot\pkgs\win32\lib\regutil.pyÚBuildDefaultPythonKeysrcCsDtƒ}zt tj|¡}| ¡tjWStjy>tjYS0dS)z-Retrieves the Registry root in use by Python.N)rÚwin32apiÚ RegOpenKeyÚwin32conÚHKEY_CURRENT_USERÚcloseÚerrorÚHKEY_LOCAL_MACHINE)ZkeynameÚkrrrÚ GetRootKeysrcCs|durtƒ}t ||¡S)z?A helper to return the default value for a key in the registry.N)rrÚ RegQueryValue)ZsubkeyÚrootkeyrrrÚGetRegistryDefaultValue&srcCsZ|durtƒ}t|ƒtkr"tj}n$t|ƒtkr6tj}ntdt|ƒƒ‚t   ||||¡dS)z;A helper to set the default value for a key in the registryNz-Value must be string or integer - was passed ) rÚtypeÚstrr ÚREG_SZÚintÚ REG_DWORDÚ TypeErrorÚreprrÚ RegSetValue)ZsubKeyÚvaluerZtypeIdrrrÚSetRegistryDefaultValue-s  rcCsdS)Nz3Software\Microsoft\Windows\CurrentVersion\App PathsrrrrrÚGetAppPathsKey;srcCsB|r tdƒ‚|dur tj |¡}t tƒtƒd|tj |¡dS)a‹Register a .exe file that uses Python. Registers the .exe with the OS. This allows the specified .exe to be run from the command-line or start button without using the full path, and also to setup application specific path (ie, os.environ['PATH']). Currently the exeAppPath is not supported, so this function is general purpose, and not specific to Python at all. Later, exeAppPath may provide a reasonable default that is used. exeFullPath -- The full path to the .exe exeAlias = None -- An alias for the exe - if none, the base portion of the filename is used. exeAppPath -- Not supported. z,Do not support exeAppPath argument currentlyNú\) r ÚosÚpathÚbasenamerrrrr r)Z exeFullPathÚexeAliasZ exeAppPathrrrÚRegisterPythonExe?s ÿr#cCst tƒtƒd|¡S)zGet a registered .exer)rrrr)r"rrrÚGetRegisteredExeYsr$c Cs`zt tƒtƒd|¡Wn>tjyZ}z$ddl}|j|jkrD‚WYd}~dSd}~00dS)z(Unregister a .exe file that uses Python.rrN)rÚ RegDeleteKeyrrr ÚwinerrorÚERROR_FILE_NOT_FOUND)r"Úexcr&rrrÚUnregisterPythonExe^s r)cCs2tƒd}|r|d|}t tƒ|tj|¡dS)z5Register a named path - ie, a named PythonPath entry.ú \PythonPathrN)rrrrr r)Únamer ÚkeyStrrrrÚRegisterNamedPathjs  r-c Csdtƒd|}zt tƒ|¡Wn>tjy^}z$ddl}|j|jkrH‚WYd}~dSd}~00dS)z7Unregister a named path - ie, a named PythonPath entry.z \PythonPath\rN)rrr%rr r&r'©r+r,r(r&rrrÚUnregisterNamedPathrs r/c Csntƒd}|r|d|}zt tƒ|¡WStjyh}z$ddl}|j|jkrR‚WYd}~dSd}~00dS)z8Get a registered named path, or None if it doesnt exist.r*rrN)rrrrr r&r'r.rrrÚGetRegisteredNamedPaths   r0cCsZzddl}| |¡Wn |jy6td|ƒYn0t tƒtƒd|tj |¡dS)aPRegister an explicit module in the registry. This forces the Python import mechanism to locate this module directly, without a sys.path search. Thus a registered module need not appear in sys.path at all. modName -- The name of the module, as used by import. modPath -- The full path and file name of the module. rNz+Warning: Registering non-existant module %sú \Modules\%s) rÚstatr Úprintrrrrr r)ÚmodNameZmodPathrrrrÚRegisterModuleŽs ür5c Cs^zt tƒtƒd|¡Wn<tjyX}z"ddl}|j|jkrD‚WYd}~n d}~00dS)znUnregister an explicit module in the registry. modName -- The name of the module, as used by import. r1rN)rr%rrr r&r')r4r(r&rrrÚUnregisterModule¤sÿ r6c Cs`zttƒd|ƒWStjyZzttƒd|tjƒWYStjyTYn0Yn0dS)z1Given a description, return the registered entry.z\Help\N)rrrr r r )ÚhelpDescrrrÚGetRegisteredHelpFile´s þ  r8écCsl|dur |}tj ||¡}z|r*t |¡WntjyHtdƒ‚Yn0t tƒt ƒd|t j |¡dS)a¶Register a help file in the registry. Note that this used to support writing to the Windows Help key, however this is no longer done, as it seems to be incompatible. helpFile -- the base name of the help file. helpPath -- the path to the help file helpDesc -- A description for the help file. If None, the helpFile param is used. bCheckFile -- A flag indicating if the file existence should be checked. NzHelp file does not existú\Help\%s) rr Újoinr2r Ú ValueErrorrrrrr r)ÚhelpFileZhelpPathr7Z bCheckFileZ fullHelpFilerrrÚRegisterHelpFileÃs  ür>c Csèt tjddtj¡}z\zt ||¡Wn<tjyb}z"ddl}|j|jkrN‚WYd}~n d}~00Wt  |¡n t  |¡0|durŠ|}zt  t ƒt ƒd|¡Wn<tjyâ}z"ddl}|j|jkr΂WYd}~n d}~00dS)z´Unregister a help file in the registry. helpFile -- the base name of the help file. helpDesc -- A description for the help file. If None, the helpFile param is used. zSoftware\Microsoft\Windows\HelprNr:) rrr r ÚKEY_ALL_ACCESSZRegDeleteValuer r&r'Ú RegCloseKeyr%rr)r=r7Úkeyr(r&rrrÚUnregisterHelpFileßs0ü ÿ rBc Csž|durt tj¡}n0zt |¡Wn tjyDtd|ƒYn0t t ƒt ƒ¡}z t  |dt j |¡Wt |¡n t |¡0t  t ƒdt j tj¡dS)z�Registers the core DLL in the registry. If no params are passed, the name of the Python DLL used in the current process is used and registered. Nz-Warning: Registering non-existant core DLL %sZDllz)Software\Python\PythonCore\CurrentVersion)rZGetModuleFileNamerÚ dllhandlerr2r r3Z RegCreateKeyrrrr rr@r)Z coredllNameZhKeyrrrÚRegisterCoreDLLs ürDcCst}t tjdtj|¡t tj|tjd¡t tjd|tjt¡t tjd|tj|¡dt}t tj|dtjd¡t tj|dtj|¡t}t tjd tj|¡t tj|tjd ¡t tjd|tj|¡d|}t tj|dtjd¡t tj|dtj|¡d S) aRegister the core Python file extensions. defPyIcon -- The default icon to use for .py files, in 'fname,offset' format. defPycIcon -- The default icon to use for .pyc files, in 'fname,offset' format. runCommand -- The command line to use for running .py files z.pyz Python Filez%s\CLSIDz%s\DefaultIconú%s\Shellz\OpenZRunz \Open\Commandz.pyczCompiled Python FileN)ÚRegistryIDPyFilerrr ÚHKEY_CLASSES_ROOTrÚ CLSIDPyFileÚRegistryIDPycFile)Z defPyIconZ defPycIconZ runCommandZ pythonFileIdÚbaserrrÚRegisterFileExtensions!sn ÿ ÿüüÿü ÿüüÿürKcCsHdt}|r(t tj|d|tj|¡t tj|d|tj|¡dS)NrEz\%sz \%s\Command©rFrrr rGr)Ú shellCommandZ exeCommandZshellUserCommandrJrrrÚRegisterShellCommandds ü ürNcCs`dt}t tj|d|tj|¡t tj|d|tj|¡t tj|d|tj|¡dS)NrEz \%s\ddeexecz\%s\ddeexec\Applicationz\%s\ddeexec\TopicrL)rMZddeAppZddeTopicZ ddeCommandrJrrrÚRegisterDDECommandzs& ü ü ürO)N)N)NN)Nr9)N)N)N)rrrr r rHrFrIrrrrrr#r$r)r-r/r0r5r6r8r>rBrDrKrNrOrrrrÚs6        % C