mirror of
https://github.com/reactos/reactos.git
synced 2025-08-08 21:03:03 +00:00
Registry Explorer (console tool) by Nedko Arnaoudov added to the system utilities subtree.
Also here: http://www.geocities.com/registryexplorer/ svn path=/trunk/; revision=1375
This commit is contained in:
parent
f3632d15b8
commit
ae69a8e1e4
53 changed files with 7055 additions and 2 deletions
108
rosapps/sysutils/regexpl/ShellCommandsLinkedList.cpp
Normal file
108
rosapps/sysutils/regexpl/ShellCommandsLinkedList.cpp
Normal file
|
@ -0,0 +1,108 @@
|
|||
/* $Id: ShellCommandsLinkedList.cpp,v 1.1 2000/10/04 21:04:31 ea Exp $
|
||||
*
|
||||
* regexpl - Console Registry Explorer
|
||||
*
|
||||
* Copyright (c) 1999-2000 Nedko Arnaoudov <nedkohome@atia.com>
|
||||
*
|
||||
* License: GNU GPL
|
||||
*
|
||||
*/
|
||||
|
||||
// ShellCommandsLinkedList.cpp: implementation of the CShellCommandsLinkedList class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "ph.h"
|
||||
#include "ShellCommandsLinkedList.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CShellCommandsLinkedList::CShellCommandsLinkedList(CConsole& rConsole):m_rConsole(rConsole)
|
||||
{
|
||||
m_pRoot = NULL;
|
||||
}
|
||||
|
||||
CShellCommandsLinkedList::~CShellCommandsLinkedList()
|
||||
{
|
||||
}
|
||||
|
||||
void CShellCommandsLinkedList::AddCommand(CShellCommand *pCommand)
|
||||
{
|
||||
// Create new node
|
||||
SNode *pNewNode = new SNode;
|
||||
if (pNewNode == NULL)
|
||||
return;
|
||||
|
||||
pNewNode->m_pData = pCommand;
|
||||
|
||||
// add new node to the end
|
||||
if (m_pRoot)
|
||||
{
|
||||
SNode *pLastNode = m_pRoot;
|
||||
|
||||
while (pLastNode->m_pNext)
|
||||
pLastNode = pLastNode->m_pNext;
|
||||
|
||||
pLastNode->m_pNext = pNewNode;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pRoot = pNewNode;
|
||||
}
|
||||
}
|
||||
|
||||
int CShellCommandsLinkedList::Execute(CArgumentParser& rArgumentParser, int& nReturnValue)
|
||||
{
|
||||
rArgumentParser.ResetArgumentIteration();
|
||||
|
||||
const TCHAR *pchCommand = rArgumentParser.GetNextArgument();
|
||||
|
||||
if (pchCommand == NULL) // empty command line
|
||||
return -2;
|
||||
|
||||
int i = -1;
|
||||
|
||||
SNode *pNode = m_pRoot;
|
||||
|
||||
while(pNode)
|
||||
{
|
||||
i++;
|
||||
if (pNode->m_pData->Match(pchCommand))
|
||||
{
|
||||
nReturnValue = pNode->m_pData->Execute(m_rConsole,rArgumentParser);
|
||||
return i;
|
||||
}
|
||||
pNode = pNode->m_pNext;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
CShellCommand * CShellCommandsLinkedList::Match(const TCHAR * pchCommand)
|
||||
{
|
||||
SNode *pNode = m_pRoot;
|
||||
|
||||
while(pNode)
|
||||
{
|
||||
if (pNode->m_pData->Match(pchCommand))
|
||||
return pNode->m_pData;
|
||||
pNode = pNode->m_pNext;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
POSITION CShellCommandsLinkedList::GetFirstCommandPosition()
|
||||
{
|
||||
return (POSITION)m_pRoot;
|
||||
}
|
||||
|
||||
CShellCommand * CShellCommandsLinkedList::GetNextCommand(POSITION& rPos)
|
||||
{
|
||||
CShellCommand * pCommand = ((SNode *)rPos)->m_pData;
|
||||
rPos = (POSITION)(((SNode *)rPos)->m_pNext);
|
||||
return pCommand;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue