services: Sort autostart services by dwTagId config value.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sebastian Lackner 2016-08-18 09:31:35 +02:00 committed by Alexandre Julliard
parent 4c01feb714
commit 6fc42341ec
1 changed files with 8 additions and 0 deletions

View File

@ -318,6 +318,13 @@ static void scmdatabase_remove_service(struct scmdatabase *db, struct service_en
service->entry.next = service->entry.prev = NULL;
}
static int compare_tags(const void *a, const void *b)
{
struct service_entry *service_a = *(struct service_entry **)a;
struct service_entry *service_b = *(struct service_entry **)b;
return service_a->config.dwTagId - service_b->config.dwTagId;
}
static void scmdatabase_autostart_services(struct scmdatabase *db)
{
struct service_entry **services_list;
@ -352,6 +359,7 @@ static void scmdatabase_autostart_services(struct scmdatabase *db)
size = i;
scmdatabase_unlock(db);
qsort(services_list, size, sizeof(services_list[0]), compare_tags);
while (!scmdatabase_lock_startup(db)) Sleep(10);
for (i = 0; i < size; i++)