WarService.h
资源名称:warftpd.zip [点击查看]
上传用户:surprise9
上传日期:2007-01-04
资源大小:426k
文件大小:2k
源码类别:
Ftp客户端
开发平台:
Visual C++
- // This is part of the WAR SOFTWARE SERIES initiated by Jarle Aase
- // Copyright 1996 by Jarle Aase. All rights reserved.
- // See the "War Software Series Licende Agreement" for details concerning
- // use and distribution.
- // ---
- // This source code, executables and programs containing source code or
- // binaries or proprietetary technology from the War Software Series are
- // NOT alloed used, viewed or tested by any governmental agencies in
- // any countries. This includes the government, departments, police,
- // military etc.
- // ---
- // This file is intended for use with Tab space = 2
- // Created and maintained in MSVC Developer Studio
- // ---
- // NAME : WarService.h
- // PURPOSE : NT Service class
- // PROGRAM :
- // DATE : Sept. 19 1996
- // AUTHOR : Jarle Aase
- // ---
- // REVISION HISTORY
- //
- #ifndef NTSERVICE_H_
- #define NTSERVICE_H_
- #include "winsvc.h"
- #define SERVICE_CONTROL_USER 128
- class DLL_WAR_DAEMON_ CNTService
- {
- public:
- CNTService(LPCSTR ServiceName, CRuntimeClass* MainThreadClass);
- virtual ~CNTService();
- BOOL IsInstalled();
- BOOL StartService();
- void SetStatus(DWORD dwState);
- BOOL Initialize();
- virtual void Run();
- virtual BOOL OnInit();
- virtual void OnStop();
- virtual void OnInterrogate();
- virtual void OnPause();
- virtual void OnContinue();
- virtual void OnShutdown();
- virtual BOOL OnUserControl(DWORD dwOpcode);
- void DebugMsg(const char* pszFormat, ...);
- static void LogEvent(WORD wType, DWORD dwID, LPCSTR Format, ...);
- static CNTService *GetService() {return m_pThis; }
- static BOOL IsService() {return (m_pThis != NULL); }
- // static member functions
- static void WINAPI ServiceMain(DWORD dwArgc, LPTSTR* lpszArgv);
- static void WINAPI Handler(DWORD dwOpcode);
- // data members
- char m_szServiceName[64];
- int m_iMajorVersion;
- int m_iMinorVersion;
- SERVICE_STATUS_HANDLE m_hServiceStatus;
- SERVICE_STATUS m_Status;
- BOOL m_bIsRunning;
- CRuntimeClass* m_MainThreadClass;
- CWinThread *m_MainThread;
- // static data
- static CNTService* m_pThis; // nasty hack to get object ptr
- private:
- HANDLE m_hEventSource;
- };
- #endif // NTSERVICE_H_