Fixes https://bugs.winehq.org/show_bug.cgi?id=27497
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/regedit/regproc.c | 11 ++++++----- programs/regedit/tests/regedit.c | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index 84a16f93c4..65087c97ee 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -1171,7 +1171,10 @@ static WCHAR *REGPROC_escape_string(WCHAR *str, size_t str_len, size_t *line_len for (i = 0, escape_count = 0; i < str_len; i++) { WCHAR c = str[i]; - if (c == '\r' || c == '\n' || c == '\' || c == '"' || c == '\0') + + if (!c) break; + + if (c == '\r' || c == '\n' || c == '\' || c == '"') escape_count++; }
@@ -1181,6 +1184,8 @@ static WCHAR *REGPROC_escape_string(WCHAR *str, size_t str_len, size_t *line_len { WCHAR c = str[i];
+ if (!c) break; + switch (c) { case '\r': @@ -1199,10 +1204,6 @@ static WCHAR *REGPROC_escape_string(WCHAR *str, size_t str_len, size_t *line_len buf[pos++] = '\'; buf[pos] = '"'; break; - case '\0': - buf[pos++] = '\'; - buf[pos] = '0'; - break; default: buf[pos] = c; } diff --git a/programs/regedit/tests/regedit.c b/programs/regedit/tests/regedit.c index 845ab00ac9..66b9562445 100644 --- a/programs/regedit/tests/regedit.c +++ b/programs/regedit/tests/regedit.c @@ -3688,7 +3688,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", embedded_null_test, TODO_REG_COMPARE), "compare_export() failed\n"); + ok(compare_export("file.reg", embedded_null_test, 0), "compare_export() failed\n");
delete_key(HKEY_CURRENT_USER, KEY_BASE); }