[PATCH 7/8] regedit: Append a newline to the end of the export file

Hugh McMaster hugh.mcmaster at outlook.com
Mon Jul 17 05:42:08 CDT 2017


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

diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index f606581113..c72675e4c3 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -1306,10 +1306,16 @@ static void export_hex_data(FILE *fp, WCHAR **buf, DWORD type, DWORD line_len,
     }
 }
 
+static void export_newline(FILE *fp, BOOL unicode)
+{
+    static const WCHAR newline[] = {'\r','\n',0};
+
+    REGPROC_write_line(fp, newline, unicode);
+}
+
 static void export_data(FILE *fp, DWORD type, size_t line_len, void *data, size_t size, BOOL unicode)
 {
     WCHAR *buf = NULL;
-    static const WCHAR newline[] = {'\r','\n',0};
 
     switch (type)
     {
@@ -1330,7 +1336,7 @@ static void export_data(FILE *fp, DWORD type, size_t line_len, void *data, size_
 
     REGPROC_write_line(fp, buf, unicode);
     HeapFree(GetProcessHeap(), 0, buf);
-    REGPROC_write_line(fp, newline, unicode);
+    export_newline(fp, unicode);
 }
 
 static WCHAR *build_subkey_path(WCHAR *path, DWORD path_len, WCHAR *subkey_name, DWORD subkey_len)
@@ -1490,6 +1496,7 @@ static BOOL export_key(WCHAR *file_name, WCHAR *path, BOOL unicode)
 
     fp = REGPROC_open_export_file(file_name, unicode);
     ret = export_registry_data(fp, key, path, unicode);
+    export_newline(fp, unicode);
     fclose(fp);
 
     RegCloseKey(key);
@@ -1522,6 +1529,7 @@ static BOOL export_all(WCHAR *file_name, WCHAR *path, BOOL unicode)
         RegCloseKey(key);
     }
 
+    export_newline(fp, unicode);
     fclose(fp);
     return TRUE;
 }
-- 
2.11.0




More information about the wine-patches mailing list