[ros-diffs] [navaraf] 14202: Specify correct buffer size in GetPrivateProfileStringW calls.

navaraf at svn.reactos.com navaraf at svn.reactos.com
Sat Mar 19 22:48:36 CET 2005


Specify correct buffer size in GetPrivateProfileStringW calls.
Modified: trunk/reactos/lib/winmm/driver.c
Modified: trunk/reactos/lib/winmm/mci.c
  _____  

Modified: trunk/reactos/lib/winmm/driver.c
--- trunk/reactos/lib/winmm/driver.c	2005-03-19 20:39:25 UTC (rev
14201)
+++ trunk/reactos/lib/winmm/driver.c	2005-03-19 21:48:33 UTC (rev
14202)
@@ -226,7 +226,7 @@

     if (lRet == ERROR_SUCCESS) return TRUE;
     /* default to system.ini if we can't find it in the registry,
      * to support native installations where system.ini is still used
*/
-    return GetPrivateProfileStringW(sectName, keyName, &wsznull, buf,
sz, wszSystemIni);
+    return GetPrivateProfileStringW(sectName, keyName, &wsznull, buf,
sz / sizeof(WCHAR), wszSystemIni);
 }
 
 
/***********************************************************************
***
  _____  

Modified: trunk/reactos/lib/winmm/mci.c
--- trunk/reactos/lib/winmm/mci.c	2005-03-19 20:39:25 UTC (rev
14201)
+++ trunk/reactos/lib/winmm/mci.c	2005-03-19 21:48:33 UTC (rev
14202)
@@ -1840,7 +1840,7 @@

 		    RegQueryInfoKeyW( hKey, 0, 0, 0, &cnt, 0, 0, 0, 0,
0, 0, 0);
 		    RegCloseKey( hKey );
 		}
-		if (GetPrivateProfileStringW(wszMci, 0, wszNull, buf,
sizeof(buf), wszSystemIni))
+		if (GetPrivateProfileStringW(wszMci, 0, wszNull, buf,
sizeof(buf) / sizeof(buf[0]), wszSystemIni))
 		    for (s = buf; *s; s += strlenW(s) + 1) cnt++;
 	    }
 	} else {
@@ -1892,7 +1892,7 @@
 	        RegCloseKey( hKey );
 	    }
 	    if (!s) {
-		if (GetPrivateProfileStringW(wszMci, 0, wszNull, buf,
sizeof(buf), wszSystemIni)) {
+		if (GetPrivateProfileStringW(wszMci, 0, wszNull, buf,
sizeof(buf) / sizeof(buf[0]), wszSystemIni)) {
 		    for (p = buf; *p; p += strlenW(p) + 1, cnt++) {
                         TRACE("%ld: %s\n", cnt, debugstr_w(p));
 			if (cnt == lpParms->dwNumber - 1) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050319/06161b92/attachment.html


More information about the Ros-diffs mailing list