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