2002-08-03 02:17:10 +02:00
|
|
|
/*
|
2003-05-13 02:41:57 +02:00
|
|
|
* free threaded marshaller
|
2002-08-03 02:17:10 +02:00
|
|
|
*
|
|
|
|
* Copyright 2002 Juergen Schmied
|
|
|
|
*
|
|
|
|
* 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-08-03 02:17:10 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2002-08-03 02:17:10 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <assert.h>
|
|
|
|
|
2004-10-07 05:06:48 +02:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
2002-08-03 02:17:10 +02:00
|
|
|
#include "winbase.h"
|
2002-12-05 21:33:07 +01:00
|
|
|
#include "objbase.h"
|
2002-08-03 02:17:10 +02:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
2006-05-25 00:01:41 +02:00
|
|
|
#include "compobj_private.h"
|
|
|
|
|
2002-08-03 02:17:10 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
|
|
|
|
2006-05-25 00:02:35 +02:00
|
|
|
static HRESULT WINAPI FTMarshalCF_QueryInterface(LPCLASSFACTORY iface,
|
|
|
|
REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
|
|
|
*ppv = NULL;
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
|
|
|
|
{
|
|
|
|
*ppv = iface;
|
2012-08-13 11:40:33 +02:00
|
|
|
IClassFactory_AddRef(iface);
|
2006-05-25 00:02:35 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI FTMarshalCF_AddRef(LPCLASSFACTORY iface)
|
|
|
|
{
|
|
|
|
return 2; /* non-heap based object */
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI FTMarshalCF_Release(LPCLASSFACTORY iface)
|
|
|
|
{
|
|
|
|
return 1; /* non-heap based object */
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FTMarshalCF_CreateInstance(LPCLASSFACTORY iface,
|
|
|
|
LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
|
|
|
IUnknown *pUnknown;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p, %s, %p)\n", pUnk, debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
hr = CoCreateFreeThreadedMarshaler(pUnk, &pUnknown);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
hr = IUnknown_QueryInterface(pUnknown, riid, ppv);
|
|
|
|
IUnknown_Release(pUnknown);
|
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FTMarshalCF_LockServer(LPCLASSFACTORY iface, BOOL fLock)
|
|
|
|
{
|
|
|
|
FIXME("(%d), stub!\n",fLock);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IClassFactoryVtbl FTMarshalCFVtbl =
|
|
|
|
{
|
|
|
|
FTMarshalCF_QueryInterface,
|
|
|
|
FTMarshalCF_AddRef,
|
|
|
|
FTMarshalCF_Release,
|
|
|
|
FTMarshalCF_CreateInstance,
|
|
|
|
FTMarshalCF_LockServer
|
|
|
|
};
|
|
|
|
static const IClassFactoryVtbl *FTMarshalCF = &FTMarshalCFVtbl;
|
|
|
|
|
|
|
|
HRESULT FTMarshalCF_Create(REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
|
|
|
return IClassFactory_QueryInterface((IClassFactory *)&FTMarshalCF, riid, ppv);
|
|
|
|
}
|