Implement I_ScSetServiceBitsA/W and SetServiceBits.
authorEric Kohl <eric.kohl@reactos.org>
Sat, 13 Sep 2008 20:04:51 +0000 (20:04 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 13 Sep 2008 20:04:51 +0000 (20:04 +0000)
svn path=/trunk/; revision=36200

reactos/base/system/services/rpcserver.c
reactos/dll/win32/advapi32/advapi32.def
reactos/dll/win32/advapi32/advapi32.h
reactos/dll/win32/advapi32/advapi32.rbuild
reactos/dll/win32/advapi32/service/scm.c
reactos/dll/win32/advapi32/service/sctrl.c
reactos/dll/win32/advapi32/service/undoc.c [deleted file]
reactos/include/reactos/idl/svcctl.idl

index a52f58f..64353ed 100644 (file)
@@ -1035,7 +1035,7 @@ DWORD RNotifyBootConfigStatus(
 
 
 /* Function 10 */
-DWORD RSetServiceBitsW(
+DWORD RI_ScSetServiceBitsW(
     handle_t BindingHandle,
     SC_RPC_HANDLE hServiceStatus,
     DWORD dwServiceBits,
@@ -2819,7 +2819,7 @@ DWORD RGetServiceKeyNameW(
 
 
 /* Function 22 */
-DWORD RSetServiceBitsA(
+DWORD RI_ScSetServiceBitsA(
     handle_t BindingHandle,
     SC_RPC_HANDLE hServiceStatus,
     DWORD dwServiceBits,
index 6d87ef4..57116b6 100644 (file)
@@ -307,8 +307,8 @@ GetWindowsAccountDomainSid@12
 ;I_ScIsSecurityProcess
 ;I_ScPnPGetServiceName
 ;I_ScSendTSMessage
-;I_ScSetServiceBitsA@20
-;I_ScSetServiceBitsW@20
+I_ScSetServiceBitsA@20
+I_ScSetServiceBitsW@20
 ;IdentifyCodeAuthzLevelW
 ImpersonateAnonymousToken@4
 ImpersonateLoggedOnUser@4
index 069df54..23a63b9 100644 (file)
@@ -50,6 +50,10 @@ BOOL
 EvtGetLocalHandle(RPC_BINDING_HANDLE *BindingHandle);
 RPC_STATUS EvtUnbindLocalHandle(void);
 
+/* scm.c */
+DWORD
+ScmRpcStatusToWinError(RPC_STATUS Status);
+
 /* Interface to ntmarta.dll **************************************************/
 
 typedef struct _NTMARTA
index 8199e92..ff6b443 100644 (file)
@@ -53,7 +53,6 @@
                        <file>rpc.c</file>
                        <file>scm.c</file>
                        <file>sctrl.c</file>
-                       <file>undoc.c</file>
        </directory>
        <directory name="token">
                        <file>privilege.c</file>
index 513cab9..a47c620 100644 (file)
@@ -78,7 +78,7 @@ HandleUnbind(VOID)
 #endif
 
 
-static DWORD
+DWORD
 ScmRpcStatusToWinError(RPC_STATUS Status)
 {
     switch (Status)
index af3900e..140a6c2 100644 (file)
@@ -528,10 +528,88 @@ RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName,
 }
 
 
+/**********************************************************************
+ *     I_ScSetServiceBitsA
+ *
+ * Undocumented
+ *
+ * @implemented
+ */
+BOOL STDCALL
+I_ScSetServiceBitsA(SC_RPC_HANDLE hServiceStatus,
+                    DWORD dwServiceBits,
+                    BOOL bSetBitsOn,
+                    BOOL bUpdateImmediately,
+                    LPSTR lpString)
+{
+    BOOL bResult;
+
+    HandleBind();
+
+    _SEH_TRY
+    {
+        /* Call to services.exe using RPC */
+        bResult = RI_ScSetServiceBitsA(BindingHandle,
+                                       (SC_RPC_HANDLE)hServiceStatus,
+                                       dwServiceBits,
+                                       bSetBitsOn,
+                                       bUpdateImmediately,
+                                       lpString);
+    }
+    _SEH_HANDLE
+    {
+        SetLastError(ScmRpcStatusToWinError(RpcExceptionCode()));
+        bResult = FALSE;
+    }
+    _SEH_END;
+
+    return bResult;
+}
+
+
+/**********************************************************************
+ *     I_ScSetServiceBitsW
+ *
+ * Undocumented
+ *
+ * @implemented
+ */
+BOOL STDCALL
+I_ScSetServiceBitsW(SC_RPC_HANDLE hServiceStatus,
+                    DWORD dwServiceBits,
+                    BOOL bSetBitsOn,
+                    BOOL bUpdateImmediately,
+                    LPWSTR lpString)
+{
+    BOOL bResult;
+
+    HandleBind();
+
+    _SEH_TRY
+    {
+        /* Call to services.exe using RPC */
+        bResult = RI_ScSetServiceBitsW(BindingHandle,
+                                       (SC_RPC_HANDLE)hServiceStatus,
+                                       dwServiceBits,
+                                       bSetBitsOn,
+                                       bUpdateImmediately,
+                                       lpString);
+    }
+    _SEH_HANDLE
+    {
+        SetLastError(ScmRpcStatusToWinError(RpcExceptionCode()));
+        bResult = FALSE;
+    }
+    _SEH_END;
+
+    return bResult;
+}
+
+
 /**********************************************************************
  *     SetServiceBits
  *
- * @unimplemented
+ * @implemented
  */
 BOOL STDCALL
 SetServiceBits(SERVICE_STATUS_HANDLE hServiceStatus,
@@ -539,8 +617,11 @@ SetServiceBits(SERVICE_STATUS_HANDLE hServiceStatus,
                BOOL bSetBitsOn,
                BOOL bUpdateImmediately)
 {
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
+    return I_ScSetServiceBitsW(hServiceStatus,
+                               dwServiceBits,
+                               bSetBitsOn,
+                               bUpdateImmediately,
+                               NULL);
 }
 
 
diff --git a/reactos/dll/win32/advapi32/service/undoc.c b/reactos/dll/win32/advapi32/service/undoc.c
deleted file mode 100644 (file)
index 7f596c7..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $Id$
- *
- * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS system libraries
- * FILE:            lib/advapi32/service/undoc.c
- * PURPOSE:         Undocumented service functions
- * PROGRAMMER:      Emanuele Aliberti
- * UPDATE HISTORY:
- *     19990413 EA     created
- *     19990515 EA
- */
-
-/* INCLUDES ******************************************************************/
-
-#include <advapi32.h>
-
-
-/* FUNCTIONS *****************************************************************/
-
-/**********************************************************************
- *     I_ScSetServiceBitsA
- *
- * Undocumented
- *
- * Return value unknown.
- */
-DWORD
-STDCALL
-I_ScSetServiceBitsA(VOID)
-{
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 1;
-}
-
-
-/**********************************************************************
- *     I_ScSetServiceBitsW
- *
- * Undocumented
- *
- * Return value unknown.
- */
-DWORD
-STDCALL
-I_ScSetServiceBitsW(VOID)
-{
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 1;
-}
-
-
index 5dff418..ba75d0d 100644 (file)
@@ -366,7 +366,7 @@ interface svcctl
         [in] DWORD BootAcceptable);
 
     /* Function 10 */
-    DWORD RSetServiceBitsW(
+    DWORD RI_ScSetServiceBitsW(
         [in] handle_t BindingHandle,
         [in] SC_RPC_HANDLE hServiceStatus,
         [in] DWORD dwServiceBits,
@@ -490,7 +490,7 @@ interface svcctl
         [in, out] DWORD* lpcchBuffer);
 
     /* Function 22 */
-    DWORD RSetServiceBitsA(
+    DWORD RI_ScSetServiceBitsA(
         [in] handle_t BindingHandle,
         [in] SC_RPC_HANDLE hServiceStatus,
         [in] DWORD dwServiceBits,