widl: Always check the runtimeclass interfaces presence.
[wine/zf.git] / dlls / ole32 / marshal.c
blob823aea6f72161179d23a1ab0be21ff7c7eb5f656
1 /*
2 * Marshalling library
4 * Copyright 2002 Marcus Meissner
5 * Copyright 2004 Mike Hearn, for CodeWeavers
6 * Copyright 2004 Rob Shearman, for CodeWeavers
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include <stdarg.h>
24 #include <string.h>
25 #include <assert.h>
27 #define COBJMACROS
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winuser.h"
32 #include "objbase.h"
33 #include "ole2.h"
34 #include "winerror.h"
36 #include "compobj_private.h"
38 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(ole);
42 HRESULT WINAPI InternalCoStdMarshalObject(REFIID riid, DWORD dest_context, void *dest_context_data, void **ppvObject);
44 static HRESULT WINAPI StdMarshalCF_QueryInterface(LPCLASSFACTORY iface,
45 REFIID riid, LPVOID *ppv)
47 *ppv = NULL;
48 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
50 *ppv = iface;
51 return S_OK;
53 return E_NOINTERFACE;
56 static ULONG WINAPI StdMarshalCF_AddRef(LPCLASSFACTORY iface)
58 return 2; /* non-heap based object */
61 static ULONG WINAPI StdMarshalCF_Release(LPCLASSFACTORY iface)
63 return 1; /* non-heap based object */
66 static HRESULT WINAPI StdMarshalCF_CreateInstance(LPCLASSFACTORY iface,
67 LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv)
69 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IMarshal))
70 return InternalCoStdMarshalObject(riid, 0, NULL, ppv);
72 FIXME("(%s), not supported.\n",debugstr_guid(riid));
73 return E_NOINTERFACE;
76 static HRESULT WINAPI StdMarshalCF_LockServer(LPCLASSFACTORY iface, BOOL fLock)
78 FIXME("(%d), stub!\n",fLock);
79 return S_OK;
82 static const IClassFactoryVtbl StdMarshalCFVtbl =
84 StdMarshalCF_QueryInterface,
85 StdMarshalCF_AddRef,
86 StdMarshalCF_Release,
87 StdMarshalCF_CreateInstance,
88 StdMarshalCF_LockServer
90 static const IClassFactoryVtbl *StdMarshalCF = &StdMarshalCFVtbl;
92 HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv)
94 *ppv = &StdMarshalCF;
95 return S_OK;