ReactOS 0.4.16-dev-297-gc569aee
factory.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "ole2.h"
#include "rpcproxy.h"
#include "initguid.h"
#include "vfw.h"
#include "avifile_private.h"
#include "wine/debug.h"
Include dependency graph for factory.c:

Go to the source code of this file.

Classes

struct  IClassFactoryImpl
 

Macros

#define COBJMACROS
 
#define SLASH(w)   ((w) == '/' || (w) == '\\')
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (avifile)
 
static IClassFactoryImplimpl_from_IClassFactory (IClassFactory *iface)
 
static HRESULT WINAPI IClassFactory_fnQueryInterface (IClassFactory *iface, REFIID riid, void **ppobj)
 
static ULONG WINAPI IClassFactory_fnAddRef (IClassFactory *iface)
 
static ULONG WINAPI IClassFactory_fnRelease (IClassFactory *iface)
 
static HRESULT WINAPI IClassFactory_fnCreateInstance (IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
 
static HRESULT WINAPI IClassFactory_fnLockServer (IClassFactory *iface, BOOL dolock)
 
static HRESULT AVIFILE_CreateClassFactory (const CLSID *clsid, const IID *riid, void **ppv)
 
LPCWSTR AVIFILE_BasenameW (LPCWSTR szPath)
 
HRESULT WINAPI DllGetClassObject (REFCLSID pclsid, REFIID piid, LPVOID *ppv)
 
HRESULT WINAPI DllCanUnloadNow (void)
 
BOOL WINAPI DllMain (HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpvReserved)
 
HRESULT WINAPI DllRegisterServer (void)
 
HRESULT WINAPI DllUnregisterServer (void)
 

Variables

HMODULE AVIFILE_hModule = NULL
 
static BOOL AVIFILE_bLocked
 
static UINT AVIFILE_uUseCount
 
static const IClassFactoryVtbl iclassfact
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file factory.c.

◆ SLASH

#define SLASH (   w)    ((w) == '/' || (w) == '\\')

Function Documentation

◆ AVIFILE_BasenameW()

LPCWSTR AVIFILE_BasenameW ( LPCWSTR  szPath)

Definition at line 162 of file factory.c.

163{
164#define SLASH(w) ((w) == '/' || (w) == '\\')
165
166 LPCWSTR szCur;
167
168 for (szCur = szPath + lstrlenW(szPath);
169 szCur > szPath && !SLASH(*szCur) && *szCur != ':';)
170 szCur--;
171
172 if (szCur == szPath)
173 return szCur;
174 else
175 return szCur + 1;
176
177#undef SLASH
178}
#define SLASH(w)
#define lstrlenW
Definition: compat.h:750
LPCWSTR szPath
Definition: env.c:37
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by AVIFILE_LoadFile(), and IPersistFile_fnLoad().

◆ AVIFILE_CreateClassFactory()

static HRESULT AVIFILE_CreateClassFactory ( const CLSID clsid,
const IID riid,
void **  ppv 
)
static

Definition at line 141 of file factory.c.

142{
144 HRESULT hr;
145
146 *ppv = NULL;
147
148 cf = HeapAlloc(GetProcessHeap(), 0, sizeof(*cf));
149 if (!cf)
150 return E_OUTOFMEMORY;
151
153 cf->ref = 1;
154 cf->clsid = *clsid;
155
156 hr = IClassFactory_QueryInterface(&cf->IClassFactory_iface, riid, ppv);
157 IClassFactory_Release(&cf->IClassFactory_iface);
158
159 return hr;
160}
static const IClassFactoryVtbl iclassfact
Definition: factory.c:133
#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
REFCLSID clsid
Definition: msctf.c:82
HRESULT hr
Definition: shlfolder.c:183
IClassFactory IClassFactory_iface
Definition: inetcomm_main.c:74

Referenced by DllGetClassObject().

◆ DllCanUnloadNow()

HRESULT WINAPI DllCanUnloadNow ( void  )

Definition at line 202 of file factory.c.

203{
205}
static UINT AVIFILE_uUseCount
Definition: factory.c:42
static BOOL AVIFILE_bLocked
Definition: factory.c:41
#define S_OK
Definition: intsafe.h:52
#define S_FALSE
Definition: winerror.h:2357

◆ DllGetClassObject()

HRESULT WINAPI DllGetClassObject ( REFCLSID  pclsid,
REFIID  piid,
LPVOID ppv 
)

Definition at line 183 of file factory.c.

184{
185 HRESULT hr;
186
187 TRACE("(%s,%s,%p)\n", debugstr_guid(pclsid), debugstr_guid(piid), ppv);
188
189 if (pclsid == NULL || piid == NULL || ppv == NULL)
190 return E_FAIL;
191
192 hr = AVIFILE_CreateClassFactory(pclsid,piid,ppv);
193 if (SUCCEEDED(hr))
194 return hr;
195
196 return avifil32_DllGetClassObject(pclsid,piid,ppv);
197}
static HRESULT AVIFILE_CreateClassFactory(const CLSID *clsid, const IID *riid, void **ppv)
Definition: factory.c:141
HRESULT WINAPI avifil32_DllGetClassObject(REFCLSID pclsid, REFIID piid, LPVOID *ppv) DECLSPEC_HIDDEN
#define E_FAIL
Definition: ddrawi.h:102
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hInstDll,
DWORD  fdwReason,
LPVOID  lpvReserved 
)

