From bdd068e087265060f405baf2457f284874d6cfae Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Sun, 9 Dec 2007 15:34:14 +0000 Subject: [PATCH] regedit: Correctly parse key name containing ']' when deleting/exporting. svn path=/trunk/; revision=31107 --- reactos/base/applications/regedit/regproc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/reactos/base/applications/regedit/regproc.c b/reactos/base/applications/regedit/regproc.c index ed7a42fafb1..5be3bb34de9 100644 --- a/reactos/base/applications/regedit/regproc.c +++ b/reactos/base/applications/regedit/regproc.c @@ -441,12 +441,14 @@ LPSTR getRegKeyName(LPSTR lpLine) keyNameBeg = strchr(lpLineCopy, '\\'); /* The key name start by '\' */ if (keyNameBeg) { - LPSTR keyNameEnd; + if (lpLine[0] == '[') /* need to find matching ']' */ + { + LPSTR keyNameEnd; - keyNameBeg++; /* is not part of the name */ - keyNameEnd = strchr(lpLineCopy, ']'); - if (keyNameEnd) { - *keyNameEnd = '\0'; /* remove ']' from the key name */ + keyNameEnd = strrchr(lpLineCopy, ']'); + if (keyNameEnd) { + *keyNameEnd = '\0'; /* remove ']' from the key name */ + } } } else { keyNameBeg = lpLineCopy + strlen(lpLineCopy); /* branch - empty string */