Module: wine Branch: master Commit: 449308ec5d2025058d46b17352c9fa05dbe0889e URL: http://source.winehq.org/git/wine.git/?a=commit;h=449308ec5d2025058d46b17352...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Sun Apr 23 17:57:28 2017 +0200
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
---
dlls/wined3d/wined3d_main.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c index 1a4e2f2..8f5da3c 100644 --- a/dlls/wined3d/wined3d_main.c +++ b/dlls/wined3d/wined3d_main.c @@ -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)