2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS net command
4 * FILE: base/applications/network/net/cmdStop.c
7 * PROGRAMMERS: Magnus Olsen (greatlord@reactos.org)
12 INT
cmdStop(INT argc
, WCHAR
**argv
)
14 SC_HANDLE hManager
= NULL
;
15 SC_HANDLE hService
= NULL
;
16 SERVICE_STATUS ServiceStatus
;
17 DWORD dwError
= ERROR_SUCCESS
;
23 ConResPuts(StdOut
, IDS_GENERIC_SYNTAX
);
24 ConResPuts(StdOut
, IDS_STOP_SYNTAX
);
28 for (i
= 2; i
< argc
; i
++)
30 if (_wcsicmp(argv
[i
], L
"/help") == 0)
32 ConResPuts(StdOut
, IDS_GENERIC_SYNTAX
);
33 ConResPuts(StdOut
, IDS_STOP_SYNTAX
);
34 ConResPuts(StdOut
, IDS_STOP_HELP_1
);
35 ConResPuts(StdOut
, IDS_STOP_HELP_2
);
36 ConResPuts(StdOut
, IDS_STOP_HELP_3
);
41 hManager
= OpenSCManagerW(NULL
,
42 SERVICES_ACTIVE_DATABASE
,
43 SC_MANAGER_ENUMERATE_SERVICE
);
46 dwError
= GetLastError();
51 hService
= OpenServiceW(hManager
,
56 dwError
= GetLastError();
61 if (!ControlService(hService
, SERVICE_CONTROL_STOP
, &ServiceStatus
))
63 dwError
= GetLastError();
70 CloseServiceHandle(hService
);
73 CloseServiceHandle(hManager
);
75 if (dwError
!= ERROR_SUCCESS
)
77 /* FIXME: Print proper error message */
78 ConPrintf(StdErr
, L
"Error: %lu\n", dwError
);