Fixed RegEnumKey(Ex)W buffer sizes.

This commit is contained in:
Marcus Meissner 2008-10-12 19:50:20 +02:00 committed by Alexandre Julliard
parent 7cfaf4aca0
commit 0ff2c06c1d
5 changed files with 8 additions and 8 deletions

View File

@ -737,7 +737,7 @@ HRESULT read_types(HKEY root, LPCWSTR key, ULONG *supplied, ULONG requested, DMO
while (rc == ERROR_SUCCESS)
{
len = MAX_PATH * sizeof(WCHAR);
len = MAX_PATH;
rc = RegEnumKeyExW(hkey, index, szNextKey, &len, NULL, NULL, NULL, NULL);
if (rc == ERROR_SUCCESS)
{
@ -749,7 +749,7 @@ HRESULT read_types(HKEY root, LPCWSTR key, ULONG *supplied, ULONG requested, DMO
RegOpenKeyExW(hkey, szNextKey, 0, KEY_READ, &subk);
while (rcs == ERROR_SUCCESS)
{
len = MAX_PATH * sizeof(WCHAR);
len = MAX_PATH;
rcs = RegEnumKeyExW(subk, sub_index, szSubKey, &len, NULL, NULL, NULL, NULL);
if (rcs == ERROR_SUCCESS)
{

View File

@ -187,7 +187,7 @@ BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LP
return FALSE;
ret = FALSE;
if (HCR_GetDefaultVerbW(hkeyClass, szVerb, sTempVerb, sizeof(sTempVerb)))
if (HCR_GetDefaultVerbW(hkeyClass, szVerb, sTempVerb, sizeof(sTempVerb)/sizeof(sTempVerb[0])))
{
WCHAR sTemp[MAX_PATH];
lstrcpyW(sTemp, swShell);

View File

@ -472,7 +472,7 @@ static UINT SHELL_FindExecutableByOperation(LPCWSTR lpOperation, LPWSTR key, LPW
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, filetype, 0, 0x02000000, &hkeyClass))
return SE_ERR_NOASSOC;
if (!HCR_GetDefaultVerbW(hkeyClass, lpOperation, verb, sizeof(verb)))
if (!HCR_GetDefaultVerbW(hkeyClass, lpOperation, verb, sizeof(verb)/sizeof(verb[0])))
return SE_ERR_NOASSOC;
RegCloseKey(hkeyClass);

View File

@ -1899,7 +1899,7 @@ static DWORD MCI_SysInfo(UINT uDevID, DWORD dwFlags, LPMCI_SYSINFO_PARMSW lpParm
if (RegQueryInfoKeyW( hKey, 0, 0, 0, &cnt,
0, 0, 0, 0, 0, 0, 0) == ERROR_SUCCESS &&
lpParms->dwNumber <= cnt) {
DWORD bufLen = sizeof(buf);
DWORD bufLen = sizeof(buf)/sizeof(buf[0]);
if (RegEnumKeyExW(hKey, lpParms->dwNumber - 1,
buf, &bufLen, 0, 0, 0, 0) == ERROR_SUCCESS)
s = buf;

View File

@ -128,7 +128,7 @@ int ASPI_GetNumControllers(void)
ERR("Could not open HKLM\\%s\n", debugstr_w(wDevicemapScsi));
return 0;
}
while (RegEnumKeyW(hkeyScsi, i++, wPortName, sizeof(wPortName)) == ERROR_SUCCESS)
while (RegEnumKeyW(hkeyScsi, i++, wPortName, sizeof(wPortName)/sizeof(wPortName[0])) == ERROR_SUCCESS)
{
if (RegOpenKeyExW(hkeyScsi, wPortName, 0, KEY_QUERY_VALUE, &hkeyPort) == ERROR_SUCCESS)
{
@ -190,7 +190,7 @@ DWORD ASPI_GetHCforController( int controller )
ERR("Could not open HKLM\\%s\n", debugstr_w(wDevicemapScsi));
return 0xFFFFFFFF;
}
while (RegEnumKeyW(hkeyScsi, i++, wPortName, sizeof(wPortName)) == ERROR_SUCCESS)
while (RegEnumKeyW(hkeyScsi, i++, wPortName, sizeof(wPortName)/sizeof(wPortName[0])) == ERROR_SUCCESS)
{
if (RegOpenKeyExW(hkeyScsi, wPortName, 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS,
&hkeyPort) == ERROR_SUCCESS)
@ -213,7 +213,7 @@ DWORD ASPI_GetHCforController( int controller )
return 0xFFFFFFFF;
}
if (RegEnumKeyW(hkeyPort, -num_ha, wBusName, sizeof(wBusName)) != ERROR_SUCCESS)
if (RegEnumKeyW(hkeyPort, -num_ha, wBusName, sizeof(wBusName)/sizeof(wBusName[0])) != ERROR_SUCCESS)
{
ERR("Failed to enumerate keys\n");
RegCloseKey(hkeyPort);