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


Python _winreg.REG_MULTI_SZ属性代码示例

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


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

示例1: get_str_type

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import REG_MULTI_SZ [as 别名]
def get_str_type(reg_type):
    if reg_type == _winreg.REG_BINARY:
        return "REG_BINARY"
    elif reg_type == _winreg.REG_DWORD:
        return "REG_DWORD"
    elif reg_type == _winreg.REG_DWORD_BIG_ENDIAN:
        return "REG_DWORD_BIG_ENDIAN"
    elif reg_type == _winreg.REG_DWORD_LITTLE_ENDIAN:
        return "REG_DWORD_LITTLE_ENDIAN"
    elif reg_type == _winreg.REG_EXPAND_SZ:
        return "REG_EXPAND_SZ"
    elif reg_type == _winreg.REG_LINK:
        return "REG_LINK"
    elif reg_type == _winreg.REG_MULTI_SZ:
        return "REG_MULTI_SZ"
    elif reg_type == _winreg.REG_SZ:
        return "REG_SZ" 
开发者ID:SekoiaLab,项目名称:Fastir_Collector,代码行数:19,代码来源:registry_obj.py

示例2: is_ran_on_startup

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import REG_MULTI_SZ [as 别名]
def is_ran_on_startup(program_name):
	"""
	Returns True if specified program is set to be ran on startup, either
	by XDG autostart or by windows registry.
	Only name (desktop filename or registry key) is checked.
	"""
	if IS_WINDOWS:
		# Check if there is value for application in ...\Run
		try:
			key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run")
			trash, keytype = _winreg.QueryValueEx(key, program_name)
			_winreg.CloseKey(key)
			return keytype in (_winreg.REG_SZ, _winreg.REG_EXPAND_SZ, _winreg.REG_MULTI_SZ)
		except WindowsError:
			# Key not found
			return False
	else:
		# Check if there application.desktop file exists
		desktopfile = os.path.join(get_config_dir(), "autostart", "%s.desktop" % (program_name,))
		if not os.path.exists(desktopfile):
			return False
		# Check if desktop file is not marked as hidden
		# (stupid way, but should work)
		is_entry = False
		with open(desktopfile, "r") as f:
			for line in f.readlines():
				line = line.strip(" \r\t\n").lower()
				if line == "[desktop entry]":
					is_entry = True
					continue
				if "=" in line:
					key, value = line.split("=", 1)
					if key.strip(" ") == "hidden":
						if value.strip(" ") == "true":
							# Desktop file is 'hidden', i.e. disabled
							return False
		# File is present and not hidden - autostart is enabled
		return is_entry 
开发者ID:kozec,项目名称:syncthing-gtk,代码行数:40,代码来源:tools.py

示例3: printReg

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import REG_MULTI_SZ [as 别名]
def printReg(hive, value, type, fullkey, outFile, objRegistry, key=None):
	if not key:
		key = fullkey
		
	if type == _winreg.REG_SZ:
		result,reg_value = objRegistry.GetStringValue(hDefKey=hive,sSubKeyName=fullkey,sValueName=value)
	elif type == _winreg.REG_EXPAND_SZ:
		result,reg_value = objRegistry.GetExpandedStringValue(hDefKey=hive,sSubKeyName=fullkey,sValueName=value)
	elif type == _winreg.REG_BINARY:
		result,reg_value = objRegistry.GetBinaryValue(hDefKey=hive,sSubKeyName=fullkey,sValueName=value)
		r_value = ""
		if result == 0:
			for decimal in reg_value:
				r_value += "%0.2X" % decimal
		reg_value = "[BINARY DATA] " + r_value
	elif type == _winreg.REG_DWORD:
		result,reg_value = objRegistry.GetDWORDValue(hDefKey=hive,sSubKeyName=fullkey,sValueName=value)
	elif type == _winreg.REG_MULTI_SZ:
		result,reg_value = objRegistry.GetMultiStringValue(hDefKey=hive,sSubKeyName=fullkey,sValueName=value)
	else:
		reg_value = "OTHER_TYPE"
	
	if reg_value == None:
		reg_value = "NULL"
	
	reg_value = convert_to_string(reg_value)
	outFile.write(key.replace(","," ") + "," + value.replace(","," ") + "," + reg_value.replace(","," ") + "\n")

#convert windows datetime to nicely formatted date 
开发者ID:CIS-CERT,项目名称:CIS-ESP,代码行数:31,代码来源:support.py


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