'Load the MIME types database from Windows registry.
If strict is true, information will be added to
list of standard types, else to the list of non-standard
types.'

def read_windows_registry(self, strict=True):

    if (not _winreg):
        return
    def enum_types(mimedb):
        i = 0
        while True:
            try:
                (yield _winreg.EnumKey(mimedb, i))
            except EnvironmentError:
                break
            i += 1
    default_encoding = sys.getdefaultencoding()
    with _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, '') as hkcr:
        for subkeyname in enum_types(hkcr):
            try:
                with _winreg.OpenKey(hkcr, subkeyname) as subkey:
                    if (not subkeyname.startswith('.')):
                        continue
                    (mimetype, datatype) = _winreg.QueryValueEx(subkey, 'Content    Type')
                    if (datatype != _winreg.REG_SZ):
                        continue
                    try:
                        mimetype = mimetype.encode(default_encoding)
                    except UnicodeEncodeError:
                        continue
                    self.add_type(mimetype, subkeyname, strict)
            except EnvironmentError:
                continue
