qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qga-win: VSS: Handle VSS_E_PROVIDER_ALREADY_REGISTERED error
@ 2017-11-22 11:30 Sameeh Jubran
  2017-11-22 11:57 ` no-reply
  2017-11-28 23:17 ` Michael Roth
  0 siblings, 2 replies; 4+ messages in thread
From: Sameeh Jubran @ 2017-11-22 11:30 UTC (permalink / raw)
  To: qemu-devel, mdroth; +Cc: Yan Vugenfirer

From: Sameeh Jubran <sjubran@redhat.com>

We can get VSS_E_PROVIDER_ALREADY_REGISTERED error if for some
reason the uninstall of qemu-ga didn't complete successfully.
In this case we can try to unregister the component service
and attempt to register it again.

Signed-off-by: Sameeh Jubran <sjubran@redhat.com>
---
 qga/vss-win32/install.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
index 51838eeb26..e7bc5e1d9d 100644
--- a/qga/vss-win32/install.cpp
+++ b/qga/vss-win32/install.cpp
@@ -443,6 +443,15 @@ STDAPI DllRegisterServer(void)
                                      VSS_PROV_SOFTWARE,
                                      const_cast<WCHAR*>(QGA_PROVIDER_VERSION),
                                      g_gProviderVersion);
+    if (hr == (long int) VSS_E_PROVIDER_ALREADY_REGISTERED) {
+        DllUnregisterServer();
+        hr = pVssAdmin->RegisterProvider(g_gProviderId, CLSID_QGAVSSProvider,
+                                     const_cast<WCHAR * >(QGA_PROVIDER_LNAME),
+                                     VSS_PROV_SOFTWARE,
+                                     const_cast<WCHAR * >(QGA_PROVIDER_VERSION),
+                                     g_gProviderVersion);
+    }
+
     if (FAILED(hr)) {
         errmsg_dialog(hr, "RegisterProvider failed");
     }
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-30 13:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-22 11:30 [Qemu-devel] [PATCH] qga-win: VSS: Handle VSS_E_PROVIDER_ALREADY_REGISTERED error Sameeh Jubran
2017-11-22 11:57 ` no-reply
2017-11-28 23:17 ` Michael Roth
2017-11-30 13:45   ` Sameeh Jubran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).