7raTEYdCql
November 10th, 2010, 01:02 PM
I'm trying to fetch values from a windows registry, using _winreg module in python.
This is function, which fetches a registry value:
def get_registry_value(sub_key, value_name):
registry = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE)
key = _winreg.OpenKey(registry, sub_key)
value = _winreg.QueryValueEx(key, value_name)
_winreg.CloseKey(key)
_winreg.CloseKey(registry)
return value
Now when I pass, subkey = SOFTWARE\Microsoft\Internet Explorer\UnattendBackup\TrustedSites and value = 'TrustedSites' to the given function it returns a null string.
I checked for other key_value pairs it was returning proper values.
Any exceptions to what the length of the value can be? Cause, this is a string containing all TrustedSites on IE. Every other case on which I've tested this function, it has been relatively short string.
Any other forum on which I can ask this doubt, where it would be more appropriate?
This is function, which fetches a registry value:
def get_registry_value(sub_key, value_name):
registry = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE)
key = _winreg.OpenKey(registry, sub_key)
value = _winreg.QueryValueEx(key, value_name)
_winreg.CloseKey(key)
_winreg.CloseKey(registry)
return value
Now when I pass, subkey = SOFTWARE\Microsoft\Internet Explorer\UnattendBackup\TrustedSites and value = 'TrustedSites' to the given function it returns a null string.
I checked for other key_value pairs it was returning proper values.
Any exceptions to what the length of the value can be? Cause, this is a string containing all TrustedSites on IE. Every other case on which I've tested this function, it has been relatively short string.
Any other forum on which I can ask this doubt, where it would be more appropriate?