[PATCH 1/2] regedit: Correctly export hex values with no data

Hugh McMaster hugh.mcmaster at outlook.com
Fri Nov 10 06:23:04 CST 2017


Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
 programs/regedit/regproc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index a70a6d1300..3d1e3da422 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -1300,6 +1300,8 @@ static void export_hex_data(FILE *fp, WCHAR **buf, DWORD type, DWORD line_len,
 
     line_len += export_hex_data_type(fp, type, unicode);
 
+    if (!size) return;
+
     if (!unicode && (type == REG_EXPAND_SZ || type == REG_MULTI_SZ))
         data = GetMultiByteStringN(data, size / sizeof(WCHAR), &size);
 
@@ -1354,8 +1356,12 @@ static void export_data(FILE *fp, WCHAR *value_name, DWORD value_len, DWORD type
         break;
     }
 
-    REGPROC_write_line(fp, buf, unicode);
-    heap_free(buf);
+    if (size || type == REG_SZ)
+    {
+        REGPROC_write_line(fp, buf, unicode);
+        heap_free(buf);
+    }
+
     export_newline(fp, unicode);
 }
 
-- 
2.14.2




More information about the wine-patches mailing list