Skip to content

Commit 55ed59c

Browse files
committed
[MSGINA] ReadRegDwordValue(): Return valid errors on data validation (reactos#8370)
1 parent e7073d2 commit 55ed59c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

dll/win32/msgina/utils.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ ReadRegDwordValue(
5353

5454
cbData = sizeof(dwValue);
5555
rc = RegQueryValueExW(hKey, pszValue, NULL, &dwType, (PBYTE)&dwValue, &cbData);
56-
if ((rc == ERROR_SUCCESS) && (dwType == REG_DWORD) && (cbData == sizeof(dwValue)))
57-
{
58-
*pValue = dwValue;
59-
return ERROR_SUCCESS;
60-
}
56+
if (rc != ERROR_SUCCESS)
57+
return rc;
58+
if (dwType != REG_DWORD)
59+
return ERROR_UNSUPPORTED_TYPE;
60+
if (cbData != sizeof(dwValue))
61+
return ERROR_INVALID_DATA; // ERROR_DATATYPE_MISMATCH;
6162

62-
return rc;
63+
*pValue = dwValue;
64+
return ERROR_SUCCESS;
6365
}
6466

6567
PWSTR

0 commit comments

Comments
 (0)