Go to the documentation of this file.00001 #pragma once
00002
00003 namespace AppSecInc
00004 {
00005 namespace Service
00006 {
00008 class ServiceImpl
00009 {
00010 private:
00011 SERVICE_STATUS_HANDLE _status;
00012 HANDLE _thread;
00013 HANDLE _stop;
00014 static ServiceImpl * _instance;
00015 static DWORD ServiceExecutionThread(LPVOID param);
00016 static void ServiceCtrlHandler(DWORD controlCode);
00017 static void UpdateSCMStatus(
00018 DWORD dwCurrentState,
00019 DWORD dwWin32ExitCode,
00020 DWORD dwServiceSpecificExitCode,
00021 DWORD dwCheckPoint,
00022 DWORD dwWaitHint);
00023 static void ServiceMain();
00024 static void StartThread();
00025 protected:
00026 BOOL _running;
00027 BOOL _paused;
00028 std::wstring _name;
00029 virtual void Run() = 0;
00030 public:
00031 ServiceImpl(const std::wstring& name);
00032 virtual ~ServiceImpl();
00033 void Stop();
00034 void Start();
00035 void Wait();
00036 };
00037 }
00038 }