[SERVICES] Implement RI_ScQueryServiceTagInfo
authorPierre Schweitzer <pierre@reactos.org>
Sun, 30 Dec 2018 11:25:18 +0000 (12:25 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 30 Dec 2018 13:27:03 +0000 (14:27 +0100)
base/system/services/database.c
base/system/services/rpcserver.c
base/system/services/services.h

index ea91a5c..fc4dd2f 100644 (file)
@@ -145,6 +145,14 @@ ScmGetServiceImageByImagePath(LPWSTR lpImagePath)
 }
 
 
+DWORD
+ScmGetServiceNameFromTag(PTAG_INFO_NAME_FROM_TAG_IN_PARAMS InParams, PTAG_INFO_NAME_FROM_TAG_OUT_PARAMS *OutParams)
+{
+    UNIMPLEMENTED;
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+
 static
 BOOL
 ScmIsSameServiceAccount(
index 5b243f7..b11db5a 100644 (file)
@@ -6586,8 +6586,38 @@ RI_ScQueryServiceTagInfo(
     PTAG_INFO_NAME_FROM_TAG_IN_PARAMS * lpInParams,
     PTAG_INFO_NAME_FROM_TAG_OUT_PARAMS * lpOutParams)
 {
-    UNIMPLEMENTED;
-    return ERROR_CALL_NOT_IMPLEMENTED;
+    PMANAGER_HANDLE hManager;
+
+    /* Validate handle */
+    hManager = ScmGetServiceManagerFromHandle(hSCManager);
+    if (hManager == NULL)
+    {
+        return ERROR_INVALID_HANDLE;
+    }
+
+    /* FIXME: should check whether client is local */
+
+    /* Check access rights */
+    if (!RtlAreAllAccessesGranted(hManager->Handle.DesiredAccess,
+                                  SC_MANAGER_ENUMERATE_SERVICE))
+    {
+        return ERROR_ACCESS_DENIED;
+    }
+
+    /* Check parameters */
+    if (lpInParams == NULL || lpOutParams == NULL)
+    {
+        return ERROR_INVALID_PARAMETER;
+    }
+
+    /* Check info level */
+    if (dwInfoLevel != TagInfoLevelNameFromTag)
+    {
+        return ERROR_RETRY;
+    }
+
+    /* Call internal helper */
+    return ScmGetServiceNameFromTag(*lpInParams, lpOutParams);
 }
 
 
index 7494337..4e6f1f1 100644 (file)
@@ -197,6 +197,8 @@ VOID ScmUnlockDatabase(VOID);
 VOID ScmInitNamedPipeCriticalSection(VOID);
 VOID ScmDeleteNamedPipeCriticalSection(VOID);
 
+DWORD ScmGetServiceNameFromTag(PTAG_INFO_NAME_FROM_TAG_IN_PARAMS InParams,
+                               PTAG_INFO_NAME_FROM_TAG_OUT_PARAMS *OutParams);
 
 /* driver.c */