https://git.reactos.org/?p=reactos.git;a=commitdiff;h=90f5e6b6c322aeb5ad7d4…
commit 90f5e6b6c322aeb5ad7d47d29f2d6c55a961a36b
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sun Dec 30 12:25:18 2018 +0100
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sun Dec 30 14:27:03 2018 +0100
[SERVICES] Implement RI_ScQueryServiceTagInfo
---
base/system/services/database.c | 8 ++++++++
base/system/services/rpcserver.c | 34 ++++++++++++++++++++++++++++++++--
base/system/services/services.h | 2 ++
3 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/base/system/services/database.c b/base/system/services/database.c
index ea91a5cb45..fc4dd2f561 100644
--- a/base/system/services/database.c
+++ b/base/system/services/database.c
@@ -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(
diff --git a/base/system/services/rpcserver.c b/base/system/services/rpcserver.c
index 5b243f7f89..b11db5ae0e 100644
--- a/base/system/services/rpcserver.c
+++ b/base/system/services/rpcserver.c
@@ -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);
}
diff --git a/base/system/services/services.h b/base/system/services/services.h
index 74943372c6..4e6f1f1810 100644
--- a/base/system/services/services.h
+++ b/base/system/services/services.h
@@ -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 */