mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:54:13 +00:00
msiexec: Avoid broken pipe error caused by setting SERVICE_STOPPED state twice.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
eddc4609ec
commit
0722a25dcd
1 changed files with 5 additions and 10 deletions
|
@ -47,7 +47,9 @@ static BOOL UpdateSCMStatus(DWORD dwCurrentState, DWORD dwWin32ExitCode,
|
||||||
status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
|
status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
|
||||||
status.dwCurrentState = dwCurrentState;
|
status.dwCurrentState = dwCurrentState;
|
||||||
|
|
||||||
if (dwCurrentState == SERVICE_START_PENDING)
|
if (dwCurrentState == SERVICE_START_PENDING
|
||||||
|
|| dwCurrentState == SERVICE_STOP_PENDING
|
||||||
|
|| dwCurrentState == SERVICE_STOPPED)
|
||||||
status.dwControlsAccepted = 0;
|
status.dwControlsAccepted = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -81,8 +83,6 @@ static BOOL UpdateSCMStatus(DWORD dwCurrentState, DWORD dwWin32ExitCode,
|
||||||
|
|
||||||
static void WINAPI ServiceCtrlHandler(DWORD code)
|
static void WINAPI ServiceCtrlHandler(DWORD code)
|
||||||
{
|
{
|
||||||
DWORD state = SERVICE_RUNNING;
|
|
||||||
|
|
||||||
WINE_TRACE("%d\n", code);
|
WINE_TRACE("%d\n", code);
|
||||||
|
|
||||||
switch (code)
|
switch (code)
|
||||||
|
@ -91,14 +91,12 @@ static void WINAPI ServiceCtrlHandler(DWORD code)
|
||||||
case SERVICE_CONTROL_STOP:
|
case SERVICE_CONTROL_STOP:
|
||||||
UpdateSCMStatus(SERVICE_STOP_PENDING, NO_ERROR, 0);
|
UpdateSCMStatus(SERVICE_STOP_PENDING, NO_ERROR, 0);
|
||||||
KillService();
|
KillService();
|
||||||
state = SERVICE_STOPPED;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Unhandled service control code: %d\n", code);
|
fprintf(stderr, "Unhandled service control code: %d\n", code);
|
||||||
|
UpdateSCMStatus(SERVICE_RUNNING, NO_ERROR, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateSCMStatus(state, NO_ERROR, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD WINAPI ServiceExecutionThread(LPVOID param)
|
static DWORD WINAPI ServiceExecutionThread(LPVOID param)
|
||||||
|
@ -150,10 +148,7 @@ static void WINAPI ServiceMain(DWORD argc, LPSTR *argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateSCMStatus(SERVICE_RUNNING, NO_ERROR, 0);
|
UpdateSCMStatus(SERVICE_RUNNING, NO_ERROR, 0);
|
||||||
|
WaitForSingleObject(thread, INFINITE);
|
||||||
WaitForSingleObject(kill_event, INFINITE);
|
|
||||||
KillService();
|
|
||||||
|
|
||||||
UpdateSCMStatus(SERVICE_STOPPED, NO_ERROR, 0);
|
UpdateSCMStatus(SERVICE_STOPPED, NO_ERROR, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue