Nikolay Sivov : combase: Move CoGetMarshalSizeMax().

Alexandre Julliard julliard at winehq.org
Fri Aug 14 16:39:31 CDT 2020


Module: wine
Branch: master
Commit: 3aefd100d73705b4d8bbe6f7dabc631322bb3a0c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3aefd100d73705b4d8bbe6f7dabc631322bb3a0c

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Aug 14 09:16:27 2020 +0300

combase: Move CoGetMarshalSizeMax().

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/combase/combase.spec |  2 +-
 dlls/combase/marshal.c    | 32 +++++++++++++++++++++++++++++
 dlls/ole32/marshal.c      | 52 -----------------------------------------------
 dlls/ole32/ole32.spec     |  2 +-
 4 files changed, 34 insertions(+), 54 deletions(-)

diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec
index 3214f54550..8bcac10cdc 100644
--- a/dlls/combase/combase.spec
+++ b/dlls/combase/combase.spec
@@ -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
diff --git a/dlls/combase/marshal.c b/dlls/combase/marshal.c
index 2b0c005812..3c577a9bff 100644
--- a/dlls/combase/marshal.c
+++ b/dlls/combase/marshal.c
@@ -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;
+}
diff --git a/dlls/ole32/marshal.c b/dlls/ole32/marshal.c
index cf1e55babe..ea8432e2ee 100644
--- a/dlls/ole32/marshal.c
+++ b/dlls/ole32/marshal.c
@@ -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)
diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec
index a19264127f..772599b4cf 100644
--- a/dlls/ole32/ole32.spec
+++ b/dlls/ole32/ole32.spec
@@ -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)




More information about the wine-cvs mailing list