ReactOS 0.4.15-dev-5666-gc548b97
clsfactory.c File Reference
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "objbase.h"
#include "ocidl.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  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 (CLSID *clsid, const IID *iid, void **ppv)
 

Variables

 classinfo
 
static const classinfo wic_classes []
 
static const IClassFactoryVtbl ClassFactoryImpl_Vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file clsfactory.c.

Function Documentation

◆ ClassFactoryImpl_AddRef()

static ULONG WINAPI ClassFactoryImpl_AddRef ( IClassFactory iface)
static

Definition at line 108 of file clsfactory.c.

109{
112
113 TRACE("(%p) refcount=%u\n", iface, ref);
114
115 return ref;
116}
#define InterlockedIncrement
Definition: armddk.h:53
static ClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: clsfactory.c:80
unsigned int ULONG
Definition: retypes.h:1
#define TRACE(s)
Definition: solgame.cpp:4
Definition: send.c:48

◆ ClassFactoryImpl_Constructor()

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

Definition at line 157 of file clsfactory.c.

158{
160 HRESULT ret;
161
162 *ppv = NULL;
163
165 if (!This) return E_OUTOFMEMORY;
166
167 This->IClassFactory_iface.lpVtbl = &ClassFactoryImpl_Vtbl;
168 This->ref = 1;
169 This->info = info;
170
171 ret = IClassFactory_QueryInterface(&This->IClassFactory_iface, riid, ppv);
172 IClassFactory_Release(&This->IClassFactory_iface);
173
174 return ret;
175}
static const IClassFactoryVtbl ClassFactoryImpl_Vtbl
Definition: clsfactory.c:149
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
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 131 of file clsfactory.c.

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

◆ ClassFactoryImpl_LockServer()

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

Definition at line 143 of file clsfactory.c.

144{
145 TRACE("(%p, %i): stub\n", iface, lock);
146 return E_NOTIMPL;
147}
#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 85 of file clsfactory.c.

87{
89 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
90
91 if (!ppv) return E_INVALIDARG;
92
93 if (IsEqualIID(&IID_IUnknown, iid) ||
95 {
96 *ppv = &This->IClassFactory_iface;
97 }
98 else
99 {
100 *ppv = NULL;
101 return E_NOINTERFACE;
102 }
103
104 IUnknown_AddRef((IUnknown*)*ppv);
105 return S_OK;
106}
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 118 of file clsfactory.c.

119{
122
123 TRACE("(%p) refcount=%u\n", iface, ref);
124
125 if (ref == 0)
127
128 return ref;
129}
#define InterlockedDecrement
Definition: armddk.h:52
#define HeapFree(x, y, z)
Definition: compat.h:735

◆ create_instance()

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

Definition at line 208 of file clsfactory.c.

209{
210 int i;
211
212 for (i=0; wic_classes[i].classid; i++)
213 if (IsEqualCLSID(wic_classes[i].classid, clsid))
214 return wic_classes[i].constructor(iid, ppv);
215
216 return CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, iid, ppv);
217}
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

Referenced by BitmapDecoderInfo_CreateInstance(), BitmapEncoderInfo_CreateInstance(), FormatConverterInfo_CreateInstance(), and MetadataReaderInfo_CreateInstance().

◆ DllGetClassObject()

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

Definition at line 177 of file clsfactory.c.

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

◆ impl_from_IClassFactory()

static ClassFactoryImpl * impl_from_IClassFactory ( IClassFactory iface)
inlinestatic

Definition at line 80 of file clsfactory.c.

81{
82 return CONTAINING_RECORD(iface, ClassFactoryImpl, IClassFactory_iface);
83}
#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  
)

Definition at line 38 of file clsfactory.c.

40 {
41 REFCLSID classid;
42 class_constructor constructor;
43} classinfo;
#define REFCLSID
Definition: guiddef.h:117
HRESULT(* class_constructor)(REFIID, void **)

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:118
static HRESULT WINAPI ClassFactoryImpl_LockServer(IClassFactory *iface, BOOL lock)
Definition: clsfactory.c:143
static ULONG WINAPI ClassFactoryImpl_AddRef(IClassFactory *iface)
Definition: clsfactory.c:108
static HRESULT WINAPI ClassFactoryImpl_QueryInterface(IClassFactory *iface, REFIID iid, void **ppv)
Definition: clsfactory.c:85
static HRESULT WINAPI ClassFactoryImpl_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppv)
Definition: clsfactory.c:131

Definition at line 149 of file clsfactory.c.

Referenced by ClassFactoryImpl_Constructor().

◆ classinfo

◆ wic_classes

