qcap/tests: Add media tests for the SmartTee filter.
[wine/multimedia.git] / programs / services / services.h
blob909054254b0b56a4749d320d0718aebf92e78d0a
1 /*
2 * Services.exe - include file
4 * Copyright 2007 Google (Mikolaj Zalewski)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef WINE_PROGRAMS_UTILS_H_
22 #define WINE_PROGRAMS_UTILS_H_
24 #include "wine/list.h"
26 struct scmdatabase
28 HKEY root_key;
29 LONG service_start_lock;
30 struct list services;
31 CRITICAL_SECTION cs;
34 struct service_entry
36 struct list entry;
37 struct scmdatabase *db;
38 LONG ref_count; /* number of references - if goes to zero and the service is deleted the structure will be freed */
39 LPWSTR name;
40 SERVICE_STATUS_PROCESS status;
41 QUERY_SERVICE_CONFIGW config;
42 DWORD preshutdown_timeout;
43 LPWSTR description;
44 LPWSTR dependOnServices;
45 LPWSTR dependOnGroups;
46 HANDLE process;
47 HANDLE control_mutex;
48 HANDLE control_pipe;
49 HANDLE overlapped_event;
50 HANDLE status_changed_event;
51 BOOL marked_for_delete;
52 BOOL is_wow64;
55 extern struct scmdatabase *active_database;
57 /* SCM database functions */
59 struct service_entry *scmdatabase_find_service(struct scmdatabase *db, LPCWSTR name);
60 struct service_entry *scmdatabase_find_service_by_displayname(struct scmdatabase *db, LPCWSTR name);
61 DWORD scmdatabase_add_service(struct scmdatabase *db, struct service_entry *entry);
63 DWORD scmdatabase_lock_startup(struct scmdatabase *db);
64 void scmdatabase_unlock_startup(struct scmdatabase *db);
66 void scmdatabase_lock_shared(struct scmdatabase *db);
67 void scmdatabase_lock_exclusive(struct scmdatabase *db);
68 void scmdatabase_unlock(struct scmdatabase *db);
70 /* Service functions */
72 DWORD service_create(LPCWSTR name, struct service_entry **entry);
73 BOOL validate_service_name(LPCWSTR name);
74 BOOL validate_service_config(struct service_entry *entry);
75 DWORD save_service_config(struct service_entry *entry);
76 void free_service_entry(struct service_entry *entry);
77 void release_service(struct service_entry *service);
78 void service_lock_shared(struct service_entry *service);
79 void service_lock_exclusive(struct service_entry *service);
80 void service_unlock(struct service_entry *service);
81 DWORD service_start(struct service_entry *service, DWORD service_argc, LPCWSTR *service_argv);
82 void service_terminate(struct service_entry *service);
83 BOOL service_send_command( struct service_entry *service, HANDLE pipe,
84 const void *data, DWORD size, DWORD *result );
86 extern HANDLE g_hStartedEvent;
88 extern DWORD service_pipe_timeout;
89 extern DWORD service_kill_timeout;
91 DWORD RPC_Init(void);
92 DWORD events_loop(void);
94 /* from utils.c */
95 LPWSTR strdupW(LPCWSTR str);
97 BOOL check_multisz(LPCWSTR lpMultiSz, DWORD cbSize);
99 DWORD load_reg_string(HKEY hKey, LPCWSTR szValue, BOOL bExpand, LPWSTR *output);
100 DWORD load_reg_multisz(HKEY hKey, LPCWSTR szValue, BOOL bAllowSingle, LPWSTR *output);
101 DWORD load_reg_dword(HKEY hKey, LPCWSTR szValue, DWORD *output);
103 static inline LPCWSTR get_display_name(struct service_entry *service)
105 return service->config.lpDisplayName ? service->config.lpDisplayName : service->name;
108 static inline BOOL is_marked_for_delete(struct service_entry *service)
110 return service->marked_for_delete;
113 static inline DWORD mark_for_delete(struct service_entry *service)
115 service->marked_for_delete = TRUE;
116 return ERROR_SUCCESS;
119 #endif /*WINE_PROGRAMS_UTILS_H_*/