services: Store a list of service handles in service_entry.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9084b9761d
commit
ac3f571e56
|
@ -78,6 +78,7 @@ struct sc_manager_handle /* service control manager handle */
|
||||||
struct sc_service_handle /* service handle */
|
struct sc_service_handle /* service handle */
|
||||||
{
|
{
|
||||||
struct sc_handle hdr;
|
struct sc_handle hdr;
|
||||||
|
struct list entry;
|
||||||
struct service_entry *service_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;
|
struct sc_service_handle *service = (struct sc_service_handle *)hdr;
|
||||||
service_lock(service->service_entry);
|
service_lock(service->service_entry);
|
||||||
|
list_remove(&service->entry);
|
||||||
if (service->service_entry->notify &&
|
if (service->service_entry->notify &&
|
||||||
service->service_entry->notify->service == service)
|
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.type = SC_HTYPE_SERVICE;
|
||||||
service->hdr.access = dwDesiredAccess;
|
service->hdr.access = dwDesiredAccess;
|
||||||
RtlMapGenericMask(&service->hdr.access, &g_svc_generic);
|
RtlMapGenericMask(&service->hdr.access, &g_svc_generic);
|
||||||
|
|
||||||
|
service_lock(entry);
|
||||||
service->service_entry = entry;
|
service->service_entry = entry;
|
||||||
|
list_add_tail(&entry->handles, &service->entry);
|
||||||
|
service_unlock(entry);
|
||||||
|
|
||||||
*phService = &service->hdr;
|
*phService = &service->hdr;
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <assert.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winsvc.h>
|
#include <winsvc.h>
|
||||||
#include <rpc.h>
|
#include <rpc.h>
|
||||||
|
@ -114,6 +115,7 @@ DWORD service_create(LPCWSTR name, struct service_entry **entry)
|
||||||
if (!*entry)
|
if (!*entry)
|
||||||
return ERROR_NOT_ENOUGH_SERVER_MEMORY;
|
return ERROR_NOT_ENOUGH_SERVER_MEMORY;
|
||||||
(*entry)->name = strdupW(name);
|
(*entry)->name = strdupW(name);
|
||||||
|
list_init(&(*entry)->handles);
|
||||||
if (!(*entry)->name)
|
if (!(*entry)->name)
|
||||||
{
|
{
|
||||||
HeapFree(GetProcessHeap(), 0, *entry);
|
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)
|
void free_service_entry(struct service_entry *entry)
|
||||||
{
|
{
|
||||||
|
assert(list_empty(&entry->handles));
|
||||||
CloseHandle(entry->status_changed_event);
|
CloseHandle(entry->status_changed_event);
|
||||||
HeapFree(GetProcessHeap(), 0, entry->name);
|
HeapFree(GetProcessHeap(), 0, entry->name);
|
||||||
HeapFree(GetProcessHeap(), 0, entry->config.lpBinaryPathName);
|
HeapFree(GetProcessHeap(), 0, entry->config.lpBinaryPathName);
|
||||||
|
|
|
@ -67,6 +67,7 @@ struct service_entry
|
||||||
BOOL is_wow64;
|
BOOL is_wow64;
|
||||||
BOOL status_notified;
|
BOOL status_notified;
|
||||||
struct sc_notify_handle *notify;
|
struct sc_notify_handle *notify;
|
||||||
|
struct list handles;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct scmdatabase *active_database;
|
extern struct scmdatabase *active_database;
|
||||||
|
|
Loading…
Reference in New Issue