[PATCH 5/5] reg: Move duplicate /v, /ve and /va combination checks to wmain

Hugh McMaster hugh.mcmaster at outlook.com
Mon Jun 6 00:32:16 CDT 2016


Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
 programs/reg/reg.c | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/programs/reg/reg.c b/programs/reg/reg.c
index ea77426..84818da 100644
--- a/programs/reg/reg.c
+++ b/programs/reg/reg.c
@@ -350,12 +350,6 @@ static int reg_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty,
 {
     HKEY key;
 
-    if (value_name && value_empty)
-    {
-        output_message(STRING_INVALID_CMDLINE);
-        return 1;
-    }
-
     if (RegCreateKeyW(root, path, &key) != ERROR_SUCCESS)
     {
         output_message(STRING_INVALID_KEY);
@@ -416,12 +410,6 @@ static int reg_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name
 {
     HKEY key;
 
-    if ((value_name && value_empty) || (value_name && value_all) || (value_empty && value_all))
-    {
-        output_message(STRING_INVALID_CMDLINE);
-        return 1;
-    }
-
     if (!force)
     {
         BOOL ret;
@@ -808,12 +796,6 @@ static int reg_query(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name,
     WCHAR newlineW[] = {'\n',0};
     int ret;
 
-    if (value_name && value_empty)
-    {
-        output_message(STRING_INVALID_CMDLINE);
-        return 1;
-    }
-
     if (RegOpenKeyExW(root, path, 0, KEY_READ, &key) != ERROR_SUCCESS)
     {
         output_message(STRING_CANNOT_FIND);
@@ -990,6 +972,12 @@ int wmain(int argc, WCHAR *argvW[])
             force = TRUE;
     }
 
+    if ((value_name && value_empty) || (value_name && value_all) || (value_empty && value_all))
+    {
+        output_message(STRING_INVALID_CMDLINE);
+        return 1;
+    }
+
     if (op == REG_ADD)
         ret = reg_add(root, path, value_name, value_empty, type, separator, data, force);
     else if (op == REG_DELETE)
-- 
1.9.1




More information about the wine-patches mailing list