advapi32: Make QueryServiceStatus use QueryServiceStatusEx.

This commit is contained in:
Rolf Kalbermatter 2007-04-20 10:42:12 +02:00 committed by Alexandre Julliard
parent af5f6325e5
commit 6c33eb4410
1 changed files with 9 additions and 39 deletions

View File

@ -1566,55 +1566,25 @@ BOOL WINAPI StartServiceW(SC_HANDLE hService, DWORD dwNumServiceArgs,
* QueryServiceStatus [ADVAPI32.@] * QueryServiceStatus [ADVAPI32.@]
* *
* PARAMS * PARAMS
* hService [] * hService [I] Handle to service to get information about
* lpservicestatus [] * lpservicestatus [O] buffer to receive the status information for the service
* *
*/ */
BOOL WINAPI QueryServiceStatus(SC_HANDLE hService, BOOL WINAPI QueryServiceStatus(SC_HANDLE hService,
LPSERVICE_STATUS lpservicestatus) LPSERVICE_STATUS lpservicestatus)
{ {
struct sc_service *hsvc; SERVICE_STATUS_PROCESS SvcStatusData;
DWORD size, type, val; BOOL ret;
HANDLE pipe;
LONG r;
TRACE("%p %p\n", hService, lpservicestatus); TRACE("%p %p\n", hService, lpservicestatus);
hsvc = sc_handle_get_handle_data(hService, SC_HTYPE_SERVICE); ret = QueryServiceStatusEx(hService, SC_STATUS_PROCESS_INFO, (LPBYTE)&SvcStatusData,
if (!hsvc) sizeof(SERVICE_STATUS_PROCESS), NULL);
{ if (ret) *lpservicestatus = SvcStatusData.status;
SetLastError( ERROR_INVALID_HANDLE ); return ret;
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;
} }
/****************************************************************************** /******************************************************************************
* QueryServiceStatusEx [ADVAPI32.@] * QueryServiceStatusEx [ADVAPI32.@]
* *