python类CreateKey()的实例源码

iebutton.py 文件源码 项目:OSPTF 作者: xSploited 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def unregister(classobj):
    import _winreg
    subKeyCLSID = "SOFTWARE\\Microsoft\\Internet Explorer\\Extensions\\%38s" % classobj._reg_clsid_
    try:
        hKey = _winreg.CreateKey( _winreg.HKEY_LOCAL_MACHINE, subKeyCLSID )
        subKey = _winreg.DeleteValue( hKey, "ButtonText" )
        _winreg.DeleteValue( hKey, "ClsidExtension" ) # for calling COM object
        _winreg.DeleteValue( hKey, "CLSID" )
        _winreg.DeleteValue( hKey, "Default Visible" )
        _winreg.DeleteValue( hKey, "ToolTip" )
        _winreg.DeleteValue( hKey, "Icon" )
        _winreg.DeleteValue( hKey, "HotIcon" )
        _winreg.DeleteKey( _winreg.HKEY_LOCAL_MACHINE, subKeyCLSID )
    except WindowsError:
        print "Couldn't delete Standard toolbar regkey."
    else:
        print "Deleted Standard toolbar regkey."

#
# test implementation
#
recipe-476229.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def create(self, key, subkey):
            """ Creates or opens a Windows registry key. The first param
            is one of the Windows HKEY names or an already open key. The
            second param is the actual key to create/open. """

            if type(key) is str:
                hkey = Registry.map_key(key)
            else:
                hkey = key

            if not hkey: raise RegistryError,"could not find registry key for %s" % key
            try:
                self._hkey = wreg.CreateKey(hkey, subkey)
                self._keyname = subkey
            except EnvironmentError, e:
                raise RegistryError, e
shell_view.py 文件源码 项目:Email_My_PC 作者: Jackeriss 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def DllRegisterServer():
    import _winreg
    key = _winreg.CreateKey(_winreg.HKEY_LOCAL_MACHINE,
                            "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\" \
                            "Explorer\\Desktop\\Namespace\\" + \
                            ShellFolderRoot._reg_clsid_)
    _winreg.SetValueEx(key, None, 0, _winreg.REG_SZ, ShellFolderRoot._reg_desc_)
    # And special shell keys under our CLSID
    key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT,
                        "CLSID\\" + ShellFolderRoot._reg_clsid_ + "\\ShellFolder")
    # 'Attributes' is an int stored as a binary! use struct
    attr = shellcon.SFGAO_FOLDER | shellcon.SFGAO_HASSUBFOLDER | \
           shellcon.SFGAO_BROWSABLE
    import struct
    s = struct.pack("i", attr)
    _winreg.SetValueEx(key, "Attributes", 0, _winreg.REG_BINARY, s)
    print ShellFolderRoot._reg_desc_, "registration complete."
iebutton.py 文件源码 项目:OSPTF 作者: xSploited 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def register(classobj):
    import _winreg
    subKeyCLSID = "SOFTWARE\\Microsoft\\Internet Explorer\\Extensions\\%38s" % classobj._reg_clsid_
    try:
        hKey = _winreg.CreateKey( _winreg.HKEY_LOCAL_MACHINE, subKeyCLSID )
        subKey = _winreg.SetValueEx( hKey, "ButtonText", 0, _winreg.REG_SZ, classobj._button_text_ )
        _winreg.SetValueEx( hKey, "ClsidExtension", 0, _winreg.REG_SZ, classobj._reg_clsid_ ) # reg value for calling COM object
        _winreg.SetValueEx( hKey, "CLSID", 0, _winreg.REG_SZ, "{1FBA04EE-3024-11D2-8F1F-0000F87ABD16}" ) # CLSID for button that sends command to COM object
        _winreg.SetValueEx( hKey, "Default Visible", 0, _winreg.REG_SZ, "Yes" )
        _winreg.SetValueEx( hKey, "ToolTip", 0, _winreg.REG_SZ, classobj._tool_tip_ )
        _winreg.SetValueEx( hKey, "Icon", 0, _winreg.REG_SZ, classobj._icon_)
        _winreg.SetValueEx( hKey, "HotIcon", 0, _winreg.REG_SZ, classobj._hot_icon_)
    except WindowsError:
        print "Couldn't set standard toolbar reg keys."
    else:
        print "Set standard toolbar reg keys."
