Specify correct buffer size in GetPrivateProfileStringW calls.

svn path=/trunk/; revision=14202
This commit is contained in:
Filip Navara 2005-03-19 21:48:33 +00:00
parent 8da44c3750
commit db3d786f03
2 changed files with 3 additions and 3 deletions

View file

@ -226,7 +226,7 @@ BOOL DRIVER_GetLibName(LPCWSTR keyName, LPCWSTR sectName, LPWSTR buf, int sz)
if (lRet == ERROR_SUCCESS) return TRUE; if (lRet == ERROR_SUCCESS) return TRUE;
/* default to system.ini if we can't find it in the registry, /* default to system.ini if we can't find it in the registry,
* to support native installations where system.ini is still used */ * 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);
} }
/************************************************************************** /**************************************************************************

View file

@ -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); RegQueryInfoKeyW( hKey, 0, 0, 0, &cnt, 0, 0, 0, 0, 0, 0, 0);
RegCloseKey( hKey ); 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++; for (s = buf; *s; s += strlenW(s) + 1) cnt++;
} }
} else { } else {
@ -1892,7 +1892,7 @@ static DWORD MCI_SysInfo(UINT uDevID, DWORD dwFlags, LPMCI_SYSINFO_PARMSW lpParm
RegCloseKey( hKey ); RegCloseKey( hKey );
} }
if (!s) { 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++) { for (p = buf; *p; p += strlenW(p) + 1, cnt++) {
TRACE("%ld: %s\n", cnt, debugstr_w(p)); TRACE("%ld: %s\n", cnt, debugstr_w(p));
if (cnt == lpParms->dwNumber - 1) { if (cnt == lpParms->dwNumber - 1) {