'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:
                ctype = _winreg.EnumKey(mimedb, i)
            except EnvironmentError:
                break
            try:
                ctype = ctype.encode(default_encoding)
            except UnicodeEncodeError:
                pass
            else:
                (yield ctype)
            i += 1
    default_encoding = sys.getdefaultencoding()
    with _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, 'MIME\\Database\\Content    Type') as mimedb:
        for ctype in enum_types(mimedb):
            try:
                with _winreg.OpenKey(mimedb, ctype) as key:
                    (suffix, datatype) = _winreg.QueryValueEx(key, 'Extension')
            except EnvironmentError:
                continue
            if (datatype != _winreg.REG_SZ):
                continue
            try:
                suffix = suffix.encode(default_encoding)
            except UnicodeEncodeError:
                continue
            self.add_type(ctype, suffix, strict)
