https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9f0c54fcd3de17d31ac13…
commit 9f0c54fcd3de17d31ac131c246b46e47088898d3
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sun Feb 25 11:07:14 2018 +0100
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sun Feb 25 11:07:41 2018 +0100
[SC][SERVICES] Support SERVICE_CONTROL_PARAMCHANGE and SERVICE_CONTROL_NETBIND*
control codes
---
base/applications/sc/control.c | 16 ++++++++++------
base/system/services/rpcserver.c | 20 +++++++++++++++++++-
2 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/base/applications/sc/control.c b/base/applications/sc/control.c
index 5e5a4e84ac..b2c9d26d9c 100644
--- a/base/applications/sc/control.c
+++ b/base/applications/sc/control.c
@@ -44,10 +44,12 @@ Control(DWORD Control,
break;
case SERVICE_CONTROL_PAUSE:
- dwDesiredAccess = SERVICE_PAUSE_CONTINUE;
- break;
-
case SERVICE_CONTROL_CONTINUE:
+ case SERVICE_CONTROL_PARAMCHANGE:
+ case SERVICE_CONTROL_NETBINDADD:
+ case SERVICE_CONTROL_NETBINDREMOVE:
+ case SERVICE_CONTROL_NETBINDENABLE:
+ case SERVICE_CONTROL_NETBINDDISABLE:
dwDesiredAccess = SERVICE_PAUSE_CONTINUE;
break;
@@ -55,10 +57,12 @@ Control(DWORD Control,
dwDesiredAccess = SERVICE_INTERROGATE;
break;
- case SERVICE_CONTROL_SHUTDOWN:
- dwDesiredAccess = 0;
+ default:
+ if (Control >= 128 && Control <= 255)
+ dwDesiredAccess = SERVICE_USER_DEFINED_CONTROL;
+ else
+ dwDesiredAccess = 0;
break;
-
}
hSCManager = OpenSCManager(NULL,
diff --git a/base/system/services/rpcserver.c b/base/system/services/rpcserver.c
index e022dff97c..43b953096b 100644
--- a/base/system/services/rpcserver.c
+++ b/base/system/services/rpcserver.c
@@ -1112,6 +1112,11 @@ RControlService(
case SERVICE_CONTROL_PAUSE:
case SERVICE_CONTROL_CONTINUE:
+ case SERVICE_CONTROL_PARAMCHANGE:
+ case SERVICE_CONTROL_NETBINDADD:
+ case SERVICE_CONTROL_NETBINDREMOVE:
+ case SERVICE_CONTROL_NETBINDENABLE:
+ case SERVICE_CONTROL_NETBINDDISABLE:
DesiredAccess = SERVICE_PAUSE_CONTINUE;
break;
@@ -1226,6 +1231,19 @@ RControlService(
if ((dwControlsAccepted & SERVICE_ACCEPT_PAUSE_CONTINUE) == 0)
return ERROR_INVALID_SERVICE_CONTROL;
break;
+
+ case SERVICE_CONTROL_PARAMCHANGE:
+ if ((dwControlsAccepted & SERVICE_ACCEPT_PARAMCHANGE) == 0)
+ return ERROR_INVALID_SERVICE_CONTROL;
+ break;
+
+ case SERVICE_CONTROL_NETBINDADD:
+ case SERVICE_CONTROL_NETBINDREMOVE:
+ case SERVICE_CONTROL_NETBINDENABLE:
+ case SERVICE_CONTROL_NETBINDDISABLE:
+ if ((dwControlsAccepted & SERVICE_ACCEPT_NETBINDCHANGE) == 0)
+ return ERROR_INVALID_SERVICE_CONTROL;
+ break;
}
/* Send control code to the service */
@@ -1728,7 +1746,7 @@ RSetServiceStatus(
/* Restore the previous service type */
lpService->Status.dwServiceType = dwPreviousType;
- /* Handle a stopped service */
+ /* Dereference a stopped service */
if ((lpServiceStatus->dwServiceType & SERVICE_WIN32) &&
(lpServiceStatus->dwCurrentState == SERVICE_STOPPED))
{