regedit: Allow entering - for a key in a .reg file to delete that
key (try 2)
Lei Zhang
thestig at google.com
Thu Mar 1 20:54:37 CST 2007
Hi,
(attached the patch this time)
In .reg files, An entry such as:
[-HKEY_FOO\bar] indicates that key should be deleted. (See bug 3269)
-------------- next part --------------
From 2c962b618737b53fd749d754f0d367bc5f8e3c23 Mon Sep 17 00:00:00 2001
From: Lei Zhang <thestig at google.com>
Date: Thu, 1 Mar 2007 16:25:08 -0800
Subject: regedit: Allow entering - for a key in a .reg file to delete that key.
---
programs/regedit/regproc.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index fe6fa8a..6c8e3a5 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -283,6 +283,7 @@ LPSTR getArg( LPSTR arg)
if( arg[0] == '\"' ) arg++;
tmp = HeapAlloc(GetProcessHeap(), 0, strlen(arg)+1);
+ CHECK_ENOUGH_MEMORY(tmp);
strcpy(tmp, arg);
return tmp;
@@ -544,6 +545,18 @@ void doSetValue(LPSTR stdInput)
if ( bTheKeyIsOpen != FALSE )
closeKey(); /* Close the previous key before */
+ /* delete the key if we encounter '-' at the start of reg key */
+ if ( stdInput[1] == '-')
+ {
+ int last_chr = strlen(stdInput) - 1;
+
+ /* skip leading "[-" and get rid of trailing "]" */
+ if (stdInput[last_chr] == ']')
+ stdInput[last_chr] = '\0';
+ delete_registry_key(stdInput+2);
+ return;
+ }
+
if ( openKey(stdInput) != ERROR_SUCCESS )
fprintf(stderr,"%s: setValue failed to open key %s\n",
getAppName(), stdInput);
--
1.4.1
More information about the wine-patches
mailing list