From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtfOw-0003UG-Gb for qemu-devel@nongnu.org; Mon, 01 Jul 2013 10:48:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtfOm-0000OM-Ol for qemu-devel@nongnu.org; Mon, 01 Jul 2013 10:48:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24066) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtfOm-0000O4-FR for qemu-devel@nongnu.org; Mon, 01 Jul 2013 10:48:12 -0400 Message-ID: <51D19733.4040107@redhat.com> Date: Mon, 01 Jul 2013 16:50:27 +0200 From: Laszlo Ersek MIME-Version: 1.0 References: <20130606150618.10486.60669.stgit@hds.com> <20130606150657.10486.19314.stgit@hds.com> In-Reply-To: <20130606150657.10486.19314.stgit@hds.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 09/10] qemu-ga: install Windows VSS provider on `qemu-ga -s install' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Tomoki Sekiyama Cc: libaiqing@huawei.com, mdroth@linux.vnet.ibm.com, stefanha@gmail.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, vrozenfe@redhat.com, pbonzini@redhat.com, seiji.aguchi@hds.com, areis@redhat.com On 06/06/13 17:06, Tomoki Sekiyama wrote: > 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 > --- > qga/main.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/qga/main.c b/qga/main.c > index 8bcedaf..739b958 100644 > --- a/qga/main.c > +++ b/qga/main.c > @@ -1058,8 +1058,16 @@ int main(int argc, char **argv) > fixed_state_dir = (state_dir == dfl_pathnames.state_dir) ? > NULL : > state_dir; > +#ifdef HAS_VSS_SDK > + if (FAILED(COMRegister())) { > + return EXIT_FAILURE; > + } COMRegister() seems to print error messages on failure, OK. > +#endif > return ga_install_service(path, log_filepath, fixed_state_dir); Shouldn't you call COMUnregister() if ga_install_service() fails? Otherwise we might end up with a half-installed service (COM app catalog entry for VSS provider: yes, VSS provider DLL: yes, VSS client / qemu-ga service: no). > } else if (strcmp(service, "uninstall") == 0) { > +#ifdef HAS_VSS_SDK > + COMUnregister(); > +#endif > return ga_uninstall_service(); > } else { > printf("Unknown service command.\n"); > > This seems OK; there isn't much to do (non-interactively) when a destructor fails. Thanks, Laszlo