ReactOS  0.4.13-dev-259-g5ca9c9c
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 ()
 

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 TRUE
Definition: types.h:120
#define CD_CMD_LENGTH
virtual const TCHAR * GetHelpString()
#define PROMPT_BUFFER_SIZE
BOOL ChangeCurrentKey(const TCHAR *pchRelativePath)
unsigned int BOOL
Definition: ntddk_ex.h:94
#define _tcsnicmp
Definition: xmlstorage.h:207
TCHAR * GetNextArgument()
void ResetArgumentIteration()
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
smooth NULL
Definition: ftsmooth.c:416
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
GLsizeiptr size
Definition: glext.h:5919
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
const TCHAR * GetLastErrorDescription()
BOOL Write(const TCHAR *p, DWORD dwChars=0)
Definition: Console.cpp:90
#define CD_CMD

◆ 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 {
94  return CD_CMD_SHORT_DESC
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 desired
Definition: jpeglib.h:1116
GLdouble n
Definition: glext.h:7729
#define CD_CMD_SHORT_DESC
#define _T(x)
Definition: vfdio.h:22
Definition: btrfs.h:122
Definition: services.c:325
#define CD_CMD
int help
Definition: sort.c:20
Definition: path.c:42

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 TRUE
Definition: types.h:120
#define _tcsicmp
Definition: xmlstorage.h:205
#define CD_CMD_LENGTH
#define _tcsnicmp
Definition: xmlstorage.h:207
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define CD_CMD

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: