ReactOS 0.4.16-dev-747-gbc52d5f
clsfactory.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "objbase.h"
#include "ocidl.h"
#include "wincodec.h"
#include "wincodecsdk.h"
#include "initguid.h"
#include "wincodecs_private.h"
#include "wine/debug.h"
Include dependency graph for clsfactory.c:

Go to the source code of this file.

Classes

struct  classinfo
 
struct  ClassFactoryImpl
 

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wincodecs)
 
HRESULT WINAPI WIC_DllGetClassObject (REFCLSID, REFIID, LPVOID *)
 
static ClassFactoryImplimpl_from_IClassFactory (IClassFactory *iface)
 
static HRESULT WINAPI ClassFactoryImpl_QueryInterface (IClassFactory *iface, REFIID iid, void **ppv)
 
static ULONG WINAPI ClassFactoryImpl_AddRef (IClassFactory *iface)
 
static ULONG WINAPI ClassFactoryImpl_Release (IClassFactory *iface)
 
static HRESULT WINAPI ClassFactoryImpl_CreateInstance (IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppv)
 
static HRESULT WINAPI ClassFactoryImpl_LockServer (IClassFactory *iface, BOOL lock)
 
static HRESULT ClassFactoryImpl_Constructor (const classinfo *info, REFIID riid, LPVOID *ppv)
 
HRESULT WINAPI DllGetClassObject (REFCLSID rclsid, REFIID iid, LPVOID *ppv)
 
HRESULT create_instance (const CLSID *clsid, const IID *iid, void **ppv)
 

Variables

static const classinfo wic_classes []
 
static const IClassFactoryVtbl ClassFactoryImpl_Vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file clsfactory.c.

Function Documentation

◆ ClassFactoryImpl_AddRef()

static ULONG WINAPI ClassFactoryImpl_AddRef ( IClassFactory iface)
static

Definition at line 112 of file clsfactory.c.

113{
116
117 TRACE("(%p) refcount=%lu\n", iface, ref);
118
119 return ref;
120}
#define InterlockedIncrement
Definition: armddk.h:53
static ClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: clsfactory.c:84
#define TRACE(s)
Definition: solgame.cpp:4
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ ClassFactoryImpl_Constructor()

static HRESULT ClassFactoryImpl_Constructor ( const classinfo info,
REFIID  riid,
LPVOID ppv 
)
static

Definition at line 161 of file clsfactory.c.

162{
164 HRESULT ret;
165
166 *ppv = NULL;
167
168 This = malloc(sizeof(ClassFactoryImpl));
169 if (!This) return E_OUTOFMEMORY;
170
171 This->IClassFactory_iface.lpVtbl = &ClassFactoryImpl_Vtbl;
172 This->ref = 1;
173 This->info = info;
174
175 ret = IClassFactory_QueryInterface(&This->IClassFactory_iface, riid, ppv);
176 IClassFactory_Release(&This->IClassFactory_iface);
177
178 return ret;
179}
static const IClassFactoryVtbl ClassFactoryImpl_Vtbl
Definition: clsfactory.c:153
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
int ret

Referenced by DllGetClassObject().

◆ ClassFactoryImpl_CreateInstance()

static HRESULT WINAPI ClassFactoryImpl_CreateInstance ( IClassFactory iface,
IUnknown pUnkOuter,
REFIID  riid,
void **  ppv 
)
static

Definition at line 135 of file clsfactory.c.

137{
139
140 *ppv = NULL;
141
142 if (pUnkOuter) return CLASS_E_NOAGGREGATION;
143
144 return This->info->constructor(riid, ppv);
145}
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662

◆ ClassFactoryImpl_LockServer()

static HRESULT WINAPI ClassFactoryImpl_LockServer ( IClassFactory iface,
BOOL  lock 
)
static

Definition at line 147 of file clsfactory.c.

148{
149 TRACE("(%p, %i): stub\n", iface, lock);
150 return E_NOTIMPL;
151}
#define E_NOTIMPL
Definition: ddrawi.h:99
rwlock_t lock
Definition: tcpcore.h:0

◆ ClassFactoryImpl_QueryInterface()

static HRESULT WINAPI ClassFactoryImpl_QueryInterface ( IClassFactory iface,
REFIID  iid,
void **  ppv 
)
static

Definition at line 89 of file clsfactory.c.

