Commit 1a0b3a565b for qemu.org
commit 1a0b3a565b410dc38c98225f642779aaaf7f536b
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date: Mon Sep 7 14:50:01 2026 +0400
qga/vss-win32: pass valid SERVICE_STATUS to ControlService
ControlService requires a non-NULL lpServiceStatus parameter ([out] vs
[out, optional]).
Passing NULL is undefined behavior per MSDN and can crash on
some Windows versions.
Fixes: 917ebcb17027 ("qga-win: Fix QGA VSS Provider service stop failure")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260907-qga-v1-3-86456ad356e2@redhat.com
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
index 5b7a8e9bc5..f89658d277 100644
--- a/qga/vss-win32/install.cpp
+++ b/qga/vss-win32/install.cpp
@@ -572,6 +572,7 @@ namespace _com_util
/* Stop QGA VSS provider service using Winsvc API */
STDAPI StopService(void)
{
+ SERVICE_STATUS status;
qga_debug_begin;
HRESULT hr = S_OK;
@@ -590,7 +591,7 @@ STDAPI StopService(void)
hr = E_FAIL;
goto out;
}
- if (!(ControlService(service, SERVICE_CONTROL_STOP, NULL))) {
+ if (!(ControlService(service, SERVICE_CONTROL_STOP, &status))) {
errmsg(E_FAIL, "Failed to stop service");
hr = E_FAIL;
}