Back

// PSLEnvironmentVar.cpp : Implementation of CPSLEnvironmentVar

#include "stdafx.h"
#include "PSLEnvironmentVar.h"

CPSLEnvironmentVar::CPSLEnvironmentVar()
{
   m_sName = _T("");
   m_sValue = _T("");
}

HRESULT CPSLEnvironmentVar::FinalConstruct()
{
   return S_OK;
}

void CPSLEnvironmentVar::FinalRelease()
{
}

void CPSLEnvironmentVar::Initialize(LPCTSTR sName, LPCTSTR sValue)
{
   m_sName = sName;
   m_sValue = sValue;
}

////////////////////////////////////////////////////////////////////////
// Interface Implementation;
////////////////////////////////////////////////////////////////////////

STDMETHODIMP CPSLEnvironmentVar::get_Name(BSTR * pValue)
{
   PSL_BEGIN

   *pValue = m_sName.copy();

   PSL_END
}

STDMETHODIMP CPSLEnvironmentVar::get_Value(BSTR * pValue)
{
   PSL_BEGIN

   *pValue = m_sValue.copy();

   PSL_END
}

STDMETHODIMP CPSLEnvironmentVar::put_Value(BSTR newValue)
{
   PSL_BEGIN

   if(::SetEnvironmentVariable(m_sName, _bstr_t(newValue)))
      m_sValue = newValue;

   PSL_END
}

Top