[PATCH 07/13] reg: Export the registry file header

Hugh McMaster hugh.mcmaster at outlook.com
Sun Dec 3 00:50:16 CST 2017


Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
 programs/reg/export.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/programs/reg/export.c b/programs/reg/export.c
index 81ffd220a3..d34878b877 100644
--- a/programs/reg/export.c
+++ b/programs/reg/export.c
@@ -26,6 +26,22 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(reg);
 
+static void write_file(HANDLE hFile, const WCHAR *str)
+{
+    DWORD written;
+
+    WriteFile(hFile, str, lstrlenW(str) * sizeof(WCHAR), &written, NULL);
+}
+
+static void export_file_header(HANDLE hFile)
+{
+    static const WCHAR header[] = { 0xfeff,'W','i','n','d','o','w','s',' ',
+                                   'R','e','g','i','s','t','r','y',' ','E','d','i','t','o','r',' ',
+                                   'V','e','r','s','i','o','n',' ','5','.','0','0','\r','\n'};
+
+    write_file(hFile, header);
+}
+
 static HANDLE create_file(const WCHAR *filename, DWORD action)
 {
     return CreateFileW(filename, GENERIC_WRITE, 0, NULL, action, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -98,6 +114,7 @@ int reg_export(int argc, WCHAR *argv[])
     }
 
     hFile = get_file_handle(argv[3], overwrite_file);
+    export_file_header(hFile);
     FIXME(": operation not yet implemented\n");
     CloseHandle(hFile);
 
-- 
2.15.0




More information about the wine-devel mailing list