mfplay: Add support for same-thread event callback.
[wine.git] / dlls / ole32 / ftmarshal.c
blob8777b553618ffc6d2d281db489971643c60d9594
1 /*
2 * free threaded marshaller
4 * Copyright 2002 Juergen Schmied
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdlib.h>
22 #include <stdarg.h>
23 #include <stdio.h>
24 #include <string.h>
25 #include <assert.h>
27 #define COBJMACROS
29 #include "windef.h"
30 #include "winbase.h"
31 #include "objbase.h"
33 #include "wine/debug.h"
35 #include "compobj_private.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(ole);
39 static HRESULT WINAPI FTMarshalCF_QueryInterface(LPCLASSFACTORY iface,
40 REFIID riid, LPVOID *ppv)
42 *ppv = NULL;
43 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
45 *ppv = iface;
46 IClassFactory_AddRef(iface);
47 return S_OK;
49 return E_NOINTERFACE;
52 static ULONG WINAPI FTMarshalCF_AddRef(LPCLASSFACTORY iface)
54 return 2; /* non-heap based object */
57 static ULONG WINAPI FTMarshalCF_Release(LPCLASSFACTORY iface)
59 return 1; /* non-heap based object */
62 static HRESULT WINAPI FTMarshalCF_CreateInstance(LPCLASSFACTORY iface,
63 LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv)
65 IUnknown *pUnknown;
66 HRESULT hr;
68 TRACE("(%p, %s, %p)\n", pUnk, debugstr_guid(riid), ppv);
70 *ppv = NULL;
72 hr = CoCreateFreeThreadedMarshaler(pUnk, &pUnknown);
74 if (SUCCEEDED(hr))
76 hr = IUnknown_QueryInterface(pUnknown, riid, ppv);
77 IUnknown_Release(pUnknown);
80 return hr;
83 static HRESULT WINAPI FTMarshalCF_LockServer(LPCLASSFACTORY iface, BOOL fLock)
85 FIXME("(%d), stub!\n",fLock);
86 return S_OK;
89 static const IClassFactoryVtbl FTMarshalCFVtbl =
91 FTMarshalCF_QueryInterface,
92 FTMarshalCF_AddRef,
93 FTMarshalCF_Release,
94 FTMarshalCF_CreateInstance,
95 FTMarshalCF_LockServer
97 static const IClassFactoryVtbl *FTMarshalCF = &FTMarshalCFVtbl;
99 HRESULT FTMarshalCF_Create(REFIID riid, LPVOID *ppv)
101 return IClassFactory_QueryInterface((IClassFactory *)&FTMarshalCF, riid, ppv);