Commit 0ff2c06c authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

Fixed RegEnumKey(Ex)W buffer sizes.

parent 7cfaf4ac
......@@ -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)
{
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment