2019-10-18 11:57:19 +08:00
|
|
|
#include "stdafx.h"
|
|
|
|
#include "MockPowerRenameRegExEvents.h"
|
|
|
|
|
2019-12-10 15:28:24 +08:00
|
|
|
IFACEMETHODIMP_(ULONG)
|
|
|
|
CMockPowerRenameRegExEvents::AddRef()
|
2019-10-18 11:57:19 +08:00
|
|
|
{
|
|
|
|
return InterlockedIncrement(&m_refCount);
|
|
|
|
}
|
|
|
|
|
2019-12-10 15:28:24 +08:00
|
|
|
IFACEMETHODIMP_(ULONG)
|
|
|
|
CMockPowerRenameRegExEvents::Release()
|
2019-10-18 11:57:19 +08:00
|
|
|
{
|
|
|
|
long refCount = InterlockedDecrement(&m_refCount);
|
|
|
|
|
|
|
|
if (refCount == 0)
|
|
|
|
{
|
|
|
|
delete this;
|
|
|
|
}
|
|
|
|
return refCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
IFACEMETHODIMP CMockPowerRenameRegExEvents::QueryInterface(_In_ REFIID riid, _Outptr_ void** ppv)
|
|
|
|
{
|
|
|
|
static const QITAB qit[] = {
|
|
|
|
QITABENT(CMockPowerRenameRegExEvents, IPowerRenameRegExEvents),
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
return QISearch(this, qit, riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
IFACEMETHODIMP CMockPowerRenameRegExEvents::OnSearchTermChanged(_In_ PCWSTR searchTerm)
|
|
|
|
{
|
|
|
|
CoTaskMemFree(m_searchTerm);
|
|
|
|
m_searchTerm = nullptr;
|
|
|
|
if (searchTerm != nullptr)
|
|
|
|
{
|
|
|
|
SHStrDup(searchTerm, &m_searchTerm);
|
|
|
|
}
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
IFACEMETHODIMP CMockPowerRenameRegExEvents::OnReplaceTermChanged(_In_ PCWSTR replaceTerm)
|
|
|
|
{
|
|
|
|
CoTaskMemFree(m_replaceTerm);
|
|
|
|
m_replaceTerm = nullptr;
|
|
|
|
if (replaceTerm != nullptr)
|
|
|
|
{
|
|
|
|
SHStrDup(replaceTerm, &m_replaceTerm);
|
|
|
|
}
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
IFACEMETHODIMP CMockPowerRenameRegExEvents::OnFlagsChanged(_In_ DWORD flags)
|
|
|
|
{
|
|
|
|
m_flags = flags;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CMockPowerRenameRegExEvents::s_CreateInstance(_Outptr_ IPowerRenameRegExEvents** ppsrree)
|
|
|
|
{
|
|
|
|
*ppsrree = nullptr;
|
|
|
|
CMockPowerRenameRegExEvents* psrree = new CMockPowerRenameRegExEvents();
|
|
|
|
HRESULT hr = psrree ? S_OK : E_OUTOFMEMORY;
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
hr = psrree->QueryInterface(IID_PPV_ARGS(ppsrree));
|
|
|
|
psrree->Release();
|
|
|
|
}
|
|
|
|
return hr;
|
|
|
|
}
|