cmd: Pass size in bytes to RegQueryValueExW().

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2021-10-20 10:06:56 +08:00 committed by Alexandre Julliard
parent 2adf4376d8
commit efd98caef1
2 changed files with 5 additions and 4 deletions

View File

@ -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"=");

View File

@ -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);
}