Hugh McMaster : reg: Export REG_DWORD values.

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


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

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

reg: Export REG_DWORD values.

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

---

 programs/reg/export.c    | 15 +++++++++++++++
 programs/reg/tests/reg.c |  4 ++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/programs/reg/export.c b/programs/reg/export.c
index 6e59ca4..b566263 100644
--- a/programs/reg/export.c
+++ b/programs/reg/export.c
@@ -118,6 +118,14 @@ static void export_string_data(WCHAR **buf, WCHAR *data, size_t size)
     heap_free(str);
 }
 
+static void export_dword_data(WCHAR **buf, DWORD *data)
+{
+    static const WCHAR fmt[] = {'d','w','o','r','d',':','%','0','8','x',0};
+
+    *buf = heap_xalloc(15 * sizeof(WCHAR));
+    sprintfW(*buf, fmt, *data);
+}
+
 static size_t export_hex_data_type(HANDLE hFile, DWORD type)
 {
     static const WCHAR hex[] = {'h','e','x',':',0};
@@ -192,6 +200,13 @@ static void export_data(HANDLE hFile, WCHAR *value_name, DWORD value_len,
     case REG_SZ:
         export_string_data(&buf, data, size);
         break;
+    case REG_DWORD:
+        if (size)
+        {
+            export_dword_data(&buf, data);
+            break;
+        }
+        /* fall through */
     case REG_NONE:
     case REG_EXPAND_SZ:
     case REG_BINARY:
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c
index 88ec308..1ec9ca0 100644
--- a/programs/reg/tests/reg.c
+++ b/programs/reg/tests/reg.c
@@ -4451,7 +4451,7 @@ static void test_export(void)
 
     run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
     ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
-    ok(compare_export("file.reg", simple_test, TODO_REG_COMPARE), "compare_export() failed\n");
+    ok(compare_export("file.reg", simple_test, 0), "compare_export() failed\n");
 
     /* Test registry export with a complex data structure */
     add_key(hkey, "Subkey1", &subkey);
@@ -4573,7 +4573,7 @@ static void test_export(void)
 
     run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
     ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
-    ok(compare_export("file.reg", hex_types_test, TODO_REG_COMPARE), "compare_export() failed\n");
+    ok(compare_export("file.reg", hex_types_test, 0), "compare_export() failed\n");
 
     delete_key(HKEY_CURRENT_USER, KEY_BASE);
 }




More information about the wine-cvs mailing list