Commit 9a6fc01d authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

services: Move ControlService and StartServiceW from advapi32.dll to services.exe.

This also changes the architecture such that services.exe is the server end of the control pipe and the service is the client end.
parent 7afd9a97
......@@ -31,6 +31,16 @@ cpp_quote("#define SVCCTL_ENDPOINT {'\\\\','p','i','p','e','\\\\','s','v','c','c
/* Not the Windows event name - if needed the true one can be found in Inside Windows */
cpp_quote("#define SVCCTL_STARTED_EVENT {'_','_','w','i','n','e','_','S','v','c','c','t','l','S','t','a','r','t','e','d',0}")
/* Service startup protocol over control pipe - not compatible with Windows */
cpp_quote("typedef struct service_start_info_t")
cpp_quote("{")
cpp_quote(" DWORD cmd;")
cpp_quote(" DWORD size;")
cpp_quote(" WCHAR str[1];")
cpp_quote("} service_start_info;")
cpp_quote("#define WINESERV_STARTINFO 1")
cpp_quote("#define WINESERV_SENDCONTROL 2")
[
uuid(367abb81-9844-35f1-ad32-98f038001003),
......@@ -48,6 +58,9 @@ interface svcctl
/* undocumented access rights */
cpp_quote("#define SERVICE_SET_STATUS 0x8000")
/* undocumented access rights */
cpp_quote("#define SERVICE_SET_STATUS 0x8000")
cpp_quote("#if 0 /* already defined in winsvc.h */")
typedef struct _QUERY_SERVICE_CONFIGW {
DWORD dwServiceType;
......@@ -82,6 +95,13 @@ cpp_quote("#endif")
[in,out] SC_RPC_HANDLE *handle
);
/* Compatible with Windows function 0x01 */
DWORD svcctl_ControlService(
[in] SC_RPC_HANDLE hService,
[in] DWORD dwControl,
[out] SERVICE_STATUS *lpServiceStatus
);
/* Compatible with Windows function 0x02 */
DWORD svcctl_DeleteService(
[in] SC_RPC_HANDLE hService
......@@ -162,6 +182,13 @@ cpp_quote("#endif")
[in] SC_RPC_HANDLE hService,
[out] QUERY_SERVICE_CONFIGW *config);
/* Untested with Windows function 0x13 */
DWORD svcctl_StartServiceW(
[in] SC_RPC_HANDLE hService,
[in] DWORD dwNumServiceArgs,
[in,unique,size_is(dwNumServiceArgs)] LPCWSTR *lpServiceArgVectors
);
/* Compatible with Windows function 0x14 */
DWORD svcctl_GetServiceDisplayNameW(
[in] SC_RPC_HANDLE hSCManager,
......
......@@ -79,6 +79,9 @@ void free_service_entry(struct service_entry *entry)
HeapFree(GetProcessHeap(), 0, entry->config.lpServiceStartName);
HeapFree(GetProcessHeap(), 0, entry->config.lpDisplayName);
HeapFree(GetProcessHeap(), 0, entry->description);
CloseHandle(entry->control_mutex);
CloseHandle(entry->control_pipe);
CloseHandle(entry->status_changed_event);
HeapFree(GetProcessHeap(), 0, entry);
}
......@@ -362,6 +365,7 @@ static DWORD load_services(void)
entry = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*entry));
entry->name = strdupW(szName);
entry->control_pipe = INVALID_HANDLE_VALUE;
WINE_TRACE("Loading service %s\n", wine_dbgstr_w(szName));
err = RegOpenKeyExW(hServicesRootKey, szName, 0, KEY_READ | KEY_WRITE, &hServiceKey);
......
......@@ -33,6 +33,9 @@ struct service_entry
LPWSTR description;
LPWSTR dependOnServices;
LPWSTR dependOnGroups;
HANDLE control_mutex;
HANDLE control_pipe;
HANDLE status_changed_event;
};
BOOL validate_service_name(LPCWSTR name);
......
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