91{
93 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
94
95 if (!ppv) return E_INVALIDARG;
96
97 if (IsEqualIID(&IID_IUnknown, iid) ||
99 {
100 *ppv = &This->IClassFactory_iface;
101 }
102 else
103 {
104 *ppv = NULL;
105 return E_NOINTERFACE;
106 }
107
108 IUnknown_AddRef((IUnknown*)*ppv);
109 return S_OK;
110}
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define E_INVALIDARG
Definition: ddrawi.h:101
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ ClassFactoryImpl_Release()

static ULONG WINAPI ClassFactoryImpl_Release ( IClassFactory iface)
static

Definition at line 122 of file clsfactory.c.

123{
126
127 TRACE("(%p) refcount=%lu\n", iface, ref);
128
129 if (ref == 0)
130 free(This);
131
132 return ref;
133}
#define InterlockedDecrement
Definition: armddk.h:52
#define free
Definition: debug_ros.c:5

◆ create_instance()

HRESULT create_instance ( const CLSID clsid,
const IID iid,
void **  ppv 
)

Definition at line 212 of file clsfactory.c.

213{
214 int i;
215
216 for (i=0; wic_classes[i].classid; i++)
217 if (IsEqualCLSID(wic_classes[i].classid, clsid))
218 return wic_classes[i].constructor(iid, ppv);
219
220 return CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, iid, ppv);
221}
static const classinfo wic_classes[]
Definition: clsfactory.c:45
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
REFCLSID clsid
Definition: msctf.c:82
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
REFCLSID classid
Definition: clsfactory.c:41
class_constructor constructor
Definition: clsfactory.c:42

Referenced by BitmapDecoderInfo_CreateInstance(), BitmapEncoderInfo_CreateInstance(), CommonDecoderFrame_Block_GetReaderByIndex(), CommonDecoderFrame_GetMetadataQueryReader(), FormatConverterInfo_CreateInstance(), MetadataReaderInfo_CreateInstance(), PaletteImpl_InitializeFromBitmap(), and write_source().

◆ DllGetClassObject()

HRESULT WINAPI DllGetClassObject ( REFCLSID  rclsid,
REFIID  iid,
LPVOID ppv 
)

Definition at line 181 of file clsfactory.c.

182{
183 HRESULT ret;
184 const classinfo *info=NULL;
185 int i;
186
187 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
188
189 if (!rclsid || !iid || !ppv)
190 return E_INVALIDARG;
191
192 *ppv = NULL;
193
194 for (i=0; wic_classes[i].classid; i++)
195 {
196 if (IsEqualCLSID(wic_classes[i].classid, rclsid))
197 {
198 info = &wic_classes[i];
199 break;
200 }
201 }
202
203 if (info)
205 else
206 ret = WIC_DllGetClassObject(rclsid, iid, ppv);
207
208 TRACE("<-- %08lX\n", ret);
209 return ret;
210}
HRESULT WINAPI WIC_DllGetClassObject(REFCLSID, REFIID, LPVOID *)
static HRESULT ClassFactoryImpl_Constructor(const classinfo *info, REFIID riid, LPVOID *ppv)
Definition: clsfactory.c:161

◆ impl_from_IClassFactory()

static ClassFactoryImpl * impl_from_IClassFactory ( IClassFactory iface)
inlinestatic

Definition at line 84 of file clsfactory.c.

85{
86 return CONTAINING_RECORD(iface, ClassFactoryImpl, IClassFactory_iface);
87}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by ClassFactoryImpl_AddRef(), ClassFactoryImpl_CreateInstance(), ClassFactoryImpl_QueryInterface(), and ClassFactoryImpl_Release().

◆ WIC_DllGetClassObject()

HRESULT WINAPI WIC_DllGetClassObject ( REFCLSID  ,
REFIID  ,
LPVOID  
)

Referenced by DllGetClassObject().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wincodecs  )

Variable Documentation

◆ ClassFactoryImpl_Vtbl

const IClassFactoryVtbl ClassFactoryImpl_Vtbl
static
Initial value:
= {
}
static ULONG WINAPI ClassFactoryImpl_Release(IClassFactory *iface)
Definition: clsfactory.c:122
static HRESULT WINAPI ClassFactoryImpl_LockServer(IClassFactory *iface, BOOL lock)
Definition: clsfactory.c:147
static ULONG WINAPI ClassFactoryImpl_AddRef(IClassFactory *iface)
Definition: clsfactory.c:112
static HRESULT WINAPI ClassFactoryImpl_QueryInterface(IClassFactory *iface, REFIID iid, void **ppv)
Definition: clsfactory.c:89
static HRESULT WINAPI ClassFactoryImpl_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppv)
Definition: clsfactory.c:135

Definition at line 153 of file clsfactory.c.

Referenced by ClassFactoryImpl_Constructor().

◆ wic_classes

const classinfo wic_classes[]
static

Definition at line 45 of file clsfactory.c.

Referenced by create_instance(), and DllGetClassObject().