https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a0d412b77a2818ba229277...
commit a0d412b77a2818ba2292772c8e8410b2b90ce215 Author: Eric Kohl eric.kohl@reactos.org AuthorDate: Sun Feb 25 14:08:16 2018 +0100 Commit: Eric Kohl eric.kohl@reactos.org CommitDate: Sun Feb 25 14:08:16 2018 +0100
[SC] Support the paramchange and netbind* control codes in the control command --- base/applications/sc/sc.c | 24 ++++++++++++++++++++---- base/applications/sc/usage.c | 8 ++++++-- 2 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/base/applications/sc/sc.c b/base/applications/sc/sc.c index e2b75083e6..c6230c4801 100644 --- a/base/applications/sc/sc.c +++ b/base/applications/sc/sc.c @@ -157,19 +157,35 @@ ScControl(LPCTSTR Server, // remote machine name } else if (!lstrcmpi(Command, _T("control"))) { - INT CtlValue; + INT ControlCode = 0;
if (ArgCount > 1) { ServiceName = *ServiceArgs++; ArgCount--;
- CtlValue = _ttoi(ServiceArgs[0]); + if (!lstrcmpi(ServiceArgs[0], _T("paramchange"))) + ControlCode = SERVICE_CONTROL_PARAMCHANGE; + else if (!lstrcmpi(ServiceArgs[0], _T("netbindadd"))) + ControlCode = SERVICE_CONTROL_NETBINDADD; + else if (!lstrcmpi(ServiceArgs[0], _T("netbindremove"))) + ControlCode = SERVICE_CONTROL_NETBINDREMOVE; + else if (!lstrcmpi(ServiceArgs[0], _T("netbindenable"))) + ControlCode = SERVICE_CONTROL_NETBINDENABLE; + else if (!lstrcmpi(ServiceArgs[0], _T("netbinddisable"))) + ControlCode = SERVICE_CONTROL_NETBINDDISABLE; + else + { + ControlCode = _ttoi(ServiceArgs[0]); + if ((ControlCode < 128) && (ControlCode > 255)) + ControlCode = 0; + } + ServiceArgs++; ArgCount--;
- if ((CtlValue >= 128) && (CtlValue <= 255)) - Control(CtlValue, + if (ControlCode != 0) + Control(ControlCode, ServiceName, ServiceArgs, ArgCount); diff --git a/base/applications/sc/usage.c b/base/applications/sc/usage.c index ec431f6856..b25aef8999 100644 --- a/base/applications/sc/usage.c +++ b/base/applications/sc/usage.c @@ -169,9 +169,13 @@ VOID CreateUsage(VOID) VOID ControlUsage(VOID) { _tprintf(_T("DESCRIPTION:\n") - _T(" Sends a CONTROL control request to a service.\n") + _T(" Sends a CONTROL code to a service.\n") _T("USAGE:\n") - _T(" sc <server> control [service name] <value>\n")); + _T(" sc <server> control [service name] <value>\n") + _T(" <value> = user-defined control code\n") + _T(" <value> = <paramchange|\n") + _T(" netbindadd|netbindremove|\n") + _T(" netbindenable|netbinddisable>\n")); }
VOID SdShowUsage(VOID)