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

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

Updated to latest wine version

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