Patchwork [RFC,07/10] qemu-ga: install Windows VSS provider on `qemu-ga -s install'

login
register
mail settings
Submitter Tomoki Sekiyama
Date Feb. 14, 2013, 6:10 a.m.
Message ID <20130214061049.15062.79638.stgit@melchior2.sdl.hitachi.co.jp>
Download mbox | patch
Permalink /patch/220366/
State New
Headers show

Comments

Tomoki Sekiyama - Feb. 14, 2013, 6:10 a.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.qu@hitachi.com>
---
 qga/main.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Patch

diff --git a/qga/main.c b/qga/main.c
index 423d41b..3e6d95e 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -850,8 +850,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");