From 012bb70cd16512dbcc1ba423c3f7f260e177afe7 Mon Sep 17 00:00:00 2001 From: Kostiantyn Kostiuk Date: Fri, 20 Jun 2025 11:31:32 +0300 Subject: qga-vss: Exit with non-zero code when register fail QGA installer uses rundll32 to run the DLLCOMRegister function from qga-vss.dll and perform VSS provider registration. rundll32 ignores the return value of the function and always exits with a zero exit code. This causes a situation where the installer does not know the status of VSS provider registration. This commit forces to change exit code when the VSS provider registration fails. https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/rundll32 Reviewed-by: Yan Vugenfirer Tested-by: Dehan Meng Message-ID: <20250620083132.28347-1-kkostiuk@redhat.com> Signed-off-by: Kostiantyn Kostiuk --- qga/vss-win32/install.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'qga/vss-win32/install.cpp') diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp index 5cea5bcf74..6ee2f44a10 100644 --- a/qga/vss-win32/install.cpp +++ b/qga/vss-win32/install.cpp @@ -385,7 +385,10 @@ out: STDAPI_(void) CALLBACK DLLCOMRegister(HWND, HINSTANCE, LPSTR, int); STDAPI_(void) CALLBACK DLLCOMRegister(HWND, HINSTANCE, LPSTR, int) { - COMRegister(); + HRESULT hr = COMRegister(); + if (FAILED(hr)) { + exit(hr); + } } STDAPI_(void) CALLBACK DLLCOMUnregister(HWND, HINSTANCE, LPSTR, int); -- cgit 1.4.1 From 1c90e89e64beb2bd72f8e437c56274c885df7b3f Mon Sep 17 00:00:00 2001 From: Elizabeth Ashurov Date: Wed, 18 Jun 2025 12:18:06 +0300 Subject: 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. Signed-off-by: Elizabeth Ashurov Reviewed-by: Kostiantyn Kostiuk Message-ID: <20250618091806.170110-1-eashurov@redhat.com> Signed-off-by: Kostiantyn Kostiuk --- qga/vss-win32/install.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'qga/vss-win32/install.cpp') diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp index 6ee2f44a10..7b25d9098b 100644 --- a/qga/vss-win32/install.cpp +++ b/qga/vss-win32/install.cpp @@ -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, -- cgit 1.4.1