ReactOS  0.4.12-dev-714-gfaac916
cmdPause.c File Reference
#include "net.h"
Include dependency graph for cmdPause.c:

Go to the source code of this file.

Functions

INT cmdPause (INT argc, WCHAR **argv)
 

Function Documentation

◆ cmdPause()

INT cmdPause ( INT  argc,
WCHAR **  argv 
)

Definition at line 12 of file cmdPause.c.

13 {
14  SC_HANDLE hManager = NULL;
15  SC_HANDLE hService = NULL;
17  INT nError = 0;
18  INT i;
19 
20  if (argc != 3)
21  {
23  PrintNetMessage(MSG_PAUSE_SYNTAX);
24  return 1;
25  }
26 
27  for (i = 2; i < argc; i++)
28  {
29  if (_wcsicmp(argv[i], L"/help") == 0)
30  {
32  PrintNetMessage(MSG_PAUSE_SYNTAX);
33  PrintNetMessage(MSG_PAUSE_HELP);
34  return 1;
35  }
36  }
37 
39  if (hManager == NULL)
40  {
41  ConPrintf(StdErr, L"[OpenSCManager] Error: %ld\n", GetLastError());
42  nError = 1;
43  goto done;
44  }
45 
46  hService = OpenService(hManager, argv[2], SERVICE_PAUSE_CONTINUE);
47  if (hService == NULL)
48  {
49  ConPrintf(StdErr, L"[OpenService] Error: %ld\n", GetLastError());
50  nError = 1;
51  goto done;
52  }
53 
55  {
56  ConPrintf(StdErr, L"[ControlService] Error: %ld\n", GetLastError());
57  }
58 
59 done:
60  if (hService != NULL)
61  CloseServiceHandle(hService);
62 
63  if (hManager != NULL)
64  CloseServiceHandle(hManager);
65 
66  return nError;
67 }
static int argc
Definition: ServiceArgs.c:12
#define SC_MANAGER_ENUMERATE_SERVICE
Definition: winsvc.h:16
#define SERVICES_ACTIVE_DATABASE
Definition: winsvc.h:564
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
VOID PrintNetMessage(DWORD dwMessage)
Definition: main.c:149
#define argv
Definition: mplay32.c:18
int32_t INT
Definition: typedefs.h:56
#define OpenService
Definition: winsvc.h:576
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define IDS_GENERIC_SYNTAX
Definition: resource.h:118
INT __cdecl ConPrintf(IN PCON_STREAM Stream, IN LPWSTR szStr,...)
Definition: outstream.c:520
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
smooth NULL
Definition: ftsmooth.c:416
#define OpenSCManager
Definition: winsvc.h:575
#define StdErr
Definition: stream.h:77
#define SERVICE_CONTROL_PAUSE
Definition: winsvc.h:37
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI ControlService(SC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus)
Definition: scm.c:619
#define StdOut
Definition: stream.h:76
static SERVICE_STATUS status
Definition: service.c:31
#define SERVICE_PAUSE_CONTINUE
Definition: winsvc.h:59
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
Definition: ps.c:97