ReactOS  0.4.14-dev-98-gb0d4763
main.c File Reference
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winreg.h"
#include "winerror.h"
#include "ole2.h"
#include "rpcproxy.h"
#include "uuids.h"
#include "d3dxof_private.h"
#include "dxfile.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 (d3dxof)
 
BOOL WINAPI DllMain (HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
 
static IClassFactoryImplimpl_from_IClassFactory (IClassFactory *iface)
 
static HRESULT WINAPI XFCF_QueryInterface (LPCLASSFACTORY iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI XFCF_AddRef (LPCLASSFACTORY iface)
 
static ULONG WINAPI XFCF_Release (LPCLASSFACTORY iface)
 
static HRESULT WINAPI XFCF_CreateInstance (LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
 
static HRESULT WINAPI XFCF_LockServer (LPCLASSFACTORY iface, BOOL dolock)
 
HRESULT WINAPI DirectXFileCreate (LPDIRECTXFILE *lplpDirectXFile)
 
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 XFCF_Vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file main.c.

Function Documentation

◆ DirectXFileCreate()

HRESULT WINAPI DirectXFileCreate ( LPDIRECTXFILE lplpDirectXFile)

Definition at line 153 of file main.c.

154 {
155  HRESULT hr;
156 
157  TRACE("(%p)\n", lplpDirectXFile);
158 
159  if (!lplpDirectXFile)
160  return DXFILEERR_BADVALUE;
161 
162  hr = IDirectXFileImpl_Create(NULL, (LPVOID)lplpDirectXFile);
163 
164  if (FAILED(hr))
165  return DXFILEERR_BADALLOC;
166 
167  return S_OK;
168 }
HRESULT hr
Definition: shlfolder.c:183
#define DXFILEERR_BADVALUE
Definition: dxfile.h:271
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
#define DXFILEERR_BADALLOC
Definition: dxfile.h:274
HRESULT IDirectXFileImpl_Create(IUnknown *pUnkOuter, LPVOID *ppObj)
Definition: d3dxof.c:51

Referenced by d3drm3_Load(), d3drm_mesh_builder3_Load(), and D3DXFileCreate().

◆ DllCanUnloadNow()

HRESULT WINAPI DllCanUnloadNow ( void  )

Definition at line 225 of file main.c.

226 {
227  return S_FALSE;
228 }
#define S_FALSE
Definition: winerror.h:2357

◆ DllGetClassObject()

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

Definition at line 187 of file main.c.

188 {
189  unsigned int i;
191 
192  TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
193 
195  && ! IsEqualGUID( &IID_IUnknown, riid) )
196  return E_NOINTERFACE;
197 
198  for (i = 0; i < ARRAY_SIZE(object_creation); i++)
199  {
200  if (IsEqualGUID(object_creation[i].clsid, rclsid))
201  break;
202  }
203 
204  if (i == ARRAY_SIZE(object_creation))
205  {
206  FIXME("%s: no class found.\n", debugstr_guid(rclsid));
208  }
209 
210  factory = HeapAlloc(GetProcessHeap(), 0, sizeof(*factory));
211  if (factory == NULL) return E_OUTOFMEMORY;
212 
214  factory->ref = 1;
215 
216  factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
217 
219  return S_OK;
220 }
#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
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
static const IClassFactoryVtbl XFCF_Vtbl
Definition: main.c:141
#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
static const struct object_creation_info object_creation[]
Definition: main.c:78
#define ARRAY_SIZE(a)
Definition: main.h:24
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
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 46 of file main.c.

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

◆ DllRegisterServer()

HRESULT WINAPI DllRegisterServer ( void  )

Definition at line 233 of file main.c.

234 {
236 }
static HINSTANCE instance
Definition: main.c:43
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98

◆ DllUnregisterServer()

HRESULT WINAPI DllUnregisterServer ( void  )

Definition at line 241 of file main.c.

242 {
244 }
static HINSTANCE instance
Definition: main.c:43
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110

◆ impl_from_IClassFactory()

static IClassFactoryImpl* impl_from_IClassFactory ( IClassFactory iface)
inlinestatic

Definition at line 67 of file main.c.

68 {
69  return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
70 }
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 XFCF_AddRef(), XFCF_CreateInstance(), XFCF_LockServer(), XFCF_QueryInterface(), and XFCF_Release().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3dxof  )

◆ XFCF_AddRef()

static ULONG WINAPI XFCF_AddRef ( LPCLASSFACTORY  iface)
static

Definition at line 99 of file main.c.

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

◆ XFCF_CreateInstance()

static HRESULT WINAPI XFCF_CreateInstance ( LPCLASSFACTORY  iface,
LPUNKNOWN  pOuter,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 117 of file main.c.

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

◆ XFCF_LockServer()

static HRESULT WINAPI XFCF_LockServer ( LPCLASSFACTORY  iface,
BOOL  dolock 
)
static

Definition at line 134 of file main.c.

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

◆ XFCF_QueryInterface()

static HRESULT WINAPI XFCF_QueryInterface ( LPCLASSFACTORY  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 83 of file main.c.

84 {
86 
89  {
90  IClassFactory_AddRef(iface);
91  *ppobj = &This->IClassFactory_iface;
92  return S_OK;
93  }
94 
95  WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
96  return E_NOINTERFACE;
97 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
#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
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: main.c:67
const GUID IID_IClassFactory

◆ XFCF_Release()

static ULONG WINAPI XFCF_Release ( LPCLASSFACTORY  iface)
static

Definition at line 105 of file main.c.

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

Variable Documentation

◆ instance

HINSTANCE instance
static

Definition at line 43 of file main.c.

Referenced by DllMain(), DllRegisterServer(), and DllUnregisterServer().

◆ object_creation

const struct object_creation_info object_creation[]
static
Initial value:
=
{
{ &CLSID_CDirectXFile, IDirectXFileImpl_Create },
}
HRESULT IDirectXFileImpl_Create(IUnknown *pUnkOuter, LPVOID *ppObj)
Definition: d3dxof.c:51

Definition at line 78 of file main.c.

Referenced by DllGetClassObject().

◆ XFCF_Vtbl

const IClassFactoryVtbl XFCF_Vtbl
static
Initial value:
=
{
}
static ULONG WINAPI XFCF_AddRef(LPCLASSFACTORY iface)
Definition: main.c:99
static ULONG WINAPI XFCF_Release(LPCLASSFACTORY iface)
Definition: main.c:105
static HRESULT WINAPI XFCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
Definition: main.c:134
static HRESULT WINAPI XFCF_QueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppobj)
Definition: main.c:83
static HRESULT WINAPI XFCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
Definition: main.c:117

Definition at line 141 of file main.c.

Referenced by DllGetClassObject().