ICInfo enumeration fix

David Smith dsmith at algonet.se
Wed Feb 16 18:40:07 CST 2005


This is a fix for ICInfo() in msvideo when it is used to ask for a codec
by index.

The function is documented in
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_icinfo.asp.

You should be able to ask for a codec by index 0..N-1 with ICInfo(
"vidc", index, &retptr) but the old behaviour counted all codecs, not
just video. The patch changes that so that only vidc codecs are counted.

This is the first time I do anything with wine, and I'm not that used
to windows mm either, so please review carefully although the patch is
short :)

Regards,
David Smith

-------------- next part --------------
diff -aur wine-20050111-org/dlls/msvideo/msvideo_main.c wine-20050111/dlls/msvideo/msvideo_main.c
--- wine-20050111-org/dlls/msvideo/msvideo_main.c	2004-12-23 21:20:49.000000000 +0100
+++ wine-20050111/dlls/msvideo/msvideo_main.c	2005-02-17 00:22:50.000000000 +0100
@@ -116,14 +116,15 @@
     lRet = RegOpenKeyExA(HKEY_LOCAL_MACHINE, HKLM_DRIVERS32, 0, KEY_QUERY_VALUE, &hKey);
     if (lRet == ERROR_SUCCESS) 
     {
-	RegQueryInfoKeyA( hKey, 0, 0, 0, &cnt, 0, 0, 0, 0, 0, 0, 0);
-	for (i = 0; i < cnt; i++) 
+	DWORD numkeys;
+	RegQueryInfoKeyA( hKey, 0, 0, 0, &numkeys, 0, 0, 0, 0, 0, 0, 0);
+	for (i = 0; i < numkeys; i++) 
 	{
 	    bufLen = sizeof(buf) / sizeof(buf[0]);
 	    lRet = RegEnumKeyExA(hKey, i, buf, &bufLen, 0, 0, 0, &lastWrite);
 	    if (lRet != ERROR_SUCCESS) continue;
 	    if (strncasecmp(buf, fccTypeStr, 5) || buf[9] != '=') continue;
-	    if ((result = handler(buf, i, param))) break;
+	    if ((result = handler(buf, cnt++, param))) break;
 	}
     	RegCloseKey( hKey );
     }
@@ -132,10 +133,10 @@
     /* if that didn't work, go through the values in system.ini */
     if (GetPrivateProfileSectionA("drivers32", buf, sizeof(buf), "system.ini")) 
     {
-	for (s = buf; *s; cnt++, s += strlen(s) + 1)
+	for (s = buf; *s; s += strlen(s) + 1)
 	{
 	    if (strncasecmp(s, fccTypeStr, 5) || s[9] != '=') continue;
-	    if ((result = handler(s, cnt, param))) break;
+	    if ((result = handler(s, cnt++, param))) break;
 	}
     }
 



More information about the wine-patches mailing list