ReactOS  0.4.13-dev-982-g9853eab
main.c File Reference
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winerror.h"
#include "ole2.h"
#include "rpcproxy.h"
#include "amstream_private.h"
#include "wine/debug.h"
Include dependency graph for main.c:

Go to the source code of this file.

Classes

struct  IClassFactoryImpl
 
struct  object_creation_info
 

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (amstream)
 
BOOL WINAPI DllMain (HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
 
static IClassFactoryImplimpl_from_IClassFactory (IClassFactory *iface)
 
static HRESULT WINAPI AMCF_QueryInterface (IClassFactory *iface, REFIID riid, void **ppobj)
 
static ULONG WINAPI AMCF_AddRef (IClassFactory *iface)
 
static ULONG WINAPI AMCF_Release (IClassFactory *iface)
 
static HRESULT WINAPI AMCF_CreateInstance (IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
 
static HRESULT WINAPI AMCF_LockServer (IClassFactory *iface, BOOL dolock)
 
HRESULT WINAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 
HRESULT WINAPI DllCanUnloadNow (void)
 
HRESULT WINAPI DllRegisterServer (void)
 
HRESULT WINAPI DllUnregisterServer (void)
 

Variables

static HINSTANCE instance
 
static const struct object_creation_info object_creation []
 
static const IClassFactoryVtbl DSCF_Vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file main.c.

Function Documentation

◆ AMCF_AddRef()

static ULONG WINAPI AMCF_AddRef ( IClassFactory iface)
static

Definition at line 97 of file main.c.

98 {
100  return InterlockedIncrement(&This->ref);
101 }
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: main.c:63
#define InterlockedIncrement
Definition: armddk.h:53

◆ AMCF_CreateInstance()

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

Definition at line 115 of file main.c.

117 {
119  HRESULT hres;
120  IUnknown *punk;
121 
122  TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
123 
124  *ppobj = NULL;
125  hres = This->pfnCreateInstance(pOuter, (LPVOID *) &punk);
126  if (SUCCEEDED(hres)) {
127  hres = IUnknown_QueryInterface(punk, riid, ppobj);
128  IUnknown_Release(punk);
129  }
130  return hres;
131 }
REFIID riid
Definition: precomp.h:44
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
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: main.c:63
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ AMCF_LockServer()

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

Definition at line 133 of file main.c.

134 {
136  FIXME("(%p)->(%d),stub!\n",This,dolock);
137  return S_OK;
138 }
#define FIXME(fmt,...)
Definition: debug.h:110
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: main.c:63
#define S_OK
Definition: intsafe.h:59

◆ AMCF_QueryInterface()

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

Definition at line 82 of file main.c.

83 {
86  {
87  IClassFactory_AddRef(iface);
88  *ppobj = iface;
89  return S_OK;
90  }
91 
92  *ppobj = NULL;
93  WARN("(%p)->(%s,%p), not found\n", iface, debugstr_guid(riid), ppobj);
94  return E_NOINTERFACE;
95 }
#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:4021
const GUID IID_IClassFactory

◆ AMCF_Release()

static ULONG WINAPI AMCF_Release ( IClassFactory iface)
static

Definition at line 103 of file main.c.

104 {
107 
108  if (ref == 0)
110 
111  return ref;
112 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define GetProcessHeap()
Definition: compat.h:395
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: main.c:63
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ DllCanUnloadNow()

HRESULT WINAPI DllCanUnloadNow ( void  )

Definition at line 204 of file main.c.

205 {
206  return S_FALSE;
207 }
#define S_FALSE
Definition: winerror.h:2357

◆ DllGetClassObject()

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

Definition at line 166 of file main.c.

167 {
168  unsigned int i;
170 
171  TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
172 
174  && ! IsEqualGUID( &IID_IUnknown, riid) )
175  return E_NOINTERFACE;
176 
177  for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
178  {
179  if (IsEqualGUID(object_creation[i].clsid, rclsid))
180  break;
181  }
182 
183  if (i == sizeof(object_creation)/sizeof(object_creation[0]))
184  {
185  FIXME("%s: no class found.\n", debugstr_guid(rclsid));
187  }
188 
189  factory = HeapAlloc(GetProcessHeap(), 0, sizeof(*factory));
190  if (factory == NULL) return E_OUTOFMEMORY;
191 
193  factory->ref = 1;
194 
195  factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
196 
198  return S_OK;
199 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static const IClassFactoryVtbl DSCF_Vtbl
Definition: main.c:140
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
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
Definition: main.c:440
#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:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
const GUID IID_IUnknown
REFCLSID clsid
Definition: msctf.c:84
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
static const struct object_creation_info object_creation[]
Definition: main.c:74
static ClassFactoryImpl factory
Definition: ole_server.c:234
const GUID IID_IClassFactory
IClassFactory IClassFactory_iface
Definition: main.c:442

◆ DllMain()

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

Definition at line 43 of file main.c.

44 {
45  switch(fdwReason) {
46  case DLL_PROCESS_ATTACH:
47  instance = hInstDLL;
48  DisableThreadLibraryCalls(hInstDLL);
49  break;
50  }
51  return TRUE;
52 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
static HINSTANCE instance
Definition: main.c:40

◆ DllRegisterServer()

HRESULT WINAPI DllRegisterServer ( void  )

Definition at line 212 of file main.c.

213 {
215 }
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98
static HINSTANCE instance
Definition: main.c:40

◆ DllUnregisterServer()

HRESULT WINAPI DllUnregisterServer ( void  )

Definition at line 220 of file main.c.

221 {
223 }
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110
static HINSTANCE instance
Definition: main.c:40

◆ impl_from_IClassFactory()

static IClassFactoryImpl* impl_from_IClassFactory ( IClassFactory iface)
inlinestatic

Definition at line 63 of file main.c.

64 {
65  return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
66 }
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 AMCF_AddRef(), AMCF_CreateInstance(), AMCF_LockServer(), and AMCF_Release().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( amstream  )

Variable Documentation

◆ DSCF_Vtbl

const IClassFactoryVtbl DSCF_Vtbl
static
Initial value:
=
{
}
static ULONG WINAPI AMCF_AddRef(IClassFactory *iface)
Definition: main.c:97
static HRESULT WINAPI AMCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj)
Definition: main.c:82
static HRESULT WINAPI AMCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
Definition: main.c:115
static ULONG WINAPI AMCF_Release(IClassFactory *iface)
Definition: main.c:103
static HRESULT WINAPI AMCF_LockServer(IClassFactory *iface, BOOL dolock)
Definition: main.c:133

Definition at line 140 of file main.c.

Referenced by DllGetClassObject().

◆ instance

HINSTANCE instance
static

Definition at line 40 of file main.c.

Referenced by _dump_EnumObjects_flags(), dde_execute(), dde_request(), disassociate2_cb(), disassociate3_cb(), disassociate_cb(), DllMain(), DllRegisterServer(), DllUnregisterServer(), dummy_callback(), enum_devices_callback(), fake_dll_main(), get_dom_element(), getItemAndInstanceFromTable(), getItemAndIntegerInstanceFromOid(), ICONTITLE_Create(), IDirectPlay2AImpl_EnumGroupPlayers(), IDirectPlay2AImpl_EnumGroups(), IDirectPlay2AImpl_EnumPlayers(), IDirectPlay2Impl_EnumGroupPlayers(), IDirectPlay2Impl_EnumGroups(), IDirectPlay2Impl_EnumPlayers(), IDirectPlay3AImpl_EnumGroupPlayers(), IDirectPlay3AImpl_EnumGroups(), IDirectPlay3AImpl_EnumGroupsInGroup(), IDirectPlay3AImpl_EnumPlayers(), IDirectPlay3Impl_EnumGroupPlayers(), IDirectPlay3Impl_EnumGroups(), IDirectPlay3Impl_EnumGroupsInGroup(), IDirectPlay3Impl_EnumPlayers(), IDirectPlay4AImpl_EnumGroupPlayers(), IDirectPlay4AImpl_EnumGroups(), IDirectPlay4AImpl_EnumGroupsInGroup(), IDirectPlay4AImpl_EnumPlayers(), IDirectPlay4Impl_EnumGroupPlayers(), IDirectPlay4Impl_EnumGroups(), IDirectPlay4Impl_EnumGroupsInGroup(), IDirectPlay4Impl_EnumPlayers(), instance_semaphore_completion_cb(), ldap_cleanup(), ldap_startup(), load_string(), LoadStringA(), LoadStringW(), map_A_to_W(), map_W_to_A(), NPP_Destroy(), NPP_New(), NPP_SetWindow(), PdhMakeCounterPathW(), setOidWithItemAndInteger(), simple_group_cancel_cb(), SortTest::sort4(), START_TEST(), test_parser(), test_progman_dde(), test_progman_dde2(), test_request_groups(), and VSSAPI_CVssWriter_Initialize().

◆ object_creation

const struct object_creation_info object_creation[]
static
Initial value:
=
{
{ &CLSID_AMMultiMediaStream, AM_create },
{ &CLSID_AMDirectDrawStream, AM_create },
{ &CLSID_AMAudioData, AMAudioData_create },
{ &CLSID_MediaStreamFilter, MediaStreamFilter_create }
}
HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj)
Definition: amstream.c:54
HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN
HRESULT AMAudioData_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN
Definition: audiodata.c:222

Definition at line 74 of file main.c.

Referenced by DllGetClassObject().