ReactOS 0.4.15-dev-7942-gd23573b
main.c
Go to the documentation of this file.
1/* DirectShow Editing Services (qedit.dll)
2 *
3 * Copyright 2008 Google (Lei Zhang)
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20#include "qedit_private.h"
21#include "rpcproxy.h"
22#include "wine/debug.h"
23
25
27
28BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
29{
30 switch(fdwReason) {
32 instance = hInstDLL;
34 break;
35 }
36 return TRUE;
37}
38
39/******************************************************************************
40 * DirectShow ClassFactory
41 */
42typedef struct {
43 IClassFactory IClassFactory_iface;
44 LONG ref;
45 HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
47
49{
50 return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
51}
52
54{
55 const CLSID *clsid;
56 HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
57};
58
60{
61 { &CLSID_AMTimeline, AMTimeline_create },
62 { &CLSID_MediaDet, MediaDet_create },
63 { &CLSID_SampleGrabber, SampleGrabber_create },
64};
65
67{
70 {
71 IClassFactory_AddRef(iface);
72 *ppobj = iface;
73 return S_OK;
74 }
75
76 *ppobj = NULL;
77 WARN("(%p)->(%s,%p), not found\n", iface, debugstr_guid(riid), ppobj);
78 return E_NOINTERFACE;
79}
80
82{
84 return InterlockedIncrement(&This->ref);
85}
86
88{
91
92 if (ref == 0)
94
95 return ref;
96}
97
99 void **ppobj)
100{
103 LPUNKNOWN punk;
104
105 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
106
107 *ppobj = NULL;
108 if (pOuter && !IsEqualGUID(&IID_IUnknown, riid))
109 return E_INVALIDARG;
110
111 hres = This->pfnCreateInstance(pOuter, (LPVOID *) &punk);
112 if (SUCCEEDED(hres)) {
113 hres = IUnknown_QueryInterface(punk, riid, ppobj);
114 IUnknown_Release(punk);
115 }
116 return hres;
117}
118
120{
122 FIXME("(%p)->(%d),stub!\n",This,dolock);
123 return S_OK;
124}
125
126static const IClassFactoryVtbl DSCF_Vtbl =
127{
133};
134
135
136/***********************************************************************
137 * DllCanUnloadNow (QEDIT.@)
138 */
140{
141 return S_FALSE;
142}
143
144/*******************************************************************************
145 * DllGetClassObject [QEDIT.@]
146 * Retrieves class object from a DLL object
147 *
148 * PARAMS
149 * rclsid [I] CLSID for the class object
150 * riid [I] Reference to identifier of interface for class object
151 * ppv [O] Address of variable to receive interface pointer for riid
152 *
153 * RETURNS
154 * Success: S_OK
155 * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
156 * E_UNEXPECTED, E_NOINTERFACE
157 */
158
160{
161 unsigned int i;
163
164 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
165
167 && ! IsEqualGUID( &IID_IUnknown, riid) )
168 return E_NOINTERFACE;
169
170 for (i = 0; i < ARRAY_SIZE(object_creation); i++)
171 {
172 if (IsEqualGUID(object_creation[i].clsid, rclsid))
173 break;
174 }
175
177 {
178 FIXME("%s: no class found.\n", debugstr_guid(rclsid));
180 }
181
182 factory = CoTaskMemAlloc(sizeof(*factory));
183 if (factory == NULL) return E_OUTOFMEMORY;
184
186 factory->ref = 1;
187
188 factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
189
191 return S_OK;
192}
193
194/***********************************************************************
195 * DllRegisterServer (QEDIT.@)
196 */
198{
200}
201
202/***********************************************************************
203 * DllUnregisterServer (QEDIT.@)
204 */
206{
208}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ARRAY_SIZE(A)
Definition: main.h:33
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define FIXME(fmt,...)
Definition: debug.h:111
#define WARN(fmt,...)
Definition: debug.h:112
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
Definition: main.c:26
static const struct object_creation_info object_creation[]
Definition: main.c:74
HRESULT WINAPI DllRegisterServer(void)
Definition: main.c:212
static HINSTANCE instance
Definition: main.c:40
HRESULT WINAPI DllUnregisterServer(void)
Definition: main.c:220
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: main.c:166
static const IClassFactoryVtbl DSCF_Vtbl
Definition: main.c:140
HRESULT WINAPI DllCanUnloadNow(void)
Definition: main.c:204
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: main.c:63
static ULONG WINAPI DSCF_AddRef(IClassFactory *iface)
Definition: main.c:81
static ULONG WINAPI DSCF_Release(IClassFactory *iface)
Definition: main.c:87
static HRESULT WINAPI DSCF_LockServer(IClassFactory *iface, BOOL dolock)
Definition: main.c:119
static HRESULT WINAPI DSCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj)
Definition: main.c:66
static HRESULT WINAPI DSCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
Definition: main.c:98
HRESULT MediaDet_create(IUnknown *pUnkOuter, LPVOID *ppv)
Definition: mediadet.c:639
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
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 CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define debugstr_guid
Definition: kernel32.h:35
HRESULT hres
Definition: protocol.c:465
REFCLSID clsid
Definition: msctf.c:82
static LPUNKNOWN
Definition: ndr_ole.c:49
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
HRESULT AMTimeline_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN
Definition: timeline.c:424
HRESULT SampleGrabber_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98
#define TRACE(s)
Definition: solgame.cpp:4
Definition: main.c:439
IClassFactory IClassFactory_iface
Definition: main.c:440
const CLSID * clsid
Definition: main.c:70
HRESULT(* pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj)
Definition: main.c:71
Definition: send.c:48
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:2357
#define E_NOINTERFACE
Definition: winerror.h:2364
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663