mirror of
https://github.com/reactos/reactos.git
synced 2025-05-20 17:45:06 +00:00
- Service list entries use a pointer to a group list entry instead of the goup name.
- New group list entries are created in the unknown-group-list for services of unknown groups. svn path=/trunk/; revision=20496
This commit is contained in:
parent
1d13ed66fa
commit
d142c4f988
4 changed files with 83 additions and 38 deletions
|
@ -267,8 +267,9 @@ CreateServiceListEntry(LPWSTR lpServiceName,
|
||||||
|
|
||||||
if (lpGroup != NULL)
|
if (lpGroup != NULL)
|
||||||
{
|
{
|
||||||
lpService->lpServiceGroup = lpGroup;
|
dwError = ScmSetServiceGroup(lpService, lpGroup);
|
||||||
lpGroup = NULL;
|
if (dwError != ERROR_SUCCESS)
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpDisplayName != NULL)
|
if (lpDisplayName != NULL)
|
||||||
|
@ -278,7 +279,7 @@ CreateServiceListEntry(LPWSTR lpServiceName,
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("ServiceName: '%S'\n", lpService->lpServiceName);
|
DPRINT("ServiceName: '%S'\n", lpService->lpServiceName);
|
||||||
DPRINT("Group: '%S'\n", lpService->lpServiceGroup);
|
DPRINT("Group: '%S'\n", lpService->lpGroup->lpGroupName);
|
||||||
DPRINT("Start %lx Type %lx Tag %lx ErrorControl %lx\n",
|
DPRINT("Start %lx Type %lx Tag %lx ErrorControl %lx\n",
|
||||||
lpService->dwStartType,
|
lpService->dwStartType,
|
||||||
lpService->Status.dwServiceType,
|
lpService->Status.dwServiceType,
|
||||||
|
@ -415,8 +416,6 @@ ScmCheckDriver(PSERVICE Service)
|
||||||
ULONG BufferLength;
|
ULONG BufferLength;
|
||||||
ULONG DataLength;
|
ULONG DataLength;
|
||||||
ULONG Index;
|
ULONG Index;
|
||||||
PLIST_ENTRY GroupEntry;
|
|
||||||
PSERVICE_GROUP CurrentGroup;
|
|
||||||
|
|
||||||
DPRINT("ScmCheckDriver(%S) called\n", Service->lpServiceName);
|
DPRINT("ScmCheckDriver(%S) called\n", Service->lpServiceName);
|
||||||
|
|
||||||
|
@ -481,24 +480,12 @@ ScmCheckDriver(PSERVICE Service)
|
||||||
/* Mark service as 'running' */
|
/* Mark service as 'running' */
|
||||||
Service->Status.dwCurrentState = SERVICE_RUNNING;
|
Service->Status.dwCurrentState = SERVICE_RUNNING;
|
||||||
|
|
||||||
/* Find the driver's group and mark it as 'running' */
|
/* Mark the service group as 'running' */
|
||||||
if (Service->lpServiceGroup != NULL)
|
if (Service->lpGroup != NULL)
|
||||||
{
|
{
|
||||||
GroupEntry = GroupListHead.Flink;
|
Service->lpGroup->ServicesRunning = TRUE;
|
||||||
while (GroupEntry != &GroupListHead)
|
|
||||||
{
|
|
||||||
CurrentGroup = CONTAINING_RECORD(GroupEntry, SERVICE_GROUP, GroupListEntry);
|
|
||||||
|
|
||||||
DPRINT("Checking group '%S'\n", &CurrentGroup->lpGroupName);
|
|
||||||
if (Service->lpServiceGroup != NULL &&
|
|
||||||
_wcsicmp(Service->lpServiceGroup, CurrentGroup->lpGroupName) == 0)
|
|
||||||
{
|
|
||||||
CurrentGroup->ServicesRunning = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
GroupEntry = GroupEntry->Flink;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -856,8 +843,7 @@ ScmAutoStartServices(VOID)
|
||||||
{
|
{
|
||||||
CurrentService = CONTAINING_RECORD(ServiceEntry, SERVICE, ServiceListEntry);
|
CurrentService = CONTAINING_RECORD(ServiceEntry, SERVICE, ServiceListEntry);
|
||||||
|
|
||||||
if ((CurrentService->lpServiceGroup != NULL) &&
|
if ((CurrentService->lpGroup == CurrentGroup) &&
|
||||||
(_wcsicmp(CurrentGroup->lpGroupName, CurrentService->lpServiceGroup) == 0) &&
|
|
||||||
(CurrentService->dwStartType == SERVICE_AUTO_START) &&
|
(CurrentService->dwStartType == SERVICE_AUTO_START) &&
|
||||||
(CurrentService->ServiceVisited == FALSE) &&
|
(CurrentService->ServiceVisited == FALSE) &&
|
||||||
(CurrentService->dwTag == CurrentGroup->TagArray[i]))
|
(CurrentService->dwTag == CurrentGroup->TagArray[i]))
|
||||||
|
@ -877,8 +863,7 @@ ScmAutoStartServices(VOID)
|
||||||
{
|
{
|
||||||
CurrentService = CONTAINING_RECORD(ServiceEntry, SERVICE, ServiceListEntry);
|
CurrentService = CONTAINING_RECORD(ServiceEntry, SERVICE, ServiceListEntry);
|
||||||
|
|
||||||
if ((CurrentService->lpServiceGroup != NULL) &&
|
if ((CurrentService->lpGroup == CurrentGroup) &&
|
||||||
(_wcsicmp(CurrentGroup->lpGroupName, CurrentService->lpServiceGroup) == 0) &&
|
|
||||||
(CurrentService->dwStartType == SERVICE_AUTO_START) &&
|
(CurrentService->dwStartType == SERVICE_AUTO_START) &&
|
||||||
(CurrentService->ServiceVisited == FALSE))
|
(CurrentService->ServiceVisited == FALSE))
|
||||||
{
|
{
|
||||||
|
@ -899,7 +884,7 @@ ScmAutoStartServices(VOID)
|
||||||
{
|
{
|
||||||
CurrentService = CONTAINING_RECORD(ServiceEntry, SERVICE, ServiceListEntry);
|
CurrentService = CONTAINING_RECORD(ServiceEntry, SERVICE, ServiceListEntry);
|
||||||
|
|
||||||
if ((CurrentService->lpServiceGroup != NULL) &&
|
if ((CurrentService->lpGroup != NULL) &&
|
||||||
(CurrentService->dwStartType == SERVICE_AUTO_START) &&
|
(CurrentService->dwStartType == SERVICE_AUTO_START) &&
|
||||||
(CurrentService->ServiceVisited == FALSE))
|
(CurrentService->ServiceVisited == FALSE))
|
||||||
{
|
{
|
||||||
|
@ -917,7 +902,7 @@ ScmAutoStartServices(VOID)
|
||||||
{
|
{
|
||||||
CurrentService = CONTAINING_RECORD(ServiceEntry, SERVICE, ServiceListEntry);
|
CurrentService = CONTAINING_RECORD(ServiceEntry, SERVICE, ServiceListEntry);
|
||||||
|
|
||||||
if ((CurrentService->lpServiceGroup == NULL) &&
|
if ((CurrentService->lpGroup == NULL) &&
|
||||||
(CurrentService->dwStartType == SERVICE_AUTO_START) &&
|
(CurrentService->dwStartType == SERVICE_AUTO_START) &&
|
||||||
(CurrentService->ServiceVisited == FALSE))
|
(CurrentService->ServiceVisited == FALSE))
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,10 +13,64 @@
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
LIST_ENTRY GroupListHead;
|
LIST_ENTRY GroupListHead;
|
||||||
|
LIST_ENTRY UnknownGroupListHead;
|
||||||
|
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
ScmSetServiceGroup(PSERVICE lpService,
|
||||||
|
LPWSTR lpGroupName)
|
||||||
|
{
|
||||||
|
PLIST_ENTRY GroupEntry;
|
||||||
|
PSERVICE_GROUP lpGroup;
|
||||||
|
|
||||||
|
GroupEntry = GroupListHead.Flink;
|
||||||
|
while (GroupEntry != &GroupListHead)
|
||||||
|
{
|
||||||
|
lpGroup = CONTAINING_RECORD(GroupEntry, SERVICE_GROUP, GroupListEntry);
|
||||||
|
|
||||||
|
if (!_wcsicmp(lpGroup->lpGroupName, lpGroupName))
|
||||||
|
{
|
||||||
|
lpService->lpGroup = lpGroup;
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
GroupEntry = GroupEntry->Flink;
|
||||||
|
}
|
||||||
|
|
||||||
|
GroupEntry = UnknownGroupListHead.Flink;
|
||||||
|
while (GroupEntry != &UnknownGroupListHead)
|
||||||
|
{
|
||||||
|
lpGroup = CONTAINING_RECORD(GroupEntry, SERVICE_GROUP, GroupListEntry);
|
||||||
|
|
||||||
|
if (!_wcsicmp(lpGroup->lpGroupName, lpGroupName))
|
||||||
|
{
|
||||||
|
lpGroup->dwRefCount++;
|
||||||
|
lpService->lpGroup = lpGroup;
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
GroupEntry = GroupEntry->Flink;
|
||||||
|
}
|
||||||
|
|
||||||
|
lpGroup = (PSERVICE_GROUP)HeapAlloc(GetProcessHeap(),
|
||||||
|
HEAP_ZERO_MEMORY,
|
||||||
|
sizeof(SERVICE_GROUP) + (wcslen(lpGroupName) * sizeof(WCHAR)));
|
||||||
|
if (lpGroup == NULL)
|
||||||
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
|
|
||||||
|
wcscpy(lpGroup->szGroupName, lpGroupName);
|
||||||
|
lpGroup->lpGroupName = lpGroup->szGroupName;
|
||||||
|
lpGroup->dwRefCount = 1;
|
||||||
|
|
||||||
|
InsertTailList(&UnknownGroupListHead,
|
||||||
|
&lpGroup->GroupListEntry);
|
||||||
|
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static NTSTATUS STDCALL
|
static NTSTATUS STDCALL
|
||||||
CreateGroupOrderListRoutine(PWSTR ValueName,
|
CreateGroupOrderListRoutine(PWSTR ValueName,
|
||||||
ULONG ValueType,
|
ULONG ValueType,
|
||||||
|
@ -120,6 +174,7 @@ ScmCreateGroupList(VOID)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
InitializeListHead(&GroupListHead);
|
InitializeListHead(&GroupListHead);
|
||||||
|
InitializeListHead(&UnknownGroupListHead);
|
||||||
|
|
||||||
/* Build group order list */
|
/* Build group order list */
|
||||||
RtlZeroMemory(&QueryTable,
|
RtlZeroMemory(&QueryTable,
|
||||||
|
|
|
@ -927,7 +927,7 @@ ScmrChangeServiceConfigW(handle_t BiningHandle,
|
||||||
|
|
||||||
if (lpdwTagId != NULL)
|
if (lpdwTagId != NULL)
|
||||||
{
|
{
|
||||||
dwError = ScmAssignNewTag(lpService->lpServiceGroup,
|
dwError = ScmAssignNewTag(lpService->lpGroup->lpGroupName,
|
||||||
&lpService->dwTag);
|
&lpService->dwTag);
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -1161,7 +1161,7 @@ ScmrCreateServiceW(handle_t BindingHandle,
|
||||||
|
|
||||||
if (lpdwTagId != NULL)
|
if (lpdwTagId != NULL)
|
||||||
{
|
{
|
||||||
dwError = ScmAssignNewTag(lpService->lpServiceGroup,
|
dwError = ScmAssignNewTag(lpService->lpGroup->lpGroupName,
|
||||||
&lpService->dwTag);
|
&lpService->dwTag);
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -1635,8 +1635,8 @@ ScmrQueryServiceConfigW(handle_t BindingHandle,
|
||||||
if (lpImagePath != NULL)
|
if (lpImagePath != NULL)
|
||||||
dwRequiredSize += ((wcslen(lpImagePath) + 1) * sizeof(WCHAR));
|
dwRequiredSize += ((wcslen(lpImagePath) + 1) * sizeof(WCHAR));
|
||||||
|
|
||||||
if (lpService->lpServiceGroup != NULL)
|
if (lpService->lpGroup != NULL)
|
||||||
dwRequiredSize += ((wcslen(lpService->lpServiceGroup) + 1) * sizeof(WCHAR));
|
dwRequiredSize += ((wcslen(lpService->lpGroup->lpGroupName) + 1) * sizeof(WCHAR));
|
||||||
|
|
||||||
/* FIXME: Add Dependencies length*/
|
/* FIXME: Add Dependencies length*/
|
||||||
|
|
||||||
|
@ -1670,11 +1670,11 @@ ScmrQueryServiceConfigW(handle_t BindingHandle,
|
||||||
lpConfig->lpBinaryPathName = NULL;
|
lpConfig->lpBinaryPathName = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpService->lpServiceGroup != NULL)
|
if (lpService->lpGroup != NULL)
|
||||||
{
|
{
|
||||||
wcscpy(lpStr, lpService->lpServiceGroup);
|
wcscpy(lpStr, lpService->lpGroup->lpGroupName);
|
||||||
lpConfig->lpLoadOrderGroup = (LPWSTR)((ULONG_PTR)lpStr - (ULONG_PTR)lpConfig);
|
lpConfig->lpLoadOrderGroup = (LPWSTR)((ULONG_PTR)lpStr - (ULONG_PTR)lpConfig);
|
||||||
lpStr += (wcslen(lpService->lpServiceGroup) + 1);
|
lpStr += (wcslen(lpService->lpGroup->lpGroupName) + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2290,7 +2290,8 @@ ScmrEnumServicesStatusExW(handle_t BindingHandle,
|
||||||
|
|
||||||
if (pszGroupName)
|
if (pszGroupName)
|
||||||
{
|
{
|
||||||
if (_wcsicmp(pszGroupName, CurrentService->lpServiceGroup))
|
if ((CurrentService->lpGroup == NULL) ||
|
||||||
|
_wcsicmp(pszGroupName, CurrentService->lpGroup->lpGroupName))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2336,7 +2337,8 @@ ScmrEnumServicesStatusExW(handle_t BindingHandle,
|
||||||
|
|
||||||
if (pszGroupName)
|
if (pszGroupName)
|
||||||
{
|
{
|
||||||
if (_wcsicmp(pszGroupName, CurrentService->lpServiceGroup))
|
if ((CurrentService->lpGroup == NULL) ||
|
||||||
|
_wcsicmp(pszGroupName, CurrentService->lpGroup->lpGroupName))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2378,7 +2380,8 @@ ScmrEnumServicesStatusExW(handle_t BindingHandle,
|
||||||
|
|
||||||
if (pszGroupName)
|
if (pszGroupName)
|
||||||
{
|
{
|
||||||
if (_wcsicmp(pszGroupName, CurrentService->lpServiceGroup))
|
if ((CurrentService->lpGroup == NULL) ||
|
||||||
|
_wcsicmp(pszGroupName, CurrentService->lpGroup->lpGroupName))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ typedef struct _SERVICE
|
||||||
LIST_ENTRY ServiceListEntry;
|
LIST_ENTRY ServiceListEntry;
|
||||||
LPWSTR lpServiceName;
|
LPWSTR lpServiceName;
|
||||||
LPWSTR lpDisplayName;
|
LPWSTR lpDisplayName;
|
||||||
LPWSTR lpServiceGroup;
|
PSERVICE_GROUP lpGroup;
|
||||||
BOOL bDeleted;
|
BOOL bDeleted;
|
||||||
DWORD dwResumeCount;
|
DWORD dwResumeCount;
|
||||||
|
|
||||||
|
@ -109,6 +109,8 @@ DWORD ScmControlDriver(PSERVICE lpService,
|
||||||
/* groupdb.c */
|
/* groupdb.c */
|
||||||
|
|
||||||
DWORD ScmCreateGroupList(VOID);
|
DWORD ScmCreateGroupList(VOID);
|
||||||
|
DWORD ScmSetServiceGroup(PSERVICE lpService,
|
||||||
|
LPWSTR lpGroupName);
|
||||||
|
|
||||||
|
|
||||||
/* rpcserver.c */
|
/* rpcserver.c */
|
||||||
|
|
Loading…
Reference in a new issue