From b2413df83348acf371c03bced9a3845bba883ed5 Mon Sep 17 00:00:00 2001 From: Sameeh Jubran Date: Wed, 11 Mar 2020 19:04:16 +0200 Subject: qga-win: Handle VSS_E_PROVIDER_ALREADY_REGISTERED error This patch handles the case where VSS Provider is already registered, where in such case qga uninstalls the provider and registers it again. Signed-off-by: Sameeh Jubran Signed-off-by: Basil Salman Signed-off-by: Michael Roth --- qga/vss-win32/install.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'qga') diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp index 6713e58..a456841 100644 --- a/qga/vss-win32/install.cpp +++ b/qga/vss-win32/install.cpp @@ -443,6 +443,17 @@ STDAPI DllRegisterServer(void) VSS_PROV_SOFTWARE, const_cast(QGA_PROVIDER_VERSION), g_gProviderVersion); + if (hr == (long int) VSS_E_PROVIDER_ALREADY_REGISTERED) { + DllUnregisterServer(); + hr = pVssAdmin->RegisterProvider(g_gProviderId, CLSID_QGAVSSProvider, + const_cast + (QGA_PROVIDER_LNAME), + VSS_PROV_SOFTWARE, + const_cast + (QGA_PROVIDER_VERSION), + g_gProviderVersion); + } + if (FAILED(hr)) { errmsg_dialog(hr, "RegisterProvider failed"); } -- cgit v1.1