+ TRACE("type %s, handler %s, info %p.\n",
+ wine_dbgstr_fcc(type), wine_dbgstr_fcc(handler), info);
+
+ memset(info, 0, sizeof(*info));
+ info->dwSize = sizeof(*info);
+ info->dwVersionICM = ICVERSION;
+
+ if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, HKLM_DRIVERS32, 0, KEY_QUERY_VALUE, &key))
+ {
+ i = 0;
+ for (;;)
+ {
+ DWORD name_len = ARRAY_SIZE(name_buf), driver_len = ARRAY_SIZE(info->szDriver);
+
+ res = RegEnumValueA(key, i++, name_buf, &name_len, 0, 0, (BYTE *)buf, &driver_len);
+ if (res == ERROR_NO_MORE_ITEMS) break;
+
+ if (name_len != 9 || name_buf[4] != '.') continue;
+ ret_type = mmioStringToFOURCCA(name_buf, 0);
+ ret_handler = mmioStringToFOURCCA(name_buf + 5, 0);
+ if (type && compare_fourcc(type, ret_type)) continue;
+ if (compare_fourcc(handler, ret_handler) && handler != count++) continue;
+
+ info->fccType = ret_type;
+ info->fccHandler = ret_handler;
+ MultiByteToWideChar(CP_ACP, 0, buf, -1, info->szDriver, ARRAY_SIZE(info->szDriver));
+ TRACE("Returning codec %s, driver %s.\n", debugstr_a(name_buf), debugstr_a(buf));
+ return TRUE;
+ }
+ RegCloseKey(key);
+ }
+
+ if (GetPrivateProfileSectionA("drivers32", buf, sizeof(buf), "system.ini"))
+ {
+ char *s;
+ for (s = buf; *s; s += strlen(s) + 1)
+ {
+ if (s[4] != '.' || s[9] != '=') continue;
+ ret_type = mmioStringToFOURCCA(s, 0);
+ ret_handler = mmioStringToFOURCCA(s + 5, 0);
+ if (type && compare_fourcc(type, ret_type)) continue;
+ if (compare_fourcc(handler, ret_handler) && handler != count++) continue;
+
+ info->fccType = ret_type;
+ info->fccHandler = ret_handler;
+ MultiByteToWideChar(CP_ACP, 0, s + 10, -1, info->szDriver, ARRAY_SIZE(info->szDriver));
+ TRACE("Returning codec %s, driver %s.\n", debugstr_an(s, 8), debugstr_a(s + 10));
+ return TRUE;
+ }
+ }
+
+ LIST_FOR_EACH_ENTRY(driver, ®_driver_list, struct reg_driver, entry)
+ {
+ if (type && compare_fourcc(type, driver->fccType)) continue;
+ if (compare_fourcc(handler, driver->fccHandler) && handler != count++) continue;
+ if (driver->proc(0, NULL, ICM_GETINFO, (DWORD_PTR)info, sizeof(*info)) == sizeof(*info))
+ return TRUE;
+ }
+
+ info->fccType = type;
+ info->fccHandler = handler;
+ WARN("No driver found for codec %s.%s.\n", wine_dbgstr_fcc(type), wine_dbgstr_fcc(handler));
+ return FALSE;