const classinfo wic_classes[]
static
Initial value:
= {
{&CLSID_WICImagingFactory, ImagingFactory_CreateInstance},
{&CLSID_WICImagingFactory2, ImagingFactory_CreateInstance},
{&CLSID_WICBmpDecoder, BmpDecoder_CreateInstance},
{&CLSID_WICPngDecoder, PngDecoder_CreateInstance},
{&CLSID_WICPngEncoder, PngEncoder_CreateInstance},
{&CLSID_WICBmpEncoder, BmpEncoder_CreateInstance},
{&CLSID_WICGifDecoder, GifDecoder_CreateInstance},
{&CLSID_WICGifEncoder, GifEncoder_CreateInstance},
{&CLSID_WICIcoDecoder, IcoDecoder_CreateInstance},
{&CLSID_WICJpegDecoder, JpegDecoder_CreateInstance},
{&CLSID_WICJpegEncoder, JpegEncoder_CreateInstance},
{&CLSID_WICTiffDecoder, TiffDecoder_CreateInstance},
{&CLSID_WICTiffEncoder, TiffEncoder_CreateInstance},
{&CLSID_WICIcnsEncoder, IcnsEncoder_CreateInstance},
{&CLSID_WICDefaultFormatConverter, FormatConverter_CreateInstance},
{&CLSID_WineTgaDecoder, TgaDecoder_CreateInstance},
{&CLSID_WICUnknownMetadataReader, UnknownMetadataReader_CreateInstance},
{&CLSID_WICIfdMetadataReader, IfdMetadataReader_CreateInstance},
{&CLSID_WICPngChrmMetadataReader, PngChrmReader_CreateInstance},
{&CLSID_WICPngGamaMetadataReader, PngGamaReader_CreateInstance},
{&CLSID_WICPngTextMetadataReader, PngTextReader_CreateInstance},
{&CLSID_WICLSDMetadataReader, LSDReader_CreateInstance},
{&CLSID_WICIMDMetadataReader, IMDReader_CreateInstance},
{&CLSID_WICGCEMetadataReader, GCEReader_CreateInstance},
{&CLSID_WICAPEMetadataReader, APEReader_CreateInstance},
{&CLSID_WICGifCommentMetadataReader, GifCommentReader_CreateInstance},
{0}}
HRESULT BmpDecoder_CreateInstance(REFIID iid, void **ppv)
Definition: bmpdecode.c:1195
HRESULT BmpEncoder_CreateInstance(REFIID iid, void **ppv)
Definition: bmpencode.c:642
HRESULT FormatConverter_CreateInstance(REFIID iid, void **ppv)
Definition: converter.c:1835
HRESULT GifEncoder_CreateInstance(REFIID iid, void **ppv)
Definition: gifformat.c:2375
HRESULT GCEReader_CreateInstance(REFIID iid, void **ppv)
Definition: gifformat.c:327
HRESULT IMDReader_CreateInstance(REFIID iid, void **ppv)
Definition: gifformat.c:249
HRESULT GifDecoder_CreateInstance(REFIID iid, void **ppv)
Definition: gifformat.c:1434
HRESULT APEReader_CreateInstance(REFIID iid, void **ppv)
Definition: gifformat.c:434
HRESULT LSDReader_CreateInstance(REFIID iid, void **ppv)
Definition: gifformat.c:168
HRESULT GifCommentReader_CreateInstance(REFIID iid, void **ppv)
Definition: gifformat.c:528
HRESULT IcoDecoder_CreateInstance(REFIID iid, void **ppv)
Definition: icoformat.c:759
HRESULT JpegEncoder_CreateInstance(REFIID iid, void **ppv)
Definition: jpegformat.c:1556
HRESULT JpegDecoder_CreateInstance(REFIID iid, void **ppv)
Definition: jpegformat.c:1550
HRESULT PngDecoder_CreateInstance(REFIID iid, void **ppv)
Definition: pngformat.c:2188
HRESULT PngEncoder_CreateInstance(REFIID iid, void **ppv)
Definition: pngformat.c:2194
HRESULT PngGamaReader_CreateInstance(REFIID iid, void **ppv)
Definition: pngformat.c:217
HRESULT PngTextReader_CreateInstance(REFIID iid, void **ppv)
Definition: pngformat.c:155
HRESULT PngChrmReader_CreateInstance(REFIID iid, void **ppv)
Definition: pngformat.c:295
HRESULT TiffEncoder_CreateInstance(REFIID iid, void **ppv)
Definition: tiffformat.c:2379
HRESULT TiffDecoder_CreateInstance(REFIID iid, void **ppv)
Definition: tiffformat.c:2373
HRESULT IcnsEncoder_CreateInstance(REFIID iid, void **ppv)
Definition: icnsformat.c:737
HRESULT ImagingFactory_CreateInstance(REFIID iid, void **ppv)
Definition: imgfactory.c:1470
HRESULT IfdMetadataReader_CreateInstance(REFIID iid, void **ppv)
HRESULT UnknownMetadataReader_CreateInstance(REFIID iid, void **ppv)
HRESULT TgaDecoder_CreateInstance(REFIID iid, void **ppv)
Definition: tgaformat.c:942

Definition at line 45 of file clsfactory.c.

Referenced by create_instance(), and DllGetClassObject().