services: Split RPC_MainLoop into initialisation and the actual loop.
This commit is contained in:
parent
9a2914b11f
commit
559fafebbf
|
@ -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();
|
||||
|
||||
SetEvent(g_hStartedEvent);
|
||||
|
||||
WINE_TRACE("Entered main loop\n");
|
||||
hSleepHandle = __wine_make_process_system();
|
||||
SetEvent(g_hStartedEvent);
|
||||
|
||||
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 */
|
||||
|
|
Loading…
Reference in New Issue