Add information letting us know creation deletion of services has worked.
[reactos.git] / reactos / subsys / system / sc / create.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS SC utility
4 * FILE: subsys/system/sc/create.c
5 * PURPOSE: control ReactOS services
6 * PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
7 * REVISIONS:
8 * Ged Murphy 20/10/05 Created
9 *
10 */
11
12 #include "sc.h"
13
14 BOOL Create(LPCTSTR ServiceName, LPCTSTR *ServiceArgs)
15 {
16 SC_HANDLE hSc;
17 LPCTSTR BinaryPathName = *++ServiceArgs;
18 LPCTSTR *Options = ++ServiceArgs;
19
20 if ((! ServiceName) || (! BinaryPathName))
21 return CreateUsage();
22
23 #ifdef SCDBG
24 /* testing */
25 printf("service to create - %s\n", ServiceName);
26 printf("Binary path - %s\n", BinaryPathName);
27 printf("Arguments :\n");
28 while (*Options)
29 {
30 printf("%s\n", *Options);
31 Options++;
32 }
33 #endif
34 hSc = CreateService(hSCManager,
35 ServiceName,
36 ServiceName,
37 SERVICE_ALL_ACCESS,
38 SERVICE_WIN32_OWN_PROCESS,
39 SERVICE_DEMAND_START,
40 SERVICE_ERROR_NORMAL,
41 BinaryPathName,
42 NULL,
43 NULL,
44 NULL,
45 NULL,
46 NULL);
47
48 if (hSc == NULL)
49 {
50 _tprintf(_T("CreateService failed\n"));
51 ReportLastError();
52 return FALSE;
53 }
54
55 _tprintf(_T("[SC] CreateService SUCCESS\n"));
56 CloseServiceHandle(hSc);
57 return TRUE;
58 }