[NET]
[reactos.git] / reactos / base / applications / network / net / cmdContinue.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS net command
4 * FILE: cmdContinue.c
5 * PURPOSE:
6 *
7 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
8 */
9
10 #include "net.h"
11
12 INT cmdContinue(INT argc, WCHAR **argv)
13 {
14 SC_HANDLE hManager = NULL;
15 SC_HANDLE hService = NULL;
16 SERVICE_STATUS status;
17 INT nError = 0;
18 INT i;
19
20 if (argc != 3)
21 {
22 PrintResourceString(IDS_CONTINUE_SYNTAX);
23 return 1;
24 }
25
26 for (i = 2; i < argc; i++)
27 {
28 if (_wcsicmp(argv[i], L"/help") == 0)
29 {
30 PrintResourceString(IDS_CONTINUE_HELP);
31 return 1;
32 }
33 }
34
35 hManager = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ENUMERATE_SERVICE);
36 if (hManager == NULL)
37 {
38 printf("[OpenSCManager] Error: %ld\n", GetLastError());
39 nError = 1;
40 goto done;
41 }
42
43 hService = OpenService(hManager, argv[2], SERVICE_PAUSE_CONTINUE);
44 if (hService == NULL)
45 {
46 printf("[OpenService] Error: %ld\n", GetLastError());
47 nError = 1;
48 goto done;
49 }
50
51 if (!ControlService(hService, SERVICE_CONTROL_CONTINUE, &status))
52 {
53 printf("[ControlService] Error: %ld\n", GetLastError());
54 nError = 1;
55 }
56
57 done:
58 if (hService != NULL)
59 CloseServiceHandle(hService);
60
61 if (hManager != NULL)
62 CloseServiceHandle(hManager);
63
64 return nError;
65 }
66
67 /* EOF */
68