Lei Zhang : regedit: Allow entering - for a key in a . reg file to delete that key.
Module: wine Branch: master Commit: 054fd8cb42fb3b3b13fee48a7747f0063d853f09 URL: http://source.winehq.org/git/wine.git/?a=commit;h=054fd8cb42fb3b3b13fee48a77... Author: Lei Zhang <thestig(a)google.com> Date: Thu Mar 1 16:25:08 2007 -0800 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);
participants (1)
-
Alexandre Julliard