source: trunk/src/DPlayX/dpclassfactory.cpp@ 4317

Last change on this file since 4317 was 4317, checked in by hugh, 25 years ago

Added ID tags

File size: 3.1 KB
Line 
1// $Id: dpclassfactory.cpp,v 1.2 2000-09-24 22:47:36 hugh Exp $
2#include <string.h>
3
4#include <odin.h>
5#define ICOM_CINTERFACE 1
6#define CINTERFACE
7
8#include "wine/obj_base.h"
9#include "winerror.h"
10#include "debugtools.h"
11#include "dpinit.h"
12
13DEFAULT_DEBUG_CHANNEL(dplay)
14
15#define debugstr_guid(a) a
16
17/*******************************************************************************
18 * DirectPlayLobby ClassFactory
19 */
20
21typedef struct
22{
23 /* IUnknown fields */
24 ICOM_VFIELD(IClassFactory);
25 DWORD ref;
26} IClassFactoryImpl;
27
28static HRESULT WINAPI
29DP_and_DPL_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
30 ICOM_THIS(IClassFactoryImpl,iface);
31
32 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
33
34 return E_NOINTERFACE;
35}
36
37static ULONG WINAPI
38DP_and_DPL_AddRef(LPCLASSFACTORY iface) {
39 ICOM_THIS(IClassFactoryImpl,iface);
40 return ++(This->ref);
41}
42
43static ULONG WINAPI DP_and_DPL_Release(LPCLASSFACTORY iface) {
44 ICOM_THIS(IClassFactoryImpl,iface);
45 /* static class (reference starts @ 1), won't ever be freed */
46 return --(This->ref);
47}
48
49static HRESULT WINAPI DP_and_DPL_CreateInstance(
50 LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
51) {
52 ICOM_THIS(IClassFactoryImpl,iface);
53
54 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
55
56 if ( DPL_CreateInterface( riid, ppobj ) == S_OK )
57 {
58 return S_OK;
59 }
60 else if ( DP_CreateInterface( riid, ppobj ) == S_OK )
61 {
62 return S_OK;
63 }
64
65 return E_NOINTERFACE;
66}
67
68static HRESULT WINAPI DP_and_DPL_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
69 ICOM_THIS(IClassFactoryImpl,iface);
70 FIXME("(%p)->(%d),stub!\n",This,dolock);
71 return S_OK;
72}
73
74static ICOM_VTABLE(IClassFactory) DP_and_DPL_Vtbl = {
75 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
76 DP_and_DPL_QueryInterface,
77 DP_and_DPL_AddRef,
78 DP_and_DPL_Release,
79 DP_and_DPL_CreateInstance,
80 DP_and_DPL_LockServer
81};
82
83static IClassFactoryImpl DP_and_DPL_CF = {&DP_and_DPL_Vtbl, 1 };
84
85
86/*******************************************************************************
87 * DPLAYX_DllGetClassObject [DPLAYX.?]
88 * Retrieves DP or DPL class object from a DLL object
89 *
90 * NOTES
91 * Docs say returns STDAPI
92 *
93 * PARAMS
94 * rclsid [I] CLSID for the class object
95 * riid [I] Reference to identifier of interface for class object
96 * ppv [O] Address of variable to receive interface pointer for riid
97 *
98 * RETURNS
99 * Success: S_OK
100 * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
101 * E_UNEXPECTED
102 */
103DWORD WINAPI DPLAYX_DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID *ppv)
104{
105 TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
106
107 if ( IsEqualCLSID( riid, &IID_IClassFactory ) )
108 {
109 *ppv = (LPVOID)&DP_and_DPL_CF;
110 IClassFactory_AddRef( (IClassFactory*)*ppv );
111
112 return S_OK;
113 }
114
115 ERR("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
116 return CLASS_E_CLASSNOTAVAILABLE;
117}
Note: See TracBrowser for help on using the repository browser.