Hugh McMaster : reg: Validate the registry key before commencing the export operation.

Alexandre Julliard julliard at winehq.org
Mon Dec 4 14:58:20 CST 2017


Module: wine
Branch: master
Commit: 17494012a0e2aa91e188087fd826e94139e6d430
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=17494012a0e2aa91e188087fd826e94139e6d430

Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date:   Sun Dec  3 06:50:14 2017 +0000

reg: Validate the registry key before commencing the export operation.

Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/reg/export.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/programs/reg/export.c b/programs/reg/export.c
index 720b9ef..9d0d332 100644
--- a/programs/reg/export.c
+++ b/programs/reg/export.c
@@ -38,7 +38,7 @@ static BOOL is_overwrite_switch(const WCHAR *s)
 
 int reg_export(int argc, WCHAR *argv[])
 {
-    HKEY root;
+    HKEY root, hkey;
     WCHAR *path, *long_key;
 
     if (argc == 3 || argc > 5)
@@ -50,7 +50,16 @@ int reg_export(int argc, WCHAR *argv[])
     if (argc == 5 && !is_overwrite_switch(argv[4]))
         goto error;
 
+    if (RegOpenKeyExW(root, path, 0, KEY_READ, &hkey))
+    {
+        output_message(STRING_INVALID_KEY);
+        return 1;
+    }
+
     FIXME(": operation not yet implemented\n");
+
+    RegCloseKey(hkey);
+
     return 1;
 
 error:




More information about the wine-cvs mailing list