Skip to contentSkip to conversation

qga/vss-win32: Add VSS provider unregistration retry

PATCH In review Elizabeth Ashurov 2 participants 2 messages Jun 18, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 qga/vss-win32: Add VSS provider unregistration retry

This commit improves the QGA VSS provider installation flow by attempting to unregister the VSS provider if it's already found during installation. This allows for a retry of installation even if a previous unregistration failed or was not performed. This will prevent inconsistencies between QGA and QGA-VSS versions.
Before this commit, QGA can use QGA-VSS from the previous installation.

---
 qga/vss-win32/install.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
qga/vss-win32/install.cpp +7 -3
index 5cea5bcf74..9fe0dfc384 100644
@@ -287,9 +287,13 @@ STDAPI COMRegister(void)
 
     chk(QGAProviderFind(QGAProviderCount, (void *)&count));
     if (count) {
-        errmsg(E_ABORT, "QGA VSS Provider is already installed");
-        qga_debug_end;
-        return E_ABORT;
+        qga_debug("QGA VSS Provider is already installed. Attempting to unregister first.");
+        hr = COMUnregister();
+        if (FAILED(hr)) {
+            errmsg(hr, "Failed to unregister existing QGA VSS Provider. Aborting installation.");
+            qga_debug_end;
+            return E_ABORT;
+        }
     }
 
     chk(CoCreateInstance(CLSID_COMAdminCatalog, NULL, CLSCTX_INPROC_SERVER,
Signature · 1 line
2.49.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 40 lines · Elizabeth Ashurov

This commit improves the QGA VSS provider installation flow by attempting to unregister the VSS provider if it's already
found during installation. This allows for a retry of installation even if a previous unregistration failed or was not performed.
This will prevent inconsistencies between QGA and QGA-VSS versions. Before this commit, QGA can use QGA-VSS from the previous installation.

---
 qga/vss-win32/install.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
qga/vss-win32/install.cpp +7 -3
index 5cea5bcf74..9fe0dfc384 100644
@@ -287,9 +287,13 @@ STDAPI COMRegister(void)
 
     chk(QGAProviderFind(QGAProviderCount, (void *)&count));
     if (count) {
-        errmsg(E_ABORT, "QGA VSS Provider is already installed");
-        qga_debug_end;
-        return E_ABORT;
+        qga_debug("QGA VSS Provider is already installed. Attempting to
 unregister first.");
+        hr = COMUnregister();
+        if (FAILED(hr)) {
+            errmsg(hr, "Failed to unregister existing QGA VSS Provider.
 Aborting installation.");
+            qga_debug_end;
+            return E_ABORT;
+        }
     }

chk(CoCreateInstance(CLSID_COMAdminCatalog, NULL,
CLSCTX_INPROC_SERVER,
--
2.49.0