From: Sameeh Jubran <sameeh@daynix.com>
To: qemu-devel@nongnu.org, Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: Yan Vugenfirer <yan@daynix.com>
Subject: [Qemu-devel] [PATCH 5/5] qga-win: service-win32: Use get_service function
Date: Wed, 5 Jul 2017 10:54:11 +0300 [thread overview]
Message-ID: <20170705075411.6556-6-sameeh@daynix.com> (raw)
In-Reply-To: <20170705075411.6556-1-sameeh@daynix.com>
From: Sameeh Jubran <sjubran@redhat.com>
Signed-off-by: Sameeh Jubran <sjubran@redhat.com>
---
qga/service-win32.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/qga/service-win32.c b/qga/service-win32.c
index 861f9fc..c17e0eb 100644
--- a/qga/service-win32.c
+++ b/qga/service-win32.c
@@ -198,20 +198,12 @@ int ga_install_service(const char *path, const char *logfile,
static int uninstall_service(LPCTSTR service_name)
{
- SC_HANDLE manager;
- SC_HANDLE service;
-
- manager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
- if (manager == NULL) {
- printf_win_error("No handle to service control manager");
- return EXIT_FAILURE;
- }
+ int ret = EXIT_FAILURE;
+ SC_HANDLE service = NULL;
+ ret = get_service(service_name, &service);
- service = OpenService(manager, service_name, DELETE);
- if (service == NULL) {
- printf_win_error("No handle to service");
- CloseServiceHandle(manager);
- return EXIT_FAILURE;
+ if (ret != EXIT_SUCCESS) {
+ return ret;
}
if (DeleteService(service) == FALSE) {
@@ -221,7 +213,6 @@ static int uninstall_service(LPCTSTR service_name)
}
CloseServiceHandle(service);
- CloseServiceHandle(manager);
return EXIT_SUCCESS;
}
--
2.9.4
next prev parent reply other threads:[~2017-07-05 7:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-05 7:54 [Qemu-devel] [PATCH 0/5] Fix qemu-ga's behaviour on Windows Sameeh Jubran
2017-07-05 7:54 ` [Qemu-devel] [PATCH 1/5] Makefile: clean: Clean exe files Sameeh Jubran
2017-07-23 14:08 ` Philippe Mathieu-Daudé
2017-07-23 20:03 ` Peter Maydell
2017-07-25 23:10 ` Michael Roth
2017-07-26 1:54 ` Philippe Mathieu-Daudé
2017-07-05 7:54 ` [Qemu-devel] [PATCH 2/5] qga-win: service-win32: Add start_service and stop_service functions Sameeh Jubran
2017-07-25 23:32 ` Michael Roth
2017-07-05 7:54 ` [Qemu-devel] [PATCH 3/5] qga-win: Add serial listener service Sameeh Jubran
2017-07-25 23:58 ` Michael Roth
2017-07-05 7:54 ` [Qemu-devel] [PATCH 4/5] qga-win: Add qga-serial-listener to msi installer Sameeh Jubran
2017-07-05 7:54 ` Sameeh Jubran [this message]
2017-07-23 6:26 ` [Qemu-devel] [PATCH 0/5] Fix qemu-ga's behaviour on Windows Sameeh Jubran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170705075411.6556-6-sameeh@daynix.com \
--to=sameeh@daynix.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=yan@daynix.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).