From 8a8a2c9bb9a19f62d27520d2ae87c6cf23cd6e50 Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Fri, 10 Nov 2017 12:23:05 +0000 Subject: [PATCH] regedit: Correctly export REG_DWORD values with no data. Signed-off-by: Hugh McMaster Signed-off-by: Alexandre Julliard --- programs/regedit/regproc.c | 8 ++++++-- programs/regedit/tests/regedit.c | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index 3d1e3da422bf..0911b50110c5 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -1345,8 +1345,12 @@ static void export_data(FILE *fp, WCHAR *value_name, DWORD value_len, DWORD type export_string_data(&buf, data, size); break; case REG_DWORD: - export_dword_data(&buf, data); - break; + if (size) + { + export_dword_data(&buf, data); + break; + } + /* fall through */ case REG_NONE: case REG_EXPAND_SZ: case REG_BINARY: diff --git a/programs/regedit/tests/regedit.c b/programs/regedit/tests/regedit.c index 334360b65317..d558f2b033ba 100644 --- a/programs/regedit/tests/regedit.c +++ b/programs/regedit/tests/regedit.c @@ -3588,7 +3588,7 @@ static void test_export(void) RegCloseKey(hkey); run_regedit_exe("regedit.exe /e file.reg HKEY_CURRENT_USER\\" KEY_BASE); - ok(compare_export("file.reg", empty_hex_test, TODO_REG_COMPARE), "compare_export() failed\n"); + ok(compare_export("file.reg", empty_hex_test, 0), "compare_export() failed\n"); delete_key(HKEY_CURRENT_USER, KEY_BASE); @@ -3605,7 +3605,7 @@ static void test_export(void) RegCloseKey(hkey); run_regedit_exe("regedit.exe /e file.reg HKEY_CURRENT_USER\\" KEY_BASE); - ok(compare_export("file.reg", empty_hex_test2, TODO_REG_COMPARE), "compare_export() failed\n"); + ok(compare_export("file.reg", empty_hex_test2, 0), "compare_export() failed\n"); delete_key(HKEY_CURRENT_USER, KEY_BASE);