19 #ifndef INCLUDE_UTIL_NTSERVICE_HPP
20 #define INCLUDE_UTIL_NTSERVICE_HPP
25 #include <RCF/util/Tchar.hpp>
34 const std::string & serviceName,
35 const std::string & serviceDisplayName);
40 int RunAsServiceOrInteractive();
41 void SetServiceStatus(DWORD dwState, DWORD waitHint = 0);
43 bool Install(
const tstring & commandLineArgs);
45 bool IsInstalled()
const;
49 void ServiceMain(DWORD dwArgc, LPTSTR * lpszArgv);
51 virtual int Start() = 0;
52 virtual void Handler(DWORD dwOpcode);
54 friend static void WINAPI _ServiceMain(DWORD dwArgc, LPTSTR* lpszArgv);
55 friend static void WINAPI _Handler(DWORD dwOpcode);
56 static NtService * spThis;
60 std::string mServiceName;
61 std::string mServiceDisplayName;
63 SERVICE_STATUS_HANDLE mhServiceStatus;
64 SERVICE_STATUS mStatus;
66 volatile bool mStopFlag;
67 bool mRunningAsService;
73 #endif // ! INCLUDE_UTIL_NTSERVICE_HPP