https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3d84e25ac0ad53d837968…
commit 3d84e25ac0ad53d837968bc056ef9cf2691075e7
Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr>
AuthorDate: Thu Nov 28 17:11:27 2019 +0100
Commit: Victor Perevertkin <victor(a)perevertkin.ru>
CommitDate: Fri Nov 29 10:45:02 2019 +0300
[CHARMAP] LoadSettings(): Properly use RegQueryValueEx()
---
base/applications/charmap/settings.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/base/applications/charmap/settings.c b/base/applications/charmap/settings.c
index 6d44a259513..5a30f6d0943 100644
--- a/base/applications/charmap/settings.c
+++ b/base/applications/charmap/settings.c
@@ -59,7 +59,8 @@ extern void LoadSettings(void)
{
TCHAR szBuffer[MAX_PATH];
DWORD dwAdvancedChecked;
- unsigned long type = REG_DWORD, size = 1024;
+ DWORD type, size = sizeof(dwAdvancedChecked);
+ LSTATUS lstatus;
/* Restore last selected font */
if (QueryStringValue(HKEY_CURRENT_USER, g_szGeneralRegKey, _T("Font"),
szBuffer, (sizeof(szBuffer)/sizeof(szBuffer[0]))) == ERROR_SUCCESS)
@@ -89,10 +90,11 @@ extern void LoadSettings(void)
}
}
- RegQueryValueEx(hKey, _T("Advanced"), NULL, &type,
(LPBYTE)&dwAdvancedChecked, &size);
-
- if(dwAdvancedChecked != FALSE)
+ lstatus = RegQueryValueEx(hKey, _T("Advanced"), NULL, &type,
(LPBYTE)&dwAdvancedChecked, &size);
+ if (lstatus == ERROR_SUCCESS && type == REG_DWORD &&
dwAdvancedChecked != FALSE)
+ {
SendDlgItemMessage(hCharmapDlg, IDC_CHECK_ADVANCED, BM_CLICK, MF_CHECKED,
0);
+ }
RegCloseKey(hKey);
}