reg: Export REG_DWORD values.

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2017-12-03 06:50:23 +00:00 committed by Alexandre Julliard
parent b31f16885d
commit 491801063f
2 changed files with 17 additions and 2 deletions

View File

@ -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:

View File

@ -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);
}