ADVAPI32: Make QueryServiceStatus use QueryServiceStatusEx
Rolf Kalbermatter
r.kalbermatter at hccnet.nl
Fri Apr 20 03:42:12 CDT 2007
Changelog
dlls/advapi32/service.c
- Make QueryServiceStatus use QueryServiceStatusEx
License: X11/LGPL
Rolf Kalbermatter
-------------- next part --------------
>From 29b3cb4ed9b8d4aa9fe0ab64c09aec14fe74fade Mon Sep 17 00:00:00 2001
From: Rolf Kalbermatter <r.kalbermatter at hccnet.nl>
Date: Fri, 20 Apr 2007 08:18:41 +0200
Subject: [PATCH] Make QueryServiceStatus use QueryServiceStatusEx
---
dlls/advapi32/service.c | 49 ++++++++++-------------------------------------
1 files changed, 10 insertions(+), 39 deletions(-)
diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c
index ca1b085..5d663e2 100644
--- a/dlls/advapi32/service.c
+++ b/dlls/advapi32/service.c
@@ -1566,55 +1566,26 @@ BOOL WINAPI StartServiceW(SC_HANDLE hSer
* QueryServiceStatus [ADVAPI32.@]
*
* PARAMS
- * hService []
- * lpservicestatus []
+ * hService [I] Handle to service to get information about
+ * lpservicestatus [O] buffer to receive the status information for the service
*
*/
BOOL WINAPI QueryServiceStatus(SC_HANDLE hService,
LPSERVICE_STATUS lpservicestatus)
{
- struct sc_service *hsvc;
- DWORD size, type, val;
- HANDLE pipe;
- LONG r;
+ SERVICE_STATUS_PROCESS SvcStatusData;
+ BOOL ret;
TRACE("%p %p\n", hService, lpservicestatus);
- hsvc = sc_handle_get_handle_data(hService, SC_HTYPE_SERVICE);
- if (!hsvc)
- {
- SetLastError( ERROR_INVALID_HANDLE );
- return FALSE;
- }
-
- pipe = service_open_pipe(hsvc->name);
- if (pipe != INVALID_HANDLE_VALUE)
- {
- r = service_get_status(pipe, lpservicestatus);
- CloseHandle(pipe);
- if (r)
- return TRUE;
- }
-
- TRACE("Failed to read service status\n");
-
- /* read the service type from the registry */
- size = sizeof(val);
- r = RegQueryValueExA(hsvc->hkey, "Type", NULL, &type, (LPBYTE)&val, &size);
- if(r!=ERROR_SUCCESS || type!=REG_DWORD)
- val = 0;
-
- lpservicestatus->dwServiceType = val;
- lpservicestatus->dwCurrentState = SERVICE_STOPPED; /* stopped */
- lpservicestatus->dwControlsAccepted = 0;
- lpservicestatus->dwWin32ExitCode = ERROR_SERVICE_NEVER_STARTED;
- lpservicestatus->dwServiceSpecificExitCode = 0;
- lpservicestatus->dwCheckPoint = 0;
- lpservicestatus->dwWaitHint = 0;
-
- return TRUE;
+ ret = QueryServiceStatusEx(hService, SC_STATUS_PROCESS_INFO, (LPBYTE)&SvcStatusData,
+ sizeof(SERVICE_STATUS_PROCESS), NULL);
+ if (ret)
+ memcpy(lpservicestatus, &(SvcStatusData.status), sizeof(SERVICE_STATUS));
+ return ret;
}
+
/******************************************************************************
* QueryServiceStatusEx [ADVAPI32.@]
*
--
1.4.1
More information about the wine-patches
mailing list