Definition at line 210 of file factory.c.

211{
212 TRACE("(%p,%d,%p)\n", hInstDll, fdwReason, lpvReserved);
213
214 switch (fdwReason) {
217 AVIFILE_hModule = hInstDll;
218 break;
219 };
220
221 return TRUE;
222}
HMODULE AVIFILE_hModule
Definition: factory.c:39
#define TRUE
Definition: types.h:120
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
static IN DWORD IN LPVOID lpvReserved

◆ DllRegisterServer()

HRESULT WINAPI DllRegisterServer ( void  )

Definition at line 227 of file factory.c.

228{
230}
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98

◆ DllUnregisterServer()

HRESULT WINAPI DllUnregisterServer ( void  )

Definition at line 235 of file factory.c.

236{
238}
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110

◆ IClassFactory_fnAddRef()

static ULONG WINAPI IClassFactory_fnAddRef ( IClassFactory iface)
static

Definition at line 71 of file factory.c.

72{
75
76 TRACE("(%p) ref = %u\n", This, ref);
77 return ref;
78}
#define InterlockedIncrement
Definition: armddk.h:53
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: factory.c:51
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ IClassFactory_fnCreateInstance()

static HRESULT WINAPI IClassFactory_fnCreateInstance ( IClassFactory iface,
IUnknown pOuter,
REFIID  riid,
void **  ppobj 
)
static

Definition at line 93 of file factory.c.

95{
97
98 TRACE("(%p,%p,%s,%p)\n", iface, pOuter, debugstr_guid(riid),
99 ppobj);
100
101 if (!ppobj)
102 return E_INVALIDARG;
103 *ppobj = NULL;
104
105 if (pOuter && !IsEqualGUID(&IID_IUnknown, riid))
106 return E_INVALIDARG;
107
108 if (IsEqualGUID(&CLSID_AVIFile, &This->clsid))
109 return AVIFILE_CreateAVIFile(pOuter, riid, ppobj);
110 if (IsEqualGUID(&CLSID_WAVFile, &This->clsid))
111 return AVIFILE_CreateWAVFile(pOuter, riid, ppobj);
112
113 if (pOuter)
115
116 if (IsEqualGUID(&CLSID_ICMStream, &This->clsid))
117 return AVIFILE_CreateICMStream(riid,ppobj);
118 if (IsEqualGUID(&CLSID_ACMStream, &This->clsid))
119 return AVIFILE_CreateACMStream(riid,ppobj);
120
121 return E_NOINTERFACE;
122}
HRESULT AVIFILE_CreateACMStream(REFIID riid, LPVOID *ppv)
Definition: acmstream.c:704
HRESULT AVIFILE_CreateAVIFile(IUnknown *pUnkOuter, REFIID riid, void **ppv)
Definition: avifile.c:645
HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN
Definition: icmstream.c:727
HRESULT AVIFILE_CreateWAVFile(IUnknown *outer_unk, REFIID riid, void **ret_iface) DECLSPEC_HIDDEN
Definition: wavfile.c:978
const GUID IID_IUnknown
#define E_INVALIDARG
Definition: ddrawi.h:101
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662

