ReactOS  0.4.14-dev-583-g2a1ba2c
dllfunc.c File Reference
#include "config.h"
#include <stdarg.h>
#include <assert.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winerror.h"
#include "winreg.h"
#include "objbase.h"
#include "uuids.h"
#include "strmif.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/strmbase.h"
Include dependency graph for dllfunc.c:

Go to the source code of this file.

Classes

struct  IClassFactoryImpl
 

Macros

#define COBJMACROS
 
#define NONAMELESSSTRUCT
 
#define NONAMELESSUNION
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (strmbase)
 
static HRESULT SetupRegisterClass (HKEY clsid, LPCWSTR szCLSID, LPCWSTR szDescription, LPCWSTR szFileName, LPCWSTR szServerType, LPCWSTR szThreadingModel)
 
static HRESULT SetupRegisterAllClasses (const FactoryTemplate *pList, int num, LPCWSTR szFileName, BOOL bRegister)
 
HRESULT WINAPI AMovieSetupRegisterFilter2 (const AMOVIESETUP_FILTER *pFilter, IFilterMapper2 *pIFM2, BOOL bRegister)
 
HRESULT WINAPI AMovieDllRegisterServer2 (BOOL bRegister)
 
static void SetupInitializeServers (const FactoryTemplate *pList, int num, BOOL bLoading)
 
