Commit 49180106 authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

reg: Export REG_DWORD values.

parent b31f1688
......@@ -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:
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment