https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e0c97c9ecacf5eae342ca412a5c8db38ea631596

commit e0c97c9ecacf5eae342ca412a5c8db38ea631596
Author:     Eric Kohl <eric.k...@reactos.org>
AuthorDate: Sun Jul 21 18:56:02 2019 +0200
Commit:     Eric Kohl <eric.k...@reactos.org>
CommitDate: Sun Jul 21 18:56:59 2019 +0200

    [SRVSVC][WKSSVC] Set the stop pending status before stopping the services 
and stop the RPC listener on shutdown as well.
---
 base/services/srvsvc/srvsvc.c | 4 ++++
 base/services/wkssvc/wkssvc.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/base/services/srvsvc/srvsvc.c b/base/services/srvsvc/srvsvc.c
index a4e77f2c8f8..32d73ea89b4 100644
--- a/base/services/srvsvc/srvsvc.c
+++ b/base/services/srvsvc/srvsvc.c
@@ -79,6 +79,7 @@ ServiceControlHandler(DWORD dwControl,
     {
         case SERVICE_CONTROL_STOP:
             TRACE("  SERVICE_CONTROL_STOP received\n");
+            UpdateServiceStatus(SERVICE_STOP_PENDING);
             /* Stop listening to incoming RPC messages */
             RpcMgmtStopServerListening(NULL);
             UpdateServiceStatus(SERVICE_STOPPED);
@@ -102,6 +103,9 @@ ServiceControlHandler(DWORD dwControl,
 
         case SERVICE_CONTROL_SHUTDOWN:
             TRACE("  SERVICE_CONTROL_SHUTDOWN received\n");
+            UpdateServiceStatus(SERVICE_STOP_PENDING);
+            /* Stop listening to incoming RPC messages */
+            RpcMgmtStopServerListening(NULL);
             UpdateServiceStatus(SERVICE_STOPPED);
             return ERROR_SUCCESS;
 
diff --git a/base/services/wkssvc/wkssvc.c b/base/services/wkssvc/wkssvc.c
index eba9053e5e0..9feb7bb50e2 100644
--- a/base/services/wkssvc/wkssvc.c
+++ b/base/services/wkssvc/wkssvc.c
@@ -76,6 +76,7 @@ ServiceControlHandler(DWORD dwControl,
     {
         case SERVICE_CONTROL_STOP:
             TRACE("  SERVICE_CONTROL_STOP received\n");
+            UpdateServiceStatus(SERVICE_STOP_PENDING);
             /* Stop listening to incoming RPC messages */
             RpcMgmtStopServerListening(NULL);
             UpdateServiceStatus(SERVICE_STOPPED);
@@ -99,6 +100,9 @@ ServiceControlHandler(DWORD dwControl,
 
         case SERVICE_CONTROL_SHUTDOWN:
             TRACE("  SERVICE_CONTROL_SHUTDOWN received\n");
+            UpdateServiceStatus(SERVICE_STOP_PENDING);
+            /* Stop listening to incoming RPC messages */
+            RpcMgmtStopServerListening(NULL);
             UpdateServiceStatus(SERVICE_STOPPED);
             return ERROR_SUCCESS;
 

Reply via email to