Author: ekohl
Date: Sat Dec 3 12:48:44 2016
New Revision: 73417
URL:
http://svn.reactos.org/svn/reactos?rev=73417&view=rev
Log:
[SERVICES]
Implement large parts of RI_ScGetCurrentGroupStateW.
Modified:
trunk/reactos/base/system/services/groupdb.c
trunk/reactos/base/system/services/rpcserver.c
trunk/reactos/base/system/services/services.h
Modified: trunk/reactos/base/system/services/groupdb.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/group…
==============================================================================
--- trunk/reactos/base/system/services/groupdb.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/groupdb.c [iso-8859-1] Sat Dec 3 12:48:44 2016
@@ -21,6 +21,41 @@
/* FUNCTIONS *****************************************************************/
+
+PSERVICE_GROUP
+ScmGetServiceGroupByName(
+ _In_ LPCWSTR lpGroupName)
+{
+ PLIST_ENTRY GroupEntry;
+ PSERVICE_GROUP lpGroup;
+
+ DPRINT("ScmGetServiceGroupByName(%S)\n", lpGroupName);
+
+ GroupEntry = GroupListHead.Flink;
+ while (GroupEntry != &GroupListHead)
+ {
+ lpGroup = CONTAINING_RECORD(GroupEntry, SERVICE_GROUP, GroupListEntry);
+
+ if (!_wcsicmp(lpGroup->lpGroupName, lpGroupName))
+ return lpGroup;
+
+ GroupEntry = GroupEntry->Flink;
+ }
+
+ GroupEntry = UnknownGroupListHead.Flink;
+ while (GroupEntry != &UnknownGroupListHead)
+ {
+ lpGroup = CONTAINING_RECORD(GroupEntry, SERVICE_GROUP, GroupListEntry);
+
+ if (!_wcsicmp(lpGroup->lpGroupName, lpGroupName))
+ return lpGroup;
+
+ GroupEntry = GroupEntry->Flink;
+ }
+
+ return NULL;
+}
+
DWORD
ScmSetServiceGroup(PSERVICE lpService,
Modified: trunk/reactos/base/system/services/rpcserver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/rpcse…
==============================================================================
--- trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] Sat Dec 3 12:48:44 2016
@@ -1443,7 +1443,7 @@
{
PSERVICE_HANDLE hSvc;
PSERVICE lpService;
- ACCESS_MASK DesiredAccess = 0;
+ ULONG DesiredAccess = 0;
HANDLE hToken = NULL;
HKEY hServiceKey = NULL;
BOOL bDatabaseLocked = FALSE;
@@ -4580,8 +4580,52 @@
LPWSTR lpLoadOrderGroup,
LPDWORD lpState)
{
- UNIMPLEMENTED;
- return ERROR_CALL_NOT_IMPLEMENTED;
+ PMANAGER_HANDLE hManager;
+ PSERVICE_GROUP pServiceGroup;
+ DWORD dwError = ERROR_SUCCESS;
+
+ DPRINT("RI_ScGetCurrentGroupStateW() called\n");
+
+ if (ScmShutdown)
+ return ERROR_SHUTDOWN_IN_PROGRESS;
+
+ hManager = ScmGetServiceManagerFromHandle(hSCManager);
+ if (hManager == NULL)
+ {
+ DPRINT1("Invalid service manager handle!\n");
+ return ERROR_INVALID_HANDLE;
+ }
+
+ /* Check for SC_MANAGER_ENUMERATE_SERVICE access right */
+ if (!RtlAreAllAccessesGranted(hManager->Handle.DesiredAccess,
+ SC_MANAGER_ENUMERATE_SERVICE))
+ {
+ DPRINT("Insufficient access rights! 0x%lx\n",
+ hManager->Handle.DesiredAccess);
+ return ERROR_ACCESS_DENIED;
+ }
+
+ /* Lock the service database shared */
+ ScmLockDatabaseShared();
+
+ /* Get the group list entry */
+ pServiceGroup = ScmGetServiceGroupByName(lpLoadOrderGroup);
+ if (pServiceGroup == NULL)
+ {
+ dwError = ERROR_SERVICE_DOES_NOT_EXIST;
+ goto done;
+ }
+
+ /* FIXME: Return the group state */
+ *lpState = 0;
+
+done:
+ /* Unlock the service database */
+ ScmUnlockDatabase();
+
+ DPRINT("RI_ScGetCurrentGroupStateW() done (Error %lu)\n", dwError);
+
+ return dwError;
}
Modified: trunk/reactos/base/system/services/services.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/servi…
==============================================================================
--- trunk/reactos/base/system/services/services.h [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/services.h [iso-8859-1] Sat Dec 3 12:48:44 2016
@@ -193,6 +193,10 @@
/* groupdb.c */
+PSERVICE_GROUP
+ScmGetServiceGroupByName(
+ _In_ LPCWSTR lpGroupName);
+
DWORD ScmCreateGroupList(VOID);
DWORD ScmSetServiceGroup(PSERVICE lpService,
LPCWSTR lpGroupName);