mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 14:24:45 +00:00
msiexec: MSI service should report SERVICE_STOPPED when appropriate.
This commit is contained in:
parent
957f7013d2
commit
955de31fad
1 changed files with 8 additions and 1 deletions
|
@ -81,6 +81,8 @@ static BOOL UpdateSCMStatus(DWORD dwCurrentState, DWORD dwWin32ExitCode,
|
|||
|
||||
static void WINAPI ServiceCtrlHandler(DWORD code)
|
||||
{
|
||||
DWORD state = SERVICE_RUNNING;
|
||||
|
||||
WINE_TRACE("%d\n", code);
|
||||
|
||||
switch (code)
|
||||
|
@ -89,13 +91,14 @@ static void WINAPI ServiceCtrlHandler(DWORD code)
|
|||
case SERVICE_CONTROL_STOP:
|
||||
UpdateSCMStatus(SERVICE_STOP_PENDING, NO_ERROR, 0);
|
||||
KillService();
|
||||
state = SERVICE_STOPPED;
|
||||
return;
|
||||
default:
|
||||
fprintf(stderr, "Unhandled service control code: %d\n", code);
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateSCMStatus(SERVICE_RUNNING, NO_ERROR, 0);
|
||||
UpdateSCMStatus(state, NO_ERROR, 0);
|
||||
}
|
||||
|
||||
static DWORD WINAPI ServiceExecutionThread(LPVOID param)
|
||||
|
@ -135,12 +138,14 @@ static void WINAPI ServiceMain(DWORD argc, LPSTR *argv)
|
|||
{
|
||||
fprintf(stderr, "Failed to create event\n");
|
||||
KillService();
|
||||
UpdateSCMStatus(SERVICE_STOPPED, NO_ERROR, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!StartServiceThread())
|
||||
{
|
||||
KillService();
|
||||
UpdateSCMStatus(SERVICE_STOPPED, NO_ERROR, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -148,6 +153,8 @@ static void WINAPI ServiceMain(DWORD argc, LPSTR *argv)
|
|||
|
||||
WaitForSingleObject(kill_event, INFINITE);
|
||||
KillService();
|
||||
|
||||
UpdateSCMStatus(SERVICE_STOPPED, NO_ERROR, 0);
|
||||
}
|
||||
|
||||
DWORD DoService(void)
|
||||
|
|
Loading…
Reference in a new issue