/* ==========================================================================
* 파    일 : ServiceMode.h
* 목    적 : 
* 작 성 자 : 박경희
* 작 성 일 : 2008-08-18
* 주의사항 :
*===========================================================================*/
#pragma once

class cServiceMode
{
public:
	cServiceMode(void);
	~cServiceMode(void);

	/// 서비스
	bool			InstallService( LPCTSTR binaryPathName, DWORD startType = SERVICE_DEMAND_START );
	bool			UninstallService( void );
	VOID			DoStopSvc();
	VOID			DoStartSvc();
	BOOL			StopDependentServices();

	bool			ServiceRun(DWORD argc, LPTSTR* argv, LPSERVICE_MAIN_FUNCTION func );

	SERVICE_STATUS*	GetServiceStatus()	{ return &mServiceStatus; }
	SERVICE_STATUS_HANDLE	GetServiceStatusHandle()	{ return mServiceStatusHandle; }
	void			SetServiceStatusHandle( SERVICE_STATUS_HANDLE hServiceStatus )	{ mServiceStatusHandle = hServiceStatus; }

	void			SetszSvcName( TCHAR* serviceName )	{ _stprintf( szSvcName, serviceName ); }

	TCHAR*			GetServiceName()	{ return mServiceName; }

private:

	TCHAR			szSvcName[80];

	SC_HANDLE		schSCManager;
	SC_HANDLE		schService;

	TCHAR*			mServiceName;
	TCHAR*			mDisplayName;
	TCHAR*			mDescription;

	SERVICE_STATUS_HANDLE	mServiceStatusHandle;
	SERVICE_STATUS	mServiceStatus;
};