fcade.py 文件源码 项目:fightcade2 作者: poliva 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def registerUriHandler():
    from _winreg import CreateKey, SetValueEx, HKEY_CURRENT_USER, REG_SZ, CloseKey
    regKeys = []
    regKeys.append(['Software\\Classes\\fcade', '', 'Fightcade'])
    regKeys.append(['Software\\Classes\\fcade', 'URL Protocol', ""])
    regKeys.append(['Software\\Classes\\fcade\\shell', '', None])
    regKeys.append(['Software\\Classes\\fcade\\shell\\open', '',  None])

    for key,name,val in regKeys:
        registryKey = CreateKey(HKEY_CURRENT_USER, key)
        SetValueEx(registryKey, name, 0, REG_SZ, val)
        CloseKey(registryKey)

    regKeysU = []
    regKeysU.append(['Software\\Classes\\fcade\\shell\\open\\command',  '', os.path.abspath(sys.argv[0])+' "%1"'])
    for key,name,val in regKeysU:
        registryKey = CreateKey(HKEY_CURRENT_USER, key)
        SetValueEx(registryKey, name, 0, REG_SZ, val)
        CloseKey(registryKey)
iebutton.py 文件源码 项目:pupy 作者: ru-faraon 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def register(classobj):
    import _winreg
    subKeyCLSID = "SOFTWARE\\Microsoft\\Internet Explorer\\Extensions\\%38s" % classobj._reg_clsid_
    try:
        hKey = _winreg.CreateKey( _winreg.HKEY_LOCAL_MACHINE, subKeyCLSID )
        subKey = _winreg.SetValueEx( hKey, "ButtonText", 0, _winreg.REG_SZ, classobj._button_text_ )
        _winreg.SetValueEx( hKey, "ClsidExtension", 0, _winreg.REG_SZ, classobj._reg_clsid_ ) # reg value for calling COM object
        _winreg.SetValueEx( hKey, "CLSID", 0, _winreg.REG_SZ, "{1FBA04EE-3024-11D2-8F1F-0000F87ABD16}" ) # CLSID for button that sends command to COM object
        _winreg.SetValueEx( hKey, "Default Visible", 0, _winreg.REG_SZ, "Yes" )
        _winreg.SetValueEx( hKey, "ToolTip", 0, _winreg.REG_SZ, classobj._tool_tip_ )
        _winreg.SetValueEx( hKey, "Icon", 0, _winreg.REG_SZ, classobj._icon_)
        _winreg.SetValueEx( hKey, "HotIcon", 0, _winreg.REG_SZ, classobj._hot_icon_)
    except WindowsError:
        print "Couldn't set standard toolbar reg keys."
    else:
        print "Set standard toolbar reg keys."
iebutton.py 文件源码 项目:pupy 作者: ru-faraon 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def unregister(classobj):
    import _winreg
    subKeyCLSID = "SOFTWARE\\Microsoft\\Internet Explorer\\Extensions\\%38s" % classobj._reg_clsid_
    try:
        hKey = _winreg.CreateKey( _winreg.HKEY_LOCAL_MACHINE, subKeyCLSID )
        subKey = _winreg.DeleteValue( hKey, "ButtonText" )
        _winreg.DeleteValue( hKey, "ClsidExtension" ) # for calling COM object
        _winreg.DeleteValue( hKey, "CLSID" )
        _winreg.DeleteValue( hKey, "Default Visible" )
        _winreg.DeleteValue( hKey, "ToolTip" )
        _winreg.DeleteValue( hKey, "Icon" )
        _winreg.DeleteValue( hKey, "HotIcon" )
        _winreg.DeleteKey( _winreg.HKEY_LOCAL_MACHINE, subKeyCLSID )
    except WindowsError:
        print "Couldn't delete Standard toolbar regkey."
    else:
        print "Deleted Standard toolbar regkey."

#
# test implementation
#
Main.py 文件源码 项目:Crypter 作者: sithis993 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def get_start_time(self):
    '''
    @summary: Get's Crypter's start time from the registry, or creates it if it
    doesn't exist
    @return: The time that the ransomware began it's encryption operation, in integer epoch form 
    '''

    # Try to open registry key
    try:
      reg = _winreg.OpenKeyEx(_winreg.HKEY_CURRENT_USER, self.REGISTRY_LOCATION)
      start_time = _winreg.QueryValueEx(reg, "")[0]
      _winreg.CloseKey(reg)
    # If failure, create the key
    except WindowsError:
      start_time = int(time.time())
      reg = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER, self.REGISTRY_LOCATION)
      _winreg.SetValue(reg, "", _winreg.REG_SZ, str(start_time))
      _winreg.CloseKey(reg)

    return start_time
