[PATCH 2/4] regedit: Do not concatenate or import a line if it has a comment beginning with a hash character
Hugh McMaster
hugh.mcmaster at outlook.com
Wed Apr 5 06:48:29 CDT 2017
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
programs/regedit/regproc.c | 11 +++++++++++
programs/regedit/tests/regedit.c | 2 +-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index 8a4fe73..2d628c3 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -745,6 +745,11 @@ static char *get_lineA(FILE *fp)
{
s = strchr(s, '\\');
if (!s) return line;
+ if ((p = strpbrk(s, ";#")) && *p == '#')
+ {
+ line = next;
+ continue;
+ }
memmove(s, next, strlen(next) + 1);
next = line;
continue;
@@ -856,8 +861,14 @@ static WCHAR *get_lineW(FILE *fp)
*p = 0;
if ((s = strchrW(line, ':')) && (*(s - 1) == 'x' || *(s - 1) == ')'))
{
+ static const WCHAR comment_chars[] = {';','#',0};
s = strchrW(s, '\\');
if (!s) return line;
+ if ((p = strpbrkW(s, comment_chars)) && *p == '#')
+ {
+ line = next;
+ continue;
+ }
memmove(s, next, (strlenW(next) + 1) * sizeof(WCHAR));
next = line;
continue;
diff --git a/programs/regedit/tests/regedit.c b/programs/regedit/tests/regedit.c
index 6b40190..33943b3 100644
--- a/programs/regedit/tests/regedit.c
+++ b/programs/regedit/tests/regedit.c
@@ -635,7 +635,7 @@ static void test_comments(void)
" 63,6f,6e,\\;comment\n"
" 63,61,74,\\#comment\n"
" 65,6e,61,74,69,6f,6e,00,00\n\n");
- todo_wine verify_reg_nonexist(hkey, "Multi-Line5");
+ verify_reg_nonexist(hkey, "Multi-Line5");
RegCloseKey(hkey);
--
2.7.4
More information about the wine-patches
mailing list