def readRegKey(self, keyname):
		"""Reads configuration data from registry key"""
		kkey = OpenKey(HKEY_LOCAL_MACHINE, keyname)
		kinfo = QueryInfoKey(kkey)
		for x in range(0, kinfo[0]):
			try:
				subname = EnumKey(kkey, x)
				# Adding this section
				self.add_section(subname)
				# Reading options from it
				subkey = OpenKey(HKEY_LOCAL_MACHINE, keyname + "\\" + subname)
				subkinfo = QueryInfoKey(subkey)
				for x in range(0, subkinfo[1]):
					try:
						(name, value, ttype) = EnumValue(subkey, x)
						self.set(subname, name, value)
					except EnvironmentError:
						break
				subkey.Close()
			except EnvironmentError:
				break		
		# Setting defaults
		for x in range(0, kinfo[1]):
			try:
				(name, value, ttype) = EnumValue(kkey, x)
				self.set("DEFAULT", name, value)
			except EnvironmentError:
				break
		# Close key
		kkey.Close()
Reads configuration data from registry key
recipes/Python/138944_Extending_ConfigParser_reading_writing_options/recipe-138944.py