ReactOS  0.4.15-dev-316-g938df97
CShellCommandDOKA Class Reference

#include <ShellCommandDOKA.h>

Inheritance diagram for CShellCommandDOKA:
Collaboration diagram for CShellCommandDOKA:

Public Member Functions

 CShellCommandDOKA (CRegistryTree &rTree)
 
virtual ~CShellCommandDOKA ()
 
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 ShellCommandDOKA.h.

Constructor & Destructor Documentation

◆ CShellCommandDOKA()

CShellCommandDOKA::CShellCommandDOKA ( CRegistryTree rTree)

Definition at line 38 of file ShellCommandDOKA.cpp.

38  :m_rTree(rTree)
39 {
40 }
CRegistryTree & m_rTree

◆ ~CShellCommandDOKA()

CShellCommandDOKA::~CShellCommandDOKA ( )
virtual

Definition at line 42 of file ShellCommandDOKA.cpp.

43 {
44 }

Member Function Documentation

◆ Execute()

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

Implements CShellCommand.

Definition at line 51 of file ShellCommandDOKA.cpp.

52 {
53  REGSAM Access = m_rTree.GetDesiredOpenKeyAccess();
54  const TCHAR *pchParameter;
55  BOOL blnBadParameter = FALSE;
56  BOOL blnHelp = FALSE;
57 
58  while((pchParameter = rArguments.GetNextArgument()) != NULL)
59  {
60  blnBadParameter = FALSE;
61 // Console.Write(_T("Processing parameter: \")");
62 // Console.Write(pchParameter);
63 // Console.Write(_T("\")\n");
64  if ((_tcsicmp(pchParameter,_T("/?")) == 0)
65  ||(_tcsicmp(pchParameter,_T("-?")) == 0))
66  {
67  blnHelp = TRUE;
68  }
69  else if (*pchParameter == _T('-'))
70  {
71  TCHAR a = *(pchParameter+1);
72  if (a == 0)
73  {
74  Access = 0;
75  }
76  else
77  {
78  if (*(pchParameter+2) != 0)
79  {
80  blnBadParameter = TRUE;
81  }
82  else
83  {
84  switch(a)
85  {
86  case _T('l'): // KEY_CREATE_LINK
87  case _T('L'):
88  Access &= ~KEY_CREATE_LINK;
89  break;
90  case _T('c'): // KEY_CREATE_SUB_KEY
91  case _T('C'):
92  Access &= ~KEY_CREATE_SUB_KEY;
93  break;
94  case _T('e'): // KEY_ENUMERATE_SUB_KEYS
95  case _T('E'):
96  Access &= ~KEY_ENUMERATE_SUB_KEYS;
97  break;
98  case _T('n'): // KEY_NOTIFY
99  case _T('N'):
100  Access &= ~KEY_NOTIFY;
101  break;
102  case _T('q'): // KEY_QUERY_VALUE
103  case _T('Q'):
104  Access &= ~KEY_QUERY_VALUE;
105  break;
106  case _T('s'): // KEY_SET_VALUE
107  case _T('S'):
108  Access &= ~KEY_SET_VALUE;
109  break;
110  default:
111  blnBadParameter = TRUE;
112  } // switch
113  } // else (*(pchParameter+2) != 0)
114  } // else (a == 0)
115  } // if (*pchParameter == _T('-'))
116  else if (*pchParameter == _T('+'))
117  {
118  TCHAR a = *(pchParameter+1);
119  if (a == 0)
120  {
121  blnBadParameter = TRUE;
122  }
123  else
124  {
125  if (*(pchParameter+2) != 0)
126  {
127  blnBadParameter = TRUE;
128  }
129  else
130  {
131  switch(a)
132  {
133  case _T('a'): // KEY_ALL_ACCESS
134  case _T('A'):
135  Access |= KEY_ALL_ACCESS;
136  break;
137  case _T('l'): // KEY_CREATE_LINK
138  case _T('L'):
139  Access |= KEY_CREATE_LINK;
140  break;
141  case _T('c'): // KEY_CREATE_SUB_KEY
142  case _T('C'):
143  Access |= KEY_CREATE_SUB_KEY;
144  break;
145  case _T('e'): // KEY_ENUMERATE_SUB_KEYS
146  case _T('E'):
147  Access |= KEY_ENUMERATE_SUB_KEYS;
148  break;
149  case _T('n'): // KEY_NOTIFY
150  case _T('N'):
151  Access |= KEY_NOTIFY;
152  break;
153  case _T('q'): // KEY_QUERY_VALUE
154  case _T('Q'):
155  Access |= KEY_QUERY_VALUE;
156  break;
157  case _T('s'): // KEY_SET_VALUE
158  case _T('S'):
159  Access |= KEY_SET_VALUE;
160  break;
161 // case _T('X'): // KEY_EXECUTE
162 // case _T('x'):
163 // Access |= KEY_EXECUTE;
164 // break;
165  case _T('R'): // KEY_READ
166  case _T('r'):
167  Access |= KEY_READ;
168  break;
169  default:
170  blnBadParameter = TRUE;
171  } // switch
172  } // else (*(pchParameter+2) != 0)
173  } // else (a == 0)
174  } // if (*pchParameter == _T('-'))
175  else
176  {
177  blnBadParameter = TRUE;
178  }
179 
180  if (blnBadParameter)
181  {
182  rConsole.Write(_T("Bad parameter: "));
183  rConsole.Write(pchParameter);
184  rConsole.Write(_T("\n"));
185  blnHelp = TRUE;
186  }
187  } // while((pchParameter = Parser.GetNextArgument()) != NULL)
188 
189  if (blnHelp)
190  {
191  rConsole.Write(GetHelpString());
192  }
193  else
194  {
195  m_rTree.SetDesiredOpenKeyAccess(Access);
196  rConsole.Write(_T("Desired open key access:\n"));
197  REGSAM Access = m_rTree.GetDesiredOpenKeyAccess();
198  if (Access & KEY_CREATE_LINK)
199  {
200  rConsole.Write(_T("\tKEY_CREATE_LINK - Permission to create a symbolic link.\n"));
201  }
202  if (Access & KEY_CREATE_SUB_KEY)
203  {
204  rConsole.Write(_T("\tKEY_CREATE_SUB_KEY - Permission to create subkeys.\n"));
205  }
206  if (Access & KEY_ENUMERATE_SUB_KEYS)
207  {
208  rConsole.Write(_T("\tKEY_ENUMERATE_SUB_KEYS - Permission to enumerate subkeys.\n"));
209  }
210  if (Access & KEY_NOTIFY)
211  {
212  rConsole.Write(_T("\tKEY_NOTIFY - Permission for change notification.\n"));
213  }
214  if (Access & KEY_QUERY_VALUE)
215  {
216  rConsole.Write(_T("\tKEY_QUERY_VALUE - Permission to query subkey data.\n"));
217  }
218  if (Access & KEY_SET_VALUE)
219  {
220  rConsole.Write(_T("\tKEY_SET_VALUE - Permission to set subkey data.\n"));
221  }
222  }
223  return 0;
224 }
virtual const TCHAR * GetHelpString()
#define TRUE
Definition: types.h:120
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define _tcsicmp
Definition: xmlstorage.h:205
#define KEY_READ
Definition: nt_native.h:1023
unsigned int BOOL
Definition: ntddk_ex.h:94
TCHAR * GetNextArgument()
smooth NULL
Definition: ftsmooth.c:416
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
CRegistryTree & m_rTree
BOOL Write(const TCHAR *p, DWORD dwChars=0)
Definition: Console.cpp:90
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define KEY_CREATE_LINK
Definition: nt_native.h:1021
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define KEY_NOTIFY
Definition: nt_native.h:1020
ACCESS_MASK REGSAM
Definition: winreg.h:69
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019

