ReactOS 0.4.15-dev-7907-g95bf896
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 IDirectXFileImpl_Create(IUnknown *pUnkOuter, LPVOID *ppObj)
Definition: d3dxof.c:50
#define NULL
Definition: types.h:112
#define DXFILEERR_BADALLOC
Definition: dxfile.h:274
#define DXFILEERR_BADVALUE
Definition: dxfile.h:271
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4

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
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 ARRAY_SIZE(A)
Definition: main.h:33
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const struct object_creation_info object_creation[]
Definition: main.c:74
static const IClassFactoryVtbl XFCF_Vtbl
Definition: main.c:141
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
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
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
REFCLSID clsid
Definition: msctf.c:82
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
Definition: main.c:439
IClassFactory IClassFactory_iface
Definition: main.c:440
#define E_NOINTERFACE
Definition: winerror.h:2364
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663

◆ DllMain()

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

Definition at line 46 of file main.c.

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

◆ DllRegisterServer()

HRESULT WINAPI DllRegisterServer ( void  )

Definition at line 233 of file main.c.

234{
236}
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}
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}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

◆ 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:63

◆ 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{
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}
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HRESULT hres
Definition: protocol.c:465
static LPUNKNOWN
Definition: ndr_ole.c:49

◆ 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}

◆ 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 WARN(fmt,...)
Definition: debug.h:112

◆ 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}
#define InterlockedDecrement
Definition: armddk.h:52
#define HeapFree(x, y, z)
Definition: compat.h:735
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

Variable Documentation

◆ instance

HINSTANCE instance
static

Definition at line 43 of file main.c.

◆ object_creation

const struct object_creation_info object_creation[]
static
Initial value:
=
{
{ &CLSID_CDirectXFile, IDirectXFileImpl_Create },
}

Definition at line 78 of file main.c.

◆ XFCF_Vtbl

const IClassFactoryVtbl XFCF_Vtbl
static
Initial value:
=
{
}
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 ULONG WINAPI XFCF_AddRef(LPCLASSFACTORY iface)
Definition: main.c:99
static HRESULT WINAPI XFCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
Definition: main.c:117
static HRESULT WINAPI XFCF_QueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppobj)
Definition: main.c:83

Definition at line 141 of file main.c.

Referenced by DllGetClassObject().