ServiceManager.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace AppSecInc
4 {
5  namespace Service
6  {
9  {
10  private:
11  SC_HANDLE m_h;
12  public:
14  virtual ~ServiceManager();
16  void Open(const std::wstring& computer_name, const std::wstring& database_name, DWORD access = SC_MANAGER_ALL_ACCESS);
18  void Open(DWORD access = SC_MANAGER_ALL_ACCESS);
20  void Close();
22  bool IsOpen() const { return m_h != NULL; }
24  SC_HANDLE GetHandle() const { return m_h; }
26  std::list<ServiceStatusProcess> GetServices(
27  DWORD service_type = SERVICE_WIN32,
28  DWORD service_state = SERVICE_STATE_ALL,
29  LPCTSTR service_group_name = NULL) const;
31  bool ServiceExists(const std::wstring& name);
32  };
33  }
34 }
35 
SC_HANDLE GetHandle() const
return the policy handle
Definition: ServiceManager.h:24
ServiceManager()
Definition: ServiceManager.cpp:6
bool ServiceExists(const std::wstring &name)
return true if the service exists
Definition: ServiceManager.cpp:98
void Open(const std::wstring &computer_name, const std::wstring &database_name, DWORD access=SC_MANAGER_ALL_ACCESS)
open the Service manager object on a computer
Definition: ServiceManager.cpp:32
bool IsOpen() const
returns true if service manager is open
Definition: ServiceManager.h:22
std::list< ServiceStatusProcess > GetServices(DWORD service_type=SERVICE_WIN32, DWORD service_state=SERVICE_STATE_ALL, LPCTSTR service_group_name=NULL) const
return a list of services
Definition: ServiceManager.cpp:49
Service manager.
Definition: ServiceManager.h:8
virtual ~ServiceManager()
Definition: ServiceManager.cpp:11
void Close()
close a previously opened service manager object
Definition: ServiceManager.cpp:19


© Application Security Inc. - All Rights Reserved http://msiext.codeplex.com