wined3d: Avoid touching the output value on failure in get_config_key_dword();.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2017-04-23 17:57:28 +02:00 committed by Alexandre Julliard
parent c09bb22c81
commit 449308ec5d
1 changed files with 12 additions and 5 deletions

View File

@ -127,13 +127,20 @@ static DWORD get_config_key(HKEY defkey, HKEY appkey, const char *name, char *bu
return ERROR_FILE_NOT_FOUND;
}
static DWORD get_config_key_dword(HKEY defkey, HKEY appkey, const char *name, DWORD *data)
static DWORD get_config_key_dword(HKEY defkey, HKEY appkey, const char *name, DWORD *value)
{
DWORD type;
DWORD size = sizeof(DWORD);
if (appkey && !RegQueryValueExA(appkey, name, 0, &type, (BYTE *)data, &size) && (type == REG_DWORD)) return 0;
if (defkey && !RegQueryValueExA(defkey, name, 0, &type, (BYTE *)data, &size) && (type == REG_DWORD)) return 0;
DWORD type, data, size;
size = sizeof(data);
if (appkey && !RegQueryValueExA(appkey, name, 0, &type, (BYTE *)&data, &size) && type == REG_DWORD) goto success;
size = sizeof(data);
if (defkey && !RegQueryValueExA(defkey, name, 0, &type, (BYTE *)&data, &size) && type == REG_DWORD) goto success;
return ERROR_FILE_NOT_FOUND;
success:
*value = data;
return 0;
}
static BOOL wined3d_dll_init(HINSTANCE hInstDLL)