Commit 559fafeb authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

services: Split RPC_MainLoop into initialisation and the actual loop.

parent 9a2914b1
......@@ -1333,11 +1333,10 @@ DWORD svcctl_QueryServiceConfig2W(
}
DWORD RPC_MainLoop(void)
DWORD RPC_Init(void)
{
WCHAR transport[] = SVCCTL_TRANSPORT;
WCHAR endpoint[] = SVCCTL_ENDPOINT;
HANDLE hSleepHandle;
DWORD err;
if ((err = RpcServerUseProtseqEpW(transport, 0, endpoint, NULL)) != ERROR_SUCCESS)
......@@ -1357,17 +1356,26 @@ DWORD RPC_MainLoop(void)
WINE_ERR("RpcServerListen failed with error %u\n", err);
return err;
}
return ERROR_SUCCESS;
}
DWORD RPC_MainLoop(void)
{
DWORD err;
HANDLE hExitEvent = __wine_make_process_system();
WINE_TRACE("Entered main loop\n");
hSleepHandle = __wine_make_process_system();
SetEvent(g_hStartedEvent);
WINE_TRACE("Entered main loop\n");
do
{
err = WaitForSingleObjectEx(hSleepHandle, INFINITE, TRUE);
err = WaitForSingleObjectEx(hExitEvent, INFINITE, TRUE);
WINE_TRACE("Wait returned %d\n", err);
} while (err != WAIT_OBJECT_0);
WINE_TRACE("Object signaled - wine shutdown\n");
CloseHandle(hExitEvent);
return ERROR_SUCCESS;
}
......
......@@ -454,7 +454,8 @@ int main(int argc, char *argv[])
return err;
if ((err = scmdatabase_load_services(active_database)) != ERROR_SUCCESS)
return err;
err = RPC_MainLoop();
if ((err = RPC_Init()) == ERROR_SUCCESS)
RPC_MainLoop();
scmdatabase_destroy(active_database);
return err;
}
......@@ -77,6 +77,7 @@ void service_unlock(struct service_entry *service);
extern HANDLE g_hStartedEvent;
DWORD RPC_Init(void);
DWORD RPC_MainLoop(void);
/* from utils.c */
......
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