當前位置: 首頁>>代碼示例>>Python>>正文


Python _winreg.REG_BINARY屬性代碼示例

本文整理匯總了Python中_winreg.REG_BINARY屬性的典型用法代碼示例。如果您正苦於以下問題:Python _winreg.REG_BINARY屬性的具體用法?Python _winreg.REG_BINARY怎麽用?Python _winreg.REG_BINARY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在_winreg的用法示例。


在下文中一共展示了_winreg.REG_BINARY屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: DllRegisterServer

# 需要導入模塊: import _winreg [as 別名]
# 或者: from _winreg import REG_BINARY [as 別名]
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." 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:19,代碼來源:shell_view.py

示例2: get_str_type

# 需要導入模塊: import _winreg [as 別名]
# 或者: from _winreg import REG_BINARY [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

示例3: write_block

# 需要導入模塊: import _winreg [as 別名]
# 或者: from _winreg import REG_BINARY [as 別名]
def write_block(self, bucket_id, value_id, data=""):
        """Described in parent class"""
        try:
            value_name = self._get_value_name(
                bucket_id, value_id)
        except BucketValueMissingException:
            logger.debug(
                "value with id does not exist in specified bucket." +
                " generating a new value name for bucket id %s" % bucket_id)
            value_name = self._generate_value_name(bucket_id)
            logger.debug("generated a new value name in bucket id %s: %s" % (
                bucket_id, value_name))
        with self._get_bucket_key(bucket_id, _winreg.KEY_WRITE) as key:
            _winreg.SetValueEx(key, value_name, 0,
                               _winreg.REG_BINARY, data)
        return RegistryStorageProvider.value_name_to_value_id(value_name) 
開發者ID:SafeBreach-Labs,項目名稱:AltFS,代碼行數:18,代碼來源:RegistryStorageProvider.py

示例4: DllRegisterServer

# 需要導入模塊: import _winreg [as 別名]
# 或者: from _winreg import REG_BINARY [as 別名]
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." 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:28,代碼來源:folder_view.py

示例5: DllRegisterServer

# 需要導入模塊: import _winreg [as 別名]
# 或者: from _winreg import REG_BINARY [as 別名]
def DllRegisterServer():
    comclass = IEToolbar

    # register toolbar with IE
    try:
        print "Trying to register Toolbar.\n"
        hkey = _winreg.CreateKey( _winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Internet Explorer\\Toolbar" )
        subKey = _winreg.SetValueEx( hkey, comclass._reg_clsid_, 0, _winreg.REG_BINARY, "\0" )
    except WindowsError:
        print "Couldn't set registry value.\nhkey: %d\tCLSID: %s\n" % ( hkey, comclass._reg_clsid_ )
    else:
        print "Set registry value.\nhkey: %d\tCLSID: %s\n" % ( hkey, comclass._reg_clsid_ )
    # TODO: implement reg settings for standard toolbar button

# unregister plugin 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:17,代碼來源:ietoolbar.py

示例6: printReg

# 需要導入模塊: import _winreg [as 別名]
# 或者: from _winreg import REG_BINARY [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_BINARY屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。