19 DWORD BytesNeeded = 0;
48 if (pServiceInfo ==
NULL)
83 DWORD BytesNeeded = 0;
84 DWORD ResumeHandle = dwResumeIndex;
85 DWORD NumServices = 0;
97 if (dwBufferSize == 0)
115 dwBufferSize = BytesNeeded;
122 if (*pServiceStatus !=
NULL)
162 INT TmpCount, TmpIndex;
169 if (!
lstrcmpi(ServiceArgs[TmpIndex],
_T(
"type=")))
176 if (!
lstrcmpi(ServiceArgs[TmpIndex],
_T(
"service")))
180 else if (!
lstrcmpi(ServiceArgs[TmpIndex],
_T(
"driver")))
184 else if (!
lstrcmpi(ServiceArgs[TmpIndex],
_T(
"all")))
188 else if (!
lstrcmpi(ServiceArgs[TmpIndex],
_T(
"interact")))
194 _tprintf(
_T(
"ERROR following \"type=\"!\nMust be one of: all, driver, interact, service.\n"));
202 else if (!
lstrcmpi(ServiceArgs[TmpIndex],
_T(
"state=")))
209 if (!
lstrcmpi(ServiceArgs[TmpIndex],
_T(
"active")))
213 else if (!
lstrcmpi(ServiceArgs[TmpIndex],
_T(
"inactive")))
217 else if (!
lstrcmpi(ServiceArgs[TmpIndex],
_T(
"all")))
223 _tprintf(
_T(
"ERROR following \"state=\"!\nMust be one of: active, all, inactive.\n"));
231 else if (!
lstrcmpi(ServiceArgs[TmpIndex],
_T(
"bufsize=")))
241 *pdwBufferSize = dwValue;
248 else if (!
lstrcmpi(ServiceArgs[TmpIndex],
_T(
"ri=")))
258 *pdwResumeIndex = dwValue;
265 else if (!
lstrcmpi(ServiceArgs[TmpIndex],
_T(
"group=")))
272 *ppszGroupName = ServiceArgs[TmpIndex];
280 *ppszServiceName = ServiceArgs[TmpIndex];
297 DWORD NumServices = 0;
300 DWORD dwBufferSize = 0;
301 DWORD dwResumeIndex = 0;
307 LPCTSTR *TmpArgs = ServiceArgs;
308 INT TmpCnt = ArgCount;
332 _tprintf(
_T(
"Service type: %lx\n"), dwServiceType);
333 _tprintf(
_T(
"Service state: %lx\n"), dwServiceState);
334 _tprintf(
_T(
"Buffer size: %lu\n"), dwBufferSize);
335 _tprintf(
_T(
"Resume index: %lu\n"), dwResumeIndex);
336 _tprintf(
_T(
"Group name: %s\n"), pszGroupName);
337 _tprintf(
_T(
"Service name: %s\n"), pszServiceName);
367 if (NumServices == 0)
370 for (
i = 0;
i < NumServices;
i++)
374 &pServiceStatus[
i].ServiceStatusProcess,
VOID PrintService(LPCTSTR lpServiceName, LPCTSTR lpDisplayName, LPSERVICE_STATUS_PROCESS pStatus, BOOL bExtended)
BOOL Query(LPCTSTR *ServiceArgs, DWORD ArgCount, BOOL bExtended)
LPSERVICE_STATUS_PROCESS QueryService(LPCTSTR ServiceName)
static BOOL ParseQueryArguments(IN LPCTSTR *ServiceArgs, IN INT ArgCount, OUT PDWORD pdwServiceType, OUT PDWORD pdwServiceState, OUT PDWORD pdwBufferSize, OUT PDWORD pdwResumeIndex, OUT LPCTSTR *ppszGroupName, OUT LPCTSTR *ppszServiceName)
static DWORD EnumServices(ENUM_SERVICE_STATUS_PROCESS **pServiceStatus, DWORD dwServiceType, DWORD dwServiceState, DWORD dwBufferSize, DWORD dwResumeIndex, LPCTSTR pszGroupName)
static WCHAR ServiceName[]
#define ERROR_INSUFFICIENT_BUFFER
#define HeapFree(x, y, z)
__in WDFDMATRANSACTION __out NTSTATUS * pStatus
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
DWORD ReportLastError(void)
BOOL WINAPI QueryServiceStatusEx(SC_HANDLE hService, SC_STATUS_TYPE InfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
_In_ LPCSTR _Out_writes_to_opt_ cchDisplayName LPSTR lpDisplayName
DWORD WINAPI GetLastError(void)
#define SERVICE_STATE_ALL
#define SERVICE_QUERY_STATUS
#define SC_MANAGER_ENUMERATE_SERVICE
#define SC_MANAGER_CONNECT
#define EnumServicesStatusEx
struct _SERVICE_STATUS_PROCESS * LPSERVICE_STATUS_PROCESS
#define SERVICE_INTERACTIVE_PROCESS