ReactOS 0.4.15-dev-7693-gd0e2924
classfactory.cpp
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS WDM Streaming ActiveMovie Proxy
4 * FILE: dll/directx/ksproxy/classfactory.cpp
5 * PURPOSE: IClassFactory interface
6 *
7 * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
8 */
9#include "precomp.h"
10
11class CClassFactory : public IClassFactory
12{
13public:
15
17 {
19 return m_Ref;
20 }
22 {
24
25 if (!m_Ref)
26 {
27 delete this;
28 return 0;
29 }
30 return m_Ref;
31 }
32
35
36 CClassFactory(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, IID *riidInst) : m_Ref(1), m_lpfnCI(lpfnCI), m_IID(riidInst)
37 {};
38
39 virtual ~CClassFactory(){};
40
41protected:
42 LONG m_Ref;
44 IID * m_IID;
45};
46
51 LPVOID *ppvObj)
52{
53 *ppvObj = NULL;
55 {
56 *ppvObj = PVOID(this);
58 return S_OK;
59 }
60 return E_NOINTERFACE;
61}
62
66 LPUNKNOWN pUnkOuter,
69{
72
73 *ppvObject = NULL;
74
76
77 swprintf(Buffer, L"riid %s", lpstr);
79
80
82 {
83 return m_lpfnCI(pUnkOuter, riid, ppvObject);
84 }
85
86 return E_NOINTERFACE;
87}
88
92 BOOL fLock)
93{
94 return E_NOTIMPL;
95}
96
100 PLONG pcRefDll,
101 IID * riidInst)
102{
103 CClassFactory* factory = new CClassFactory(lpfnCI, pcRefDll, riidInst);
104
105 if (!factory)
106 return NULL;
107
108 if (pcRefDll)
109 InterlockedIncrement(pcRefDll);
110
111 return (LPCLASSFACTORY)factory;
112}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define STDMETHODIMP
Definition: basetyps.h:43
IClassFactory * CClassFactory_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, IID *riidInst)
Definition: bufpool.h:45
LPFNCREATEINSTANCE m_lpfnCI
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
HRESULT WINAPI CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
virtual ~CClassFactory()
STDMETHODIMP_(ULONG) AddRef()
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
CClassFactory(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, IID *riidInst)
HRESULT WINAPI LockServer(BOOL fLock)
STDMETHODIMP_(ULONG) Release()
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112
HRESULT(CALLBACK * LPFNCREATEINSTANCE)(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObject)
Definition: precomp.h:22
#define MAX_PATH
Definition: compat.h:34
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
LPFNCREATEINSTANCE lpfnCI
Definition: shellole.c:61
#define swprintf
Definition: precomp.h:40
unsigned int BOOL
Definition: ntddk_ex.h:94
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
REFIID riid
Definition: atlbase.h:39
ULONG AddRef()
ULONG Release()
#define S_OK
Definition: intsafe.h:52
static LPCSTR lpstr
Definition: font.c:51
static LPOLESTR
Definition: stg_prop.c:27
const GUID IID_IUnknown
const GUID IID_IClassFactory
static LPUNKNOWN
Definition: ndr_ole.c:49
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
Definition: main.c:439
void * PVOID
Definition: typedefs.h:50
int32_t * PLONG
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364
__wchar_t WCHAR
Definition: xmlstorage.h:180