Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendpclassfactory.c
Go to the documentation of this file.
00001 /* COM class factory for direct play lobby interfaces. 00002 * 00003 * Copyright 1999, 2000 Peter Hunnisett 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 */ 00019 00020 #include <stdarg.h> 00021 #include <string.h> 00022 00023 #define COBJMACROS 00024 00025 #include "windef.h" 00026 #include "winbase.h" 00027 #include "objbase.h" 00028 #include "winerror.h" 00029 #include "wine/debug.h" 00030 #include "dpinit.h" 00031 00032 WINE_DEFAULT_DEBUG_CHANNEL(dplay); 00033 00034 00035 /******************************************************************************* 00036 * DirectPlayLobby ClassFactory 00037 */ 00038 00039 typedef struct 00040 { 00041 /* IUnknown fields */ 00042 const IClassFactoryVtbl *lpVtbl; 00043 LONG ref; 00044 } IClassFactoryImpl; 00045 00046 static HRESULT WINAPI 00047 DP_and_DPL_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { 00048 IClassFactoryImpl *This = (IClassFactoryImpl *)iface; 00049 00050 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); 00051 00052 return E_NOINTERFACE; 00053 } 00054 00055 static ULONG WINAPI 00056 DP_and_DPL_AddRef(LPCLASSFACTORY iface) { 00057 IClassFactoryImpl *This = (IClassFactoryImpl *)iface; 00058 return InterlockedIncrement(&This->ref); 00059 } 00060 00061 static ULONG WINAPI DP_and_DPL_Release(LPCLASSFACTORY iface) { 00062 IClassFactoryImpl *This = (IClassFactoryImpl *)iface; 00063 /* static class (reference starts @ 1), won't ever be freed */ 00064 return InterlockedDecrement(&This->ref); 00065 } 00066 00067 static HRESULT WINAPI DP_and_DPL_CreateInstance( 00068 LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj 00069 ) { 00070 IClassFactoryImpl *This = (IClassFactoryImpl *)iface; 00071 00072 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj); 00073 00074 if ( DPL_CreateInterface( riid, ppobj ) == S_OK ) 00075 { 00076 return S_OK; 00077 } 00078 else if ( DP_CreateInterface( riid, ppobj ) == S_OK ) 00079 { 00080 return S_OK; 00081 } 00082 00083 return E_NOINTERFACE; 00084 } 00085 00086 static HRESULT WINAPI DP_and_DPL_LockServer(LPCLASSFACTORY iface,BOOL dolock) { 00087 IClassFactoryImpl *This = (IClassFactoryImpl *)iface; 00088 FIXME("(%p)->(%d),stub!\n",This,dolock); 00089 return S_OK; 00090 } 00091 00092 static const IClassFactoryVtbl DP_and_DPL_Vtbl = { 00093 DP_and_DPL_QueryInterface, 00094 DP_and_DPL_AddRef, 00095 DP_and_DPL_Release, 00096 DP_and_DPL_CreateInstance, 00097 DP_and_DPL_LockServer 00098 }; 00099 00100 static IClassFactoryImpl DP_and_DPL_CF = {&DP_and_DPL_Vtbl, 1 }; 00101 00102 00103 /******************************************************************************* 00104 * DllGetClassObject [DPLAYX.@] 00105 * Retrieves DP or DPL class object from a DLL object 00106 * 00107 * NOTES 00108 * Docs say returns STDAPI 00109 * 00110 * PARAMS 00111 * rclsid [I] CLSID for the class object 00112 * riid [I] Reference to identifier of interface for class object 00113 * ppv [O] Address of variable to receive interface pointer for riid 00114 * 00115 * RETURNS 00116 * Success: S_OK 00117 * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG, 00118 * E_UNEXPECTED 00119 */ 00120 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) 00121 { 00122 TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); 00123 00124 if ( IsEqualCLSID( riid, &IID_IClassFactory ) ) 00125 { 00126 *ppv = (LPVOID)&DP_and_DPL_CF; 00127 IClassFactory_AddRef( (IClassFactory*)*ppv ); 00128 00129 return S_OK; 00130 } 00131 00132 ERR("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); 00133 return CLASS_E_CLASSNOTAVAILABLE; 00134 } Generated on Sat May 26 2012 04:20:08 for ReactOS by
1.7.6.1
|