win_add2path.py 文件源码 项目:oil 作者: oilshell 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def modify():
    pythonpath = os.path.dirname(os.path.normpath(sys.executable))
    scripts = os.path.join(pythonpath, "Scripts")
    appdata = os.environ["APPDATA"]
    if hasattr(site, "USER_SITE"):
        userpath = site.USER_SITE.replace(appdata, "%APPDATA%")
        userscripts = os.path.join(userpath, "Scripts")
    else:
        userscripts = None

    with _winreg.CreateKey(HKCU, ENV) as key:
        try:
            envpath = _winreg.QueryValueEx(key, PATH)[0]
        except WindowsError:
            envpath = DEFAULT

        paths = [envpath]
        for path in (pythonpath, scripts, userscripts):
            if path and path not in envpath and os.path.isdir(path):
                paths.append(path)

        envpath = os.pathsep.join(paths)
        _winreg.SetValueEx(key, PATH, 0, _winreg.REG_EXPAND_SZ, envpath)
        return paths, envpath
win_add2path.py 文件源码 项目:python2-tracer 作者: extremecoders-re 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def modify():
    pythonpath = os.path.dirname(os.path.normpath(sys.executable))
    scripts = os.path.join(pythonpath, "Scripts")
    appdata = os.environ["APPDATA"]
    if hasattr(site, "USER_SITE"):
        userpath = site.USER_SITE.replace(appdata, "%APPDATA%")
        userscripts = os.path.join(userpath, "Scripts")
    else:
        userscripts = None

    with _winreg.CreateKey(HKCU, ENV) as key:
        try:
            envpath = _winreg.QueryValueEx(key, PATH)[0]
        except WindowsError:
            envpath = DEFAULT

        paths = [envpath]
        for path in (pythonpath, scripts, userscripts):
            if path and path not in envpath and os.path.isdir(path):
                paths.append(path)

        envpath = os.pathsep.join(paths)
        _winreg.SetValueEx(key, PATH, 0, _winreg.REG_EXPAND_SZ, envpath)
        return paths, envpath
abstracts.py 文件源码 项目:cuckoo-headless 作者: evandowning 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def init_regkeys(self, regkeys):
        """Initializes the registry to avoid annoying popups, configure
        settings, etc.
        @param regkeys: the root keys, subkeys, and key/value pairs.
        """
        for rootkey, subkey, values in regkeys:
            key_handle = CreateKey(rootkey, subkey)

            for key, value in values.items():
                if isinstance(value, str):
                    SetValueEx(key_handle, key, 0, REG_SZ, value)
                elif isinstance(value, int):
                    SetValueEx(key_handle, key, 0, REG_DWORD, value)
                elif isinstance(value, dict):
                    self.init_regkeys([
                        [rootkey, "%s\\%s" % (subkey, key), value],
                    ])
                else:
                    raise CuckooPackageError("Invalid value type: %r" % value)

            CloseKey(key_handle)
shell_view.py 文件源码 项目:remoteControlPPT 作者: htwenning 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def DllRegisterServer():
    import _winreg
    key = _winreg.CreateKey(_winreg.HKEY_LOCAL_MACHINE,
                            "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\" \
                            "Explorer\\Desktop\\Namespace\\" + \
                            ShellFolderRoot._reg_clsid_)
    _winreg.SetValueEx(key, None, 0, _winreg.REG_SZ, ShellFolderRoot._reg_desc_)
    # And special shell keys under our CLSID
    key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT,
                        "CLSID\\" + ShellFolderRoot._reg_clsid_ + "\\ShellFolder")
    # 'Attributes' is an int stored as a binary! use struct
    attr = shellcon.SFGAO_FOLDER | shellcon.SFGAO_HASSUBFOLDER | \
           shellcon.SFGAO_BROWSABLE
    import struct
    s = struct.pack("i", attr)
    _winreg.SetValueEx(key, "Attributes", 0, _winreg.REG_BINARY, s)
    print ShellFolderRoot._reg_desc_, "registration complete."
iebutton.py 文件源码 项目:remoteControlPPT 作者: htwenning 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def unregister(classobj):
    import _winreg
    subKeyCLSID = "SOFTWARE\\Microsoft\\Internet Explorer\\Extensions\\%38s" % classobj._reg_clsid_
    try:
        hKey = _winreg.CreateKey( _winreg.HKEY_LOCAL_MACHINE, subKeyCLSID )
        subKey = _winreg.DeleteValue( hKey, "ButtonText" )
        _winreg.DeleteValue( hKey, "ClsidExtension" ) # for calling COM object
        _winreg.DeleteValue( hKey, "CLSID" )
        _winreg.DeleteValue( hKey, "Default Visible" )
        _winreg.DeleteValue( hKey, "ToolTip" )
        _winreg.DeleteValue( hKey, "Icon" )
        _winreg.DeleteValue( hKey, "HotIcon" )
        _winreg.DeleteKey( _winreg.HKEY_LOCAL_MACHINE, subKeyCLSID )
    except WindowsError:
        print "Couldn't delete Standard toolbar regkey."
    else:
        print "Deleted Standard toolbar regkey."

#
# test implementation
#
textext.py 文件源码 项目:inkscapeMadeEasy 作者: fsmMLK 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def save(self):
        if USE_WINDOWS:
            import _winreg
            try:
                key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, self.keyname,
                                      sam=_winreg.KEY_SET_VALUE | _winreg.KEY_WRITE)
            except:
                key = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER, self.keyname)
            try:
                for k, v in self.values.iteritems():
                    _winreg.SetValueEx(key, str(k), 0, _winreg.REG_SZ, str(v))
            finally:
                key.Close()
        else:
            d = os.path.dirname(self.filename)
            if not os.path.isdir(d):
                os.makedirs(d)

            f = open(self.filename, 'w')
            try:
                data = '\n'.join(["%s=%s" % (k,v)
                                  for k,v in self.values.iteritems()])
                f.write(data)
            finally:
                f.close()
get_toolchain_if_necessary.py 文件源码 项目:Chromium_DepotTools 作者: p07r0457 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def EnableCrashDumpCollection():
  """Tell Windows Error Reporting to record crash dumps so that we can diagnose
  linker crashes and other toolchain failures. Documented at:
  https://msdn.microsoft.com/en-us/library/windows/desktop/bb787181.aspx
  """
  if sys.platform == 'win32' and os.environ.get('CHROME_HEADLESS') == '1':
    key_name = r'SOFTWARE\Microsoft\Windows\Windows Error Reporting'
    try:
      key = winreg.CreateKey(winreg.HKEY_LOCAL_MACHINE, key_name)
      # Merely creating LocalDumps is sufficient to enable the defaults.
      winreg.CreateKey(key, "LocalDumps")
      # Disable the WER UI, as documented here:
      # https://msdn.microsoft.com/en-us/library/windows/desktop/bb513638.aspx
      winreg.SetValueEx(key, "DontShowUI", 0, winreg.REG_DWORD, 1)
    # Trap OSError instead of WindowsError so pylint will succeed on Linux.
    # Catching errors is important because some build machines are not elevated
    # and writing to HKLM requires elevation.
    except OSError:
      pass
get_toolchain_if_necessary.py 文件源码 项目:node-gn 作者: Shouqun 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def EnableCrashDumpCollection():
  """Tell Windows Error Reporting to record crash dumps so that we can diagnose
  linker crashes and other toolchain failures. Documented at:
  https://msdn.microsoft.com/en-us/library/windows/desktop/bb787181.aspx
  """
  if sys.platform == 'win32' and os.environ.get('CHROME_HEADLESS') == '1':
    key_name = r'SOFTWARE\Microsoft\Windows\Windows Error Reporting'
    try:
      key = winreg.CreateKey(winreg.HKEY_LOCAL_MACHINE, key_name)
      # Merely creating LocalDumps is sufficient to enable the defaults.
      winreg.CreateKey(key, "LocalDumps")
      # Disable the WER UI, as documented here:
      # https://msdn.microsoft.com/en-us/library/windows/desktop/bb513638.aspx
      winreg.SetValueEx(key, "DontShowUI", 0, winreg.REG_DWORD, 1)
    # Trap OSError instead of WindowsError so pylint will succeed on Linux.
    # Catching errors is important because some build machines are not elevated
    # and writing to HKLM requires elevation.
    except OSError:
      pass
