comdlg32: Improve error handling in get_config_key_string.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-05-08 16:41:12 +02:00 committed by Alexandre Julliard
parent 0239026bf3
commit a16b9ff583
1 changed files with 4 additions and 5 deletions

View File

@ -250,11 +250,10 @@ static BOOL get_config_key_string(HKEY hkey, const WCHAR *name, WCHAR **value)
DWORD type, size;
WCHAR *str;
if (hkey && !RegQueryValueExW(hkey, name, 0, &type, NULL, &size))
{
if (type != REG_SZ && type != REG_EXPAND_SZ)
return FALSE;
}
if (RegQueryValueExW(hkey, name, 0, &type, NULL, &size))
return FALSE;
if (type != REG_SZ && type != REG_EXPAND_SZ)
return FALSE;
str = heap_alloc(size);
if (RegQueryValueExW(hkey, name, 0, &type, (BYTE *)str, &size))