ReactOS  0.4.13-dev-464-g6b95727
dpclassfactory.c
Go to the documentation of this file.
1 /* COM class factory for direct play lobby interfaces.
2  *
3  * Copyright 1999, 2000 Peter Hunnisett
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 <stdarg.h>
21 #include <string.h>
22 
23 #define COBJMACROS
24 
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "objbase.h"
29 #include "winerror.h"
30 #include "wine/debug.h"
31 #include "dplay.h"
32 #include "dplobby.h"
33 #include "initguid.h"
34 #include "dplay_global.h"
35 
37 
38 
39 typedef struct
40 {
41  IClassFactory IClassFactory_iface;
42  HRESULT (*createinstance)(REFIID riid, void **ppv);
44 
46 {
47  return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
48 }
49 
51  void **ppv)
52 {
53  TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
54 
56  {
57  *ppv = iface;
58  IClassFactory_AddRef(iface);
59  return S_OK;
60  }
61 
62  *ppv = NULL;
63  WARN("no interface for %s\n", debugstr_guid(riid));
64  return E_NOINTERFACE;
65 }
66 
68 {
69  return 2; /* non-heap based object */
70 }
71 
73 {
74  return 1; /* non-heap based object */
75 }
76 
78  REFIID riid, void **ppv)
79 {
81 
82  TRACE("(%p)->(%p,%s,%p)\n", iface, pOuter, debugstr_guid(riid), ppv);
83 
84  if (pOuter)
85  return CLASS_E_NOAGGREGATION;
86 
87  return This->createinstance(riid, ppv);
88 }
89 
91 {
92  FIXME("(%p)->(%d),stub!\n", iface, dolock);
93  return S_OK;
94 }
95 
96 static const IClassFactoryVtbl cf_vt = {
102 };
103 
106 
107 
108 /*******************************************************************************
109  * DllGetClassObject [DPLAYX.@]
110  * Retrieves DP or DPL class object from a DLL object
111  *
112  * NOTES
113  * Docs say returns STDAPI
114  *
115  * PARAMS
116  * rclsid [I] CLSID for the class object
117  * riid [I] Reference to identifier of interface for class object
118  * ppv [O] Address of variable to receive interface pointer for riid
119  *
120  * RETURNS
121  * Success: S_OK
122  * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
123  * E_UNEXPECTED
124  */
126 {
127  TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
128 
129  if (IsEqualCLSID(&CLSID_DirectPlay, rclsid))
130  return IClassFactory_QueryInterface(&dplay_cf.IClassFactory_iface, riid, ppv);
131 
132  if (IsEqualCLSID(&CLSID_DirectPlayLobby, rclsid))
133  return IClassFactory_QueryInterface(&dplaylobby_cf.IClassFactory_iface, riid, ppv);
134 
135  FIXME("(%s,%s,%p): no class found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
137 }
HRESULT dplay_create(REFIID riid, void **ppv)
Definition: dplay.c:5680
#define HRESULT
Definition: msvc.h:9
#define REFIID
Definition: guiddef.h:113
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define REFCLSID
Definition: guiddef.h:112
#define WARN(fmt,...)
Definition: debug.h:111
REFIID LPVOID * ppv
Definition: atlbase.h:39
static IClassFactoryImpl dplay_cf
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
static HRESULT WINAPI IClassFactoryImpl_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
struct tagIClassFactoryImpl IClassFactoryImpl
static IClassFactoryImpl dplaylobby_cf
static HRESULT WINAPI IClassFactoryImpl_LockServer(IClassFactory *iface, BOOL dolock)
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
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
static HRESULT WINAPI IClassFactoryImpl_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
const GUID IID_IUnknown
static ULONG WINAPI IClassFactoryImpl_Release(IClassFactory *iface)
#define WINAPI
Definition: msvc.h:8
HRESULT dplobby_create(REFIID riid, void **ppv) DECLSPEC_HIDDEN
Definition: dplobby.c:2026
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
static const IClassFactoryVtbl cf_vt
#define S_OK
Definition: intsafe.h:59
static ULONG WINAPI IClassFactoryImpl_AddRef(IClassFactory *iface)
IClassFactory IClassFactory_iface
Definition: main.c:58
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
unsigned int ULONG
Definition: retypes.h:1
const GUID IID_IClassFactory
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:91
WINE_DEFAULT_DEBUG_CHANNEL(dplay)