ReactOS  0.4.12-dev-57-g7050ac4
print.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Services
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * FILE: base/applications/sc/print.c
5  * PURPOSE: print service info
6  * COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy@gmail.com>
7  * Copyright 2016 Eric Kohl <eric.kohl@reactos.org>
8  */
9 
10 #include "sc.h"
11 
12 VOID
13 PrintService(LPCTSTR lpServiceName,
16  BOOL bExtended)
17 {
18  _tprintf(_T("SERVICE_NAME: %s\n"), lpServiceName);
19 
20  if (lpDisplayName)
21  _tprintf(_T("DISPLAY_NAME: %s\n"), lpDisplayName);
22 
23  // Re-use PrintServiceStatus(), as SERVICE_STATUS_PROCESS is in fact an extension of SERVICE_STATUS.
25 
26  if (bExtended)
27  {
28  _tprintf(_T("\tPID : %lu\n"),
29  pStatus->dwProcessId);
30  _tprintf(_T("\tFLAGS : %lu\n"),
31  pStatus->dwServiceFlags);
32  }
33 
34  _tprintf(_T("\n"));
35 }
36 
37 
38 VOID
40  LPSERVICE_STATUS pStatus)
41 {
42  _tprintf(_T("\tTYPE : %x "),
43  (unsigned int)pStatus->dwServiceType);
44 
45  switch (pStatus->dwServiceType)
46  {
48  _tprintf(_T("KERNEL_DRIVER\n"));
49  break;
51  _tprintf(_T("FILE_SYSTEM_DRIVER\n"));
52  break;
54  _tprintf(_T("WIN32_OWN_PROCESS\n"));
55  break;
57  _tprintf(_T("WIN32_SHARE_PROCESS\n"));
58  break;
60  _tprintf(_T("WIN32_OWN_PROCESS (interactive)\n"));
61  break;
63  _tprintf(_T("WIN32_SHARE_PROCESS (interactive)\n"));
64  break;
65  default:
66  _tprintf(_T("\n"));
67  }
68 
69  _tprintf(_T("\tSTATE : %x "),
70  (unsigned int)pStatus->dwCurrentState);
71 
72  switch (pStatus->dwCurrentState)
73  {
74  case SERVICE_STOPPED:
75  _tprintf(_T("STOPPED\n"));
76  break;
78  _tprintf(_T("START_PENDING\n"));
79  break;
81  _tprintf(_T("STOP_PENDING\n"));
82  break;
83  case SERVICE_RUNNING:
84  _tprintf(_T("RUNNING\n"));
85  break;
87  _tprintf(_T("CONTINUE_PENDING\n"));
88  break;
90  _tprintf(_T("PAUSE_PENDING\n"));
91  break;
92  case SERVICE_PAUSED:
93  _tprintf(_T("PAUSED\n"));
94  break;
95  default:
96  _tprintf(_T("\n"));
97  }
98 
99  _tprintf(_T("\t\t\t\t("));
100 
102  _tprintf(_T("STOPPABLE,"));
103  else
104  _tprintf(_T("NOT_STOPPABLE,"));
105 
107  _tprintf(_T("PAUSABLE,"));
108  else
109  _tprintf(_T("NOT_PAUSABLE,"));
110 
112  _tprintf(_T("ACCEPTS_SHUTDOWN"));
113  else
114  _tprintf(_T("IGNORES_SHUTDOWN"));
115 
116  _tprintf(_T(")\n"));
117 
118  _tprintf(_T("\tWIN32_EXIT_CODE : %u (0x%x)\n"),
119  (unsigned int)pStatus->dwWin32ExitCode,
120  (unsigned int)pStatus->dwWin32ExitCode);
121  _tprintf(_T("\tSERVICE_EXIT_CODE : %u (0x%x)\n"),
122  (unsigned int)pStatus->dwServiceSpecificExitCode,
123  (unsigned int)pStatus->dwServiceSpecificExitCode);
124  _tprintf(_T("\tCHECKPOINT : 0x%x\n"),
125  (unsigned int)pStatus->dwCheckPoint);
126  _tprintf(_T("\tWAIT_HINT : 0x%x\n"),
127  (unsigned int)pStatus->dwWaitHint);
128 }
#define _tprintf
Definition: tchar.h:506
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
DWORD dwCurrentState
Definition: winsvc.h:100
#define SERVICE_PAUSE_PENDING
Definition: winsvc.h:26
#define SERVICE_PAUSED
Definition: winsvc.h:27
#define SERVICE_INTERACTIVE_PROCESS
Definition: cmtypes.h:965
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
#define SERVICE_START_PENDING
Definition: winsvc.h:22
DWORD dwServiceSpecificExitCode
Definition: winsvc.h:103
DWORD dwCheckPoint
Definition: winsvc.h:104
#define SERVICE_STOPPED
Definition: winsvc.h:21
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define SERVICE_FILE_SYSTEM_DRIVER
Definition: cmtypes.h:952
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:960
#define SERVICE_ACCEPT_PAUSE_CONTINUE
Definition: winsvc.h:29
VOID PrintServiceStatus(LPSERVICE_STATUS pStatus)
Definition: print.c:39
#define SERVICE_ACCEPT_SHUTDOWN
Definition: winsvc.h:30
#define _T(x)
Definition: vfdio.h:22
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD dwWaitHint
Definition: winsvc.h:105
DWORD dwWin32ExitCode
Definition: winsvc.h:102
DWORD dwServiceType
Definition: winsvc.h:99
#define SERVICE_WIN32_SHARE_PROCESS
Definition: cmtypes.h:961
DWORD dwControlsAccepted
Definition: winsvc.h:101
#define SERVICE_CONTINUE_PENDING
Definition: winsvc.h:25
_In_ LPCSTR _Out_writes_to_opt_ cchDisplayName LPSTR lpDisplayName
Definition: winbase.h:2730
#define SERVICE_STOP_PENDING
Definition: winsvc.h:23
VOID PrintService(LPCTSTR lpServiceName, LPCTSTR lpDisplayName, LPSERVICE_STATUS_PROCESS pStatus, BOOL bExtended)
Definition: print.c:13
#define SERVICE_KERNEL_DRIVER
Definition: cmtypes.h:951