2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS SC utility
4 * FILE: subsys/system/sc/control.c
5 * PURPOSE: control ReactOS services
6 * PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
8 * Ged Murphy 20/10/05 Created
15 * handles the following commands:
16 * control, continue, interrogate, pause, stop
19 BOOL
Control(DWORD Control
, LPCTSTR ServiceName
, LPCTSTR
*Args
)
22 SERVICE_STATUS Status
;
26 _tprintf(_T("service to control - %s\n\n"), ServiceName
);
27 _tprintf(_T("command - %lu\n\n"), Control
);
28 _tprintf(_T("Arguments :\n"));
31 printf("%s\n", *Args
);
36 hSc
= OpenService(hSCManager
, ServiceName
,
37 SERVICE_INTERROGATE
| SERVICE_PAUSE_CONTINUE
|
38 SERVICE_STOP
| SERVICE_USER_DEFINED_CONTROL
|
39 SERVICE_QUERY_STATUS
);
43 _tprintf(_T("openService failed\n"));
48 if (! ControlService(hSc
, Control
, &Status
))
50 _tprintf(_T("[SC] controlService FAILED %lu:\n\n"), GetLastError());
55 CloseServiceHandle(hSc
);
57 /* print the status information */