1 // XMergeFactory.cpp: implementation of the CXMergeFactory class.
3 //////////////////////////////////////////////////////////////////////
7 #include "XMergeFilter.h"
8 #include "XMergeFactory.h"
10 //////////////////////////////////////////////////////////////////////
11 // IUnknown implementation
12 //////////////////////////////////////////////////////////////////////
13 STDMETHODIMP
CXMergeFactory::QueryInterface(REFIID riid
, void **ppvObject
)
18 if(::IsEqualIID(riid
, IID_IUnknown
) || ::IsEqualIID(riid
, IID_IClassFactory
))
20 *ppvObject
= static_cast<IClassFactory
*>(this);
28 reinterpret_cast<IUnknown
*>(*ppvObject
)->AddRef();
33 STDMETHODIMP_(ULONG
) CXMergeFactory::AddRef()
35 return ::InterlockedIncrement(&m_cRef
);
39 STDMETHODIMP_(ULONG
) CXMergeFactory::Release()
41 if(::InterlockedDecrement(&m_cRef
) == 0)
51 //////////////////////////////////////////////////////////////////////
52 // IUnknown implementation
53 //////////////////////////////////////////////////////////////////////
54 STDMETHODIMP
CXMergeFactory::CreateInstance(IUnknown
*pUnkOuter
, REFIID iid
, void **ppvObject
)
56 if (ppvObject
== NULL
)
59 if (pUnkOuter
!= NULL
) // cannot aggregate
62 return CLASS_E_NOAGGREGATION
;
65 if (iid
== IID_ICeFileFilter
)
67 CXMergeFilter
*pFilter
= new CXMergeFilter();
74 HRESULT hr
= pFilter
->QueryInterface(iid
, ppvObject
);
84 STDMETHODIMP
CXMergeFactory::LockServer(BOOL fLock
)
86 _Module
.LockServer(fLock
);