services: Do not overwrite the service type in SetServiceStatus().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-07-03 17:29:35 -05:00 committed by Alexandre Julliard
parent 946e1b2f6b
commit 4f8dfdba3d
3 changed files with 16 additions and 11 deletions

View File

@ -135,6 +135,8 @@ static BOOL start_driver(HANDLE service)
}
ok(status.dwCurrentState == SERVICE_RUNNING,
"expected SERVICE_RUNNING, got %d\n", status.dwCurrentState);
ok(status.dwServiceType == SERVICE_KERNEL_DRIVER,
"expected SERVICE_KERNEL_DRIVER, got %#x\n", status.dwServiceType);
return TRUE;
}

View File

@ -865,28 +865,31 @@ static void fill_notify(struct sc_notify_handle *notify, struct service_entry *s
SetEvent(notify->event);
}
DWORD __cdecl svcctl_SetServiceStatus(
SC_RPC_HANDLE hServiceStatus,
LPSERVICE_STATUS lpServiceStatus)
DWORD __cdecl svcctl_SetServiceStatus(SC_RPC_HANDLE handle, SERVICE_STATUS *status)
{
struct sc_service_handle *service, *service_handle;
struct process_entry *process;
DWORD err, mask;
WINE_TRACE("(%p, %p)\n", hServiceStatus, lpServiceStatus);
WINE_TRACE("(%p, %p)\n", handle, status);
if ((err = validate_service_handle(hServiceStatus, SERVICE_SET_STATUS, &service)) != 0)
if ((err = validate_service_handle(handle, SERVICE_SET_STATUS, &service)) != 0)
return err;
service_lock(service->service_entry);
/* FIXME: be a bit more discriminant about what parts of the status we set
* and check that fields are valid */
service->service_entry->status = *lpServiceStatus;
service->service_entry->status.dwCurrentState = status->dwCurrentState;
service->service_entry->status.dwControlsAccepted = status->dwControlsAccepted;
service->service_entry->status.dwWin32ExitCode = status->dwWin32ExitCode;
service->service_entry->status.dwServiceSpecificExitCode = status->dwServiceSpecificExitCode;
service->service_entry->status.dwCheckPoint = status->dwCheckPoint;
service->service_entry->status.dwWaitHint = status->dwWaitHint;
SetEvent(service->service_entry->status_changed_event);
if ((process = service->service_entry->process) &&
lpServiceStatus->dwCurrentState == SERVICE_STOPPED)
status->dwCurrentState == SERVICE_STOPPED)
{
service->service_entry->process = NULL;
if (!--process->use_count)

View File

@ -462,7 +462,7 @@ static void test_service(void)
res = QueryServiceStatus(service_handle, &status);
ok(res, "QueryServiceStatus failed: %d\n", GetLastError());
todo_wine ok(status.dwServiceType == SERVICE_WIN32_OWN_PROCESS, "status.dwServiceType = %x\n", status.dwServiceType);
ok(status.dwServiceType == SERVICE_WIN32_OWN_PROCESS, "status.dwServiceType = %x\n", status.dwServiceType);
ok(status.dwCurrentState == SERVICE_RUNNING, "status.dwCurrentState = %x\n", status.dwCurrentState);
ok(status.dwControlsAccepted == (SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN),
"status.dwControlsAccepted = %x\n", status.dwControlsAccepted);
@ -517,7 +517,7 @@ static inline void test_no_stop(void)
res = QueryServiceStatus(service_handle, &status);
ok(res, "QueryServiceStatus failed: %d\n", GetLastError());
todo_wine ok(status.dwServiceType == SERVICE_WIN32_OWN_PROCESS, "status.dwServiceType = %x\n", status.dwServiceType);
ok(status.dwServiceType == SERVICE_WIN32_OWN_PROCESS, "status.dwServiceType = %x\n", status.dwServiceType);
ok(status.dwCurrentState == SERVICE_RUNNING, "status.dwCurrentState = %x\n", status.dwCurrentState);
ok(status.dwControlsAccepted == (SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN),
"status.dwControlsAccepted = %x\n", status.dwControlsAccepted);
@ -538,7 +538,7 @@ static inline void test_no_stop(void)
res = QueryServiceStatus(service_handle, &status);
ok(res, "QueryServiceStatus failed: %d\n", GetLastError());
todo_wine ok(status.dwServiceType == SERVICE_WIN32_OWN_PROCESS, "status.dwServiceType = %x\n", status.dwServiceType);
ok(status.dwServiceType == SERVICE_WIN32_OWN_PROCESS, "status.dwServiceType = %x\n", status.dwServiceType);
ok(status.dwCurrentState==SERVICE_STOPPED || status.dwCurrentState==SERVICE_STOP_PENDING,
"status.dwCurrentState = %x\n", status.dwCurrentState);
ok(status.dwControlsAccepted == 0, "status.dwControlsAccepted = %x\n", status.dwControlsAccepted);
@ -558,7 +558,7 @@ static inline void test_no_stop(void)
res = QueryServiceStatus(service_handle, &status);
ok(res, "QueryServiceStatus failed: %d\n", GetLastError());
todo_wine ok(status.dwServiceType == SERVICE_WIN32_OWN_PROCESS, "status.dwServiceType = %x\n", status.dwServiceType);
ok(status.dwServiceType == SERVICE_WIN32_OWN_PROCESS, "status.dwServiceType = %x\n", status.dwServiceType);
ok(status.dwCurrentState==SERVICE_STOPPED || status.dwCurrentState==SERVICE_STOP_PENDING,
"status.dwCurrentState = %x\n", status.dwCurrentState);
ok(status.dwControlsAccepted == 0, "status.dwControlsAccepted = %x\n", status.dwControlsAccepted);