get_toolchain_if_necessary.py 文件源码 项目:depot_tools 作者: webrtc-uwp 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def EnableCrashDumpCollection():
  """Tell Windows Error Reporting to record crash dumps so that we can diagnose
  linker crashes and other toolchain failures. Documented at:
  https://msdn.microsoft.com/en-us/library/windows/desktop/bb787181.aspx
  """
  if sys.platform == 'win32' and os.environ.get('CHROME_HEADLESS') == '1':
    key_name = r'SOFTWARE\Microsoft\Windows\Windows Error Reporting'
    try:
      key = winreg.CreateKeyEx(winreg.HKEY_LOCAL_MACHINE, key_name, 0,
                               winreg.KEY_WOW64_64KEY | winreg.KEY_ALL_ACCESS)
      # Merely creating LocalDumps is sufficient to enable the defaults.
      winreg.CreateKey(key, "LocalDumps")
      # Disable the WER UI, as documented here:
      # https://msdn.microsoft.com/en-us/library/windows/desktop/bb513638.aspx
      winreg.SetValueEx(key, "DontShowUI", 0, winreg.REG_DWORD, 1)
    # Trap OSError instead of WindowsError so pylint will succeed on Linux.
    # Catching errors is important because some build machines are not elevated
    # and writing to HKLM requires elevation.
    except OSError:
      pass
recipe-498148.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __set_keys(self, keys):
        'Private class method.'
        if isinstance(keys, str):
            _winreg.CreateKey(self.__self, keys)
        elif isinstance(keys, (list, tuple)):
            for key in keys:
                self.keys = key
        else:
            raise TypeError, 'Key Could Not Be Created'
recipe-502268.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def create(self, path):
        # create a subkey, and the path to it if necessary
        k=self
        for p in path.split('/'):
            if p in k.keys:
                k=k.keys[p]
            else:
                reg.CreateKey(k.wrk, p)
                k=Key(k, p)
        return k
recipe-578209.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __set_keys(self, keys):
        'Private class method.'
        if isinstance(keys, str):
            _winreg.CreateKey(self.__key, keys)
        elif isinstance(keys, (list, tuple)):
            for key in keys:
                self.keys = key
        else:
            raise TypeError, 'Key Could Not Be Created'
recipe-578209.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __setitem__(self, key, value):
        'Assign the item to a key.'
        key = Key(_winreg.CreateKey(self.__key, key), mode=KEY.ALL_ACCESS)
        for name in value.values:
            key.values[name] = value.values[name]
        for name in value.keys:
            key.keys[name] = value.keys[name]
recipe-510392.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def __set_keys(self, keys):
        'Private class method.'
        if isinstance(keys, str):
            _winreg.CreateKey(self.__key, keys)
        elif isinstance(keys, (list, tuple)):
            for key in keys:
                self.keys = key
        else:
            raise TypeError, 'Key Could Not Be Created'
recipe-476229.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def create(self, key, subkey):
        """ Create a windows registry key. Same
        as CreateKey of _winreg """

        regkey = Registry.RegistryKey()
        regkey.create(key, subkey)
        return regkey
NinjaRipperMayaImportTools.py 文件源码 项目:NinjaRipperMayaImportTools 作者: T-Maxxx 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def setupRegister():
    global RegisterKey
    try:
        RegisterKey = reg.OpenKey(
            reg.HKEY_CURRENT_USER,
            "SOFTWARE\\Autodesk\\MayaPlugins\\NinjaRipperMayaImportTools",
            0,
            reg.KEY_ALL_ACCESS
        )
    except WindowsError:
        RegisterKey = reg.CreateKey(
            reg.HKEY_CURRENT_USER,
            "SOFTWARE\\Autodesk\\MayaPlugins\\NinjaRipperMayaImportTools"
        )
        regSetBool("NR_AutoMode", True)
        regSetString("InitialDirectory", "")
        # regSetDword("NR_VertexLayout_PosX", 0)
        # regSetDword("NR_VertexLayout_PosY", 1)
        # regSetDword("NR_VertexLayout_PosZ", 2)
        regSetDword("NR_VertexLayout_NmlX", 3)
        regSetDword("NR_VertexLayout_NmlY", 4)
        regSetDword("NR_VertexLayout_NmlZ", 5)
        regSetDword("NR_VertexLayout_TCU", 6)
        regSetDword("NR_VertexLayout_TCV", 7)
        regSetFloat("NR_TransformScale", 100.0)
        regSetFloat("NR_TransformRotateX", 90.0)
        regSetFloat("NR_TransformRotateY", 0.0)
        regSetFloat("NR_TransformRotateZ", 0.0)
        regSetFloat("NR_TransformUVScale", 1.0)
        regSetDword("NR_MiscTextureNumber", 0)
        regSetDword("NR_MiscFlipUV", 0)
        regSetBool("NR_MiscNormalizeUV", False)
        regSetBool("NR_MiscReverseNormals", False)
        regSetBool('NR_MiscImportAnything', False)
