ReactOS  0.4.14-dev-50-g13bb5e2
classfactory.c File Reference
#include "precomp.h"
Include dependency graph for classfactory.c:

Go to the source code of this file.

Classes

struct  IClassFactoryImpl
 

Functions

static HRESULT WINAPI IClassFactory_fnQueryInterface (LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
 
static ULONG WINAPI IClassFactory_fnAddRef (LPCLASSFACTORY iface)
 
static ULONG WINAPI IClassFactory_fnRelease (LPCLASSFACTORY iface)
 
static HRESULT WINAPI IClassFactory_fnCreateInstance (LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
 
static HRESULT WINAPI IClassFactory_fnLockServer (LPCLASSFACTORY iface, BOOL fLock)
 
IClassFactoryIClassFactory_fnConstructor (LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, REFIID riidInst)
 

Variables

static const IClassFactoryVtbl dclfvt
 

Function Documentation

◆ IClassFactory_fnAddRef()

static ULONG WINAPI IClassFactory_fnAddRef ( LPCLASSFACTORY  iface)
static

Definition at line 48 of file classfactory.c.

50 {
52 
53  /* increment reference count */
54  ULONG refCount = InterlockedIncrement(&This->ref);
55 
56  return refCount;
57 }
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ IClassFactory_fnConstructor()

IClassFactory* IClassFactory_fnConstructor ( LPFNCREATEINSTANCE  lpfnCI,
PLONG  pcRefDll,
REFIID  riidInst 
)

Definition at line 125 of file classfactory.c.

129 {
130  IClassFactoryImpl* lpclf;
131 
132  lpclf = CoTaskMemAlloc(sizeof(IClassFactoryImpl));
133  lpclf->ref = 1;
134  lpclf->lpVtbl = &dclfvt;
135  lpclf->lpfnCI = lpfnCI;
136 
137  if (pcRefDll)
138  InterlockedIncrement(pcRefDll);
139  lpclf->riidInst = riidInst;
140 
141  return (LPCLASSFACTORY)lpclf;
142 }
LPFNCREATEINSTANCE lpfnCI
Definition: classfactory.c:18
const IClassFactoryVtbl * lpVtbl
Definition: classfactory.c:15
LPFNCREATEINSTANCE lpfnCI
Definition: shellole.c:61
const IID * riidInst
Definition: classfactory.c:19
#define InterlockedIncrement
Definition: armddk.h:53
static const IClassFactoryVtbl dclfvt
Definition: classfactory.c:114
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

Referenced by DllGetClassObject().

◆ IClassFactory_fnCreateInstance()

static HRESULT WINAPI IClassFactory_fnCreateInstance ( LPCLASSFACTORY  iface,
LPUNKNOWN  pUnkOuter,
REFIID  riid,
LPVOID ppvObject 
)
static

Definition at line 81 of file classfactory.c.

86 {
88 
89  if (!ppvObject)
90  return E_INVALIDARG;
91 
92  *ppvObject = NULL;
93 
94  if ( This->riidInst==NULL || IsEqualCLSID(riid, This->riidInst) || IsEqualCLSID(riid, &IID_IUnknown) )
95  {
96  /* instantiate object */
97  return This->lpfnCI(pUnkOuter, riid, ppvObject);
98  }
99 
100  return E_NOINTERFACE;
101 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96

◆ IClassFactory_fnLockServer()

static HRESULT WINAPI IClassFactory_fnLockServer ( LPCLASSFACTORY  iface,
BOOL  fLock 
)
static

Definition at line 105 of file classfactory.c.

108 {
109  //IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
110  return E_NOTIMPL;
111 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ IClassFactory_fnQueryInterface()

static HRESULT WINAPI IClassFactory_fnQueryInterface ( LPCLASSFACTORY  iface,
REFIID  riid,
LPVOID ppvObj 
)
static

Definition at line 26 of file classfactory.c.

30 {
32 
33  *ppvObj = NULL;
34 
35  /* check requested interface */
37  {
38  *ppvObj = This;
40  return S_OK;
41  }
42  return E_NOINTERFACE;
43 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define InterlockedIncrement
Definition: armddk.h:53
const GUID IID_IClassFactory
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ IClassFactory_fnRelease()

static ULONG WINAPI IClassFactory_fnRelease ( LPCLASSFACTORY  iface)
static

Definition at line 62 of file classfactory.c.

64 {
66  ULONG refCount = InterlockedDecrement(&This->ref);
67 
68  /* decrement reference count */
69  if (!refCount)
70  {
71  /* free class factory */
73  return 0;
74  }
75  return refCount;
76 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1

Variable Documentation

◆ dclfvt

const IClassFactoryVtbl dclfvt
static
Initial value:
=
{
}
static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface)
Definition: classfactory.c:62
static HRESULT WINAPI IClassFactory_fnQueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
Definition: classfactory.c:26
static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface, BOOL fLock)
Definition: classfactory.c:105
static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface)
Definition: classfactory.c:48
static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
Definition: classfactory.c:81

Definition at line 114 of file classfactory.c.

Referenced by IClassFactory_fnConstructor().