git-svn-id: svn://10.65.10.50/branches/R_10_00@23098 c028cbd2-c16b-5b4b-a496-9718f37d4682
51 lines
1.8 KiB
C++
51 lines
1.8 KiB
C++
/****************************** Module Header ******************************\
|
|
* Module Name: SampleService.h
|
|
* Project: CppWindowsService
|
|
* Copyright (c) Microsoft Corporation.
|
|
*
|
|
* Provides a sample service class that derives from the service base class -
|
|
* CServiceBase. The sample service logs the service start and stop
|
|
* information to the Application event log, and shows how to run the main
|
|
* function of the service in a thread pool worker thread.
|
|
*
|
|
* This source is subject to the Microsoft Public License.
|
|
* See http://www.microsoft.com/en-us/openness/resources/licenses.aspx#MPL.
|
|
* All other rights reserved.
|
|
*
|
|
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
|
|
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
|
|
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
|
|
\***************************************************************************/
|
|
|
|
#pragma once
|
|
|
|
#include "ServiceBase.h"
|
|
#include "PathName.h"
|
|
|
|
class CESignService : public CServiceBase
|
|
{
|
|
private:
|
|
BOOL m_fStopping;
|
|
HANDLE m_hStoppedEvent;
|
|
|
|
protected:
|
|
virtual void OnStart(DWORD dwArgc, PWSTR *pszArgv);
|
|
virtual void OnStop();
|
|
|
|
char ParseHex(const char* hex) const;
|
|
const char* ParseString(const char* s, gt_string str) const;
|
|
const char* ParseString(const char* equal, CPathName& path) const;
|
|
bool ParseGET(const char* get, CPathName& src, CPathName& dst,
|
|
CPathName& bck, gt_string pin, gt_string ext) const;
|
|
|
|
DWORD RunAsync(const char* strCmdLine) const;
|
|
DWORD RunSync(const char* strCmdLine) const;
|
|
|
|
public:
|
|
CESignService(LPCTSTR pszServiceName, BOOL fCanStop = TRUE,
|
|
BOOL fCanShutdown = TRUE, BOOL fCanPauseContinue = FALSE);
|
|
void ServiceLoop(void);
|
|
virtual ~CESignService();
|
|
|
|
};
|