◆ GetHelpShortDescriptionString()

const TCHAR * CShellCommandDOKA::GetHelpShortDescriptionString ( )
virtual

Implements CShellCommand.

Definition at line 250 of file ShellCommandDOKA.cpp.

251 {
252  return DOKA_CMD_SHORT_DESC;
253 }
#define DOKA_CMD_SHORT_DESC

◆ GetHelpString()

const TCHAR * CShellCommandDOKA::GetHelpString ( )
virtual

Implements CShellCommand.

Definition at line 226 of file ShellCommandDOKA.cpp.

227 {
228  return DOKA_CMD_SHORT_DESC
229  _T("Syntax: ") DOKA_CMD _T(" [Switches] [/?]\n\n")
230  _T(" /? - This help.\n\n")
231  _T("Switches are:\n")
232  _T(" - - Reset all permisions.\n")
233  _T(" -l - Reset permission to create a symbolic link.\n")
234  _T(" -c - Reset permission to create subkeys.\n")
235  _T(" -e - Reset permission to enumerate subkeys.\n")
236  _T(" -n - Reset permission for change notification.\n")
237  _T(" -q - Reset permission to query subkey data.\n")
238  _T(" -s - Reset permission to set subkey data.\n")
239  _T(" +a - Set all permisions.\n")
240  _T(" +l - Set permission to create a symbolic link.\n")
241  _T(" +c - Set permission to create subkeys.\n")
242  _T(" +e - Set permission to enumerate subkeys.\n")
243  _T(" +n - Set permission for change notification.\n")
244  _T(" +q - Set permission to query subkey data.\n")
245  _T(" +s - Set permission to set subkey data.\n")
246  _T(" +r - Equivalent to combination of +q , +e and +n\n\n")
247  _T("Without parameters, command displays current Desired Open Key Access.\n");
248 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble n
Definition: glext.h:7729
#define DOKA_CMD_SHORT_DESC
static BOOL Set
Definition: pageheap.c:10
#define Open
Definition: syshdrs.h:62
#define DOKA_CMD
#define e
Definition: ke_i.h:82
r l[0]
Definition: byte_order.h:167
#define _T(x)
Definition: vfdio.h:22
const GLubyte * c
Definition: glext.h:8905
#define for
Definition: utility.h:88
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble s
Definition: gl.h:2039
const WCHAR * link
Definition: db.cpp:989
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
Definition: _set.h:46
static const struct access_res create[16]
Definition: package.c:7720
int help
Definition: sort.c:20
struct task_struct * current
Definition: linux.c:32

Referenced by Execute().

◆ Match()

BOOL CShellCommandDOKA::Match ( const TCHAR pchCommand)
virtual

Implements CShellCommand.

Definition at line 46 of file ShellCommandDOKA.cpp.

47 {
48  return _tcsicmp(pchCommand,DOKA_CMD) == 0;
49 }
#define _tcsicmp
Definition: xmlstorage.h:205
#define DOKA_CMD

Member Data Documentation

◆ m_rTree

CRegistryTree& CShellCommandDOKA::m_rTree
private

Definition at line 22 of file ShellCommandDOKA.h.

Referenced by Execute().


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