diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-10-22 15:48:15 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-10-22 15:49:02 +0100 |
commit | 855df874403b11ea426c5c6fa708e52ab0b2f042 (patch) | |
tree | 990aed45e6c063354b60e59a8bf97e37e2533f0a | |
parent | 2a1279607c3982114ae931a6670bc36d2cb2ec1d (diff) | |
download | hivex-855df874403b11ea426c5c6fa708e52ab0b2f042.tar.gz hivex-855df874403b11ea426c5c6fa708e52ab0b2f042.tar.xz hivex-855df874403b11ea426c5c6fa708e52ab0b2f042.zip |
regedit: Fix syntax for deleting registry keys (RHBZ#737944).
Previously we parsed -[...] to delete a registry key, but this is not
correct. It should be [-...]. Reference:
http://support.microsoft.com/kb/310516
https://secure.wikimedia.org/wikipedia/en/wiki/Windows_Registry#.REG_files
-rw-r--r-- | perl/lib/Win/Hivex/Regedit.pm | 10 | ||||
-rw-r--r-- | perl/t/560-regedit-import.t | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/perl/lib/Win/Hivex/Regedit.pm b/perl/lib/Win/Hivex/Regedit.pm index 3d7e5ed..8914f9e 100644 --- a/perl/lib/Win/Hivex/Regedit.pm +++ b/perl/lib/Win/Hivex/Regedit.pm @@ -164,16 +164,16 @@ sub reg_import # Ignore comments. next if /^\s*;/; - # Expect to see [...] or -[...] + # Expect to see [...] or [-...] # to merge or delete a node respectively. - if (/^\[(.*)\]\s*$/) { + if (/^\[-(.*)\]\s*$/) { + _delete_node ($hmap, \%params, $1); + $state = "outer"; + } elsif (/^\[(.*)\]\s*$/) { $state = "inner"; $newnode = $1; @newvalues = (); @delvalues = (); - } elsif (/^-\[(.*)\]\s*$/) { - _delete_node ($hmap, \%params, $1); - $state = "outer"; } else { croak (_unexpected ($_, $lineno)); } diff --git a/perl/t/560-regedit-import.t b/perl/t/560-regedit-import.t index 0dca8df..effb024 100644 --- a/perl/t/560-regedit-import.t +++ b/perl/t/560-regedit-import.t @@ -66,7 +66,7 @@ $data = ' [\A] @="Hello" --[\B] +[-\B] '; $expected = '[\] @@ -87,7 +87,7 @@ $data = ' [\A] @=- --[\C] +[-\C] [\A\B] '; @@ -131,7 +131,7 @@ $data = ' "Key\"Containing\"Quotes"=- "ValueContainingEscapes"=- --[\A] +[-\A] '; $expected = '[\] |