Patchwork [v5,10/11] qemu-ga: Install Windows VSS provider on `qemu-ga -s install'

login
register
mail settings
Submitter Tomoki Sekiyama
Date July 3, 2013, 3:49 p.m.
Message ID <20130703154954.20767.5463.stgit@hds.com>
Download mbox | patch
Permalink /patch/256700/
State New
Headers show

Comments

Tomoki Sekiyama - July 3, 2013, 3:49 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 |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Patch

diff --git a/qga/main.c b/qga/main.c
index 160ff28..be23749 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -1037,8 +1037,16 @@  int main(int argc, char **argv)
                 fixed_state_dir = (state_dir == dfl_pathnames.state_dir) ?
                                   NULL :
                                   state_dir;
-                return ga_install_service(path, log_filepath, fixed_state_dir);
+                if (ga_install_vss_provider()) {
+                    return EXIT_FAILURE;
+                }
+                if (ga_install_service(path, log_filepath, fixed_state_dir)) {
+                    ga_uninstall_vss_provider();
+                    return EXIT_FAILURE;
+                }
+                return 0;
             } else if (strcmp(service, "uninstall") == 0) {
+                ga_uninstall_vss_provider();
                 return ga_uninstall_service();
             } else {
                 printf("Unknown service command.\n");