Patchwork [RFC,v3,08/11] qemu-ga: install Windows VSS provider on `qemu-ga -s install'

login
register
mail settings
Submitter Tomoki Sekiyama
Date May 21, 2013, 3:34 p.m.
Message ID <20130521153405.4880.69541.stgit@hds.com>
Download mbox | patch
Permalink /patch/245324/
State New
Headers show

Comments

Tomoki Sekiyama - May 21, 2013, 3:34 p.m.
Register QGA VSS provider library into Windows when qemu-ga is installed as
Windows service ('-s install' option). It is deregistered when the service
is uninstalled ('-s uninstall' option).

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
---
 qga/main.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Patch

diff --git a/qga/main.c b/qga/main.c
index 3ffba14..377b4be 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -1029,8 +1029,16 @@  int main(int argc, char **argv)
         case 's':
             service = optarg;
             if (strcmp(service, "install") == 0) {
+#ifdef HAS_VSS_SDK
+                if (FAILED(COMRegister())) {
+                    return EXIT_FAILURE;
+                }
+#endif
                 return ga_install_service(path, log_filepath);
             } else if (strcmp(service, "uninstall") == 0) {
+#ifdef HAS_VSS_SDK
+                COMUnregister();
+#endif
                 return ga_uninstall_service();
             } else {
                 printf("Unknown service command.\n");