BOOL WINAPI STRMBASE_DllMain (HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
 
static IClassFactoryImplimpl_from_IClassFactory (IClassFactory *iface)
 
static HRESULT WINAPI DSCF_QueryInterface (IClassFactory *iface, REFIID riid, void **ppobj)
 
static ULONG WINAPI DSCF_AddRef (IClassFactory *iface)
 
static ULONG WINAPI DSCF_Release (IClassFactory *iface)
 
static HRESULT WINAPI DSCF_CreateInstance (IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
 
static HRESULT WINAPI DSCF_LockServer (IClassFactory *iface, BOOL dolock)
 
HRESULT WINAPI STRMBASE_DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 
HRESULT WINAPI STRMBASE_DllCanUnloadNow (void)
 

Variables

const int g_cTemplates
 
const FactoryTemplate g_Templates []
 
static HINSTANCE g_hInst = NULL
 
static LONG server_locks = 0
 
static const WCHAR clsid_keyname [] = {'C','L','S','I','D',0 }
 
static const WCHAR ips32_keyname [] = {'I','n','P','r','o','c','S','e','r','v','e','r','3','2',0}
 
static const WCHAR tmodel_keyname [] = {'T','h','r','e','a','d','i','n','g','M','o','d','e','l',0}
 
static const WCHAR tmodel_both [] = {'B','o','t','h',0}
 
static const IClassFactoryVtbl DSCF_Vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 26 of file dllfunc.c.

◆ NONAMELESSSTRUCT

#define NONAMELESSSTRUCT

Definition at line 27 of file dllfunc.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 28 of file dllfunc.c.

Function Documentation

◆ AMovieDllRegisterServer2()

HRESULT WINAPI AMovieDllRegisterServer2 ( BOOL  bRegister)

Definition at line 155 of file dllfunc.c.

156 {
157  HRESULT hr;
158  int i;
159  IFilterMapper2 *pIFM2 = NULL;
160  WCHAR szFileName[MAX_PATH];
161 
162  if (!GetModuleFileNameW(g_hInst, szFileName, MAX_PATH))
163  {
164  ERR("Failed to get module file name for registration\n");
165  return E_FAIL;
166  }
167 
168  if (bRegister)
170 
172 
173  TRACE("Getting IFilterMapper2\r\n");
174  hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
175  &IID_IFilterMapper2, (void **)&pIFM2);
176 
177  for (i = 0; SUCCEEDED(hr) && i < g_cTemplates; i++)
178  hr = AMovieSetupRegisterFilter2(g_Templates[i].m_pAMovieSetup_Filter, pIFM2, bRegister);
179 
180  /* release interface */
181  if (pIFM2)
182  IFilterMapper2_Release(pIFM2);
183 
184  /* and clear up */
186  CoUninitialize();
187 
188  /* if unregistering, unregister all OLE servers */
189  if (SUCCEEDED(hr) && !bRegister)
191 
192  return hr;
193 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:609
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define E_FAIL
Definition: ddrawi.h:102
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
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibraries(void)
Definition: compobj.c:3701
const int g_cTemplates
static HRESULT SetupRegisterAllClasses(const FactoryTemplate *pList, int num, LPCWSTR szFileName, BOOL bRegister)
Definition: dllfunc.c:106
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
static HINSTANCE g_hInst
Definition: dllfunc.c:48
HRESULT WINAPI AMovieSetupRegisterFilter2(const AMOVIESETUP_FILTER *pFilter, IFilterMapper2 *pIFM2, BOOL bRegister)
Definition: dllfunc.c:134
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define ERR(fmt,...)
Definition: debug.h:109
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
const FactoryTemplate g_Templates[]
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ AMovieSetupRegisterFilter2()

HRESULT WINAPI AMovieSetupRegisterFilter2 ( const AMOVIESETUP_FILTER pFilter,
IFilterMapper2 pIFM2,
BOOL  bRegister 
)

Definition at line 134 of file dllfunc.c.

135 {
136  if (!pFilter)
137  return S_OK;
138 
139  if (bRegister)
140  {
141  {
142  REGFILTER2 rf2;
143  rf2.dwVersion = 1;
144  rf2.dwMerit = pFilter->merit;
145  rf2.u.s1.cPins = pFilter->pins;
146  rf2.u.s1.rgPins = pFilter->pPin;
147 
148  return IFilterMapper2_RegisterFilter(pIFM2, pFilter->clsid, pFilter->name, NULL, &CLSID_LegacyAmFilterCategory, NULL, &rf2);
149  }
150  }
151  else
152  return IFilterMapper2_UnregisterFilter(pIFM2, &CLSID_LegacyAmFilterCategory, NULL, pFilter->clsid);
153 }
const WCHAR * name
Definition: strmbase.h:324
const AMOVIESETUP_PIN * pPin
Definition: strmbase.h:327
DWORD dwMerit
Definition: axextend.idl:232
smooth NULL
Definition: ftsmooth.c:416
const REGFILTERPINS * rgPins
Definition: axextend.idl:239
ULONG cPins
Definition: axextend.idl:238
#define S_OK
Definition: intsafe.h:59
DWORD dwVersion
Definition: axextend.idl:231
const CLSID * clsid
Definition: strmbase.h:323

Referenced by AMovieDllRegisterServer2().

◆ DSCF_AddRef()

static ULONG WINAPI DSCF_AddRef ( IClassFactory iface)
static

Definition at line 262 of file dllfunc.c.

263 {
265  return InterlockedIncrement(&This->ref);
266 }
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: dllfunc.c:242
#define InterlockedIncrement
Definition: armddk.h:53

◆ DSCF_CreateInstance()

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

Definition at line 279 of file dllfunc.c.

281 {
284  LPUNKNOWN punk;
285 
286  TRACE("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj);
287 
288  if (!ppobj)
289  return E_POINTER;
290 
291  /* Enforce the normal OLE rules regarding interfaces and delegation */
292  if (pOuter && !IsEqualGUID(riid, &IID_IUnknown))
293  return E_NOINTERFACE;
294 
295  *ppobj = NULL;
296  punk = This->pfnCreateInstance(pOuter, &hres);
297  if (!punk)
298  {
299  /* No object created, update error if it isn't done already and return */
300  if (SUCCEEDED(hres))
302  return hres;
303  }
304 
305  if (SUCCEEDED(hres))
306  {
307  hres = IUnknown_QueryInterface(punk, riid, ppobj);
308  }
309  /* Releasing the object. If everything was successful, QueryInterface
310  should have incremented the refcount once more, otherwise this will
311  purge the object. */
312  IUnknown_Release(punk);
313  return hres;
314 }
#define E_NOINTERFACE
Definition: winerror.h:2364
#define ERROR_SUCCESS
Definition: deptool.c:10
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: dllfunc.c:242
REFIID riid
Definition: precomp.h:44
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static LPUNKNOWN
Definition: ndr_ole.c:49
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define E_POINTER
Definition: winerror.h:2365
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ DSCF_LockServer()

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

Definition at line 316 of file dllfunc.c.

317 {
319  TRACE("(%p)->(%d)\n",This, dolock);
320 
321  if (dolock)
323  else
325  return S_OK;
326 }
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: dllfunc.c:242
#define TRACE(s)
Definition: solgame.cpp:4
static LONG server_locks
Definition: dllfunc.c:49
#define InterlockedDecrement
Definition: armddk.h:52
#define S_OK
Definition: intsafe.h:59
#define InterlockedIncrement
Definition: armddk.h:53

◆ DSCF_QueryInterface()

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

Definition at line 247 of file dllfunc.c.

248 {
249  if (IsEqualGUID(riid, &IID_IUnknown) ||
251  {
252  IClassFactory_AddRef(iface);
253  *ppobj = iface;
254  return S_OK;
255  }
256 
257  *ppobj = NULL;
258  WARN("(%p)->(%s,%p), not found\n", iface, debugstr_guid(riid), ppobj);
259  return E_NOINTERFACE;
260 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
const GUID IID_IClassFactory

◆ DSCF_Release()

static ULONG WINAPI DSCF_Release ( IClassFactory iface)
static

Definition at line 268 of file dllfunc.c.

269 {
272 
273  if (ref == 0)
275 
276  return ref;
277 }
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: dllfunc.c:242
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define GetProcessHeap()
Definition: compat.h:403
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ impl_from_IClassFactory()

static IClassFactoryImpl* impl_from_IClassFactory ( IClassFactory iface)
inlinestatic

Definition at line 242 of file dllfunc.c.

243 {
244  return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
245 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by DSCF_AddRef(), DSCF_CreateInstance(), DSCF_LockServer(), and DSCF_Release().

◆ SetupInitializeServers()

static void SetupInitializeServers ( const FactoryTemplate pList,
int  num,
BOOL  bLoading 
)
static

Definition at line 205 of file dllfunc.c.

207 {
208  int i;
209 
210  for (i = 0; i < num; i++, pList++)
211  {
212  if (pList->m_lpfnInit)
213  pList->m_lpfnInit(bLoading, pList->m_ClsID);
214  }
215 }
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
GLuint GLuint num
Definition: glext.h:9618
LPFNInitRoutine m_lpfnInit
Definition: strmbase.h:337
const CLSID * m_ClsID
Definition: strmbase.h:335

Referenced by STRMBASE_DllMain().

◆ SetupRegisterAllClasses()

static HRESULT SetupRegisterAllClasses ( const FactoryTemplate pList,
int  num,
LPCWSTR  szFileName,
BOOL  bRegister 
)
static

Definition at line 106 of file dllfunc.c.

108 {
109  HRESULT hr = NOERROR;
110  HKEY hkey;
113  if (ERROR_SUCCESS != ret)
114  return HRESULT_FROM_WIN32(ret);
115 
116  for (i = 0; i < num; i++, pList++)
117  {
118  /* (un)register CLSID and InprocServer32 */
120  if (SUCCEEDED(hr))
121  {
122  if (bRegister )
123  hr = SetupRegisterClass(hkey, szCLSID,
124  pList->m_Name, szFileName,
126  else
127  hr = RegDeleteTreeW(hkey, szCLSID);
128  }
129  }
130  RegCloseKey(hkey);
131  return hr;
132 }
WCHAR OLECHAR
Definition: compat.h:1941
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * m_Name
Definition: strmbase.h:334
#define NOERROR
Definition: winerror.h:2354
#define CHARS_IN_GUID
static const WCHAR szCLSID[]
Definition: msipriv.h:1160
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
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
static const WCHAR tmodel_both[]
Definition: dllfunc.c:58
static const WCHAR ips32_keyname[]
Definition: dllfunc.c:56
static const WCHAR clsid_keyname[]
Definition: dllfunc.c:55
LONG HRESULT
Definition: typedefs.h:77
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
GLuint GLuint num
Definition: glext.h:9618
int ret
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
LSTATUS WINAPI RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1746
const CLSID * m_ClsID
Definition: strmbase.h:335
static HRESULT SetupRegisterClass(HKEY clsid, LPCWSTR szCLSID, LPCWSTR szDescription, LPCWSTR szFileName, LPCWSTR szServerType, LPCWSTR szThreadingModel)
Definition: dllfunc.c:63
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by AMovieDllRegisterServer2().

◆ SetupRegisterClass()

static HRESULT SetupRegisterClass ( HKEY  clsid,
LPCWSTR  szCLSID,
LPCWSTR  szDescription,
LPCWSTR  szFileName,
LPCWSTR  szServerType,
LPCWSTR  szThreadingModel 
)
static

Definition at line 63 of file dllfunc.c.

68 {
69  HKEY hkey, hsubkey = NULL;
70  LONG ret = RegCreateKeyW(clsid, szCLSID, &hkey);
71  if (ERROR_SUCCESS != ret)
72  return HRESULT_FROM_WIN32(ret);
73 
74  /* set description string */
76  sizeof(WCHAR) * (lstrlenW(szDescription) + 1));
77  if (ERROR_SUCCESS != ret)
78  goto err_out;
79 
80  /* create CLSID\\{"CLSID"}\\"ServerType" key, using key to CLSID\\{"CLSID"}
81  passed back by last call to RegCreateKeyW(). */
82  ret = RegCreateKeyW(hkey, szServerType, &hsubkey);
83  if (ERROR_SUCCESS != ret)
84  goto err_out;
85 
86  /* set server path */
87  ret = RegSetValueW(hsubkey, NULL, REG_SZ, szFileName,
88  sizeof(WCHAR) * (lstrlenW(szFileName) + 1));
89  if (ERROR_SUCCESS != ret)
90  goto err_out;
91 
92  /* set threading model */
94  (const BYTE*)szThreadingModel,
95  sizeof(WCHAR) * (lstrlenW(szThreadingModel) + 1));
96 err_out:
97  if (hsubkey)
98  RegCloseKey(hsubkey);
99  RegCloseKey(hkey);
100  return HRESULT_FROM_WIN32(ret);
101 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR tmodel_keyname[]
Definition: dllfunc.c:57
LONG WINAPI RegSetValueW(HKEY hKeyOriginal, LPCWSTR lpSubKey, DWORD dwType, LPCWSTR lpData, DWORD cbData)
Definition: reg.c:5014
static const WCHAR szCLSID[]
Definition: msipriv.h:1160
#define lstrlenW
Definition: compat.h:415
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
REFCLSID clsid
Definition: msctf.c:82
static const WCHAR L[]
Definition: oid.c:1250
unsigned char BYTE
Definition: mem.h:68
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
static const WCHAR szDescription[]
Definition: provider.c:55
#define REG_SZ
Definition: layer.c:22

Referenced by SetupRegisterAllClasses().

◆ STRMBASE_DllCanUnloadNow()

HRESULT WINAPI STRMBASE_DllCanUnloadNow ( void  )

Definition at line 393 of file dllfunc.c.

394 {
395  TRACE("\n");
396 
397  if (server_locks == 0)
398  return S_OK;
399  return S_FALSE;
400 }
#define S_FALSE
Definition: winerror.h:2357
#define TRACE(s)
Definition: solgame.cpp:4
static LONG server_locks
Definition: dllfunc.c:49
#define S_OK
Definition: intsafe.h:59

◆ STRMBASE_DllGetClassObject()

HRESULT WINAPI STRMBASE_DllGetClassObject ( REFCLSID  rclsid,
REFIID  riid,
LPVOID ppv 
)

Definition at line 340 of file dllfunc.c.

341 {
342  const FactoryTemplate *pList = g_Templates;
344  int i;
345 
346  TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
347 
348  if (!ppv)
349  return E_POINTER;
350 
351  *ppv = NULL;
352 
355  return E_NOINTERFACE;
356 
357  for (i = 0; i < g_cTemplates; i++, pList++)
358  {
359  if (IsEqualGUID(pList->m_ClsID, rclsid))
360  break;
361  }
362 
363  if (i == g_cTemplates)
364  {
365  char dllname[MAX_PATH];
366  if (!GetModuleFileNameA(g_hInst, dllname, sizeof(dllname)))
367  strcpy(dllname, "???");
368  ERR("%s: no class found in %s.\n", debugstr_guid(rclsid), dllname);
370  }
371  else if (!pList->m_lpfnNew)
372  {
373  FIXME("%s: class not implemented yet.\n", debugstr_guid(rclsid));
375  }
376 
378  if (!factory)
379  return E_OUTOFMEMORY;
380 
382  factory->ref = 1;
383 
384  factory->pfnCreateInstance = pList->m_lpfnNew;
385 
387  return S_OK;
388 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:548
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
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
const int g_cTemplates
Definition: main.c:438
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
const GUID IID_IUnknown
static const IClassFactoryVtbl DSCF_Vtbl
Definition: dllfunc.c:328
#define MAX_PATH
Definition: compat.h:26
static HINSTANCE g_hInst
Definition: dllfunc.c:48
#define ERR(fmt,...)
Definition: debug.h:109
const CLSID * m_ClsID
Definition: strmbase.h:335
LPFNNewCOMObject m_lpfnNew
Definition: strmbase.h:336
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
const FactoryTemplate g_Templates[]
static ClassFactoryImpl factory
Definition: ole_server.c:234
#define E_POINTER
Definition: winerror.h:2365
const GUID IID_IClassFactory
IClassFactory IClassFactory_iface
Definition: main.c:440

◆ STRMBASE_DllMain()

BOOL WINAPI STRMBASE_DllMain ( HINSTANCE  hInstDLL,
DWORD  fdwReason,
LPVOID  lpv 
)

Definition at line 217 of file dllfunc.c.

218 {
219  switch (fdwReason)
220  {
221  case DLL_PROCESS_ATTACH:
222  g_hInst = hInstDLL;
223  DisableThreadLibraryCalls(hInstDLL);
225  break;
226  case DLL_PROCESS_DETACH:
228  break;
229  }
230  return TRUE;
231 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
const int g_cTemplates
#define DLL_PROCESS_DETACH
Definition: compat.h:119
static HINSTANCE g_hInst
Definition: dllfunc.c:48
const FactoryTemplate g_Templates[]
static void SetupInitializeServers(const FactoryTemplate *pList, int num, BOOL bLoading)
Definition: dllfunc.c:205

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( strmbase  )

Variable Documentation

◆ clsid_keyname

const WCHAR clsid_keyname[] = {'C','L','S','I','D',0 }
static

Definition at line 55 of file dllfunc.c.

Referenced by SetupRegisterAllClasses().

◆ DSCF_Vtbl

const IClassFactoryVtbl DSCF_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI DSCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
Definition: dllfunc.c:279
static ULONG WINAPI DSCF_Release(IClassFactory *iface)
Definition: dllfunc.c:268
static ULONG WINAPI DSCF_AddRef(IClassFactory *iface)
Definition: dllfunc.c:262
static HRESULT WINAPI DSCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj)
Definition: dllfunc.c:247
static HRESULT WINAPI DSCF_LockServer(IClassFactory *iface, BOOL dolock)
Definition: dllfunc.c:316

Definition at line 328 of file dllfunc.c.

Referenced by STRMBASE_DllGetClassObject().

◆ g_cTemplates

◆ g_hInst

HINSTANCE g_hInst = NULL
static

◆ g_Templates

◆ ips32_keyname

const WCHAR ips32_keyname[] = {'I','n','P','r','o','c','S','e','r','v','e','r','3','2',0}
static

Definition at line 56 of file dllfunc.c.

Referenced by SetupRegisterAllClasses().

◆ server_locks

LONG server_locks = 0
static

Definition at line 49 of file dllfunc.c.

Referenced by DSCF_LockServer(), and STRMBASE_DllCanUnloadNow().

◆ tmodel_both

const WCHAR tmodel_both[] = {'B','o','t','h',0}
static

Definition at line 58 of file dllfunc.c.

Referenced by SetupRegisterAllClasses().

◆ tmodel_keyname

const WCHAR tmodel_keyname[] = {'T','h','r','e','a','d','i','n','g','M','o','d','e','l',0}
static

Definition at line 57 of file dllfunc.c.

Referenced by SetupRegisterClass().