version 1.2, 2006/01/30 16:19:34
|
version 1.3, 2007/06/19 17:58:04
|
|
|
{ | { |
public: | public: |
// default ctor | // default ctor |
Service(void); |
Service(); |
| |
// ctor using service name | // ctor using service name |
Service(const char *service_name); | Service(const char *service_name); |
|
|
Service(const char *service_name, char *event_source); | Service(const char *service_name, char *event_source); |
| |
// dtor | // dtor |
~Service(void); |
~Service(); |
| |
// State | // State |
enum State | enum State |
|
|
SERVICE_ERROR_DEPENDENCY_DELETED = ERROR_SERVICE_DEPENDENCY_DELETED, | SERVICE_ERROR_DEPENDENCY_DELETED = ERROR_SERVICE_DEPENDENCY_DELETED, |
SERVICE_ERROR_NEVER_STARTED = ERROR_SERVICE_NEVER_STARTED, | SERVICE_ERROR_NEVER_STARTED = ERROR_SERVICE_NEVER_STARTED, |
SERVICE_ERROR_NOT_FOUND = ERROR_SERVICE_NOT_FOUND, | SERVICE_ERROR_NOT_FOUND = ERROR_SERVICE_NOT_FOUND, |
SERVICE_ERROR_CONTROLLER_CONNECT = ERROR_FAILED_SERVICE_CONTROLLER_CONNECT, |
SERVICE_ERROR_CONTROLLER_CONNECT = |
|
ERROR_FAILED_SERVICE_CONTROLLER_CONNECT, |
SERVICE_ERROR_INVALID_CONTROL = ERROR_INVALID_SERVICE_CONTROL, | SERVICE_ERROR_INVALID_CONTROL = ERROR_INVALID_SERVICE_CONTROL, |
SERVICE_ERROR_INVALID_ACCOUNT = ERROR_INVALID_SERVICE_ACCOUNT, | SERVICE_ERROR_INVALID_ACCOUNT = ERROR_INVALID_SERVICE_ACCOUNT, |
SERVICE_ERROR_INVALID_LOCK = ERROR_INVALID_SERVICE_LOCK, | SERVICE_ERROR_INVALID_LOCK = ERROR_INVALID_SERVICE_LOCK, |
|
|
| |
// Methods | // Methods |
ReturnCode Install(char *display_name, char *description, char *exe_name); | ReturnCode Install(char *display_name, char *description, char *exe_name); |
ReturnCode Remove(void); |
ReturnCode Remove(); |
| |
ReturnCode Start(int wait_time); | ReturnCode Start(int wait_time); |
ReturnCode Stop(int wait_time); | ReturnCode Stop(int wait_time); |
static bool report_status(DWORD current_state, DWORD exit_code, DWORD check_point, DWORD wait_hint); |
static bool report_status( |
|
DWORD current_state, |
|
DWORD exit_code, |
|
DWORD check_point, |
|
DWORD wait_hint); |
| |
static ReturnCode Run(SERVICE_MAIN_T service_main, DWORD flags = 0); | static ReturnCode Run(SERVICE_MAIN_T service_main, DWORD flags = 0); |
ReturnCode GetState(State *state); | ReturnCode GetState(State *state); |
|
|
g_argv = service_args; | g_argv = service_args; |
g_argc = num_args; | g_argc = num_args; |
} | } |
static char *GetServiceName(void) |
static char *GetServiceName() |
{ | { |
return g_service_name; | return g_service_name; |
} | } |
|
|
static void WINAPI service_control_handler(DWORD control); | static void WINAPI service_control_handler(DWORD control); |
static bool check_args_for_string(char *string); | static bool check_args_for_string(char *string); |
static void __stdcall real_service_main(DWORD argc, LPTSTR *argv); | static void __stdcall real_service_main(DWORD argc, LPTSTR *argv); |
static void change_service_description(SC_HANDLE service, char *description); |
static void change_service_description( |
|
SC_HANDLE service, |
|
char* description); |
State get_state(DWORD scm_state); | State get_state(DWORD scm_state); |
static ReturnCode get_error(DWORD error_status, const char action[] = "cimserver"); |
static ReturnCode get_error( |
|
DWORD error_status, |
|
const char action[] = "cimserver"); |
}; | }; |
| |
#endif // SERVICE_H | #endif // SERVICE_H |