no message

svn path=/trunk/; revision=1500
This commit is contained in:
Nedko Arnaudov
2001-01-10 01:25:29 +00:00
parent 48b5533bd5
commit 1688a8d7c5
29 changed files with 3494 additions and 2470 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: ShellCommandDeleteKey.cpp,v 1.2 2000/10/24 20:17:41 narnaoud Exp $
/* $Id: ShellCommandDeleteKey.cpp,v 1.3 2001/01/10 01:25:29 narnaoud Exp $
*
* regexpl - Console Registry Explorer
*
@@ -50,7 +50,7 @@ BOOL CShellCommandDeleteKey::Match(const TCHAR *pchCommand)
int CShellCommandDeleteKey::Execute(CConsole &rConsole, CArgumentParser& rArguments)
{
const TCHAR *pchKey = NULL, *pchArg;
TCHAR *pchKey = NULL, *pchArg;
BOOL blnHelp = FALSE;
BOOL blnExitAfterHelp = FALSE;
@@ -99,20 +99,72 @@ int CShellCommandDeleteKey::Execute(CConsole &rConsole, CArgumentParser& rArgume
rConsole.Write(_T("\n"));
}
if (!m_rTree.DeleteKey(pchKey,blnRecursive))
// search for last key name token
TCHAR *pch = pchKey;
while(*pch)
pch++;
if (pch > pchKey)
pch--;
while(*pch == _T('\\'))
*pch = 0;
while((pch > pchKey)&&(*pch != _T('\\')))
pch--;
ASSERT(pch >= pchKey);
const TCHAR *pszPath;
TCHAR *pszPattern = pch+1;
if (pch == pchKey)
{
pszPath = _T(".");
}
else
{
if (pch-1 == pchKey)
{
rConsole.Write(DK_CMD COMMAND_NA_ON_ROOT);
return 0;
}
else
{
*pch = 0;
pszPath = pchKey;
}
}
{
size_t s = _tcslen(pszPattern);
if (s && (pszPattern[0] == _T('\"'))&&(pszPattern[s-1] == _T('\"')))
{
pszPattern[s-1] = 0;
pszPattern++;
}
}
if (!m_rTree.DeleteSubkeys(pszPattern,pszPath,blnRecursive))
{
rConsole.Write(_T("Cannot delete key.\n"));
rConsole.Write(_T("Cannot delete key(s).\n"));
rConsole.Write(m_rTree.GetLastErrorDescription());
}
else
{
InvalidateCompletion();
}
return 0;
}
const TCHAR * CShellCommandDeleteKey::GetHelpString()
{
return DK_CMD_SHORT_DESC
_T("Syntax: ") DK_CMD _T(" [/s] [/?] Key_Name\n\n")
_T(" /? - This help.\n\n")
_T(" /s - Delete key and all subkeys.\n");
_T("Syntax: ") DK_CMD _T(" [/s] [/?] [PATH]KEY_NAME\n\n")
_T(" PATH - optional path to key which subkey(s) will be deleted. Default is current key.")
_T(" KEY_NAME - name of key to be deleted. Wildcards can be used.")
_T(" /? - This help.\n\n")
_T(" /s - Delete key and all subkeys.\n");
}
const TCHAR * CShellCommandDeleteKey::GetHelpShortDescriptionString()