Hugh McMaster : reg: Add basic syntax checks for the export operation.

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


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

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

reg: Add basic syntax checks for 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 | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/programs/reg/export.c b/programs/reg/export.c
index f4318ef..530d11b 100644
--- a/programs/reg/export.c
+++ b/programs/reg/export.c
@@ -18,12 +18,37 @@
 
 #include <windows.h>
 
+#include <wine/unicode.h>
 #include <wine/debug.h>
 
+#include "reg.h"
+
 WINE_DEFAULT_DEBUG_CHANNEL(reg);
 
+static BOOL is_overwrite_switch(const WCHAR *s)
+{
+    if (strlenW(s) > 2)
+        return FALSE;
+
+    if ((s[0] == '/' || s[0] == '-') && (s[1] == 'y' || s[1] == 'Y'))
+        return TRUE;
+
+    return FALSE;
+}
+
 int reg_export(int argc, WCHAR *argv[])
 {
+    if (argc == 3 || argc > 5)
+        goto error;
+
+    if (argc == 5 && !is_overwrite_switch(argv[4]))
+        goto error;
+
     FIXME(": operation not yet implemented\n");
     return 1;
+
+error:
+    output_message(STRING_INVALID_SYNTAX);
+    output_message(STRING_FUNC_HELP, struprW(argv[1]));
+    return 1;
 }




More information about the wine-cvs mailing list