ReactOS  0.4.15-dev-3440-g915569a
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 36 of file classfactory.c.

38 {
40  ULONG refCount = InterlockedIncrement(&This->ref);
41 
42  return refCount;
43 }
#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 105 of file classfactory.c.

109 {
110  IClassFactoryImpl* lpclf;
111 
112  lpclf = CoTaskMemAlloc(sizeof(IClassFactoryImpl));
113  lpclf->ref = 1;
114  lpclf->lpVtbl = &dclfvt;
115  lpclf->lpfnCI = lpfnCI;
116 
117  if (pcRefDll)
118  InterlockedIncrement(pcRefDll);
119  lpclf->riidInst = riidInst;
120 
121  return (LPCLASSFACTORY)lpclf;
122 }
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:94
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426

◆ IClassFactory_fnCreateInstance()

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

Definition at line 65 of file classfactory.c.

70 {
72 
73  *ppvObject = NULL;
74 
75  if ( This->riidInst==NULL || IsEqualCLSID(riid, This->riidInst) || IsEqualCLSID(riid, &IID_IUnknown) )
76  {
77  return This->lpfnCI(pUnkOuter, riid, ppvObject);
78  }
79 
80  return E_NOINTERFACE;
81 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define NULL
Definition: types.h:112
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96

◆ IClassFactory_fnLockServer()

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

Definition at line 85 of file classfactory.c.

88 {
89  //IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
90  return E_NOTIMPL;
91 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ IClassFactory_fnQueryInterface()

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

Definition at line 16 of file classfactory.c.

20 {
22 
23  *ppvObj = NULL;
25  {
26  *ppvObj = This;
28  return S_OK;
29  }
30  return E_NOINTERFACE;
31 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:52
#define InterlockedIncrement
Definition: armddk.h:53
#define NULL
Definition: types.h:112
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 48 of file classfactory.c.

50 {
52  ULONG refCount = InterlockedDecrement(&This->ref);
53 
54  if (!refCount)
55  {
57  return 0;
58  }
59  return refCount;
60 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#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_fnAddRef(LPCLASSFACTORY iface)
Definition: classfactory.c:36
static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
Definition: classfactory.c:65
static HRESULT WINAPI IClassFactory_fnQueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
Definition: classfactory.c:16
static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface)
Definition: classfactory.c:48
static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface, BOOL fLock)
Definition: classfactory.c:85

Definition at line 94 of file classfactory.c.

Referenced by IClassFactory_fnConstructor().