Python _winreg.REG_BINARY Examples
The following are 8
code examples of _winreg.REG_BINARY().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
_winreg
, or try the search function
.
Example #1
Source File: shell_view.py From ironpython2 with Apache License 2.0 | 6 votes |
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."
Example #2
Source File: registry_obj.py From Fastir_Collector with GNU General Public License v3.0 | 6 votes |
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"
Example #3
Source File: RegistryStorageProvider.py From AltFS with BSD 3-Clause "New" or "Revised" License | 6 votes |
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)
Example #4
Source File: shell_view.py From Email_My_PC with MIT License | 6 votes |
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."
Example #5
Source File: folder_view.py From ironpython2 with Apache License 2.0 | 5 votes |
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."
Example #6
Source File: ietoolbar.py From ironpython2 with Apache License 2.0 | 5 votes |
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
Example #7
Source File: folder_view.py From Email_My_PC with MIT License | 5 votes |
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."
Example #8
Source File: support.py From CIS-ESP with Apache License 2.0 | 5 votes |
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