From db3d786f03fb657bdfb37e9a5b7803333ebc48d1 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Sat, 19 Mar 2005 21:48:33 +0000 Subject: [PATCH] Specify correct buffer size in GetPrivateProfileStringW calls. svn path=/trunk/; revision=14202 --- reactos/lib/winmm/driver.c | 2 +- reactos/lib/winmm/mci.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/reactos/lib/winmm/driver.c b/reactos/lib/winmm/driver.c index f03902712eb..9bda8da6dbf 100644 --- a/reactos/lib/winmm/driver.c +++ b/reactos/lib/winmm/driver.c @@ -226,7 +226,7 @@ BOOL DRIVER_GetLibName(LPCWSTR keyName, LPCWSTR sectName, LPWSTR buf, int sz) 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); } /************************************************************************** diff --git a/reactos/lib/winmm/mci.c b/reactos/lib/winmm/mci.c index f19006a3822..6cf7a639f52 100644 --- a/reactos/lib/winmm/mci.c +++ b/reactos/lib/winmm/mci.c @@ -1840,7 +1840,7 @@ static DWORD MCI_SysInfo(UINT uDevID, DWORD dwFlags, LPMCI_SYSINFO_PARMSW lpParm 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 @@ static DWORD MCI_SysInfo(UINT uDevID, DWORD dwFlags, LPMCI_SYSINFO_PARMSW lpParm 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) {