当前位置: 首页>>代码示例>>Python>>正文


Python win32api.RegOpenKey方法代码示例

本文整理汇总了Python中win32api.RegOpenKey方法的典型用法代码示例。如果您正苦于以下问题:Python win32api.RegOpenKey方法的具体用法?Python win32api.RegOpenKey怎么用?Python win32api.RegOpenKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在win32api的用法示例。


在下文中一共展示了win32api.RegOpenKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_regkey

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import RegOpenKey [as 别名]
def get_regkey(self):
        try:
            accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE
            keyPath = 'Software\\Skype\\ProtectedStorage'

            try:
                hkey = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, keyPath, 0, accessRead)
            except Exception, e:
                print e
                return ''

            num = win32api.RegQueryInfoKey(hkey)[1]
            k = win32api.RegEnumValue(hkey, 0)

            if k:
                key = k[1]
                return win32crypt.CryptUnprotectData(key, None, None, None, 0)[1] 
开发者ID:mehulj94,项目名称:Radium,代码行数:19,代码来源:skype.py

示例2: GetSubList

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import RegOpenKey [as 别名]
def GetSubList(self):
		keyStr = regutil.BuildDefaultPythonKey() + "\\PythonPath"
		hKey = win32api.RegOpenKey(regutil.GetRootKey(), keyStr)
		try:
			ret = []
			ret.append(HLIProjectRoot("", "Standard Python Library")) # The core path.
			index = 0
			while 1:
				try:
					ret.append(HLIProjectRoot(win32api.RegEnumKey(hKey, index)))
					index = index + 1
				except win32api.error:
					break
			return ret
		finally:
			win32api.RegCloseKey(hKey) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:18,代码来源:browseProjects.py

示例3: UpdateForRegItem

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import RegOpenKey [as 别名]
def UpdateForRegItem(self, item):
		self.DeleteAllItems()
		hkey = win32api.RegOpenKey(item.keyRoot, item.keyName)
		try:
			valNum = 0
			ret = []
			while 1:
				try:
					res = win32api.RegEnumValue(hkey, valNum)
				except win32api.error:
					break
				name = res[0]
				if not name: name = "(Default)"
				self.InsertItem(valNum, name)
				self.SetItemText(valNum, 1, str(res[1]))
				valNum = valNum + 1
		finally:
			win32api.RegCloseKey(hkey) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:20,代码来源:regedit.py

示例4: WriteToolMenuItems

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import RegOpenKey [as 别名]
def WriteToolMenuItems( items ):
	# Items is a list of (menu, command)
	# Delete the entire registry tree.
	try:
		mainKey = win32ui.GetAppRegistryKey()
		toolKey = win32api.RegOpenKey(mainKey, "Tools Menu")
	except win32ui.error:
		toolKey = None
	if toolKey is not None:
		while 1:
			try:
				subkey = win32api.RegEnumKey(toolKey, 0)
			except win32api.error:
				break
			win32api.RegDeleteKey(toolKey, subkey)
	# Keys are now removed - write the new ones.
	# But first check if we have the defaults - and if so, dont write anything!
	if items==defaultToolMenuItems:
		return
	itemNo = 1
	for menu, cmd in items:
		win32ui.WriteProfileVal("Tools Menu\\%s" % itemNo, "", menu)
		win32ui.WriteProfileVal("Tools Menu\\%s" % itemNo, "Command", cmd)
		itemNo = itemNo + 1 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:26,代码来源:toolmenu.py

示例5: _GetServiceShortName

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import RegOpenKey [as 别名]
def _GetServiceShortName(longName):
    # looks up a services name
    # from the display name
    # Thanks to Andy McKay for this code.
    access = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE
    hkey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services", 0, access)
    num = win32api.RegQueryInfoKey(hkey)[0]
    longName = longName.lower()
    # loop through number of subkeys
    for x in range(0, num):
    # find service name, open subkey
        svc = win32api.RegEnumKey(hkey, x)
        skey = win32api.RegOpenKey(hkey, svc, 0, access)
        try:
            # find display name
            thisName = str(win32api.RegQueryValueEx(skey, "DisplayName")[0])
            if thisName.lower() == longName:
                return svc
        except win32api.error:
            # in case there is no key called DisplayName
            pass
    return None

# Open a service given either it's long or short name. 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:26,代码来源:win32serviceutil.py

