ReactOS 0.4.15-dev-7942-gd23573b
CShellCommandChangeKey Class Reference

#include <ShellCommandChangeKey.h>

Inheritance diagram for CShellCommandChangeKey:
Collaboration diagram for CShellCommandChangeKey:

Public Member Functions

 CShellCommandChangeKey (CRegistryTree &rTree)
 
virtual ~CShellCommandChangeKey ()
 
virtual BOOL Match (const TCHAR *pchCommand)
 
virtual int Execute (CConsole &rConsole, CArgumentParser &rArguments)
 
virtual const TCHARGetHelpString ()
 
virtual const TCHARGetHelpShortDescriptionString ()
 
- Public Member Functions inherited from CShellCommand
 CShellCommand ()
 
virtual ~CShellCommand ()
 
virtual BOOL Match (const TCHAR *pchCommand)=0
 
virtual int Execute (CConsole &rConsole, CArgumentParser &rArguments)=0
 
virtual const TCHARGetHelpString ()=0
 
virtual const TCHARGetHelpShortDescriptionString ()=0
 

Private Attributes

CRegistryTreem_rTree
 

Detailed Description

Definition at line 12 of file ShellCommandChangeKey.h.

Constructor & Destructor Documentation

◆ CShellCommandChangeKey()

CShellCommandChangeKey::CShellCommandChangeKey ( CRegistryTree rTree)

Definition at line 37 of file ShellCommandChangeKey.cpp.

37 :m_rTree(rTree)
38{
39
40}

◆ ~CShellCommandChangeKey()

CShellCommandChangeKey::~CShellCommandChangeKey ( )
virtual

Definition at line 42 of file ShellCommandChangeKey.cpp.

43{
44
45}

Member Function Documentation

◆ Execute()

int CShellCommandChangeKey::Execute ( CConsole rConsole,
CArgumentParser rArguments 
)
virtual

Implements CShellCommand.

Definition at line 58 of file ShellCommandChangeKey.cpp.

59{
60 BOOL blnHelp = FALSE;
61
62 rArguments.ResetArgumentIteration();
63 const TCHAR *pchCommandItself = rArguments.GetNextArgument();
64 const TCHAR *pchPath = rArguments.GetNextArgument();
65
66 if ((_tcsnicmp(pchCommandItself,CD_CMD _T(".."),CD_CMD_LENGTH+2*sizeof(TCHAR)) == 0)||
67 (_tcsnicmp(pchCommandItself,CD_CMD _T("\\"),CD_CMD_LENGTH+1*sizeof(TCHAR)) == 0))
68 {
69 if (!pchPath) pchPath = pchCommandItself + CD_CMD_LENGTH;
70 else blnHelp = TRUE;
71 }
72
73 if ((!blnHelp)&&(pchPath != NULL)&&(!rArguments.GetNextArgument()))
74 {
75 size_t size = _tcslen(pchPath);
77
78 if (!m_rTree.ChangeCurrentKey(pchPath))
79 {
81 rConsole.Write(_T("\n"));
82 }
83 }
84 else
85 {
86 rConsole.Write(GetHelpString());
87 }
88
89 return 0;
90}
#define PROMPT_BUFFER_SIZE
#define CD_CMD_LENGTH
#define CD_CMD
void ResetArgumentIteration()
TCHAR * GetNextArgument()
BOOL Write(const TCHAR *p, DWORD dwChars=0)
Definition: Console.cpp:90
const TCHAR * GetLastErrorDescription()
BOOL ChangeCurrentKey(const TCHAR *pchRelativePath)
virtual const TCHAR * GetHelpString()
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizeiptr size
Definition: glext.h:5919
#define ASSERT(a)
Definition: mode.c:44
#define _T(x)
Definition: vfdio.h:22
char TCHAR
Definition: xmlstorage.h:189
#define _tcsnicmp
Definition: xmlstorage.h:207
#define _tcslen
Definition: xmlstorage.h:198

◆ GetHelpShortDescriptionString()

const TCHAR * CShellCommandChangeKey::GetHelpShortDescriptionString ( )
virtual

Implements CShellCommand.

Definition at line 101 of file ShellCommandChangeKey.cpp.

102{
103 return CD_CMD_SHORT_DESC;
104}
#define CD_CMD_SHORT_DESC

◆ GetHelpString()

const TCHAR * CShellCommandChangeKey::GetHelpString ( )
virtual

Implements CShellCommand.

Definition at line 92 of file ShellCommandChangeKey.cpp.

93{
95 _T("Syntax: ") CD_CMD _T(" <KEY>\n\n")
96 _T(" <KEY> - Relative path of desired key.\n\n")
97 _T("Without parameters, command displays this help.\n");
98
99}
int help
Definition: sort.c:20
GLdouble n
Definition: glext.h:7729
int desired
Definition: jpeglib.h:1119
Definition: btrfs.h:143
Definition: copy.c:22

Referenced by Execute().

◆ Match()

BOOL CShellCommandChangeKey::Match ( const TCHAR pchCommand)
virtual

Implements CShellCommand.

Definition at line 47 of file ShellCommandChangeKey.cpp.

48{
49 if (_tcsicmp(pchCommand,CD_CMD) == 0)
50 return TRUE;
51 if (_tcsnicmp(pchCommand,CD_CMD _T(".."),CD_CMD_LENGTH+1*sizeof(TCHAR)) == 0)
52 return TRUE;
53 if (_tcsnicmp(pchCommand,CD_CMD _T("\\"),CD_CMD_LENGTH+2*sizeof(TCHAR)) == 0)
54 return TRUE;
55 return FALSE;
56}
#define _tcsicmp
Definition: xmlstorage.h:205

Member Data Documentation

◆ m_rTree

CRegistryTree& CShellCommandChangeKey::m_rTree
private

Definition at line 22 of file ShellCommandChangeKey.h.

Referenced by Execute().


The documentation for this class was generated from the following files: