2003-09-27 04:23:44 +02:00
|
|
|
/* COM class factory for direct play lobby interfaces.
|
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
* Copyright 1999, 2000 Peter Hunnisett
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-10 00:29:33 +01:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2001-01-26 21:43:40 +01:00
|
|
|
#include <string.h>
|
2004-10-07 05:06:48 +02:00
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
2000-11-08 06:05:15 +01:00
|
|
|
#include "windef.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winbase.h"
|
2008-02-19 20:09:19 +01:00
|
|
|
#include "winuser.h"
|
2002-12-05 21:33:07 +01:00
|
|
|
#include "objbase.h"
|
1999-09-28 18:35:32 +02:00
|
|
|
#include "winerror.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2008-02-19 20:09:19 +01:00
|
|
|
#include "dplay.h"
|
|
|
|
#include "dplobby.h"
|
|
|
|
#include "initguid.h"
|
1999-09-28 18:35:32 +02:00
|
|
|
#include "dpinit.h"
|
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dplay);
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* DirectPlayLobby ClassFactory
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/* IUnknown fields */
|
2005-06-01 21:57:42 +02:00
|
|
|
const IClassFactoryVtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
1999-09-28 18:35:32 +02:00
|
|
|
} IClassFactoryImpl;
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
DP_and_DPL_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-01-18 06:09:49 +01:00
|
|
|
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI
|
|
|
|
DP_and_DPL_AddRef(LPCLASSFACTORY iface) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
2005-01-11 16:46:43 +01:00
|
|
|
return InterlockedIncrement(&This->ref);
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DP_and_DPL_Release(LPCLASSFACTORY iface) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
1999-09-28 18:35:32 +02:00
|
|
|
/* static class (reference starts @ 1), won't ever be freed */
|
2005-01-11 16:46:43 +01:00
|
|
|
return InterlockedDecrement(&This->ref);
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DP_and_DPL_CreateInstance(
|
|
|
|
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
|
|
|
|
) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-01-18 06:09:49 +01:00
|
|
|
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if ( DPL_CreateInterface( riid, ppobj ) == S_OK )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
return S_OK;
|
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
else if ( DP_CreateInterface( riid, ppobj ) == S_OK )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DP_and_DPL_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
1999-09-28 18:35:32 +02:00
|
|
|
FIXME("(%p)->(%d),stub!\n",This,dolock);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IClassFactoryVtbl DP_and_DPL_Vtbl = {
|
1999-09-28 18:35:32 +02:00
|
|
|
DP_and_DPL_QueryInterface,
|
|
|
|
DP_and_DPL_AddRef,
|
|
|
|
DP_and_DPL_Release,
|
|
|
|
DP_and_DPL_CreateInstance,
|
|
|
|
DP_and_DPL_LockServer
|
|
|
|
};
|
|
|
|
|
|
|
|
static IClassFactoryImpl DP_and_DPL_CF = {&DP_and_DPL_Vtbl, 1 };
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
2005-08-10 15:02:43 +02:00
|
|
|
* DllGetClassObject [DPLAYX.@]
|
1999-09-28 18:35:32 +02:00
|
|
|
* Retrieves DP or DPL class object from a DLL object
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* Docs say returns STDAPI
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* rclsid [I] CLSID for the class object
|
|
|
|
* riid [I] Reference to identifier of interface for class object
|
|
|
|
* ppv [O] Address of variable to receive interface pointer for riid
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: S_OK
|
|
|
|
* Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
|
|
|
|
* E_UNEXPECTED
|
|
|
|
*/
|
2005-08-08 19:35:28 +02:00
|
|
|
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-01-18 06:09:49 +01:00
|
|
|
TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
if ( IsEqualCLSID( riid, &IID_IClassFactory ) )
|
|
|
|
{
|
2009-01-16 09:53:59 +01:00
|
|
|
*ppv = &DP_and_DPL_CF;
|
1999-09-28 18:35:32 +02:00
|
|
|
IClassFactory_AddRef( (IClassFactory*)*ppv );
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2000-01-18 06:09:49 +01:00
|
|
|
ERR("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
1999-09-28 18:35:32 +02:00
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
|
|
|
}
|