Commit efd98cae authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

cmd: Pass size in bytes to RegQueryValueExW().

parent 2adf4376
......@@ -4763,7 +4763,7 @@ void WCMD_assoc (const WCHAR *args, BOOL assoc) {
WCHAR *newValue;
LONG rc = ERROR_SUCCESS;
WCHAR keyValue[MAXSTRING];
DWORD valueLen = MAXSTRING;
DWORD valueLen;
HKEY readKey;
/* See if parameter includes '=' */
......@@ -4803,7 +4803,7 @@ void WCMD_assoc (const WCHAR *args, BOOL assoc) {
if (RegOpenKeyExW(key, subkey, 0, accessOptions, &readKey) == ERROR_SUCCESS) {
valueLen = ARRAY_SIZE(keyValue);
valueLen = sizeof(keyValue);
rc = RegQueryValueExW(readKey, NULL, NULL, NULL, (LPBYTE)keyValue, &valueLen);
WCMD_output_asis(keyName);
WCMD_output_asis(L"=");
......@@ -4836,6 +4836,7 @@ void WCMD_assoc (const WCHAR *args, BOOL assoc) {
if (RegOpenKeyExW(key, subkey, 0, accessOptions, &readKey) == ERROR_SUCCESS) {
valueLen = sizeof(keyValue);
rc = RegQueryValueExW(readKey, NULL, NULL, NULL, (LPBYTE)keyValue, &valueLen);
WCMD_output_asis(args);
WCMD_output_asis(L"=");
......
......@@ -2700,7 +2700,7 @@ int __cdecl wmain (int argc, WCHAR *argvW[])
size = sizeof(DWORD);
RegQueryValueExW(key, L"DefaultColor", NULL, NULL, (BYTE *)&value, &size);
} else if (type == REG_SZ) {
size = ARRAY_SIZE(strvalue);
size = sizeof(strvalue);
RegQueryValueExW(key, L"DefaultColor", NULL, NULL, (BYTE *)strvalue, &size);
value = wcstoul(strvalue, NULL, 10);
}
......@@ -2719,7 +2719,7 @@ int __cdecl wmain (int argc, WCHAR *argvW[])
size = sizeof(DWORD);
RegQueryValueExW(key, L"DefaultColor", NULL, NULL, (BYTE *)&value, &size);
} else if (type == REG_SZ) {
size = ARRAY_SIZE(strvalue);
size = sizeof(strvalue);
RegQueryValueExW(key, L"DefaultColor", NULL, NULL, (BYTE *)strvalue, &size);
value = wcstoul(strvalue, NULL, 10);
}
......
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