Skip to contentSkip to conversation

qga/vss-win32: Add VSS provider unregistration retry

PATCH Superseded Elizabeth Ashurov 2 participants 2 messages Jun 17, 2025 – Jun 18, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

---
 qga/vss-win32/install.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
qga/vss-win32/install.cpp +8 -3
index 5cea5bcf74..a136d46050 100644
@@ -263,6 +263,7 @@ STDAPI COMRegister(void)
     qga_debug_begin;
 
     HRESULT hr;
+    HRESULT unregisterHr;
     COMInitializer initializer;
     COMPointer<IUnknown> pUnknown;
     COMPointer<ICOMAdminCatalog2> pCatalog;
@@ -287,9 +288,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.");
+        unregisterHr = COMUnregister();
+        if (FAILED(unregisterHr)) {
+            errmsg(unregisterHr, "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
#1 lore raw

Best Regards,
Konstantin Kostiuk.

Quoted 5 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.

Please add:
This will prevent inconsistencies between QGA and QGA-VSS versions. Before this commit, QGA can use QGA-VSS from the previous installation.

Quoted 11 lines
---
 qga/vss-win32/install.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
qga/vss-win32/install.cpp +0 -0
index 5cea5bcf74..a136d46050 100644

qga/vss-win32/install.cpp STDAPI COMRegister(void) · line 267

Quoted 5 lines
qga/vss-win32/install.cpp +1 -0
@@ -263,6 +263,7 @@ STDAPI COMRegister(void)
     qga_debug_begin;
 
     HRESULT hr;
+    HRESULT unregisterHr;
 

extra HRESULT is redundant; you can reuse existing one

Quoted 9 lines
qga/vss-win32/install.cpp +0 -0
     COMInitializer initializer;
     COMPointer<IUnknown> pUnknown;
     COMPointer<ICOMAdminCatalog2> pCatalog;
qga/vss-win32/install.cpp +0 -2
@@ -287,9 +288,13 @@ STDAPI COMRegister(void)
 
     chk(QGAProviderFind(QGAProviderCount, (void *)&count));
     if (count) {
-        errmsg(E_ABORT, "QGA VSS Provider is already installed");
-        qga_debug_end;

qga/vss-win32/install.cpp STDAPI COMRegister(void) · line 299

Quoted 10 lines
qga/vss-win32/install.cpp +6 -1
-        return E_ABORT;
+        qga_debug("QGA VSS Provider is already installed. Attempting to
 unregister first.");
+        unregisterHr = COMUnregister();
+        if (FAILED(unregisterHr)) {
+            errmsg(unregisterHr, "Failed to unregister existing QGA VSS
 Provider. Aborting installation.");
+            qga_debug_end;
+            return E_ABORT;
 

.git/rebase-apply/patch:29: trailing whitespace.

            return E_ABORT;

warning: 1 line adds whitespace errors.
please fix

Quoted 9 lines
qga/vss-win32/install.cpp +1 -0
+        }
     }

     chk(CoCreateInstance(CLSID_COMAdminCatalog, NULL,

CLSCTX_INPROC_SERVER,
--
2.49.0