Reactos
at master 102 lines 2.9 kB view raw
1/* 2 * regexpl - Console Registry Explorer 3 * 4 * Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; see the file COPYING. If not, write to 18 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 * Boston, MA 02111-1307, USA. 20 */ 21 22// ShellCommandConnect.cpp: implementation of the CShellCommandConnect class. 23// 24////////////////////////////////////////////////////////////////////// 25 26#include "ph.h" 27#include "ShellCommandConnect.h" 28 29#define CONNECT_CMD _T("CONNECT") 30#define CONNECT_CMD_SHORT_DESC CONNECT_CMD _T(" command is used to connect to remote registry.\n") 31 32////////////////////////////////////////////////////////////////////// 33// Construction/Destruction 34////////////////////////////////////////////////////////////////////// 35 36CShellCommandConnect::CShellCommandConnect(CRegistryTree& rTree):m_rTree(rTree) 37{ 38} 39 40CShellCommandConnect::~CShellCommandConnect() 41{ 42} 43 44BOOL CShellCommandConnect::Match(const TCHAR *pchCommand) 45{ 46 return _tcsicmp(pchCommand,CONNECT_CMD) == 0; 47} 48 49int CShellCommandConnect::Execute(CConsole &rConsole, CArgumentParser& rArguments) 50{ 51 const TCHAR *pchArg; 52 const TCHAR *pchMachine = NULL; 53 BOOL blnHelp = FALSE; 54 55 VERIFY(m_rTree.ChangeCurrentKey(_T("\\"))); 56 57 while ((pchArg = rArguments.GetNextArgument()) != NULL) 58 { 59 if ((_tcsicmp(pchArg,_T("/?")) == 0) 60 ||(_tcsicmp(pchArg,_T("-?")) == 0)) 61 { 62 blnHelp = TRUE; 63 } 64// else if ((_tcsicmp(pchArg,_T("-a")) == 0)|| 65// (_tcsicmp(pchArg,_T("/a")) == 0)) 66// { 67// } 68 else 69 { 70 pchMachine = pchArg; 71 } 72 } 73 74 if (blnHelp) 75 rConsole.Write(GetHelpString()); 76 77 if (!m_rTree.SetMachineName(pchMachine)) 78 { 79 rConsole.Write(m_rTree.GetLastErrorDescription()); 80 rConsole.Write(_T("\n")); 81 } 82 83 return 0; 84} 85 86const TCHAR * CShellCommandConnect::GetHelpString() 87{ 88 return CONNECT_CMD_SHORT_DESC 89// _T("Syntax: ") CONNECT_CMD _T(" [Switches] [/?] machine\n\n") 90 _T("Syntax: ") CONNECT_CMD _T(" /? | MACHINE\n\n") 91 _T(" /? - This help.\n\n") 92// _T("Switches are:\n") 93// _T(" -a anonymous login.\n") 94 _T(" MACHINE is name/ip of the remote machine.\n") 95 _T("Example:\n") 96 _T(" ") CONNECT_CMD _T(" BOB"); 97} 98 99const TCHAR * CShellCommandConnect::GetHelpShortDescriptionString() 100{ 101 return CONNECT_CMD_SHORT_DESC; 102}