Commit 3396ca87 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

msvfw32: Fix driver enumeration.

parent f08342f5
......@@ -223,34 +223,33 @@ static int compare_fourcc(DWORD fcc1, DWORD fcc2)
return strncasecmp(fcc_str1, fcc_str2, 4);
}
typedef BOOL (*enum_handler_t)(const char*, unsigned int, void*);
typedef BOOL (*enum_handler_t)(const char *name, const char *driver, unsigned int index, void *param);
static BOOL enum_drivers(DWORD fccType, enum_handler_t handler, void* param)
{
CHAR buf[2048], fccTypeStr[5], *s;
char fccTypeStr[4];
char name_buf[10];
char buf[2048];
DWORD i, cnt = 0, lRet;
BOOL result = FALSE;
HKEY hKey;
fourcc_to_string(fccTypeStr, fccType);
fccTypeStr[4] = '.';
/* first, go through the registry entries */
lRet = RegOpenKeyExA(HKEY_LOCAL_MACHINE, HKLM_DRIVERS32, 0, KEY_QUERY_VALUE, &hKey);
if (lRet == ERROR_SUCCESS)
{
DWORD name, data, type;
i = 0;
for (;;)
{
name = 10;
data = sizeof buf - name;
lRet = RegEnumValueA(hKey, i++, buf, &name, 0, &type, (LPBYTE)(buf+name), &data);
DWORD name_len = 10, driver_len = 128;
lRet = RegEnumValueA(hKey, i++, name_buf, &name_len, 0, 0, (BYTE *)buf, &driver_len);
if (lRet == ERROR_NO_MORE_ITEMS) break;
if (lRet != ERROR_SUCCESS) continue;
if (fccType && (name != 9 || strncasecmp(buf, fccTypeStr, 5))) continue;
buf[name] = '=';
if ((result = handler(buf, cnt++, param))) break;
if (name_len != 9 || name_buf[4] != '.') continue;
if (fccType && strncasecmp(name_buf, fccTypeStr, 4)) continue;
if ((result = handler(name_buf, buf, cnt++, param))) break;
}
RegCloseKey( hKey );
}
......@@ -259,11 +258,12 @@ static BOOL enum_drivers(DWORD fccType, enum_handler_t handler, void* param)
/* if that didn't work, go through the values in system.ini */
if (GetPrivateProfileSectionA("drivers32", buf, sizeof(buf), "system.ini"))
{
char *s;
for (s = buf; *s; s += strlen(s) + 1)
{
TRACE("got %s\n", s);
if (fccType && (strncasecmp(s, fccTypeStr, 5) || s[9] != '=')) continue;
if ((result = handler(s, cnt++, param))) break;
if (s[4] != '.' || s[9] != '=') continue;
if (fccType && strncasecmp(s, fccTypeStr, 4)) continue;
if ((result = handler(s, s + 10, cnt++, param))) break;
}
}
......@@ -294,10 +294,11 @@ DWORD WINAPI VideoForWindowsVersion(void)
return 0x040003B6; /* 4.950 */
}
static BOOL ICInfo_enum_handler(const char *drv, unsigned int nr, void *param)
static BOOL ICInfo_enum_handler(const char *name, const char *driver, unsigned int nr, void *param)
{
ICINFO *lpicinfo = param;
DWORD fccHandler = mmioStringToFOURCCA(drv + 5, 0);
DWORD fccType = mmioStringToFOURCCA(name, 0);
DWORD fccHandler = mmioStringToFOURCCA(name + 5, 0);
if (lpicinfo->fccHandler != nr && compare_fourcc(lpicinfo->fccHandler, fccHandler))
return FALSE;
......@@ -308,7 +309,7 @@ static BOOL ICInfo_enum_handler(const char *drv, unsigned int nr, void *param)
lpicinfo->dwVersionICM = ICVERSION;
lpicinfo->szName[0] = 0;
lpicinfo->szDescription[0] = 0;
MultiByteToWideChar(CP_ACP, 0, drv + 10, -1, lpicinfo->szDriver,
MultiByteToWideChar(CP_ACP, 0, driver, -1, lpicinfo->szDriver,
sizeof(lpicinfo->szDriver)/sizeof(WCHAR));
return TRUE;
......@@ -647,10 +648,10 @@ static HIC try_driver(driver_info_t *info)
return 0;
}
static BOOL ICLocate_enum_handler(const char *drv, unsigned int nr, void *param)
static BOOL ICLocate_enum_handler(const char *name, const char *driver, unsigned int nr, void *param)
{
driver_info_t *info = param;
info->fccHandler = mmioStringToFOURCCA(drv + 5, 0);
info->fccHandler = mmioStringToFOURCCA(name + 5, 0);
info->hic = try_driver(info);
return info->hic != 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment