1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS net command
4 * FILE: base/applications/network/net/cmdContinue.c
5 * PURPOSE:
6 *
7 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
8 */
9
10 #include "net.h"
11
cmdContinue(INT argc,WCHAR ** argv)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 PrintMessageString(4381);
23 ConPuts(StdOut, L"\n");
24 PrintNetMessage(MSG_CONTINUE_SYNTAX);
25 return 1;
26 }
27
28 for (i = 2; i < argc; i++)
29 {
30 if (_wcsicmp(argv[i], L"/help") == 0)
31 {
32 PrintMessageString(4381);
33 ConPuts(StdOut, L"\n");
34 PrintNetMessage(MSG_CONTINUE_SYNTAX);
35 PrintNetMessage(MSG_CONTINUE_HELP);
36 return 1;
37 }
38 }
39
40 hManager = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ENUMERATE_SERVICE);
41 if (hManager == NULL)
42 {
43 ConPrintf(StdErr, L"[OpenSCManager] Error: %ld\n", GetLastError());
44 nError = 1;
45 goto done;
46 }
47
48 hService = OpenService(hManager, argv[2], SERVICE_PAUSE_CONTINUE);
49 if (hService == NULL)
50 {
51 ConPrintf(StdErr, L"[OpenService] Error: %ld\n", GetLastError());
52 nError = 1;
53 goto done;
54 }
55
56 if (!ControlService(hService, SERVICE_CONTROL_CONTINUE, &status))
57 {
58 ConPrintf(StdErr, L"[ControlService] Error: %ld\n", GetLastError());
59 nError = 1;
60 }
61
62 done:
63 if (hService != NULL)
64 CloseServiceHandle(hService);
65
66 if (hManager != NULL)
67 CloseServiceHandle(hManager);
68
69 return nError;
70 }
71
72 /* EOF */
73
74