[PATCH 2/2] services: Do not overwrite the service type in SetServiceStatus().
Zebediah Figura
zfigura at codeweavers.com
Wed Jul 3 17:29:35 CDT 2019
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
This fixes the test failure reported here:
https://www.winehq.org/pipermail/wine-devel/2019-July/148450.html
dlls/ntoskrnl.exe/tests/ntoskrnl.c | 2 ++
programs/services/rpc.c | 17 ++++++++++-------
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
index 267fddb7cc3..48ddb299cfd 100644
--- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
@@ -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;
}
diff --git a/programs/services/rpc.c b/programs/services/rpc.c
index 8a77d97dd9f..a657492a5f6 100644
--- a/programs/services/rpc.c
+++ b/programs/services/rpc.c
@@ -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)
--
2.20.1
More information about the wine-devel
mailing list