Signed-off-by: Zebediah Figura z.figura12@gmail.com --- Fixes e.g. msacm.l3acm being enumerated as "msac".".l3a".
This behaviour matches that on Windows tested mainly by manually modifying the registry. If this is appropriate for a test I will add one.
dlls/msvfw32/msvideo_main.c | 53 +++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 26 deletions(-)
diff --git a/dlls/msvfw32/msvideo_main.c b/dlls/msvfw32/msvideo_main.c index d49ea74..82351d6 100644 --- a/dlls/msvfw32/msvideo_main.c +++ b/dlls/msvfw32/msvideo_main.c @@ -223,48 +223,48 @@ 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); - 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; - } - RegCloseKey( hKey ); + { + 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 (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 ); } if (result) return result;
/* if that didn't work, go through the values in system.ini */ if (GetPrivateProfileSectionA("drivers32", buf, sizeof(buf), "system.ini")) { - 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; - } + char *s; + for (s = buf; *s; s += strlen(s) + 1) + { + if (s[5] != '.' || s[9] != '=') continue; + if (fccType && strncasecmp(s, fccTypeStr, 4)) continue; + if ((result = handler(s, s + 10, cnt++, param))) break; + } }
return result; @@ -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; }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- Fixes https://bugs.winehq.org/show_bug.cgi?id=44489.
dlls/msvfw32/msvideo_main.c | 1 + dlls/msvfw32/tests/msvfw.c | 6 ++++++ 2 files changed, 7 insertions(+)
diff --git a/dlls/msvfw32/msvideo_main.c b/dlls/msvfw32/msvideo_main.c index 82351d6..6423e80 100644 --- a/dlls/msvfw32/msvideo_main.c +++ b/dlls/msvfw32/msvideo_main.c @@ -303,6 +303,7 @@ static BOOL ICInfo_enum_handler(const char *name, const char *driver, unsigned i if (lpicinfo->fccHandler != nr && compare_fourcc(lpicinfo->fccHandler, fccHandler)) return FALSE;
+ lpicinfo->fccType = fccType; lpicinfo->fccHandler = fccHandler; lpicinfo->dwFlags = 0; lpicinfo->dwVersion = 0; diff --git a/dlls/msvfw32/tests/msvfw.c b/dlls/msvfw32/tests/msvfw.c index c6fe0f2..beeca9f 100644 --- a/dlls/msvfw32/tests/msvfw.c +++ b/dlls/msvfw32/tests/msvfw.c @@ -294,6 +294,7 @@ static void test_ICInfo(void) for (i = found = 0; ICInfo(0, i, &info); i++) { trace("Codec name: %s, fccHandler: 0x%08x\n", wine_dbgstr_w(info.szName), info.fccHandler); + ok(info.fccType, "expected nonzero fccType\n");
ok(ICInfo(info.fccType, info.fccHandler, &info2), "ICInfo failed on fcc 0x%08x\n", info.fccHandler); @@ -308,6 +309,11 @@ static void test_ICInfo(void) "ICInfo failed on fcc 0x%08x\n", info.fccHandler); } ok(found != 0, "expected at least one codec\n"); + + memset(&info, 0, sizeof(info)); + ok(!ICInfo(ICTYPE_VIDEO, mmioFOURCC('f','a','k','e'), &info), "expected failure\n"); + ok(info.fccType == ICTYPE_VIDEO, "got 0x%08x\n", info.fccType); + ok(info.fccHandler == mmioFOURCC('f','a','k','e'), "got 0x%08x\n", info.fccHandler); }
START_TEST(msvfw)
Zebediah Figura z.figura12@gmail.com writes:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
Fixes e.g. msacm.l3acm being enumerated as "msac".".l3a".
This behaviour matches that on Windows tested mainly by manually modifying the registry. If this is appropriate for a test I will add one.
dlls/msvfw32/msvideo_main.c | 53 +++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 26 deletions(-)
This one also fails:
../../../tools/runtest -q -P wine -T ../../.. -M msvfw32.dll -p msvfw32_test.exe.so msvfw && touch msvfw.ok msvfw.c:34: Test failed: ICOpen(vidc.0) failed msvfw.c:43: Test failed: ICOpen(vidc.0) failed msvfw.c:101: Test failed: RLE8->RGB failed msvfw.c:140: Test failed: cvid->RGB16 failed msvfw.c:144: Test failed: cvid->RGB16 height<0 failed msvfw.c:150: Test failed: cvid->RGB32 failed msvfw.c:154: Test failed: cvid->RGB32 height<0 failed msvfw.c:169: Test failed: MSVC->RGB16 failed msvfw.c:215: Test failed: RGB8->RGB identity failed msvfw.c:220: Test failed: RLE8->RGB again failed msvfw.c:310: Test failed: expected at least one codec Makefile:218: recipe for target 'msvfw.ok' failed make: *** [msvfw.ok] Error 11
On 13/02/18 12:19, Alexandre Julliard wrote:
Zebediah Figura z.figura12@gmail.com writes:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
Fixes e.g. msacm.l3acm being enumerated as "msac".".l3a".
This behaviour matches that on Windows tested mainly by manually modifying the registry. If this is appropriate for a test I will add one.
dlls/msvfw32/msvideo_main.c | 53 +++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 26 deletions(-)
This one also fails:
../../../tools/runtest -q -P wine -T ../../.. -M msvfw32.dll -p msvfw32_test.exe.so msvfw && touch msvfw.ok msvfw.c:34: Test failed: ICOpen(vidc.0) failed msvfw.c:43: Test failed: ICOpen(vidc.0) failed msvfw.c:101: Test failed: RLE8->RGB failed msvfw.c:140: Test failed: cvid->RGB16 failed msvfw.c:144: Test failed: cvid->RGB16 height<0 failed msvfw.c:150: Test failed: cvid->RGB32 failed msvfw.c:154: Test failed: cvid->RGB32 height<0 failed msvfw.c:169: Test failed: MSVC->RGB16 failed msvfw.c:215: Test failed: RGB8->RGB identity failed msvfw.c:220: Test failed: RLE8->RGB again failed msvfw.c:310: Test failed: expected at least one codec Makefile:218: recipe for target 'msvfw.ok' failed make: *** [msvfw.ok] Error 11
Whoops. I've sent an updated patch; thanks.