◆ IClassFactory_fnLockServer()

static HRESULT WINAPI IClassFactory_fnLockServer ( IClassFactory iface,
BOOL  dolock 
)
static

Definition at line 124 of file factory.c.

125{
126 TRACE("(%p,%d)\n",iface,dolock);
127
128 AVIFILE_bLocked = dolock;
129
130 return S_OK;
131}

◆ IClassFactory_fnQueryInterface()

static HRESULT WINAPI IClassFactory_fnQueryInterface ( IClassFactory iface,
REFIID  riid,
void **  ppobj 
)
static

Definition at line 56 of file factory.c.

58{
59 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(riid), ppobj);
60
61 if ((IsEqualGUID(&IID_IUnknown, riid)) ||
63 *ppobj = iface;
64 IClassFactory_AddRef(iface);
65 return S_OK;
66 }
67
68 return E_NOINTERFACE;
69}
const GUID IID_IClassFactory

◆ IClassFactory_fnRelease()

static ULONG WINAPI IClassFactory_fnRelease ( IClassFactory iface)
static

Definition at line 80 of file factory.c.

81{
84
85 TRACE("(%p) ref = %u\n", This, ref);
86
87 if(!ref)
89
90 return ref;
91}
#define InterlockedDecrement
Definition: armddk.h:52
#define HeapFree(x, y, z)
Definition: compat.h:735

◆ impl_from_IClassFactory()

static IClassFactoryImpl * impl_from_IClassFactory ( IClassFactory iface)
inlinestatic

Definition at line 51 of file factory.c.

52{
53 return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
54}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by IClassFactory_fnAddRef(), IClassFactory_fnCreateInstance(), IClassFactory_fnRelease(), MSTASK_IClassFactory_QueryInterface(), OBJSEL_IClassFactory_AddRef(), and OBJSEL_IClassFactory_Release().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( avifile  )

Variable Documentation

◆ AVIFILE_bLocked

BOOL AVIFILE_bLocked
static

Definition at line 41 of file factory.c.

Referenced by DllCanUnloadNow(), and IClassFactory_fnLockServer().

◆ AVIFILE_hModule

◆ AVIFILE_uUseCount

UINT AVIFILE_uUseCount
static

Definition at line 42 of file factory.c.

Referenced by DllCanUnloadNow().

◆ iclassfact

const IClassFactoryVtbl iclassfact
static
Initial value:
= {
}
static ULONG WINAPI IClassFactory_fnRelease(IClassFactory *iface)
Definition: factory.c:80
static ULONG WINAPI IClassFactory_fnAddRef(IClassFactory *iface)
Definition: factory.c:71
static HRESULT WINAPI IClassFactory_fnQueryInterface(IClassFactory *iface, REFIID riid, void **ppobj)
Definition: factory.c:56
static HRESULT WINAPI IClassFactory_fnLockServer(IClassFactory *iface, BOOL dolock)
Definition: factory.c:124
static HRESULT WINAPI IClassFactory_fnCreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
Definition: factory.c:93

Definition at line 133 of file factory.c.

Referenced by AVIFILE_CreateClassFactory().