|
// PSLService.cpp : Implementation of CPSLService
#include "stdafx.h"
#include "PSLService.h"
CPSLService::CPSLService()
{
}
HRESULT CPSLService::FinalConstruct()
{
return S_OK;
}
void CPSLService::FinalRelease()
{
}
void CPSLService::Initialize(SC_HANDLE hService, ENUM_SERVICE_STATUS_PROCESS & ssp, LPBYTE pTempBuffer, DWORD dwBufferSize)
{
CServiceInfo::Initialize(hService, ssp, pTempBuffer, dwBufferSize);
}
////////////////////////////////////////////////////////////////////////
// Interface Implementation;
////////////////////////////////////////////////////////////////////////
STDMETHODIMP CPSLService::get_Name(BSTR * pValue)
{
PSL_BEGIN
*pValue = m_sName.copy();
PSL_END
}
STDMETHODIMP CPSLService::get_DisplayName(BSTR * pValue)
{
PSL_BEGIN
*pValue = m_sDisplayName.copy();
PSL_END
}
STDMETHODIMP CPSLService::get_Description(BSTR * pValue)
{
PSL_BEGIN
*pValue = m_sDescription.copy();
PSL_END
}
STDMETHODIMP CPSLService::get_Path(BSTR * pValue)
{
PSL_BEGIN
*pValue = m_sPath.copy();
PSL_END
}
STDMETHODIMP CPSLService::get_CurrentState(PSLServiceState * pValue)
{
PSL_BEGIN
SetException(CServiceInfo::Update());
*pValue = m_CurrentState;
PSL_END
}
STDMETHODIMP CPSLService::get_Type(PSLServiceType * pValue)
{
PSL_BEGIN
if((m_dwServiceType & SERVICE_WIN32_OWN_PROCESS) > 0)
*pValue = stOwnProcess;
else
*pValue = stShareProcess;
PSL_END
}
STDMETHODIMP CPSLService::get_IsInteractive(VARIANT_BOOL * pValue)
{
PSL_BEGIN
if((m_dwServiceType & SERVICE_INTERACTIVE_PROCESS) > 0)
*pValue = VARIANT_TRUE;
else
*pValue = VARIANT_FALSE;
PSL_END
}
STDMETHODIMP CPSLService::get_LogOnAs(BSTR * pValue)
{
PSL_BEGIN
*pValue = m_sStartName.copy();
PSL_END
}
STDMETHODIMP CPSLService::get_Dependencies(BSTR * pValue)
{
PSL_BEGIN
*pValue = m_sDependencies.copy();
PSL_END
}
STDMETHODIMP CPSLService::get_StartType(PSLServiceStartType * pValue)
{
PSL_BEGIN
*pValue = static_cast<PSLServiceStartType>(m_dwStartType);
PSL_END
}
STDMETHODIMP CPSLService::get_ProcessID(long * pValue)
{
PSL_BEGIN
SetException(CServiceInfo::Update());
*pValue = m_dwProcessID;
PSL_END
}
STDMETHODIMP CPSLService::Start(long * pValue)
{
PSL_BEGIN
PSLException ex;
*pValue = CServiceInfo::StartService(NULL, ex);
SetException(ex);
PSL_END
}
STDMETHODIMP CPSLService::StartEx(SAFEARRAY * CmdParams, long * pValue)
{
PSL_BEGIN
if(!CmdParams)
return MakeException(exInvalidParameter);
PSLException ex;
*pValue = CServiceInfo::StartService(CmdParams, ex);
SetException(ex);
PSL_END
}
STDMETHODIMP CPSLService::Stop(long * pValue)
{
PSL_BEGIN
PSLException ex;
*pValue = CServiceInfo::StopService(ex);
SetException(ex);
PSL_END
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.