mirror of
https://github.com/reactos/wine.git
synced 2024-12-14 07:08:41 +00:00
services: Add a grab_service function.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2e6fc89395
commit
46a974856f
@ -373,9 +373,7 @@ DWORD __cdecl svcctl_OpenServiceW(
|
||||
return ERROR_INVALID_NAME;
|
||||
|
||||
scmdatabase_lock(manager->db);
|
||||
entry = scmdatabase_find_service(manager->db, lpServiceName);
|
||||
if (entry != NULL)
|
||||
InterlockedIncrement(&entry->ref_count);
|
||||
entry = grab_service(scmdatabase_find_service(manager->db, lpServiceName));
|
||||
scmdatabase_unlock(manager->db);
|
||||
|
||||
if (entry == NULL)
|
||||
|
@ -346,15 +346,13 @@ static void scmdatabase_autostart_services(struct scmdatabase *db)
|
||||
break;
|
||||
services_list = slist_new;
|
||||
}
|
||||
services_list[i] = service;
|
||||
InterlockedIncrement(&service->ref_count);
|
||||
i++;
|
||||
services_list[i++] = grab_service(service);
|
||||
}
|
||||
}
|
||||
size = i;
|
||||
|
||||
scmdatabase_unlock(db);
|
||||
|
||||
size = i;
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
DWORD err;
|
||||
@ -494,6 +492,13 @@ void release_process(struct process_entry *process)
|
||||
scmdatabase_unlock(db);
|
||||
}
|
||||
|
||||
struct service_entry *grab_service(struct service_entry *service)
|
||||
{
|
||||
if (service)
|
||||
InterlockedIncrement(&service->ref_count);
|
||||
return service;
|
||||
}
|
||||
|
||||
void release_service(struct service_entry *service)
|
||||
{
|
||||
struct scmdatabase *db = service->db;
|
||||
|
@ -84,6 +84,7 @@ BOOL validate_service_name(LPCWSTR name);
|
||||
BOOL validate_service_config(struct service_entry *entry);
|
||||
DWORD save_service_config(struct service_entry *entry);
|
||||
void free_service_entry(struct service_entry *entry);
|
||||
struct service_entry *grab_service(struct service_entry *service);
|
||||
void release_service(struct service_entry *service);
|
||||
void service_lock(struct service_entry *service);
|
||||
void service_unlock(struct service_entry *service);
|
||||
|
Loading…
Reference in New Issue
Block a user