empty_volume_cache.py 文件源码 项目:Email_My_PC 作者: Jackeriss 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def DllRegisterServer():
    # Also need to register specially in:
    # HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches
    # See link at top of file.
    import _winreg
    kn = r"Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\%s" \
         % (EmptyVolumeCache._reg_desc_,)
    key = _winreg.CreateKey(_winreg.HKEY_LOCAL_MACHINE, kn)
    _winreg.SetValueEx(key, None, 0, _winreg.REG_SZ, EmptyVolumeCache._reg_clsid_)
folder_view.py 文件源码 项目:Email_My_PC 作者: Jackeriss 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
def DllRegisterServer():
    import _winreg
    if sys.getwindowsversion()[0] < 6:
        print "This sample only works on Vista"
        sys.exit(1)

    key = _winreg.CreateKey(_winreg.HKEY_LOCAL_MACHINE,
                            "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\" \
                            "Explorer\\Desktop\\Namespace\\" + \
                            ShellFolder._reg_clsid_)
    _winreg.SetValueEx(key, None, 0, _winreg.REG_SZ, ShellFolder._reg_desc_)
    # And special shell keys under our CLSID
    key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT,
                        "CLSID\\" + ShellFolder._reg_clsid_ + "\\ShellFolder")
    # 'Attributes' is an int stored as a binary! use struct
    attr = shellcon.SFGAO_FOLDER | shellcon.SFGAO_HASSUBFOLDER | \
           shellcon.SFGAO_BROWSABLE
    import struct
    s = struct.pack("i", attr)
    _winreg.SetValueEx(key, "Attributes", 0, _winreg.REG_BINARY, s)
    # register the context menu handler under the FolderViewSampleType type.
    keypath = "%s\\shellex\\ContextMenuHandlers\\%s" % (ContextMenu._context_menu_type_, ContextMenu._reg_desc_)
    key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT, keypath)
    _winreg.SetValueEx(key, None, 0, _winreg.REG_SZ, ContextMenu._reg_clsid_)
    propsys.PSRegisterPropertySchema(get_schema_fname())
    print ShellFolder._reg_desc_, "registration complete."
icon_handler.py 文件源码 项目:Email_My_PC 作者: Jackeriss 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def DllRegisterServer():
    import _winreg
    key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT,
                            "Python.File\\shellex")
    subkey = _winreg.CreateKey(key, "IconHandler")
    _winreg.SetValueEx(subkey, None, 0, _winreg.REG_SZ, ShellExtension._reg_clsid_)
    print ShellExtension._reg_desc_, "registration complete."
copy_hook.py 文件源码 项目:Email_My_PC 作者: Jackeriss 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def DllRegisterServer():
    import _winreg
    key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT,
                            "directory\\shellex\\CopyHookHandlers\\" +
                            ShellExtension._reg_desc_)
    _winreg.SetValueEx(key, None, 0, _winreg.REG_SZ, ShellExtension._reg_clsid_)
    key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT,
                            "*\\shellex\\CopyHookHandlers\\" +
                            ShellExtension._reg_desc_)
    _winreg.SetValueEx(key, None, 0, _winreg.REG_SZ, ShellExtension._reg_clsid_)
    print ShellExtension._reg_desc_, "registration complete."
context_menu.py 文件源码 项目:Email_My_PC 作者: Jackeriss 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def DllRegisterServer():
    import _winreg
    key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT,
                            "Python.File\\shellex")
    subkey = _winreg.CreateKey(key, "ContextMenuHandlers")
    subkey2 = _winreg.CreateKey(subkey, "PythonSample")
    _winreg.SetValueEx(subkey2, None, 0, _winreg.REG_SZ, ShellExtension._reg_clsid_)
    print ShellExtension._reg_desc_, "registration complete."
excelAddin.py 文件源码 项目:OSPTF 作者: xSploited 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def RegisterAddin(klass):
    import _winreg
    key = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER, "Software\\Microsoft\\Office\\Excel\\Addins")
    subkey = _winreg.CreateKey(key, klass._reg_progid_)
    _winreg.SetValueEx(subkey, "CommandLineSafe", 0, _winreg.REG_DWORD, 0)
    _winreg.SetValueEx(subkey, "LoadBehavior", 0, _winreg.REG_DWORD, 3)
    _winreg.SetValueEx(subkey, "Description", 0, _winreg.REG_SZ, "Excel Addin")
    _winreg.SetValueEx(subkey, "FriendlyName", 0, _winreg.REG_SZ, "A Simple Excel Addin")


问题


面经


文章

微信
公众号

扫码关注公众号