combase: Move CoGetMarshalSizeMax().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-08-14 09:16:27 +03:00 committed by Alexandre Julliard
parent aaef46ea48
commit 3aefd100d7
4 changed files with 34 additions and 54 deletions

View File

@ -112,7 +112,7 @@
@ stdcall CoGetInstanceFromIStorage(ptr ptr ptr long ptr long ptr)
@ stdcall CoGetInterfaceAndReleaseStream(ptr ptr ptr)
@ stdcall CoGetMalloc(long ptr)
@ stdcall CoGetMarshalSizeMax(ptr ptr ptr long ptr long) ole32.CoGetMarshalSizeMax
@ stdcall CoGetMarshalSizeMax(ptr ptr ptr long ptr long)
@ stub CoGetModuleType
@ stdcall CoGetObjectContext(ptr ptr)
@ stdcall CoGetPSClsid(ptr ptr) ole32.CoGetPSClsid

View File

@ -24,6 +24,7 @@
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/orpc.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
@ -379,3 +380,34 @@ HRESULT WINAPI CoCreateFreeThreadedMarshaler(IUnknown *outer, IUnknown **marshal
return S_OK;
}
/***********************************************************************
* CoGetMarshalSizeMax (combase.@)
*/
HRESULT WINAPI CoGetMarshalSizeMax(ULONG *size, REFIID riid, IUnknown *unk,
DWORD dest_context, void *pvDestContext, DWORD mshlFlags)
{
BOOL std_marshal = FALSE;
IMarshal *marshal;
HRESULT hr;
if (!unk)
return E_POINTER;
hr = IUnknown_QueryInterface(unk, &IID_IMarshal, (void **)&marshal);
if (hr != S_OK)
{
std_marshal = TRUE;
hr = CoGetStandardMarshal(riid, unk, dest_context, pvDestContext, mshlFlags, &marshal);
}
if (hr != S_OK)
return hr;
hr = IMarshal_GetMarshalSizeMax(marshal, riid, unk, dest_context, pvDestContext, mshlFlags, size);
if (!std_marshal)
/* add on the size of the whole OBJREF structure like native does */
*size += sizeof(OBJREF);
IMarshal_Release(marshal);
return hr;
}

View File

@ -1777,58 +1777,6 @@ static HRESULT get_unmarshaler_from_stream(IStream *stream, IMarshal **marshal,
return hr;
}
/***********************************************************************
* CoGetMarshalSizeMax [OLE32.@]
*
* Gets the maximum amount of data that will be needed by a marshal.
*
* PARAMS
* pulSize [O] Address where maximum marshal size will be stored.
* riid [I] Identifier of the interface to marshal.
* pUnk [I] Pointer to the object to marshal.
* dwDestContext [I] Destination. Used to enable or disable optimizations.
* pvDestContext [I] Reserved. Must be NULL.
* mshlFlags [I] Flags that affect the marshaling. See CoMarshalInterface().
*
* RETURNS
* Success: S_OK.
* Failure: HRESULT code.
*
* SEE ALSO
* CoMarshalInterface().
*/
HRESULT WINAPI CoGetMarshalSizeMax(ULONG *pulSize, REFIID riid, IUnknown *pUnk,
DWORD dwDestContext, void *pvDestContext,
DWORD mshlFlags)
{
HRESULT hr;
LPMARSHAL pMarshal;
BOOL std_marshal = FALSE;
if(!pUnk)
return E_POINTER;
hr = IUnknown_QueryInterface(pUnk, &IID_IMarshal, (void**)&pMarshal);
if (hr != S_OK)
{
std_marshal = TRUE;
hr = CoGetStandardMarshal(riid, pUnk, dwDestContext, pvDestContext,
mshlFlags, &pMarshal);
}
if (hr != S_OK)
return hr;
hr = IMarshal_GetMarshalSizeMax(pMarshal, riid, pUnk, dwDestContext,
pvDestContext, mshlFlags, pulSize);
if (!std_marshal)
/* add on the size of the whole OBJREF structure like native does */
*pulSize += sizeof(OBJREF);
IMarshal_Release(pMarshal);
return hr;
}
static void dump_MSHLFLAGS(MSHLFLAGS flags)
{
if (flags & MSHLFLAGS_TABLESTRONG)

View File

@ -39,7 +39,7 @@
@ stdcall CoGetInstanceFromIStorage(ptr ptr ptr long ptr long ptr) combase.CoGetInstanceFromIStorage
@ stdcall CoGetInterfaceAndReleaseStream(ptr ptr ptr) combase.CoGetInterfaceAndReleaseStream
@ stdcall CoGetMalloc(long ptr) combase.CoGetMalloc
@ stdcall CoGetMarshalSizeMax(ptr ptr ptr long ptr long)
@ stdcall CoGetMarshalSizeMax(ptr ptr ptr long ptr long) combase.CoGetMarshalSizeMax
@ stdcall CoGetObject(wstr ptr ptr ptr)
@ stdcall CoGetObjectContext(ptr ptr) combase.CoGetObjectContext
@ stdcall CoGetPSClsid(ptr ptr)