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 <[email protected]>
---
 qga/vss-win32/install.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
index 5b7a8e9bc529..f89658d277e9 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;
     }

-- 
2.55.0.543.g5ebe2ebe4ea8


Reply via email to