| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- // TimeSyncServer.h : PROJECT_NAME 应用程序的主头文件
- //
- #pragma once
- #ifndef __AFXWIN_H__
- #error "在包含此文件之前包含“stdafx.h”以生成 PCH 文件"
- #endif
- #include "resource.h" // 主符号
- #include <WinSvc.h>
- #include <DbgHelp.h>
- #pragma comment(lib, "dbghelp.lib")
- extern SERVICE_STATUS m_ServiceStatus;
- extern SERVICE_STATUS_HANDLE m_ServiceStatusHandle;
- //函数声明
- void WINAPI ServiceMain(DWORD argc, LPTSTR *argv);
- void WINAPI ServiceCtrlHandler(DWORD Opcode);
- BOOL InstallService(CString &strPath);
- BOOL DeleteService();
- class CDumpCatch
- {
- public:
- CDumpCatch();
- ~CDumpCatch();
- private:
- static LPTOP_LEVEL_EXCEPTION_FILTER WINAPI TempSetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter);
- static BOOL ReleaseDumpFile(const std::string& strPath, EXCEPTION_POINTERS* pException);
- static LONG WINAPI UnhandledExceptionFilterEx(struct _EXCEPTION_POINTERS* pException);
- static void MyPureCallHandler(void);
- static void MyInvalidParameterHandler(const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line, uintptr_t pReserved);
- BOOL AddExceptionHandle();
- BOOL RemoveExceptionHandle();
- BOOL PreventSetUnhandledExceptionFilter();
- void SetInvalidHandle();
- void UnSetInvalidHandle();
- private:
- LPTOP_LEVEL_EXCEPTION_FILTER m_preFilter;
- _invalid_parameter_handler m_preIph;
- _purecall_handler m_prePch;
- };
- // CTimeSyncServerApp:
- // 有关此类的实现,请参阅 TimeSyncServer.cpp
- //
- class CTimeSyncServerApp : public CWinApp
- {
- public:
- CTimeSyncServerApp();
- // 重写
- public:
- virtual BOOL InitInstance();
- static void StartTheAppServices(WORD);
- // 实现
- DECLARE_MESSAGE_MAP()
- };
- extern CTimeSyncServerApp theApp;
|