Commit ac3f571e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

services: Store a list of service handles in service_entry.

parent 9084b976
......@@ -78,6 +78,7 @@ struct sc_manager_handle /* service control manager handle */
struct sc_service_handle /* service handle */
{
struct sc_handle hdr;
struct list entry;
struct service_entry *service_entry;
};
......@@ -311,6 +312,7 @@ static void SC_RPC_HANDLE_destroy(SC_RPC_HANDLE handle)
{
struct sc_service_handle *service = (struct sc_service_handle *)hdr;
service_lock(service->service_entry);
list_remove(&service->entry);
if (service->service_entry->notify &&
service->service_entry->notify->service == service)
{
......@@ -431,7 +433,11 @@ static DWORD create_handle_for_service(struct service_entry *entry, DWORD dwDesi
service->hdr.type = SC_HTYPE_SERVICE;
service->hdr.access = dwDesiredAccess;
RtlMapGenericMask(&service->hdr.access, &g_svc_generic);
service_lock(entry);
service->service_entry = entry;
list_add_tail(&entry->handles, &service->entry);
service_unlock(entry);
*phService = &service->hdr;
return ERROR_SUCCESS;
......
......@@ -21,6 +21,7 @@
#define WIN32_LEAN_AND_MEAN
#include <stdarg.h>
#include <assert.h>
#include <windows.h>
#include <winsvc.h>
#include <rpc.h>
......@@ -114,6 +115,7 @@ DWORD service_create(LPCWSTR name, struct service_entry **entry)
if (!*entry)
return ERROR_NOT_ENOUGH_SERVER_MEMORY;
(*entry)->name = strdupW(name);
list_init(&(*entry)->handles);
if (!(*entry)->name)
{
HeapFree(GetProcessHeap(), 0, *entry);
......@@ -136,6 +138,7 @@ DWORD service_create(LPCWSTR name, struct service_entry **entry)
void free_service_entry(struct service_entry *entry)
{
assert(list_empty(&entry->handles));
CloseHandle(entry->status_changed_event);
HeapFree(GetProcessHeap(), 0, entry->name);
HeapFree(GetProcessHeap(), 0, entry->config.lpBinaryPathName);
......
......@@ -67,6 +67,7 @@ struct service_entry
BOOL is_wow64;
BOOL status_notified;
struct sc_notify_handle *notify;
struct list handles;
};
extern struct scmdatabase *active_database;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment