msvcr80: Add _CreateFrameInfo implementation.
[wine.git] / programs / services / services.h
blobb8f4774be2a63833488f0155ca979e25cdc13d95
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 process_entry
36 LONG ref_count;
37 HANDLE process;
38 HANDLE control_mutex;
39 HANDLE control_pipe;
40 HANDLE overlapped_event;
41 HANDLE status_changed_event;
44 struct service_entry
46 struct list entry;
47 struct scmdatabase *db;
48 LONG ref_count; /* number of references - if goes to zero and the service is deleted the structure will be freed */
49 LPWSTR name;
50 SERVICE_STATUS_PROCESS status;
51 QUERY_SERVICE_CONFIGW config;
52 DWORD preshutdown_timeout;
53 LPWSTR description;
54 LPWSTR dependOnServices;
55 LPWSTR dependOnGroups;
56 struct process_entry *process;
57 BOOL force_shutdown;
58 BOOL marked_for_delete;
59 BOOL is_wow64;
62 extern struct scmdatabase *active_database;
64 /* SCM database functions */
66 struct service_entry *scmdatabase_find_service(struct scmdatabase *db, LPCWSTR name);
67 struct service_entry *scmdatabase_find_service_by_displayname(struct scmdatabase *db, LPCWSTR name);
68 DWORD scmdatabase_add_service(struct scmdatabase *db, struct service_entry *entry);
70 DWORD scmdatabase_lock_startup(struct scmdatabase *db);
71 void scmdatabase_unlock_startup(struct scmdatabase *db);
73 void scmdatabase_lock(struct scmdatabase *db);
74 void scmdatabase_unlock(struct scmdatabase *db);
76 /* Service functions */
78 DWORD service_create(LPCWSTR name, struct service_entry **entry);
79 BOOL validate_service_name(LPCWSTR name);
80 BOOL validate_service_config(struct service_entry *entry);
81 DWORD save_service_config(struct service_entry *entry);
82 void free_service_entry(struct service_entry *entry);
83 void release_service(struct service_entry *service);
84 void service_lock(struct service_entry *service);
85 void service_unlock(struct service_entry *service);
86 DWORD service_start(struct service_entry *service, DWORD service_argc, LPCWSTR *service_argv);
87 void service_terminate(struct service_entry *service);
89 /* Process functions */
91 void release_process(struct process_entry *process);
92 BOOL process_send_command(struct process_entry *process, const void *data, DWORD size, DWORD *result);
94 extern HANDLE g_hStartedEvent;
96 extern DWORD service_pipe_timeout;
97 extern DWORD service_kill_timeout;
99 DWORD RPC_Init(void);
100 DWORD events_loop(void);
102 /* from utils.c */
103 LPWSTR strdupW(LPCWSTR str);
105 BOOL check_multisz(LPCWSTR lpMultiSz, DWORD cbSize);
107 DWORD load_reg_string(HKEY hKey, LPCWSTR szValue, BOOL bExpand, LPWSTR *output);
108 DWORD load_reg_multisz(HKEY hKey, LPCWSTR szValue, BOOL bAllowSingle, LPWSTR *output);
109 DWORD load_reg_dword(HKEY hKey, LPCWSTR szValue, DWORD *output);
111 static inline LPCWSTR get_display_name(struct service_entry *service)
113 return service->config.lpDisplayName ? service->config.lpDisplayName : service->name;
116 static inline BOOL is_marked_for_delete(struct service_entry *service)
118 return service->marked_for_delete;
121 static inline DWORD mark_for_delete(struct service_entry *service)
123 service->marked_for_delete = TRUE;
124 return ERROR_SUCCESS;
127 #endif /*WINE_PROGRAMS_UTILS_H_*/