示例6: __FindSvcDeps

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import RegOpenKey [as 别名]
def __FindSvcDeps(findName):
    if type(findName) is pywintypes.UnicodeType: findName = str(findName)
    dict = {}
    k = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services")
    num = 0
    while 1:
        try:
            svc = win32api.RegEnumKey(k, num)
        except win32api.error:
            break
        num = num + 1
        sk = win32api.RegOpenKey(k, svc)
        try:
            deps, typ = win32api.RegQueryValueEx(sk, "DependOnService")
        except win32api.error:
            deps = ()
        for dep in deps:
            dep = dep.lower()
            dep_on = dict.get(dep, [])
            dep_on.append(svc)
            dict[dep]=dep_on

    return __ResolveDeps(findName, dict) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:25,代码来源:win32serviceutil.py

示例7: get_regkey

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import RegOpenKey [as 别名]
def get_regkey(self):
        try:
            accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE
            keyPath = 'Software\\Skype\\ProtectedStorage'

            try:
                hkey = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, keyPath, 0, accessRead)
            except Exception, e:
                # print e
                return ''

            num = win32api.RegQueryInfoKey(hkey)[1]
            k = win32api.RegEnumValue(hkey, 0)

            if k:
                key = k[1]
                return win32crypt.CryptUnprotectData(key, None, None, None, 0)[1] 
开发者ID:mehulj94,项目名称:BrainDamage,代码行数:19,代码来源:skype.py

示例8: check_winscp_installed

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import RegOpenKey [as 别名]
def check_winscp_installed(self):
        accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE
        try:
            key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER,
                                      'Software\Martin Prikryl\WinSCP 2\Configuration\Security', 0, accessRead)
            return True
        except Exception, e:
            return False 
开发者ID:mehulj94,项目名称:Radium,代码行数:10,代码来源:winscp.py

示例9: check_masterPassword

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import RegOpenKey [as 别名]
def check_masterPassword(self):
        accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE
        key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, 'Software\Martin Prikryl\WinSCP 2\Configuration\Security',
                                  0, accessRead)
        thisName = str(win32api.RegQueryValueEx(key, 'UseMasterPassword')[0])

        if thisName == '0':
            return False
        else:
            return True 
开发者ID:mehulj94,项目名称:Radium,代码行数:12,代码来源:winscp.py

示例10: get_logins_info

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import RegOpenKey [as 别名]
def get_logins_info(self):
        accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE
        try:
            key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, 'Software\Martin Prikryl\WinSCP 2\Sessions', 0,
                                      accessRead)
        except Exception, e:
            return False 
开发者ID:mehulj94,项目名称:Radium,代码行数:9,代码来源:winscp.py

示例11: get_default_database

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import RegOpenKey [as 别名]
def get_default_database(self):
        accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE
        key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, 'Software\\ACS\\PuTTY Connection Manager', 0, accessRead)
        thisName = str(win32api.RegQueryValueEx(key, 'DefaultDatabase')[0])
        if thisName:
            return thisName
        else:
            return ' ' 
开发者ID:mehulj94,项目名称:Radium,代码行数:10,代码来源:putty.py

示例12: run

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import RegOpenKey [as 别名]
def run(self):

        accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE
        keyPath = 'Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows Messaging Subsystem\\Profiles\\Outlook'

        try:
            hkey = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, keyPath, 0, accessRead)
        except Exception, e:
            return 
开发者ID:mehulj94,项目名称:Radium,代码行数:11,代码来源:outlook.py

示例13: GetItemsCurrentValue

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import RegOpenKey [as 别名]
def GetItemsCurrentValue(self, item, valueName):
		hkey = win32api.RegOpenKey(item.keyRoot, item.keyName)
		try:
			val, type = win32api.RegQueryValueEx(hkey, valueName)
			if type != win32con.REG_SZ:
				raise TypeError("Only strings can be edited")
			return val
		finally:
			win32api.RegCloseKey(hkey) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源:regedit.py

示例14: SetItemsCurrentValue

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import RegOpenKey [as 别名]
def SetItemsCurrentValue(self, item, valueName, value):
		# ** Assumes already checked is a string.
		hkey = win32api.RegOpenKey(item.keyRoot, item.keyName , 0, win32con.KEY_SET_VALUE)
		try:
			win32api.RegSetValueEx(hkey, valueName, 0, win32con.REG_SZ, value)
		finally:
			win32api.RegCloseKey(hkey) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:9,代码来源:regedit.py

示例15: IsExpandable

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import RegOpenKey [as 别名]
def IsExpandable(self):
		# All keys are expandable, even if they currently have zero children.
		return 1
##		hkey = win32api.RegOpenKey(self.keyRoot, self.keyName)
##		try:
##			keys, vals, dt = win32api.RegQueryInfoKey(hkey)
##			return (keys>0)
##		finally:
##			win32api.RegCloseKey(hkey) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源:regedit.py


注:本文中的win32api.RegOpenKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。