Fixed a char/NULL comparison.
[wine/testsucceed.git] / dlls / dplayx / dpclassfactory.c
blob9a7546a7448420b6ac48dd07eb6e64090cb948f2
2 #include "wine/obj_base.h"
3 #include "winerror.h"
4 #include "debugtools.h"
5 #include "dpinit.h"
7 DEFAULT_DEBUG_CHANNEL(dplay)
10 /*******************************************************************************
11 * DirectPlayLobby ClassFactory
14 typedef struct
16 /* IUnknown fields */
17 ICOM_VFIELD(IClassFactory);
18 DWORD ref;
19 } IClassFactoryImpl;
21 static HRESULT WINAPI
22 DP_and_DPL_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
23 ICOM_THIS(IClassFactoryImpl,iface);
25 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
27 return E_NOINTERFACE;
30 static ULONG WINAPI
31 DP_and_DPL_AddRef(LPCLASSFACTORY iface) {
32 ICOM_THIS(IClassFactoryImpl,iface);
33 return ++(This->ref);
36 static ULONG WINAPI DP_and_DPL_Release(LPCLASSFACTORY iface) {
37 ICOM_THIS(IClassFactoryImpl,iface);
38 /* static class (reference starts @ 1), won't ever be freed */
39 return --(This->ref);
42 static HRESULT WINAPI DP_and_DPL_CreateInstance(
43 LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
44 ) {
45 ICOM_THIS(IClassFactoryImpl,iface);
47 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
49 if ( DPL_CreateInterface( riid, ppobj ) == S_OK )
51 return S_OK;
53 else if ( DP_CreateInterface( riid, ppobj ) == S_OK )
55 return S_OK;
58 return E_NOINTERFACE;
61 static HRESULT WINAPI DP_and_DPL_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
62 ICOM_THIS(IClassFactoryImpl,iface);
63 FIXME("(%p)->(%d),stub!\n",This,dolock);
64 return S_OK;
67 static ICOM_VTABLE(IClassFactory) DP_and_DPL_Vtbl = {
68 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
69 DP_and_DPL_QueryInterface,
70 DP_and_DPL_AddRef,
71 DP_and_DPL_Release,
72 DP_and_DPL_CreateInstance,
73 DP_and_DPL_LockServer
76 static IClassFactoryImpl DP_and_DPL_CF = {&DP_and_DPL_Vtbl, 1 };
79 /*******************************************************************************
80 * DPLAYX_DllGetClassObject [DPLAYX.11]
81 * Retrieves DP or DPL class object from a DLL object
83 * NOTES
84 * Docs say returns STDAPI
86 * PARAMS
87 * rclsid [I] CLSID for the class object
88 * riid [I] Reference to identifier of interface for class object
89 * ppv [O] Address of variable to receive interface pointer for riid
91 * RETURNS
92 * Success: S_OK
93 * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
94 * E_UNEXPECTED
96 DWORD WINAPI DPLAYX_DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID *ppv)
98 TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
100 if ( IsEqualCLSID( riid, &IID_IClassFactory ) )
102 *ppv = (LPVOID)&DP_and_DPL_CF;
103 IClassFactory_AddRef( (IClassFactory*)*ppv );
105 return S_OK;
108 ERR("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
109 return CLASS_E_CLASSNOTAVAILABLE;