marshal.c 2.65 KB
Newer Older
1
/*
2
 *	Marshalling library
3
 *
4 5 6
 * Copyright 2002 Marcus Meissner
 * Copyright 2004 Mike Hearn, for CodeWeavers
 * Copyright 2004 Rob Shearman, for CodeWeavers
7 8 9 10 11 12 13 14 15 16 17 18 19
 *
 * 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
20
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 22
 */

23
#include <stdarg.h>
24 25 26
#include <string.h>
#include <assert.h>

27 28
#define COBJMACROS

29
#include "windef.h"
30
#include "winbase.h"
31
#include "winuser.h"
32 33 34
#include "objbase.h"
#include "ole2.h"
#include "winerror.h"
35

36 37
#include "compobj_private.h"

38
#include "wine/debug.h"
39

40
WINE_DEFAULT_DEBUG_CHANNEL(ole);
41

42
HRESULT WINAPI InternalCoStdMarshalObject(REFIID riid, DWORD dest_context, void *dest_context_data, void **ppvObject);
43

44 45 46 47 48 49
static HRESULT WINAPI StdMarshalCF_QueryInterface(LPCLASSFACTORY iface,
                                                  REFIID riid, LPVOID *ppv)
{
    *ppv = NULL;
    if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
    {
50
        *ppv = iface;
51 52 53
        return S_OK;
    }
    return E_NOINTERFACE;
54 55
}

56 57 58 59 60 61 62 63 64 65 66 67 68
static ULONG WINAPI StdMarshalCF_AddRef(LPCLASSFACTORY iface)
{
    return 2; /* non-heap based object */
}

static ULONG WINAPI StdMarshalCF_Release(LPCLASSFACTORY iface)
{
    return 1; /* non-heap based object */
}

static HRESULT WINAPI StdMarshalCF_CreateInstance(LPCLASSFACTORY iface,
    LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv)
{
69
    if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IMarshal))
70
        return InternalCoStdMarshalObject(riid, 0, NULL, ppv);
71

72 73
    FIXME("(%s), not supported.\n",debugstr_guid(riid));
    return E_NOINTERFACE;
74 75
}

76 77
static HRESULT WINAPI StdMarshalCF_LockServer(LPCLASSFACTORY iface, BOOL fLock)
{
78 79 80 81
    FIXME("(%d), stub!\n",fLock);
    return S_OK;
}

82
static const IClassFactoryVtbl StdMarshalCFVtbl =
83 84 85 86 87 88
{
    StdMarshalCF_QueryInterface,
    StdMarshalCF_AddRef,
    StdMarshalCF_Release,
    StdMarshalCF_CreateInstance,
    StdMarshalCF_LockServer
89
};
90
static const IClassFactoryVtbl *StdMarshalCF = &StdMarshalCFVtbl;
91

92 93 94 95
HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv)
{
    *ppv = &StdMarshalCF;
    return S_OK;
96
}