mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:43:04 +00:00

- start to implement 'start' - split and rewrite much of the 'query' functionality - a lot of code "altering" Comments are a bit vauge, but it's still very incomplete and untested and most changes aren't worth mentioning. svn path=/trunk/; revision=18958
45 lines
916 B
C
45 lines
916 B
C
/*
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
* PROJECT: ReactOS SC utility
|
|
* FILE: subsys/system/sc/control.c
|
|
* PURPOSE: control ReactOS services
|
|
* PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
|
|
* REVISIONS:
|
|
* Ged Murphy 20/10/05 Created
|
|
*
|
|
*/
|
|
|
|
#include "sc.h"
|
|
|
|
/*
|
|
* handles the following commands:
|
|
* control, continue, interrogate, pause, stop
|
|
*/
|
|
|
|
BOOL Control(DWORD Control, TCHAR **Args)
|
|
{
|
|
SC_HANDLE hSc;
|
|
SERVICE_STATUS Status;
|
|
LPCTSTR ServiceName = *Args;
|
|
|
|
|
|
hSc = OpenService(hSCManager, ServiceName, DELETE);
|
|
|
|
if (hSc == NULL)
|
|
{
|
|
_tprintf(_T("openService failed\n"));
|
|
ReportLastError();
|
|
return FALSE;
|
|
}
|
|
|
|
if (! ControlService(hSc, Control, &Status))
|
|
{
|
|
_tprintf(_T("controlService failed\n"));
|
|
ReportLastError();
|
|
return FALSE;
|
|
}
|
|
|
|
CloseServiceHandle(hSc);
|
|
return TRUE;
|
|
|
|
}
|