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

commit fd090c6ca1caa060e244fcacceb675759aafa27a
Author:     Eric Kohl <eric.k...@reactos.org>
AuthorDate: Tue May 1 21:33:37 2018 +0200
Commit:     Eric Kohl <eric.k...@reactos.org>
CommitDate: Tue May 1 21:33:37 2018 +0200

    [SERVICES] Implement RI_ScSetServiceBitsA/W
    
    - RI_ScSetServiceBitsA: Just call RI_ScSetServiceBitsW.
    - RI_ScSetServiceBitsW: Store the service bits in the service list entry.
    TODO: Merge all service bits in a global variable and pass it to the server 
service. Maybe use netapi.I_NetServerSetServiceBits(Ex)?
---
 base/system/services/rpcserver.c | 50 ++++++++++++++++++++++++++++++++++++----
 base/system/services/services.h  |  2 ++
 2 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/base/system/services/rpcserver.c b/base/system/services/rpcserver.c
index 43b953096b..0d75aae927 100644
--- a/base/system/services/rpcserver.c
+++ b/base/system/services/rpcserver.c
@@ -1860,8 +1860,41 @@ RI_ScSetServiceBitsW(
     int bUpdateImmediately,
     wchar_t *lpString)
 {
-    UNIMPLEMENTED;
-    return ERROR_CALL_NOT_IMPLEMENTED;
+    PSERVICE pService;
+
+    DPRINT("RI_ScSetServiceBitsW(%p %lx %d %d %S)\n",
+           hServiceStatus, dwServiceBits, bSetBitsOn,
+           bUpdateImmediately, lpString);
+
+    if (ScmShutdown)
+        return ERROR_SHUTDOWN_IN_PROGRESS;
+
+    if (lpString != NULL)
+        return ERROR_INVALID_PARAMETER;
+
+    if (hServiceStatus == 0)
+    {
+        DPRINT("hServiceStatus == NULL!\n");
+        return ERROR_INVALID_HANDLE;
+    }
+
+    // FIXME: Validate the status handle
+    pService = (PSERVICE)hServiceStatus;
+
+    if (bSetBitsOn)
+    {
+        DPRINT("Old service bits: %08lx\n", pService->dwServiceBits);
+        pService->dwServiceBits |= dwServiceBits;
+        DPRINT("New service bits: %08lx\n", pService->dwServiceBits);
+    }
+    else
+    {
+        DPRINT("Old service bits: %08lx\n", pService->dwServiceBits);
+        pService->dwServiceBits &= ~dwServiceBits;
+        DPRINT("New service bits: %08lx\n", pService->dwServiceBits);
+    }
+
+    return ERROR_SUCCESS;
 }
 
 
@@ -3335,8 +3368,17 @@ RI_ScSetServiceBitsA(
     int bUpdateImmediately,
     char *lpString)
 {
-    UNIMPLEMENTED;
-    return ERROR_CALL_NOT_IMPLEMENTED;
+    if (ScmShutdown)
+        return ERROR_SHUTDOWN_IN_PROGRESS;
+
+    if (lpString != NULL)
+        return ERROR_INVALID_PARAMETER;
+
+    return RI_ScSetServiceBitsW(hServiceStatus,
+                                dwServiceBits,
+                                bSetBitsOn,
+                                bUpdateImmediately,
+                                NULL);
 }
 
 
diff --git a/base/system/services/services.h b/base/system/services/services.h
index 3592ba2560..b455bead0f 100644
--- a/base/system/services/services.h
+++ b/base/system/services/services.h
@@ -71,6 +71,8 @@ typedef struct _SERVICE
     DWORD dwErrorControl;
     DWORD dwTag;
 
+    DWORD dwServiceBits;
+
     ULONG Flags;
 
     PSECURITY_DESCRIPTOR pSecurityDescriptor;

Reply via email to