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