[REG] Sync with Wine Staging 2.2. CORE-12823
authorAmine Khaldi <amine.khaldi@reactos.org>
Sun, 26 Feb 2017 16:16:31 +0000 (16:16 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 26 Feb 2017 16:16:31 +0000 (16:16 +0000)
68c1765 reg: Simplify help handling by removing an if-else if-else block.
8a8a753 reg: Fix dword conversion on 64-bit operating systems.

svn path=/trunk/; revision=73931

reactos/base/applications/cmdutils/reg/reg.c
reactos/media/doc/README.WINE

index 4459fb6..094a2f4 100644 (file)
@@ -255,9 +255,9 @@ static LPBYTE get_regdata(const WCHAR *data, DWORD reg_type, WCHAR separator, DW
         case REG_DWORD_BIG_ENDIAN: /* Yes, this is correct! */
         {
             LPWSTR rest;
         case REG_DWORD_BIG_ENDIAN: /* Yes, this is correct! */
         {
             LPWSTR rest;
-            DWORD val;
+            unsigned long val;
             val = strtoulW(data, &rest, (tolowerW(data[1]) == 'x') ? 16 : 10);
             val = strtoulW(data, &rest, (tolowerW(data[1]) == 'x') ? 16 : 10);
-            if (*rest || data[0] == '-' || (val == ~0u && errno == ERANGE)) {
+            if (*rest || data[0] == '-' || (val == ~0u && errno == ERANGE) || val > ~0u) {
                 output_message(STRING_MISSING_INTEGER);
                 break;
             }
                 output_message(STRING_MISSING_INTEGER);
                 break;
             }
@@ -908,23 +908,32 @@ static const WCHAR addW[] = {'a','d','d',0};
 static const WCHAR deleteW[] = {'d','e','l','e','t','e',0};
 static const WCHAR queryW[] = {'q','u','e','r','y',0};
 
 static const WCHAR deleteW[] = {'d','e','l','e','t','e',0};
 static const WCHAR queryW[] = {'q','u','e','r','y',0};
 
-static enum operations get_operation(const WCHAR *str)
+static enum operations get_operation(const WCHAR *str, int *op_help)
 {
     if (!lstrcmpiW(str, addW))
 {
     if (!lstrcmpiW(str, addW))
+    {
+        *op_help = STRING_ADD_USAGE;
         return REG_ADD;
         return REG_ADD;
+    }
 
     if (!lstrcmpiW(str, deleteW))
 
     if (!lstrcmpiW(str, deleteW))
+    {
+        *op_help = STRING_DELETE_USAGE;
         return REG_DELETE;
         return REG_DELETE;
+    }
 
     if (!lstrcmpiW(str, queryW))
 
     if (!lstrcmpiW(str, queryW))
+    {
+        *op_help = STRING_QUERY_USAGE;
         return REG_QUERY;
         return REG_QUERY;
+    }
 
     return REG_INVALID;
 }
 
 int wmain(int argc, WCHAR *argvW[])
 {
 
     return REG_INVALID;
 }
 
 int wmain(int argc, WCHAR *argvW[])
 {
-    int i, op, ret;
+    int i, op, op_help, ret;
     BOOL show_op_help = FALSE;
     static const WCHAR switchVAW[] = {'v','a',0};
     static const WCHAR switchVEW[] = {'v','e',0};
     BOOL show_op_help = FALSE;
     static const WCHAR switchVAW[] = {'v','a',0};
     static const WCHAR switchVEW[] = {'v','e',0};
@@ -945,7 +954,7 @@ int wmain(int argc, WCHAR *argvW[])
         return 0;
     }
 
         return 0;
     }
 
-    op = get_operation(argvW[1]);
+    op = get_operation(argvW[1], &op_help);
 
     if (op == REG_INVALID)
     {
 
     if (op == REG_INVALID)
     {
@@ -965,12 +974,7 @@ int wmain(int argc, WCHAR *argvW[])
     }
     else if (show_op_help)
     {
     }
     else if (show_op_help)
     {
-        if (op == REG_ADD)
-            output_message(STRING_ADD_USAGE);
-        else if (op == REG_DELETE)
-            output_message(STRING_DELETE_USAGE);
-        else
-            output_message(STRING_QUERY_USAGE);
+        output_message(op_help);
         return 0;
     }
 
         return 0;
     }
 
index 9853bc5..dbffd65 100644 (file)
@@ -227,7 +227,7 @@ reactos/win32ss/printing/monitors/localmon/ui/  # Synced to WineStaging-1.9.11 (
 ReactOS shares the following programs with Winehq.
 
 reactos/base/applications/cmdutils/cscript  # Synced to WineStaging-1.9.11
 ReactOS shares the following programs with Winehq.
 
 reactos/base/applications/cmdutils/cscript  # Synced to WineStaging-1.9.11
-reactos/base/applications/cmdutils/reg      # Synced to WineStaging-1.9.16
+reactos/base/applications/cmdutils/reg      # Synced to WineStaging-2.2
 reactos/base/applications/cmdutils/schtasks # Synced to WineStaging-1.9.14
 reactos/base/applications/cmdutils/taskkill # Synced to WineStaging-1.9.11
 reactos/base/applications/cmdutils/wmic     # Synced to WineStaging-1.9.11
 reactos/base/applications/cmdutils/schtasks # Synced to WineStaging-1.9.14
 reactos/base/applications/cmdutils/taskkill # Synced to WineStaging-1.9.11
 reactos/base/applications/cmdutils/wmic     # Synced to WineStaging-1.9.11