This commit is contained in:
akallabeth 2024-08-07 09:33:28 +02:00 committed by Armin Novak
parent 15def36dd6
commit 9fe1ff0165
No known key found for this signature in database
GPG Key ID: 2CF4A2D2D3D72105

View File

@ -385,11 +385,13 @@ LONG RegQueryValueExW(HKEY hKey, LPCWSTR lpValueName, LPDWORD lpReserved, LPDWOR
case REG_DWORD_BIG_ENDIAN:
case REG_QWORD:
case REG_DWORD:
return reg_read_int(pValue, lpData, lpcbData);
status = reg_read_int(pValue, lpData, lpcbData);
goto end;
case REG_SZ:
{
const size_t length = strnlen(pValue->data.string, UINT32_MAX) * sizeof(WCHAR);
status = ERROR_SUCCESS;
if (lpData != NULL)
{
DWORD size = 0;
@ -404,14 +406,13 @@ LONG RegQueryValueExW(HKEY hKey, LPCWSTR lpValueName, LPDWORD lpReserved, LPDWOR
size = *lpcbData;
*lpcbData = (DWORD)length;
if (size < length)
return ERROR_MORE_DATA;
status = ERROR_MORE_DATA;
if (ConvertUtf8NToWChar(pValue->data.string, length, cnv.wc, length) < 0)
return ERROR_OUTOFMEMORY;
status = ERROR_OUTOFMEMORY;
}
else if (lpcbData)
*lpcbData = (UINT32)length;
status = ERROR_SUCCESS;
goto end;
}
default: