ReactOS  0.4.14-dev-337-gf981a68
marshal.c File Reference
#include <stdarg.h>
#include <string.h>
#include <assert.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "objbase.h"
#include "ole2.h"
#include "winerror.h"
#include "compobj_private.h"
#include "wine/debug.h"
Include dependency graph for marshal.c:

Go to the source code of this file.

Classes

struct  proxy_manager
 
struct  _StdMarshalImpl
 

Macros

#define COBJMACROS
 
#define NORMALEXTREFS   5
 
#define SORFP_TABLEWEAK   SORF_OXRES1
 
#define SORFP_NOLIFETIMEMGMT   SORF_OXRES2
 

Typedefs

typedef struct _StdMarshalImpl StdMarshalImpl
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
static struct proxy_managerimpl_from_IMultiQI (IMultiQI *iface)
 
static struct proxy_managerimpl_from_IMarshal (IMarshal *iface)
 
static struct proxy_managerimpl_from_IClientSecurity (IClientSecurity *iface)
 
static HRESULT unmarshal_object (const STDOBJREF *stdobjref, APARTMENT *apt, MSHCTX dest_context, void *dest_context_data, REFIID riid, const OXID_INFO *oxid_info, void **object)
 
static HRESULT get_facbuf_for_iid (REFIID riid, IPSFactoryBuffer **facbuf)
 
HRESULT marshal_object (APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnknown *object, DWORD dest_context, void *dest_context_data, MSHLFLAGS mshlflags)
 
static HRESULT proxy_manager_get_remunknown (struct proxy_manager *This, IRemUnknown **remunk)
 
static void proxy_manager_destroy (struct proxy_manager *This)
 
static HRESULT proxy_manager_find_ifproxy (struct proxy_manager *This, REFIID riid, struct ifproxy **ifproxy_found)
 
static HRESULT proxy_manager_query_local_interface (struct proxy_manager *This, REFIID riid, void **ppv)
 
static HRESULT WINAPI ClientIdentity_QueryInterface (IMultiQI *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ClientIdentity_AddRef (IMultiQI *iface)
 
static ULONG WINAPI ClientIdentity_Release (IMultiQI *iface)
 
static HRESULT WINAPI ClientIdentity_QueryMultipleInterfaces (IMultiQI *iface, ULONG cMQIs, MULTI_QI *pMQIs)
 
static HRESULT StdMarshalImpl_Construct (REFIID, DWORD, void *, void **)
 
static HRESULT WINAPI Proxy_QueryInterface (IMarshal *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI Proxy_AddRef (IMarshal *iface)
 
static ULONG WINAPI Proxy_Release (IMarshal *iface)
 
static HRESULT WINAPI Proxy_GetUnmarshalClass (IMarshal *iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, CLSID *pCid)
 
static HRESULT WINAPI Proxy_GetMarshalSizeMax (IMarshal *iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, DWORD *pSize)
 
static void fill_std_objref (OBJREF *objref, const GUID *iid, STDOBJREF *std)
 
static HRESULT WINAPI Proxy_MarshalInterface (LPMARSHAL iface, IStream *pStm, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags)
 
static HRESULT WINAPI Proxy_UnmarshalInterface (IMarshal *iface, IStream *pStm, REFIID riid, void **ppv)
 
static HRESULT WINAPI Proxy_ReleaseMarshalData (IMarshal *iface, IStream *pStm)
 
static HRESULT WINAPI Proxy_DisconnectObject (IMarshal *iface, DWORD dwReserved)
 
static HRESULT WINAPI ProxyCliSec_QueryInterface (IClientSecurity *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI ProxyCliSec_AddRef (IClientSecurity *iface)
 
static ULONG WINAPI ProxyCliSec_Release (IClientSecurity *iface)
 
static HRESULT WINAPI ProxyCliSec_QueryBlanket (IClientSecurity *iface, IUnknown *pProxy, DWORD *pAuthnSvc, DWORD *pAuthzSvc, OLECHAR **ppServerPrincName, DWORD *pAuthnLevel, DWORD *pImpLevel, void **pAuthInfo, DWORD *pCapabilities)
 
static HRESULT WINAPI ProxyCliSec_SetBlanket (IClientSecurity *iface, IUnknown *pProxy, DWORD AuthnSvc, DWORD AuthzSvc, OLECHAR *pServerPrincName, DWORD AuthnLevel, DWORD ImpLevel, void *pAuthInfo, DWORD Capabilities)
 
static HRESULT WINAPI ProxyCliSec_CopyProxy (IClientSecurity *iface, IUnknown *pProxy, IUnknown **ppCopy)
 
static HRESULT ifproxy_get_public_ref (struct ifproxy *This)
 
static HRESULT ifproxy_release_public_refs (struct ifproxy *This)
 
static void ifproxy_disconnect (struct ifproxy *This)
 
static void ifproxy_destroy (struct ifproxy *This)
 
static HRESULT proxy_manager_construct (APARTMENT *apt, ULONG sorflags, OXID oxid, OID oid, const OXID_INFO *oxid_info, struct proxy_manager **proxy_manager)
 
static void proxy_manager_set_context (struct proxy_manager *This, MSHCTX dest_context, void *dest_context_data)
 
static HRESULT proxy_manager_create_ifproxy (struct proxy_manager *This, const STDOBJREF *stdobjref, REFIID riid, IRpcChannelBuffer *channel, struct ifproxy **iif_out)
 
static void proxy_manager_disconnect (struct proxy_manager *This)
 
static BOOL find_proxy_manager (APARTMENT *apt, OXID oxid, OID oid, struct proxy_manager **proxy_found)
 
HRESULT apartment_disconnectproxies (struct apartment *apt)
 
static StdMarshalImplimpl_from_StdMarshal (IMarshal *iface)
 
static HRESULT WINAPI StdMarshalImpl_QueryInterface (IMarshal *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI StdMarshalImpl_AddRef (IMarshal *iface)
 
static ULONG WINAPI StdMarshalImpl_Release (IMarshal *iface)
 
static HRESULT WINAPI StdMarshalImpl_GetUnmarshalClass (IMarshal *iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, CLSID *pCid)
 
static HRESULT WINAPI StdMarshalImpl_GetMarshalSizeMax (IMarshal *iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, DWORD *pSize)
 
static HRESULT WINAPI StdMarshalImpl_MarshalInterface (IMarshal *iface, IStream *pStm, REFIID riid, void *pv, DWORD dest_context, void *dest_context_data, DWORD mshlflags)
 
static HRESULT std_unmarshal_interface (MSHCTX dest_context, void *dest_context_data, IStream *pStm, REFIID riid, void **ppv)
 
static HRESULT WINAPI StdMarshalImpl_UnmarshalInterface (IMarshal *iface, IStream *pStm, REFIID riid, void **ppv)
 
static HRESULT std_release_marshal_data (IStream *pStm)
 
static HRESULT WINAPI StdMarshalImpl_ReleaseMarshalData (IMarshal *iface, IStream *pStm)
 
static HRESULT WINAPI StdMarshalImpl_DisconnectObject (IMarshal *iface, DWORD dwReserved)
 
HRESULT WINAPI CoGetStandardMarshal (REFIID riid, IUnknown *pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags, LPMARSHAL *ppMarshal)
 
static HRESULT get_marshaler (REFIID riid, IUnknown *pUnk, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags, LPMARSHAL *pMarshal)
 
static HRESULT get_unmarshaler_from_stream (IStream *stream, IMarshal **marshal, IID *iid)
 
HRESULT WINAPI CoGetMarshalSizeMax (ULONG *pulSize, REFIID riid, IUnknown *pUnk, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags)
 
static void dump_MSHLFLAGS (MSHLFLAGS flags)
 
HRESULT WINAPI CoMarshalInterface (IStream *pStream, REFIID riid, IUnknown *pUnk, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags)
 
HRESULT WINAPI CoUnmarshalInterface (IStream *pStream, REFIID riid, LPVOID *ppv)
 
HRESULT WINAPI CoReleaseMarshalData (IStream *pStream)
 
HRESULT WINAPI CoMarshalInterThreadInterfaceInStream (REFIID riid, LPUNKNOWN pUnk, LPSTREAM *ppStm)
 
HRESULT WINAPI CoGetInterfaceAndReleaseStream (LPSTREAM pStm, REFIID riid, LPVOID *ppv)
 
static HRESULT WINAPI StdMarshalCF_QueryInterface (LPCLASSFACTORY iface, REFIID riid, LPVOID *ppv)
 
static ULONG WINAPI StdMarshalCF_AddRef (LPCLASSFACTORY iface)
 
static ULONG WINAPI StdMarshalCF_Release (LPCLASSFACTORY iface)
 
static HRESULT WINAPI StdMarshalCF_CreateInstance (LPCLASSFACTORY iface, LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv)
 
static HRESULT WINAPI StdMarshalCF_LockServer (LPCLASSFACTORY iface, BOOL fLock)
 
HRESULT MARSHAL_GetStandardMarshalCF (LPVOID *ppv)
 
HRESULT WINAPI CoMarshalHresult (LPSTREAM pStm, HRESULT hresult)
 
HRESULT WINAPI CoUnmarshalHresult (LPSTREAM pStm, HRESULT *phresult)
 

Variables

static const IMultiQIVtbl ClientIdentity_Vtbl
 
static const IMarshalVtbl ProxyMarshal_Vtbl
 
static const IClientSecurityVtbl ProxyCliSec_Vtbl
 
static const IMarshalVtbl StdMarshalVtbl
 
static const IClassFactoryVtbl StdMarshalCFVtbl
 
static const IClassFactoryVtbl * StdMarshalCF = &StdMarshalCFVtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 27 of file marshal.c.

◆ NORMALEXTREFS

#define NORMALEXTREFS   5

Definition at line 43 of file marshal.c.

◆ SORFP_NOLIFETIMEMGMT

#define SORFP_NOLIFETIMEMGMT   SORF_OXRES2

Definition at line 50 of file marshal.c.

◆ SORFP_TABLEWEAK

#define SORFP_TABLEWEAK   SORF_OXRES1

Definition at line 47 of file marshal.c.

Typedef Documentation

◆ StdMarshalImpl

Function Documentation

◆ apartment_disconnectproxies()

HRESULT apartment_disconnectproxies ( struct apartment apt)

Definition at line 1226 of file marshal.c.

1227 {
1228  struct list * cursor;
1229 
1230  LIST_FOR_EACH(cursor, &apt->proxies)
1231  {
1232  struct proxy_manager * proxy = LIST_ENTRY(cursor, struct proxy_manager, entry);
1234  }
1235 
1236  return S_OK;
1237 }
int proxy
Definition: main.c:67
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
struct list proxies
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
#define S_OK
Definition: intsafe.h:59
const char cursor[]
Definition: icontest.c:13
static void proxy_manager_disconnect(struct proxy_manager *This)
Definition: marshal.c:1060
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by apartment_release().

◆ ClientIdentity_AddRef()

static ULONG WINAPI ClientIdentity_AddRef ( IMultiQI iface)
static

Definition at line 236 of file marshal.c.

237 {
238  struct proxy_manager *This = impl_from_IMultiQI(iface);
239  TRACE("%p - before %d\n", iface, This->refs);
240  return InterlockedIncrement(&This->refs);
241 }
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
static struct proxy_manager * impl_from_IMultiQI(IMultiQI *iface)
Definition: marshal.c:73

◆ ClientIdentity_QueryInterface()

static HRESULT WINAPI ClientIdentity_QueryInterface ( IMultiQI iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 222 of file marshal.c.

223 {
224  HRESULT hr;
225  MULTI_QI mqi;
226 
227  TRACE("%s\n", debugstr_guid(riid));
228 
229  mqi.pIID = riid;
230  hr = IMultiQI_QueryMultipleInterfaces(iface, 1, &mqi);
231  *ppv = mqi.pItf;
232 
233  return hr;
234 }
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77

◆ ClientIdentity_QueryMultipleInterfaces()

static HRESULT WINAPI ClientIdentity_QueryMultipleInterfaces ( IMultiQI iface,
ULONG  cMQIs,
MULTI_QI *  pMQIs 
)
static

Definition at line 253 of file marshal.c.

254 {
255  struct proxy_manager *This = impl_from_IMultiQI(iface);
256  REMQIRESULT *qiresults = NULL;
257  ULONG nonlocal_mqis = 0;
258  ULONG i;
259  ULONG successful_mqis = 0;
260  IID *iids = HeapAlloc(GetProcessHeap(), 0, cMQIs * sizeof(*iids));
261  /* mapping of RemQueryInterface index to QueryMultipleInterfaces index */
262  ULONG *mapping = HeapAlloc(GetProcessHeap(), 0, cMQIs * sizeof(*mapping));
263 
264  TRACE("cMQIs: %d\n", cMQIs);
265 
266  /* try to get a local interface - this includes already active proxy
267  * interfaces and also interfaces exposed by the proxy manager */
268  for (i = 0; i < cMQIs; i++)
269  {
270  TRACE("iid[%d] = %s\n", i, debugstr_guid(pMQIs[i].pIID));
271  pMQIs[i].hr = proxy_manager_query_local_interface(This, pMQIs[i].pIID, (void **)&pMQIs[i].pItf);
272  if (pMQIs[i].hr == S_OK)
273  successful_mqis++;
274  else
275  {
276  iids[nonlocal_mqis] = *pMQIs[i].pIID;
277  mapping[nonlocal_mqis] = i;
278  nonlocal_mqis++;
279  }
280  }
281 
282  TRACE("%d interfaces not found locally\n", nonlocal_mqis);
283 
284  /* if we have more than one interface not found locally then we must try
285  * to query the remote object for it */
286  if (nonlocal_mqis != 0)
287  {
289  HRESULT hr;
290  IPID *ipid;
291 
292  /* get the ipid of the first entry */
293  /* FIXME: should we implement ClientIdentity on the ifproxies instead
294  * of the proxy_manager so we use the correct ipid here? */
295  ipid = &LIST_ENTRY(list_head(&This->interfaces), struct ifproxy, entry)->stdobjref.ipid;
296 
297  /* get IRemUnknown proxy so we can communicate with the remote object */
299 
300  if (SUCCEEDED(hr))
301  {
302  hr = IRemUnknown_RemQueryInterface(remunk, ipid, NORMALEXTREFS,
303  nonlocal_mqis, iids, &qiresults);
304  IRemUnknown_Release(remunk);
305  if (FAILED(hr))
306  ERR("IRemUnknown_RemQueryInterface failed with error 0x%08x\n", hr);
307  }
308 
309  /* IRemUnknown_RemQueryInterface can return S_FALSE if only some of
310  * the interfaces were returned */
311  if (SUCCEEDED(hr))
312  {
314 
315  /* try to unmarshal each object returned to us */
316  for (i = 0; i < nonlocal_mqis; i++)
317  {
318  ULONG index = mapping[i];
319  HRESULT hrobj = qiresults[i].hResult;
320  if (hrobj == S_OK)
321  hrobj = unmarshal_object(&qiresults[i].std, apt,
322  This->dest_context,
323  This->dest_context_data,
324  pMQIs[index].pIID, &This->oxid_info,
325  (void **)&pMQIs[index].pItf);
326 
327  if (hrobj == S_OK)
328  successful_mqis++;
329  else
330  ERR("Failed to get pointer to interface %s\n", debugstr_guid(pMQIs[index].pIID));
331  pMQIs[index].hr = hrobj;
332  }
333 
334  apartment_release(apt);
335  }
336 
337  /* free the memory allocated by the proxy */
338  CoTaskMemFree(qiresults);
339  }
340 
341  TRACE("%d/%d successfully queried\n", successful_mqis, cMQIs);
342 
343  HeapFree(GetProcessHeap(), 0, iids);
345 
346  if (successful_mqis == cMQIs)
347  return S_OK; /* we got all requested interfaces */
348  else if (successful_mqis == 0)
349  return E_NOINTERFACE; /* we didn't get any interfaces */
350  else
351  return S_FALSE; /* we got some interfaces */
352 }
static HRESULT proxy_manager_query_local_interface(struct proxy_manager *This, REFIID riid, void **ppv)
Definition: marshal.c:932
#define E_NOINTERFACE
Definition: winerror.h:2364
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
HRESULT hr
Definition: shlfolder.c:183
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1172
static HRESULT proxy_manager_get_remunknown(struct proxy_manager *This, IRemUnknown **remunk)
Definition: marshal.c:1088
Definition: features.h:417
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT unmarshal_object(const STDOBJREF *stdobjref, APARTMENT *apt, MSHCTX dest_context, void *dest_context_data, REFIID riid, const OXID_INFO *oxid_info, void **object)
Definition: marshal.c:1340
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
#define index(s, c)
Definition: various.h:29
APARTMENT * apartment_get_current_or_mta(void)
Definition: compobj.c:742
uint32_t entry
Definition: isohybrid.c:63
#define NORMALEXTREFS
Definition: marshal.c:43
IRemUnknown * remunk
Definition: marshal.c:67
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
unsigned int ULONG
Definition: retypes.h:1
#define LIST_ENTRY(type)
Definition: queue.h:175
#define HeapFree(x, y, z)
Definition: compat.h:402
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static struct proxy_manager * impl_from_IMultiQI(IMultiQI *iface)
Definition: marshal.c:73

◆ ClientIdentity_Release()

static ULONG WINAPI ClientIdentity_Release ( IMultiQI iface)
static

Definition at line 243 of file marshal.c.

244 {
245  struct proxy_manager *This = impl_from_IMultiQI(iface);
247  TRACE("%p - after %d\n", iface, refs);
248  if (!refs)
250  return refs;
251 }
static void proxy_manager_destroy(struct proxy_manager *This)
Definition: marshal.c:1155
LONG refs
Definition: marshal.c:64
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
static struct proxy_manager * impl_from_IMultiQI(IMultiQI *iface)
Definition: marshal.c:73

◆ CoGetInterfaceAndReleaseStream()

HRESULT WINAPI CoGetInterfaceAndReleaseStream ( LPSTREAM  pStm,
REFIID  riid,
LPVOID ppv 
)

Definition at line 2144 of file marshal.c.

2146 {
2147  HRESULT hres;
2148 
2149  TRACE("(%p, %s, %p)\n", pStm, debugstr_guid(riid), ppv);
2150 
2151  if(!pStm) return E_INVALIDARG;
2152  hres = CoUnmarshalInterface(pStm, riid, ppv);
2153  IStream_Release(pStm);
2154  return hres;
2155 }
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1981
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define E_INVALIDARG
Definition: ddrawi.h:101
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77

Referenced by CRecyclerDropTarget::_DoDeleteThreadProc(), CFSDropTarget::_DoDropThreadProc(), and test_CoGetInterfaceAndReleaseStream().

◆ CoGetMarshalSizeMax()

HRESULT WINAPI CoGetMarshalSizeMax ( ULONG pulSize,
REFIID  riid,
IUnknown pUnk,
DWORD  dwDestContext,
void pvDestContext,
DWORD  mshlFlags 
)

Definition at line 1800 of file marshal.c.

1803 {
1804  HRESULT hr;
1805  LPMARSHAL pMarshal;
1806  BOOL std_marshal = FALSE;
1807 
1808  if(!pUnk)
1809  return E_POINTER;
1810 
1811  hr = IUnknown_QueryInterface(pUnk, &IID_IMarshal, (void**)&pMarshal);
1812  if (hr != S_OK)
1813  {
1814  std_marshal = TRUE;
1815  hr = CoGetStandardMarshal(riid, pUnk, dwDestContext, pvDestContext,
1816  mshlFlags, &pMarshal);
1817  }
1818  if (hr != S_OK)
1819  return hr;
1820 
1821  hr = IMarshal_GetMarshalSizeMax(pMarshal, riid, pUnk, dwDestContext,
1822  pvDestContext, mshlFlags, pulSize);
1823  if (!std_marshal)
1824  /* add on the size of the whole OBJREF structure like native does */
1825  *pulSize += sizeof(OBJREF);
1826 
1827  IMarshal_Release(pMarshal);
1828  return hr;
1829 }
interface IMarshal * LPMARSHAL
Definition: objfwd.h:11
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
_Check_return_ _Out_ PULONG pulSize
Definition: winddi.h:2120
struct tagOBJREF OBJREF
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI CoGetStandardMarshal(REFIID riid, IUnknown *pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags, LPMARSHAL *ppMarshal)
Definition: marshal.c:1676
#define E_POINTER
Definition: winerror.h:2365
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30

Referenced by CompositeMonikerMarshalImpl_GetMarshalSizeMax(), test_CoGetStandardMarshal(), test_DfMarshal_custom_marshaling(), test_StdMarshal_custom_marshaling(), and WdtpInterfacePointer_UserSize().

◆ CoGetStandardMarshal()

HRESULT WINAPI CoGetStandardMarshal ( REFIID  riid,
IUnknown pUnk,
DWORD  dwDestContext,
LPVOID  pvDestContext,
DWORD  mshlflags,
LPMARSHAL ppMarshal 
)

Definition at line 1676 of file marshal.c.

1679 {
1680  if (pUnk == NULL)
1681  {
1682  FIXME("(%s,NULL,%x,%p,%x,%p), unimplemented yet.\n",
1683  debugstr_guid(riid),dwDestContext,pvDestContext,mshlflags,ppMarshal);
1684  return E_NOTIMPL;
1685  }
1686  TRACE("(%s,%p,%x,%p,%x,%p)\n",
1687  debugstr_guid(riid),pUnk,dwDestContext,pvDestContext,mshlflags,ppMarshal);
1688 
1689  return StdMarshalImpl_Construct(&IID_IMarshal, dwDestContext, pvDestContext, (void**)ppMarshal);
1690 }
REFIID riid
Definition: precomp.h:44
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT StdMarshalImpl_Construct(REFIID, DWORD, void *, void **)
Definition: marshal.c:1633
#define E_NOTIMPL
Definition: ddrawi.h:99
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30

Referenced by CoGetMarshalSizeMax(), CustomMarshal_MarshalInterface(), FTMarshalImpl_GetMarshalSizeMax(), FTMarshalImpl_MarshalInterface(), get_marshaler(), and test_CoGetStandardMarshal().

◆ CoMarshalHresult()

HRESULT WINAPI CoMarshalHresult ( LPSTREAM  pStm,
HRESULT  hresult 
)

Definition at line 2227 of file marshal.c.

2228 {
2229  return IStream_Write(pStm, &hresult, sizeof(hresult), NULL);
2230 }
smooth NULL
Definition: ftsmooth.c:416

Referenced by test_hresult_marshaling().

◆ CoMarshalInterface()

HRESULT WINAPI CoMarshalInterface ( IStream pStream,
REFIID  riid,
IUnknown pUnk,
DWORD  dwDestContext,
void pvDestContext,
DWORD  mshlFlags 
)

Definition at line 1876 of file marshal.c.

1879 {
1880  HRESULT hr;
1881  CLSID marshaler_clsid;
1882  LPMARSHAL pMarshal;
1883 
1884  TRACE("(%p, %s, %p, %x, %p, ", pStream, debugstr_guid(riid), pUnk,
1885  dwDestContext, pvDestContext);
1886  dump_MSHLFLAGS(mshlFlags);
1887  TRACE(")\n");
1888 
1889  if (!pUnk || !pStream)
1890  return E_INVALIDARG;
1891 
1892  /* get the marshaler for the specified interface */
1893  hr = get_marshaler(riid, pUnk, dwDestContext, pvDestContext, mshlFlags, &pMarshal);
1894  if (hr != S_OK)
1895  {
1896  ERR("Failed to get marshaller, 0x%08x\n", hr);
1897  return hr;
1898  }
1899 
1900  hr = IMarshal_GetUnmarshalClass(pMarshal, riid, pUnk, dwDestContext,
1901  pvDestContext, mshlFlags, &marshaler_clsid);
1902  if (hr != S_OK)
1903  {
1904  ERR("IMarshal::GetUnmarshalClass failed, 0x%08x\n", hr);
1905  goto cleanup;
1906  }
1907 
1908  /* FIXME: implement handler marshaling too */
1909  if (IsEqualCLSID(&marshaler_clsid, &CLSID_StdMarshal))
1910  {
1911  TRACE("Using standard marshaling\n");
1912  }
1913  else
1914  {
1915  OBJREF objref;
1916 
1917  TRACE("Using custom marshaling\n");
1918  objref.signature = OBJREF_SIGNATURE;
1919  objref.iid = *riid;
1920  objref.flags = OBJREF_CUSTOM;
1921  objref.u_objref.u_custom.clsid = marshaler_clsid;
1922  objref.u_objref.u_custom.cbExtension = 0;
1923  objref.u_objref.u_custom.size = 0;
1924  hr = IMarshal_GetMarshalSizeMax(pMarshal, riid, pUnk, dwDestContext,
1925  pvDestContext, mshlFlags,
1926  &objref.u_objref.u_custom.size);
1927  if (hr != S_OK)
1928  {
1929  ERR("Failed to get max size of marshal data, error 0x%08x\n", hr);
1930  goto cleanup;
1931  }
1932  /* write constant sized common header and OR_CUSTOM data into stream */
1933  hr = IStream_Write(pStream, &objref,
1934  FIELD_OFFSET(OBJREF, u_objref.u_custom.pData), NULL);
1935  if (hr != S_OK)
1936  {
1937  ERR("Failed to write OR_CUSTOM header to stream with 0x%08x\n", hr);
1938  goto cleanup;
1939  }
1940  }
1941 
1942  TRACE("Calling IMarshal::MarshalInterface\n");
1943  /* call helper object to do the actual marshaling */
1944  hr = IMarshal_MarshalInterface(pMarshal, pStream, riid, pUnk, dwDestContext,
1945  pvDestContext, mshlFlags);
1946 
1947  if (hr != S_OK)
1948  {
1949  ERR("Failed to marshal the interface %s, %x\n", debugstr_guid(riid), hr);
1950  goto cleanup;
1951  }
1952 
1953 cleanup:
1954  IMarshal_Release(pMarshal);
1955 
1956  TRACE("completed with hr 0x%08x\n", hr);
1957 
1958  return hr;
1959 }
interface IMarshal * LPMARSHAL
Definition: objfwd.h:11
#define OBJREF_SIGNATURE
Definition: marshal.c:77
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
GUID iid
Definition: marshal.c:102
ULONG signature
Definition: marshal.c:100
struct tagOBJREF::@1641::OR_CUSTOM u_custom
union tagOBJREF::@1641 u_objref
static void dump_MSHLFLAGS(MSHLFLAGS flags)
Definition: marshal.c:1832
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
ULONG flags
Definition: marshal.c:101
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static HRESULT get_marshaler(REFIID riid, IUnknown *pUnk, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags, LPMARSHAL *pMarshal)
Definition: marshal.c:1697
const CLSID CLSID_StdMarshal
#define OBJREF_CUSTOM
Definition: marshal.c:79
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
char * cleanup(char *str)
Definition: wpickclick.c:99
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30

Referenced by apartment_hostobject(), bsc_thread(), CoMarshalInterThreadInterfaceInStream(), CompositeMonikerMarshalImpl_MarshalInterface(), crash_couninitialize_proc(), duo_marshal_thread_proc(), get_local_server_stream(), host_object_proc(), implicit_mta_marshal_proc(), LresultFromObject(), marshal_stgmed(), marshal_WdtpInterfacePointer(), no_couninitialize_server_proc(), RegisterDragDrop(), RunningObjectTableImpl_Register(), set_src_dataobject(), StdGlobalInterfaceTable_RegisterInterfaceInGlobal(), test_bad_marshal_stream(), test_CoMarshalInterface(), test_CoRegisterPSClsid(), test_CoWaitForMultipleHandles_thread(), test_DfMarshal_custom_marshaling(), test_disconnect_stub(), test_external_connection(), test_file_moniker(), test_InternetSecurityMarshalling(), test_lock_object_external(), test_marshal(), test_moniker(), test_no_marshaler(), test_normal_marshal_and_release(), test_normal_marshal_and_unmarshal(), test_normal_marshal_and_unmarshal_twice(), test_proxy_marshal_and_unmarshal(), test_proxy_marshal_and_unmarshal2(), test_proxy_marshal_and_unmarshal_strong(), test_proxy_marshal_and_unmarshal_weak(), test_same_apartment_unmarshal_failure(), test_StdMarshal_custom_marshaling(), and WdtpInterfacePointer_UserMarshal().

◆ CoMarshalInterThreadInterfaceInStream()

HRESULT WINAPI CoMarshalInterThreadInterfaceInStream ( REFIID  riid,
LPUNKNOWN  pUnk,
LPSTREAM ppStm 
)

Definition at line 2100 of file marshal.c.

2102 {
2103  ULARGE_INTEGER xpos;
2105  HRESULT hres;
2106 
2107  TRACE("(%s, %p, %p)\n",debugstr_guid(riid), pUnk, ppStm);
2108 
2109  hres = CreateStreamOnHGlobal(NULL, TRUE, ppStm);
2110  if (FAILED(hres)) return hres;
2111  hres = CoMarshalInterface(*ppStm, riid, pUnk, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
2112 
2113  if (SUCCEEDED(hres))
2114  {
2115  memset(&seekto, 0, sizeof(seekto));
2116  IStream_Seek(*ppStm, seekto, STREAM_SEEK_SET, &xpos);
2117  }
2118  else
2119  {
2120  IStream_Release(*ppStm);
2121  *ppStm = NULL;
2122  }
2123 
2124  return hres;
2125 }
#define TRUE
Definition: types.h:120
REFIID riid
Definition: precomp.h:44
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define seekto(pos, errstr)
Definition: mkdosfs.c:1613
HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:1876
#define memset(x, y, z)
Definition: compat.h:39
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by CRecyclerDropTarget::_DoDeleteAsync(), CFSDropTarget::Drop(), and test_CoMarshalInterThreadInterfaceInStream().

◆ CoReleaseMarshalData()

HRESULT WINAPI CoReleaseMarshalData ( IStream pStream)

Definition at line 2055 of file marshal.c.

2056 {
2057  HRESULT hr;
2058  LPMARSHAL pMarshal;
2059 
2060  TRACE("(%p)\n", pStream);
2061 
2062  hr = get_unmarshaler_from_stream(pStream, &pMarshal, NULL);
2063  if (hr == S_FALSE)
2064  {
2065  hr = std_release_marshal_data(pStream);
2066  if (hr != S_OK)
2067  ERR("StdMarshal ReleaseMarshalData failed with error 0x%08x\n", hr);
2068  return hr;
2069  }
2070  if (hr != S_OK)
2071  return hr;
2072 
2073  /* call the helper object to do the releasing of marshal data */
2074  hr = IMarshal_ReleaseMarshalData(pMarshal, pStream);
2075  if (hr != S_OK)
2076  ERR("IMarshal::ReleaseMarshalData failed with error 0x%08x\n", hr);
2077 
2078  IMarshal_Release(pMarshal);
2079  return hr;
2080 }
interface IMarshal * LPMARSHAL
Definition: objfwd.h:11
HRESULT hr
Definition: shlfolder.c:183
static HRESULT get_unmarshaler_from_stream(IStream *stream, IMarshal **marshal, IID *iid)
Definition: marshal.c:1719
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
static HRESULT std_release_marshal_data(IStream *pStm)
Definition: marshal.c:1537
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59

Referenced by apartment_release(), crash_couninitialize_proc(), duo_marshal_thread_proc(), host_object_proc(), LresultFromObject(), marshal_WdtpInterfacePointer(), RegisterDragDrop(), release_marshal_data(), release_std_git(), RevokeDragDrop(), rot_entry_delete(), StdGlobalInterfaceTable_RegisterInterfaceInGlobal(), StdGlobalInterfaceTable_RevokeInterfaceFromGlobal(), test_bad_marshal_stream(), test_call_from_message(), test_CoMarshalInterface(), test_disconnect_stub(), test_external_connection(), test_freethreadedmarshaler(), test_lock_object_external(), test_marshal_and_unmarshal_invalid(), test_normal_marshal_and_release(), test_StdMarshal_custom_marshaling(), and window_proc().

◆ CoUnmarshalHresult()

HRESULT WINAPI CoUnmarshalHresult ( LPSTREAM  pStm,
HRESULT phresult 
)

Definition at line 2248 of file marshal.c.

2249 {
2250  return IStream_Read(pStm, phresult, sizeof(*phresult), NULL);
2251 }
smooth NULL
Definition: ftsmooth.c:416

Referenced by test_hresult_marshaling().

◆ CoUnmarshalInterface()

HRESULT WINAPI CoUnmarshalInterface ( IStream pStream,
REFIID  riid,
LPVOID ppv 
)

Definition at line 1981 of file marshal.c.

1982 {
1983  HRESULT hr;
1984  LPMARSHAL pMarshal;
1985  IID iid;
1986  IUnknown *object;
1987 
1988  TRACE("(%p, %s, %p)\n", pStream, debugstr_guid(riid), ppv);
1989 
1990  if (!pStream || !ppv)
1991  return E_INVALIDARG;
1992 
1993  hr = get_unmarshaler_from_stream(pStream, &pMarshal, &iid);
1994  if (hr == S_FALSE)
1995  {
1996  hr = std_unmarshal_interface(0, NULL, pStream, &iid, (void**)&object);
1997  if (hr != S_OK)
1998  ERR("StdMarshal UnmarshalInterface failed, 0x%08x\n", hr);
1999  }
2000  else if (hr == S_OK)
2001  {
2002  /* call the helper object to do the actual unmarshaling */
2003  hr = IMarshal_UnmarshalInterface(pMarshal, pStream, &iid, (LPVOID*)&object);
2004  IMarshal_Release(pMarshal);
2005  if (hr != S_OK)
2006  ERR("IMarshal::UnmarshalInterface failed, 0x%08x\n", hr);
2007  }
2008 
2009  if (hr == S_OK)
2010  {
2011  /* IID_NULL means use the interface ID of the marshaled object */
2012  if (!IsEqualIID(riid, &IID_NULL) && !IsEqualIID(riid, &iid))
2013  {
2014  TRACE("requested interface != marshalled interface, additional QI needed\n");
2015  hr = IUnknown_QueryInterface(object, riid, ppv);
2016  if (hr != S_OK)
2017  ERR("Couldn't query for interface %s, hr = 0x%08x\n",
2018  debugstr_guid(riid), hr);
2019  IUnknown_Release(object);
2020  }
2021  else
2022  {
2023  *ppv = object;
2024  }
2025  }
2026 
2027  TRACE("completed with hr 0x%x\n", hr);
2028 
2029  return hr;
2030 }
interface IMarshal * LPMARSHAL
Definition: objfwd.h:11
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
static HRESULT get_unmarshaler_from_stream(IStream *stream, IMarshal **marshal, IID *iid)
Definition: marshal.c:1719
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define IID_NULL
Definition: guiddef.h:98
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
static HRESULT std_unmarshal_interface(MSHCTX dest_context, void *dest_context_data, IStream *pStm, REFIID riid, void **ppv)
Definition: marshal.c:1409
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
void * object
Definition: jmemsys.h:48

Referenced by apartment_hostobject_in_hostapt(), CoGetInterfaceAndReleaseStream(), CompositeMonikerMarshalImpl_UnmarshalInterface(), cowait_unmarshal_thread(), EnumMonikerImpl_Next(), get_current_dataobject(), get_droptarget_pointer(), implicit_mta_unmarshal_proc(), no_couninitialize_client_proc(), ObjectFromLresult(), RPC_GetLocalClassObject(), RunningObjectTableImpl_GetObject(), StdGlobalInterfaceTable_GetInterfaceFromGlobal(), test_bsc_marshaling(), test_call_from_message(), test_channel_hook(), test_client_security(), test_CoMarshalInterThreadInterfaceInStream(), test_CoUnmarshalInterface(), test_external_connection(), test_file_moniker(), test_GetDataHere_Proxy(), test_handler_marshaling(), test_implicit_mta(), test_interthread_marshal_and_unmarshal(), test_marshal(), test_marshal_and_unmarshal_invalid(), test_marshal_channel_buffer(), test_marshal_proxy_apartment_shutdown(), test_marshal_proxy_mta_apartment_shutdown(), test_marshal_stub_apartment_shutdown(), test_message_filter(), test_moniker(), test_no_couninitialize_server(), test_normal_marshal_and_unmarshal(), test_normal_marshal_and_unmarshal_twice(), test_proxy_interfaces(), test_proxy_marshal_and_unmarshal(), test_proxy_marshal_and_unmarshal2(), test_proxy_marshal_and_unmarshal_strong(), test_proxy_marshal_and_unmarshal_weak(), test_proxy_used_in_wrong_thread(), test_same_apartment_unmarshal_failure(), test_StdMarshal_custom_marshaling(), test_tablestrong_marshal_and_unmarshal_twice(), test_tableweak_and_normal_marshal_and_unmarshal(), test_tableweak_marshal_and_unmarshal_twice(), test_tableweak_marshal_releasedata1(), test_tableweak_marshal_releasedata2(), test_typelibmarshal(), unmarshal_stgmed(), WdtpInterfacePointer_UserUnmarshal(), and window_proc().

◆ dump_MSHLFLAGS()

static void dump_MSHLFLAGS ( MSHLFLAGS  flags)
static

Definition at line 1832 of file marshal.c.

1833 {
1834  if (flags & MSHLFLAGS_TABLESTRONG)
1835  TRACE(" MSHLFLAGS_TABLESTRONG");
1836  if (flags & MSHLFLAGS_TABLEWEAK)
1837  TRACE(" MSHLFLAGS_TABLEWEAK");
1838  if (!(flags & (MSHLFLAGS_TABLESTRONG|MSHLFLAGS_TABLEWEAK)))
1839  TRACE(" MSHLFLAGS_NORMAL");
1840  if (flags & MSHLFLAGS_NOPING)
1841  TRACE(" MSHLFLAGS_NOPING");
1842 }
#define TRACE(s)
Definition: solgame.cpp:4
GLbitfield flags
Definition: glext.h:7161

Referenced by CoMarshalInterface().

◆ fill_std_objref()

static void fill_std_objref ( OBJREF objref,
const GUID iid,
STDOBJREF std 
)
static

Definition at line 398 of file marshal.c.

399 {
400  objref->signature = OBJREF_SIGNATURE;
401  objref->flags = OBJREF_STANDARD;
402  objref->iid = *iid;
403  if(std)
404  objref->u_objref.u_standard.std = *std;
405  memset(&objref->u_objref.u_standard.saResAddr, 0,
406  sizeof(objref->u_objref.u_standard.saResAddr));
407 }
#define OBJREF_SIGNATURE
Definition: marshal.c:77
GUID iid
Definition: marshal.c:102
ULONG signature
Definition: marshal.c:100
union tagOBJREF::@1641 u_objref
Definition: features.h:417
struct tagOBJREF::@1641::OR_STANDARD u_standard
#define OBJREF_STANDARD
Definition: marshal.c:78
ULONG flags
Definition: marshal.c:101
#define memset(x, y, z)
Definition: compat.h:39

Referenced by Proxy_MarshalInterface(), and StdMarshalImpl_MarshalInterface().

◆ find_proxy_manager()

static BOOL find_proxy_manager ( APARTMENT apt,
OXID  oxid,
OID  oid,
struct proxy_manager **  proxy_found 
)
static

Definition at line 1200 of file marshal.c.

1201 {
1202  BOOL found = FALSE;
1203  struct list * cursor;
1204 
1205  EnterCriticalSection(&apt->cs);
1206  LIST_FOR_EACH(cursor, &apt->proxies)
1207  {
1208  struct proxy_manager * proxy = LIST_ENTRY(cursor, struct proxy_manager, entry);
1209  if ((oxid == proxy->oxid) && (oid == proxy->oid))
1210  {
1211  /* be careful of a race with ClientIdentity_Release, which would
1212  * cause us to return a proxy which is in the process of being
1213  * destroyed */
1214  if (IMultiQI_AddRef(&proxy->IMultiQI_iface) != 0)
1215  {
1216  *proxy_found = proxy;
1217  found = TRUE;
1218  break;
1219  }
1220  }
1221  }
1222  LeaveCriticalSection(&apt->cs);
1223  return found;
1224 }
int proxy
Definition: main.c:67
#define TRUE
Definition: types.h:120
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
unsigned int BOOL
Definition: ntddk_ex.h:94
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
struct list proxies
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
const char cursor[]
Definition: icontest.c:13
OXID oxid
Definition: marshal.c:60
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LIST_ENTRY(type)
Definition: queue.h:175
CRITICAL_SECTION cs

Referenced by unmarshal_object().

◆ get_facbuf_for_iid()

static HRESULT get_facbuf_for_iid ( REFIID  riid,
IPSFactoryBuffer **  facbuf 
)
inlinestatic

Definition at line 108 of file marshal.c.

109 {
110  HRESULT hr;
111  CLSID clsid;
112 
113  hr = CoGetPSClsid(riid, &clsid);
114  if (hr != S_OK)
115  return hr;
116  return CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER | WINE_CLSCTX_DONT_HOST,
117  NULL, &IID_IPSFactoryBuffer, (LPVOID*)facbuf);
118 }
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid)
Definition: compobj.c:2690
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3103
LONG HRESULT
Definition: typedefs.h:77
#define WINE_CLSCTX_DONT_HOST
REFCLSID clsid
Definition: msctf.c:82
#define S_OK
Definition: intsafe.h:59

Referenced by marshal_object(), and proxy_manager_create_ifproxy().

◆ get_marshaler()

static HRESULT get_marshaler ( REFIID  riid,
IUnknown pUnk,
DWORD  dwDestContext,
void pvDestContext,
DWORD  mshlFlags,
LPMARSHAL pMarshal 
)
static

Definition at line 1697 of file marshal.c.

1700 {
1701  HRESULT hr;
1702 
1703  if (!pUnk)
1704  return E_POINTER;
1705  hr = IUnknown_QueryInterface(pUnk, &IID_IMarshal, (LPVOID*)pMarshal);
1706  if (hr != S_OK)
1707  hr = CoGetStandardMarshal(riid, pUnk, dwDestContext, pvDestContext,
1708  mshlFlags, pMarshal);
1709  return hr;
1710 }
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI CoGetStandardMarshal(REFIID riid, IUnknown *pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags, LPMARSHAL *ppMarshal)
Definition: marshal.c:1676
#define E_POINTER
Definition: winerror.h:2365
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30

Referenced by CoMarshalInterface().

◆ get_unmarshaler_from_stream()

static HRESULT get_unmarshaler_from_stream ( IStream stream,
IMarshal **  marshal,
IID iid 
)
static

Definition at line 1719 of file marshal.c.

1720 {
1721  HRESULT hr;
1722  ULONG res;
1723  OBJREF objref;
1724 
1725  /* read common OBJREF header */
1726  hr = IStream_Read(stream, &objref, FIELD_OFFSET(OBJREF, u_objref), &res);
1727  if (hr != S_OK || (res != FIELD_OFFSET(OBJREF, u_objref)))
1728  {
1729  ERR("Failed to read common OBJREF header, 0x%08x\n", hr);
1730  return STG_E_READFAULT;
1731  }
1732 
1733  /* sanity check on header */
1734  if (objref.signature != OBJREF_SIGNATURE)
1735  {
1736  ERR("Bad OBJREF signature 0x%08x\n", objref.signature);
1737  return RPC_E_INVALID_OBJREF;
1738  }
1739 
1740  if (iid) *iid = objref.iid;
1741 
1742  /* FIXME: handler marshaling */
1743  if (objref.flags & OBJREF_STANDARD)
1744  {
1745  TRACE("Using standard unmarshaling\n");
1746  *marshal = NULL;
1747  return S_FALSE;
1748  }
1749  else if (objref.flags & OBJREF_CUSTOM)
1750  {
1751  ULONG custom_header_size = FIELD_OFFSET(OBJREF, u_objref.u_custom.pData) -
1752  FIELD_OFFSET(OBJREF, u_objref.u_custom);
1753  TRACE("Using custom unmarshaling\n");
1754  /* read constant sized OR_CUSTOM data from stream */
1755  hr = IStream_Read(stream, &objref.u_objref.u_custom,
1756  custom_header_size, &res);
1757  if (hr != S_OK || (res != custom_header_size))
1758  {
1759  ERR("Failed to read OR_CUSTOM header, 0x%08x\n", hr);
1760  return STG_E_READFAULT;
1761  }
1762  /* now create the marshaler specified in the stream */
1763  hr = CoCreateInstance(&objref.u_objref.u_custom.clsid, NULL,
1764  CLSCTX_INPROC_SERVER, &IID_IMarshal,
1765  (LPVOID*)marshal);
1766  }
1767  else
1768  {
1769  FIXME("Invalid or unimplemented marshaling type specified: %x\n",
1770  objref.flags);
1771  return RPC_E_INVALID_OBJREF;
1772  }
1773 
1774  if (hr != S_OK)
1775  ERR("Failed to create marshal, 0x%08x\n", hr);
1776 
1777  return hr;
1778 }
#define OBJREF_SIGNATURE
Definition: marshal.c:77
HRESULT hr
Definition: shlfolder.c:183
GUID iid
Definition: marshal.c:102
ULONG signature
Definition: marshal.c:100
struct tagOBJREF::@1641::OR_CUSTOM u_custom
union tagOBJREF::@1641 u_objref
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define OBJREF_STANDARD
Definition: marshal.c:78
ULONG flags
Definition: marshal.c:101
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
Definition: parse.h:22
#define OBJREF_CUSTOM
Definition: marshal.c:79
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define STG_E_READFAULT
Definition: winerror.h:2576
GLuint res
Definition: glext.h:9613
unsigned int ULONG
Definition: retypes.h:1
#define RPC_E_INVALID_OBJREF
Definition: winerror.h:2505

Referenced by CoReleaseMarshalData(), and CoUnmarshalInterface().

◆ ifproxy_destroy()

static void ifproxy_destroy ( struct ifproxy This)
static

Definition at line 772 of file marshal.c.

773 {
774  TRACE("%p\n", This);
775 
776  /* release public references to this object so that the stub can know
777  * when to destroy itself */
779 
780  list_remove(&This->entry);
781 
782  if (This->chan)
783  {
784  IRpcChannelBuffer_Release(This->chan);
785  This->chan = NULL;
786  }
787 
788  if (This->proxy) IRpcProxyBuffer_Release(This->proxy);
789 
791 }
smooth NULL
Definition: ftsmooth.c:416
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
static HRESULT ifproxy_release_public_refs(struct ifproxy *This)
Definition: marshal.c:718
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by proxy_manager_create_ifproxy(), proxy_manager_destroy(), and unmarshal_object().

◆ ifproxy_disconnect()

static void ifproxy_disconnect ( struct ifproxy This)
static

Definition at line 762 of file marshal.c.

763 {
765  if (This->proxy) IRpcProxyBuffer_Disconnect(This->proxy);
766 
767  IRpcChannelBuffer_Release(This->chan);
768  This->chan = NULL;
769 }
smooth NULL
Definition: ftsmooth.c:416
static HRESULT ifproxy_release_public_refs(struct ifproxy *This)
Definition: marshal.c:718

Referenced by proxy_manager_disconnect().

◆ ifproxy_get_public_ref()

static HRESULT ifproxy_get_public_ref ( struct ifproxy This)
static

Definition at line 681 of file marshal.c.

682 {
683  HRESULT hr = S_OK;
684 
685  if (WAIT_OBJECT_0 != WaitForSingleObject(This->parent->remoting_mutex, INFINITE))
686  {
687  ERR("Wait failed for ifproxy %p\n", This);
688  return E_UNEXPECTED;
689  }
690 
691  if (This->refs == 0)
692  {
694 
695  TRACE("getting public ref for ifproxy %p\n", This);
696 
698  if (hr == S_OK)
699  {
700  HRESULT hrref = S_OK;
701  REMINTERFACEREF rif;
702  rif.ipid = This->stdobjref.ipid;
703  rif.cPublicRefs = NORMALEXTREFS;
704  rif.cPrivateRefs = 0;
705  hr = IRemUnknown_RemAddRef(remunk, 1, &rif, &hrref);
706  IRemUnknown_Release(remunk);
707  if (hr == S_OK && hrref == S_OK)
709  else
710  ERR("IRemUnknown_RemAddRef returned with 0x%08x, hrref = 0x%08x\n", hr, hrref);
711  }
712  }
713  ReleaseMutex(This->parent->remoting_mutex);
714 
715  return hr;
716 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT proxy_manager_get_remunknown(struct proxy_manager *This, IRemUnknown **remunk)
Definition: marshal.c:1088
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define InterlockedExchangeAdd
Definition: interlocked.h:181
#define TRACE(s)
Definition: solgame.cpp:4
#define WAIT_OBJECT_0
Definition: winbase.h:387
LONG HRESULT
Definition: typedefs.h:77
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
Definition: synch.c:618
#define NORMALEXTREFS
Definition: marshal.c:43
IRemUnknown * remunk
Definition: marshal.c:67
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
#define E_UNEXPECTED
Definition: winerror.h:2456
#define INFINITE
Definition: serial.h:102

Referenced by unmarshal_object().

◆ ifproxy_release_public_refs()

static HRESULT ifproxy_release_public_refs ( struct ifproxy This)
static

Definition at line 718 of file marshal.c.

719 {
720  HRESULT hr = S_OK;
721  LONG public_refs;
722 
723  if (WAIT_OBJECT_0 != WaitForSingleObject(This->parent->remoting_mutex, INFINITE))
724  {
725  ERR("Wait failed for ifproxy %p\n", This);
726  return E_UNEXPECTED;
727  }
728 
729  public_refs = This->refs;
730  if (public_refs > 0)
731  {
733 
734  TRACE("releasing %d refs\n", public_refs);
735 
737  if (hr == S_OK)
738  {
739  REMINTERFACEREF rif;
740  rif.ipid = This->stdobjref.ipid;
741  rif.cPublicRefs = public_refs;
742  rif.cPrivateRefs = 0;
743  hr = IRemUnknown_RemRelease(remunk, 1, &rif);
744  IRemUnknown_Release(remunk);
745  if (hr == S_OK)
746  InterlockedExchangeAdd((LONG *)&This->refs, -public_refs);
747  else if (hr == RPC_E_DISCONNECTED)
748  WARN("couldn't release references because object was "
749  "disconnected: oxid = %s, oid = %s\n",
750  wine_dbgstr_longlong(This->parent->oxid),
751  wine_dbgstr_longlong(This->parent->oid));
752  else
753  ERR("IRemUnknown_RemRelease failed with error 0x%08x\n", hr);
754  }
755  }
756  ReleaseMutex(This->parent->remoting_mutex);
757 
758  return hr;
759 }
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
static HRESULT proxy_manager_get_remunknown(struct proxy_manager *This, IRemUnknown **remunk)
Definition: marshal.c:1088
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define InterlockedExchangeAdd
Definition: interlocked.h:181
#define TRACE(s)
Definition: solgame.cpp:4
#define WAIT_OBJECT_0
Definition: winbase.h:387
LONG HRESULT
Definition: typedefs.h:77
#define RPC_E_DISCONNECTED
Definition: winerror.h:2484
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
Definition: synch.c:618
IRemUnknown * remunk
Definition: marshal.c:67
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
#define E_UNEXPECTED
Definition: winerror.h:2456
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
#define INFINITE
Definition: serial.h:102

Referenced by ifproxy_destroy(), and ifproxy_disconnect().

◆ impl_from_IClientSecurity()

static struct proxy_manager* impl_from_IClientSecurity ( IClientSecurity iface)
inlinestatic

Definition at line 83 of file marshal.c.

84 {
86 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
IClientSecurity IClientSecurity_iface
Definition: marshal.c:57

Referenced by ProxyCliSec_AddRef(), ProxyCliSec_QueryInterface(), and ProxyCliSec_Release().

◆ impl_from_IMarshal()

static struct proxy_manager* impl_from_IMarshal ( IMarshal iface)
inlinestatic

Definition at line 78 of file marshal.c.

79 {
80  return CONTAINING_RECORD(iface, struct proxy_manager, IMarshal_iface);
81 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
IMarshal IMarshal_iface
Definition: marshal.c:56

Referenced by Proxy_AddRef(), Proxy_DisconnectObject(), Proxy_MarshalInterface(), Proxy_QueryInterface(), Proxy_Release(), Proxy_ReleaseMarshalData(), and Proxy_UnmarshalInterface().

◆ impl_from_IMultiQI()

static struct proxy_manager* impl_from_IMultiQI ( IMultiQI iface)
inlinestatic

Definition at line 73 of file marshal.c.

74 {
75  return CONTAINING_RECORD(iface, struct proxy_manager, IMultiQI_iface);
76 }
IMultiQI IMultiQI_iface
Definition: marshal.c:55
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by ClientIdentity_AddRef(), ClientIdentity_QueryMultipleInterfaces(), and ClientIdentity_Release().

◆ impl_from_StdMarshal()

static StdMarshalImpl* impl_from_StdMarshal ( IMarshal iface)
inlinestatic

Definition at line 1248 of file marshal.c.

1249 {
1251 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
IMarshal IMarshal_iface
Definition: marshal.c:56

Referenced by StdMarshalImpl_AddRef(), StdMarshalImpl_Release(), and StdMarshalImpl_UnmarshalInterface().

◆ MARSHAL_GetStandardMarshalCF()

HRESULT MARSHAL_GetStandardMarshalCF ( LPVOID ppv)

Definition at line 2205 of file marshal.c.

2206 {
2207  *ppv = &StdMarshalCF;
2208  return S_OK;
2209 }
REFIID LPVOID * ppv
Definition: atlbase.h:39
static const IClassFactoryVtbl * StdMarshalCF
Definition: marshal.c:2203
#define S_OK
Definition: intsafe.h:59

Referenced by DllGetClassObject().

◆ marshal_object()

HRESULT marshal_object ( APARTMENT apt,
STDOBJREF stdobjref,
REFIID  riid,
IUnknown object,
DWORD  dest_context,
void dest_context_data,
MSHLFLAGS  mshlflags 
)

Definition at line 121 of file marshal.c.

123 {
124  struct stub_manager *manager;
125  struct ifstub *ifstub;
126  BOOL tablemarshal;
127  HRESULT hr;
128 
129  hr = apartment_getoxid(apt, &stdobjref->oxid);
130  if (hr != S_OK)
131  return hr;
132 
134  if (hr != S_OK)
135  return hr;
136 
137  if (!(manager = get_stub_manager_from_object(apt, object, TRUE)))
138  return E_OUTOFMEMORY;
139 
140  stdobjref->flags = SORF_NULL;
141  if (mshlflags & MSHLFLAGS_TABLEWEAK)
142  stdobjref->flags |= SORFP_TABLEWEAK;
143  if (mshlflags & MSHLFLAGS_NOPING)
144  stdobjref->flags |= SORF_NOPING;
145  stdobjref->oid = manager->oid;
146 
147  tablemarshal = ((mshlflags & MSHLFLAGS_TABLESTRONG) || (mshlflags & MSHLFLAGS_TABLEWEAK));
148 
149  /* make sure ifstub that we are creating is unique */
150  ifstub = stub_manager_find_ifstub(manager, riid, mshlflags);
151  if (!ifstub) {
153 
154  /* IUnknown doesn't require a stub buffer, because it never goes out on
155  * the wire */
156  if (!IsEqualIID(riid, &IID_IUnknown))
157  {
158  IPSFactoryBuffer *psfb;
159 
160  hr = get_facbuf_for_iid(riid, &psfb);
161  if (hr == S_OK) {
162  hr = IPSFactoryBuffer_CreateStub(psfb, riid, manager->object, &stub);
163  IPSFactoryBuffer_Release(psfb);
164  if (hr != S_OK)
165  ERR("Failed to create an IRpcStubBuffer from IPSFactory for %s with error 0x%08x\n",
166  debugstr_guid(riid), hr);
167  }else {
168  ERR("couldn't get IPSFactory buffer for interface %s\n", debugstr_guid(riid));
169  hr = E_NOINTERFACE;
170  }
171 
172  }
173 
174  if (hr == S_OK) {
175  ifstub = stub_manager_new_ifstub(manager, stub, riid, dest_context, dest_context_data, mshlflags);
176  if (!ifstub)
177  hr = E_OUTOFMEMORY;
178  }
179  if (stub) IRpcStubBuffer_Release(stub);
180 
181  if (hr != S_OK) {
182  stub_manager_int_release(manager);
183  /* destroy the stub manager if it has no ifstubs by releasing
184  * zero external references */
185  stub_manager_ext_release(manager, 0, FALSE, TRUE);
186  return hr;
187  }
188  }
189 
190  if (!tablemarshal)
191  {
192  stdobjref->cPublicRefs = NORMALEXTREFS;
193  stub_manager_ext_addref(manager, stdobjref->cPublicRefs, FALSE);
194  }
195  else
196  {
197  stdobjref->cPublicRefs = 0;
198  if (mshlflags & MSHLFLAGS_TABLESTRONG)
199  stub_manager_ext_addref(manager, 1, FALSE);
200  else
201  stub_manager_ext_addref(manager, 0, TRUE);
202  }
203 
204  /* FIXME: check return value */
206 
207  stdobjref->ipid = ifstub->ipid;
208 
209  stub_manager_int_release(manager);
210  return S_OK;
211 }
struct ifstub * stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *sb, REFIID iid, DWORD dest_context, void *dest_context_data, MSHLFLAGS flags) DECLSPEC_HIDDEN
Definition: stubmanager.c:70
struct ifstub * stub_manager_find_ifstub(struct stub_manager *m, REFIID iid, MSHLFLAGS flags) DECLSPEC_HIDDEN
Definition: stubmanager.c:158
ULONG flags
Definition: marshal.c:92
#define TRUE
Definition: types.h:120
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT apartment_createwindowifneeded(struct apartment *apt)
Definition: compobj.c:1704
IPID ipid
Definition: marshal.c:96
HRESULT hr
Definition: shlfolder.c:183
static HRESULT apartment_getoxid(const struct apartment *apt, OXID *oxid)
REFIID riid
Definition: precomp.h:44
ULONG stub_manager_int_release(struct stub_manager *This) DECLSPEC_HIDDEN
Definition: stubmanager.c:311
Definition: stubgen.c:11
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
ULONG stub_manager_ext_addref(struct stub_manager *m, ULONG refs, BOOL tableweak) DECLSPEC_HIDDEN
Definition: stubmanager.c:408
#define debugstr_guid
Definition: kernel32.h:35
OXID oxid
Definition: marshal.c:94
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
HRESULT RPC_RegisterInterface(REFIID riid) DECLSPEC_HIDDEN
Definition: rpc.c:1530
#define NORMALEXTREFS
Definition: marshal.c:43
#define ERR(fmt,...)
Definition: debug.h:109
ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs, BOOL tableweak, BOOL last_unlock_releases) DECLSPEC_HIDDEN
Definition: stubmanager.c:439
#define S_OK
Definition: intsafe.h:59
IUnknown * object
static HRESULT get_facbuf_for_iid(REFIID riid, IPSFactoryBuffer **facbuf)
Definition: marshal.c:108
ULONG cPublicRefs
Definition: marshal.c:93
struct stub_manager * get_stub_manager_from_object(APARTMENT *apt, IUnknown *object, BOOL alloc) DECLSPEC_HIDDEN
Definition: stubmanager.c:337
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define SORFP_TABLEWEAK
Definition: marshal.c:47

Referenced by RemUnknown_RemQueryInterface(), start_apartment_remote_unknown(), and StdMarshalImpl_MarshalInterface().

◆ Proxy_AddRef()

static ULONG WINAPI Proxy_AddRef ( IMarshal iface)
static

Definition at line 370 of file marshal.c.

371 {
372  struct proxy_manager *This = impl_from_IMarshal( iface );
373  return IMultiQI_AddRef(&This->IMultiQI_iface);
374 }
static struct proxy_manager * impl_from_IMarshal(IMarshal *iface)
Definition: marshal.c:78

◆ Proxy_DisconnectObject()

static HRESULT WINAPI Proxy_DisconnectObject ( IMarshal iface,
DWORD  dwReserved 
)
static

Definition at line 568 of file marshal.c.

569 {
570  struct proxy_manager *This = impl_from_IMarshal( iface );
571  IMarshal *marshal;
572  HRESULT hr;
573 
574  TRACE("(%p, %x)\n", This, dwReserved);
575 
576  hr = StdMarshalImpl_Construct(&IID_IMarshal, This->dest_context,
577  This->dest_context_data, (void**)&marshal);
578  if(FAILED(hr))
579  return hr;
580 
581  hr = IMarshal_DisconnectObject(marshal, dwReserved);
582  IMarshal_Release(marshal);
583  return hr;
584 }
HRESULT hr
Definition: shlfolder.c:183
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static HRESULT StdMarshalImpl_Construct(REFIID, DWORD, void *, void **)
Definition: marshal.c:1633
static struct proxy_manager * impl_from_IMarshal(IMarshal *iface)
Definition: marshal.c:78

◆ Proxy_GetMarshalSizeMax()

static HRESULT WINAPI Proxy_GetMarshalSizeMax ( IMarshal iface,
REFIID  riid,
void pv,
DWORD  dwDestContext,
void pvDestContext,
DWORD  mshlflags,
DWORD pSize 
)
static

Definition at line 390 of file marshal.c.

393 {
394  *pSize = FIELD_OFFSET(OBJREF, u_objref.u_standard.saResAddr.aStringArray);
395  return S_OK;
396 }
struct tagOBJREF::@1641::OR_STANDARD u_standard
#define S_OK
Definition: intsafe.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254

◆ Proxy_GetUnmarshalClass()

static HRESULT WINAPI Proxy_GetUnmarshalClass ( IMarshal iface,
REFIID  riid,
void pv,
DWORD  dwDestContext,
void pvDestContext,
DWORD  mshlflags,
CLSID pCid 
)
static

Definition at line 382 of file marshal.c.

385 {
386  *pCid = CLSID_StdMarshal;
387  return S_OK;
388 }
const CLSID CLSID_StdMarshal
#define S_OK
Definition: intsafe.h:59

◆ proxy_manager_construct()

static HRESULT proxy_manager_construct ( APARTMENT apt,
ULONG  sorflags,
OXID  oxid,
OID  oid,
const OXID_INFO *  oxid_info,
struct proxy_manager **  proxy_manager 
)
static

Definition at line 793 of file marshal.c.

796 {
797  struct proxy_manager * This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
798  if (!This) return E_OUTOFMEMORY;
799 
800  This->remoting_mutex = CreateMutexW(NULL, FALSE, NULL);
801  if (!This->remoting_mutex)
802  {
805  }
806 
807  if (oxid_info)
808  {
809  This->oxid_info.dwPid = oxid_info->dwPid;
810  This->oxid_info.dwTid = oxid_info->dwTid;
811  This->oxid_info.ipidRemUnknown = oxid_info->ipidRemUnknown;
812  This->oxid_info.dwAuthnHint = oxid_info->dwAuthnHint;
813  This->oxid_info.psa = NULL /* FIXME: copy from oxid_info */;
814  }
815  else
816  {
817  HRESULT hr = RPC_ResolveOxid(oxid, &This->oxid_info);
818  if (FAILED(hr))
819  {
820  CloseHandle(This->remoting_mutex);
822  return hr;
823  }
824  }
825 
826  This->IMultiQI_iface.lpVtbl = &ClientIdentity_Vtbl;
827  This->IMarshal_iface.lpVtbl = &ProxyMarshal_Vtbl;
828  This->IClientSecurity_iface.lpVtbl = &ProxyCliSec_Vtbl;
829 
830  list_init(&This->entry);
831  list_init(&This->interfaces);
832 
834  DEBUG_SET_CRITSEC_NAME(&This->cs, "proxy_manager");
835 
836  /* the apartment the object was unmarshaled into */
837  This->parent = apt;
838 
839  /* the source apartment and id of the object */
840  This->oxid = oxid;
841  This->oid = oid;
842 
843  This->refs = 1;
844 
845  /* the DCOM draft specification states that the SORF_NOPING flag is
846  * proxy manager specific, not ifproxy specific, so this implies that we
847  * should store the STDOBJREF flags here in the proxy manager. */
848  This->sorflags = sorflags;
849 
850  /* we create the IRemUnknown proxy on demand */
851  This->remunk = NULL;
852 
853  /* initialise these values to the weakest values and they will be
854  * overwritten in proxy_manager_set_context */
855  This->dest_context = MSHCTX_INPROC;
856  This->dest_context_data = NULL;
857 
858  EnterCriticalSection(&apt->cs);
859  /* FIXME: we are dependent on the ordering in here to make sure a proxy's
860  * IRemUnknown proxy doesn't get destroyed before the regular proxy does
861  * because we need the IRemUnknown proxy during the destruction of the
862  * regular proxy. Ideally, we should maintain a separate list for the
863  * IRemUnknown proxies that need late destruction */
864  list_add_tail(&apt->proxies, &This->entry);
865  LeaveCriticalSection(&apt->cs);
866 
867  TRACE("%p created for OXID %s, OID %s\n", This,
869 
870  *proxy_manager = This;
871  return S_OK;
872 }
#define CloseHandle
Definition: compat.h:406
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
#define DEBUG_SET_CRITSEC_NAME(cs, name)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const IClientSecurityVtbl ProxyCliSec_Vtbl
Definition: marshal.c:671
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
smooth NULL
Definition: ftsmooth.c:416
struct list proxies
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
OXID_INFO oxid_info
Definition: marshal.c:61
LONG HRESULT
Definition: typedefs.h:77
ULONG sorflags
Definition: marshal.c:66
#define S_OK
Definition: intsafe.h:59
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:576
OXID oxid
Definition: marshal.c:60
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
static const IMarshalVtbl ProxyMarshal_Vtbl
Definition: marshal.c:586
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
HRESULT RPC_ResolveOxid(OXID oxid, OXID_INFO *oxid_info) DECLSPEC_HIDDEN
Definition: rpc.c:1609
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
CRITICAL_SECTION cs
#define HeapFree(x, y, z)
Definition: compat.h:402
static const IMultiQIVtbl ClientIdentity_Vtbl
Definition: marshal.c:354

Referenced by unmarshal_object().

◆ proxy_manager_create_ifproxy()

static HRESULT proxy_manager_create_ifproxy ( struct proxy_manager This,
const STDOBJREF stdobjref,
REFIID  riid,
IRpcChannelBuffer channel,
struct ifproxy **  iif_out 
)
static

Definition at line 971 of file marshal.c.

974 {
975  HRESULT hr;
976  IPSFactoryBuffer * psfb;
977  struct ifproxy * ifproxy = HeapAlloc(GetProcessHeap(), 0, sizeof(*ifproxy));
978  if (!ifproxy) return E_OUTOFMEMORY;
979 
981 
982  ifproxy->parent = This;
984  ifproxy->iid = *riid;
985  ifproxy->refs = 0;
986  ifproxy->proxy = NULL;
987 
988  assert(channel);
989  ifproxy->chan = channel; /* FIXME: we should take the binding strings and construct the channel in this function */
990 
991  /* the IUnknown interface is special because it does not have a
992  * proxy associated with the ifproxy as we handle IUnknown ourselves */
994  {
995  ifproxy->iface = &This->IMultiQI_iface;
996  IMultiQI_AddRef(&This->IMultiQI_iface);
997  hr = S_OK;
998  }
999  else
1000  {
1001  hr = get_facbuf_for_iid(riid, &psfb);
1002  if (hr == S_OK)
1003  {
1004  /* important note: the outer unknown is set to the proxy manager.
1005  * This ensures the COM identity rules are not violated, by having a
1006  * one-to-one mapping of objects on the proxy side to objects on the
1007  * stub side, no matter which interface you view the object through */
1008  hr = IPSFactoryBuffer_CreateProxy(psfb, (IUnknown*)&This->IMultiQI_iface, riid,
1009  &ifproxy->proxy, &ifproxy->iface);
1010  IPSFactoryBuffer_Release(psfb);
1011  if (hr != S_OK)
1012  ERR("Could not create proxy for interface %s, error 0x%08x\n",
1013  debugstr_guid(riid), hr);
1014  }
1015  else
1016  ERR("Could not get IPSFactoryBuffer for interface %s, error 0x%08x\n",
1017  debugstr_guid(riid), hr);
1018 
1019  if (hr == S_OK)
1020  hr = IRpcProxyBuffer_Connect(ifproxy->proxy, ifproxy->chan);
1021  }
1022 
1023  if (hr == S_OK)
1024  {
1025  EnterCriticalSection(&This->cs);
1026  list_add_tail(&This->interfaces, &ifproxy->entry);
1027  LeaveCriticalSection(&This->cs);
1028 
1029  *iif_out = ifproxy;
1030  TRACE("ifproxy %p created for IPID %s, interface %s with %u public refs\n",
1032  }
1033  else
1035 
1036  return hr;
1037 }
struct proxy_manager * parent
IPID ipid
Definition: marshal.c:96
HRESULT hr
Definition: shlfolder.c:183
LPRPCPROXYBUFFER proxy
STDOBJREF stdobjref
REFIID riid
Definition: precomp.h:44
#define assert(x)
Definition: debug.h:53
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
LPVOID iface
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
struct list entry
IRpcChannelBuffer * chan
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
static void ifproxy_destroy(struct ifproxy *This)
Definition: marshal.c:772
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
static HRESULT get_facbuf_for_iid(REFIID riid, IPSFactoryBuffer **facbuf)
Definition: marshal.c:108
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
ULONG cPublicRefs
Definition: marshal.c:93
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

Referenced by unmarshal_object().

◆ proxy_manager_destroy()

static void proxy_manager_destroy ( struct proxy_manager This)
static

Definition at line 1155 of file marshal.c.

1156 {
1157  struct list * cursor;
1158 
1159  TRACE("oxid = %s, oid = %s\n", wine_dbgstr_longlong(This->oxid),
1160  wine_dbgstr_longlong(This->oid));
1161 
1162  if (This->parent)
1163  {
1164  EnterCriticalSection(&This->parent->cs);
1165 
1166  /* remove ourself from the list of proxy objects in the apartment */
1167  LIST_FOR_EACH(cursor, &This->parent->proxies)
1168  {
1169  if (cursor == &This->entry)
1170  {
1171  list_remove(&This->entry);
1172  break;
1173  }
1174  }
1175 
1176  LeaveCriticalSection(&This->parent->cs);
1177  }
1178 
1179  /* destroy all of the interface proxies */
1180  while ((cursor = list_head(&This->interfaces)))
1181  {
1182  struct ifproxy * ifproxy = LIST_ENTRY(cursor, struct ifproxy, entry);
1184  }
1185 
1186  if (This->remunk) IRemUnknown_Release(This->remunk);
1187  CoTaskMemFree(This->oxid_info.psa);
1188 
1191 
1192  CloseHandle(This->remoting_mutex);
1193 
1194  HeapFree(GetProcessHeap(), 0, This);
1195 }
#define CloseHandle
Definition: compat.h:406
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
#define DEBUG_CLEAR_CRITSEC_NAME(cs)
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
static void ifproxy_destroy(struct ifproxy *This)
Definition: marshal.c:772
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
const char cursor[]
Definition: icontest.c:13
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LIST_ENTRY(type)
Definition: queue.h:175
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by ClientIdentity_Release().

◆ proxy_manager_disconnect()

static void proxy_manager_disconnect ( struct proxy_manager This)
static

Definition at line 1060 of file marshal.c.

1061 {
1062  struct list * cursor;
1063 
1064  TRACE("oxid = %s, oid = %s\n", wine_dbgstr_longlong(This->oxid),
1065  wine_dbgstr_longlong(This->oid));
1066 
1067  EnterCriticalSection(&This->cs);
1068 
1069  /* SORFP_NOLIFTIMEMGMT proxies (for IRemUnknown) shouldn't be
1070  * disconnected - it won't do anything anyway, except cause
1071  * problems for other objects that depend on this proxy always
1072  * working */
1073  if (!(This->sorflags & SORFP_NOLIFETIMEMGMT))
1074  {
1075  LIST_FOR_EACH(cursor, &This->interfaces)
1076  {
1077  struct ifproxy * ifproxy = LIST_ENTRY(cursor, struct ifproxy, entry);
1079  }
1080  }
1081 
1082  /* apartment is being destroyed so don't keep a pointer around to it */
1083  This->parent = NULL;
1084 
1085  LeaveCriticalSection(&This->cs);
1086 }
#define SORFP_NOLIFETIMEMGMT
Definition: marshal.c:50
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
smooth NULL
Definition: ftsmooth.c:416
static void ifproxy_disconnect(struct ifproxy *This)
Definition: marshal.c:762
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
const char cursor[]
Definition: icontest.c:13
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by apartment_disconnectproxies().

◆ proxy_manager_find_ifproxy()

static HRESULT proxy_manager_find_ifproxy ( struct proxy_manager This,
REFIID  riid,
struct ifproxy **  ifproxy_found 
)
static

Definition at line 1039 of file marshal.c.

1040 {
1041  HRESULT hr = E_NOINTERFACE; /* assume not found */
1042  struct list * cursor;
1043 
1044  EnterCriticalSection(&This->cs);
1045  LIST_FOR_EACH(cursor, &This->interfaces)
1046  {
1047  struct ifproxy * ifproxy = LIST_ENTRY(cursor, struct ifproxy, entry);
1048  if (IsEqualIID(riid, &ifproxy->iid))
1049  {
1050  *ifproxy_found = ifproxy;
1051  hr = S_OK;
1052  break;
1053  }
1054  }
1055  LeaveCriticalSection(&This->cs);
1056 
1057  return hr;
1058 }
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
LONG HRESULT
Definition: typedefs.h:77
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
#define S_OK
Definition: intsafe.h:59
const char cursor[]
Definition: icontest.c:13
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LIST_ENTRY(type)
Definition: queue.h:175
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

Referenced by proxy_manager_query_local_interface(), Proxy_MarshalInterface(), and unmarshal_object().

◆ proxy_manager_get_remunknown()

static HRESULT proxy_manager_get_remunknown ( struct proxy_manager This,
IRemUnknown **  remunk 
)
static

Definition at line 1088 of file marshal.c.

1089 {
1090  HRESULT hr = S_OK;
1091  struct apartment *apt;
1092  BOOL called_in_original_apt;
1093 
1094  /* we don't want to try and unmarshal or use IRemUnknown if we don't want
1095  * lifetime management */
1096  if (This->sorflags & SORFP_NOLIFETIMEMGMT)
1097  return S_FALSE;
1098 
1099  if (!(apt = apartment_get_current_or_mta()))
1100  return CO_E_NOTINITIALIZED;
1101 
1102  called_in_original_apt = This->parent && (This->parent->oxid == apt->oxid);
1103 
1104  EnterCriticalSection(&This->cs);
1105  /* only return the cached object if called from the original apartment.
1106  * in future, we might want to make the IRemUnknown proxy callable from any
1107  * apartment to avoid these checks */
1108  if (This->remunk && called_in_original_apt)
1109  {
1110  /* already created - return existing object */
1111  *remunk = This->remunk;
1112  IRemUnknown_AddRef(*remunk);
1113  }
1114  else if (!This->parent)
1115  {
1116  /* disconnected - we can't create IRemUnknown */
1117  *remunk = NULL;
1118  hr = S_FALSE;
1119  }
1120  else
1121  {
1122  STDOBJREF stdobjref;
1123  /* Don't want IRemUnknown lifetime management as this is IRemUnknown!
1124  * We also don't care about whether or not the stub is still alive */
1125  stdobjref.flags = SORFP_NOLIFETIMEMGMT | SORF_NOPING;
1126  stdobjref.cPublicRefs = 1;
1127  /* oxid of destination object */
1128  stdobjref.oxid = This->oxid;
1129  /* FIXME: what should be used for the oid? The DCOM draft doesn't say */
1130  stdobjref.oid = (OID)-1;
1131  stdobjref.ipid = This->oxid_info.ipidRemUnknown;
1132 
1133  /* do the unmarshal */
1134  hr = unmarshal_object(&stdobjref, apt, This->dest_context,
1135  This->dest_context_data, &IID_IRemUnknown,
1136  &This->oxid_info, (void**)remunk);
1137  if (hr == S_OK && called_in_original_apt)
1138  {
1139  This->remunk = *remunk;
1140  IRemUnknown_AddRef(This->remunk);
1141  }
1142  }
1143  LeaveCriticalSection(&This->cs);
1144  apartment_release(apt);
1145 
1146  TRACE("got IRemUnknown* pointer %p, hr = 0x%08x\n", *remunk, hr);
1147 
1148  return hr;
1149 }
ULONG flags
Definition: marshal.c:92
IPID ipid
Definition: marshal.c:96
#define SORFP_NOLIFETIMEMGMT
Definition: marshal.c:50
HRESULT hr
Definition: shlfolder.c:183
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1172
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define CO_E_NOTINITIALIZED
unsigned int BOOL
Definition: ntddk_ex.h:94
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
OXID oxid
Definition: marshal.c:94
static HRESULT unmarshal_object(const STDOBJREF *stdobjref, APARTMENT *apt, MSHCTX dest_context, void *dest_context_data, REFIID riid, const OXID_INFO *oxid_info, void **object)
Definition: marshal.c:1340
LONG HRESULT
Definition: typedefs.h:77
static const IID IID_IRemUnknown
Definition: marshal.c:130
UINT64 OID
Definition: marshal.c:88
APARTMENT * apartment_get_current_or_mta(void)
Definition: compobj.c:742
#define S_OK
Definition: intsafe.h:59
ULONG cPublicRefs
Definition: marshal.c:93
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by ClientIdentity_QueryMultipleInterfaces(), ifproxy_get_public_ref(), ifproxy_release_public_refs(), and Proxy_MarshalInterface().

◆ proxy_manager_query_local_interface()

static HRESULT proxy_manager_query_local_interface ( struct proxy_manager This,
REFIID  riid,
void **  ppv 
)
static

Definition at line 932 of file marshal.c.

933 {
934  HRESULT hr;
935  struct ifproxy * ifproxy;
936 
937  TRACE("%s\n", debugstr_guid(riid));
938 
939  if (IsEqualIID(riid, &IID_IUnknown) ||
940  IsEqualIID(riid, &IID_IMultiQI))
941  {
942  *ppv = &This->IMultiQI_iface;
943  IMultiQI_AddRef(&This->IMultiQI_iface);
944  return S_OK;
945  }
946  if (IsEqualIID(riid, &IID_IMarshal))
947  {
948  *ppv = &This->IMarshal_iface;
949  IMarshal_AddRef(&This->IMarshal_iface);
950  return S_OK;
951  }
952  if (IsEqualIID(riid, &IID_IClientSecurity))
953  {
954  *ppv = &This->IClientSecurity_iface;
955  IClientSecurity_AddRef(&This->IClientSecurity_iface);
956  return S_OK;
957  }
958 
960  if (hr == S_OK)
961  {
962  *ppv = ifproxy->iface;
963  IUnknown_AddRef((IUnknown *)*ppv);
964  return S_OK;
965  }
966 
967  *ppv = NULL;
968  return E_NOINTERFACE;
969 }
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
LPVOID iface
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
static HRESULT proxy_manager_find_ifproxy(struct proxy_manager *This, REFIID riid, struct ifproxy **ifproxy_found)
Definition: marshal.c:1039
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

Referenced by ClientIdentity_QueryMultipleInterfaces().

◆ proxy_manager_set_context()

static void proxy_manager_set_context ( struct proxy_manager This,
MSHCTX  dest_context,
void dest_context_data 
)
inlinestatic

Definition at line 874 of file marshal.c.

875 {
876  MSHCTX old_dest_context;
877  MSHCTX new_dest_context;
878 
879  do
880  {
881  old_dest_context = This->dest_context;
882  new_dest_context = old_dest_context;
883  /* "stronger" values overwrite "weaker" values. stronger values are
884  * ones that disable more optimisations */
885  switch (old_dest_context)
886  {
887  case MSHCTX_INPROC:
888  new_dest_context = dest_context;
889  break;
890  case MSHCTX_CROSSCTX:
891  switch (dest_context)
892  {
893  case MSHCTX_INPROC:
894  break;
895  default:
896  new_dest_context = dest_context;
897  }
898  break;
899  case MSHCTX_LOCAL:
900  switch (dest_context)
901  {
902  case MSHCTX_INPROC:
903  case MSHCTX_CROSSCTX:
904  break;
905  default:
906  new_dest_context = dest_context;
907  }
908  break;
909  case MSHCTX_NOSHAREDMEM:
910  switch (dest_context)
911  {
912  case MSHCTX_DIFFERENTMACHINE:
913  new_dest_context = dest_context;
914  break;
915  default:
916  break;
917  }
918  break;
919  default:
920  break;
921  }
922 
923  if (old_dest_context == new_dest_context) break;
924 
925  new_dest_context = InterlockedCompareExchange((PLONG)&This->dest_context, new_dest_context, old_dest_context);
926  } while (new_dest_context != old_dest_context);
927 
928  if (dest_context_data)
929  InterlockedExchangePointer(&This->dest_context_data, dest_context_data);
930 }
#define InterlockedCompareExchange
Definition: interlocked.h:104
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
signed int * PLONG
Definition: retypes.h:5

Referenced by unmarshal_object().

◆ Proxy_MarshalInterface()

static HRESULT WINAPI Proxy_MarshalInterface ( LPMARSHAL  iface,
IStream pStm,
REFIID  riid,
void pv,
DWORD  dwDestContext,
void pvDestContext,
DWORD  mshlflags 
)
static

Definition at line 409 of file marshal.c.

412 {
413  struct proxy_manager *This = impl_from_IMarshal( iface );
414  HRESULT hr;
415  struct ifproxy *ifproxy;
416 
417  TRACE("(...,%s,...)\n", debugstr_guid(riid));
418 
420  if (SUCCEEDED(hr))
421  {
423 
425 
426  if ((mshlflags != MSHLFLAGS_TABLEWEAK) &&
427  (mshlflags != MSHLFLAGS_TABLESTRONG))
428  {
429  ULONG cPublicRefs = ifproxy->refs;
430  ULONG cPublicRefsOld;
431  /* optimization - share out proxy's public references if possible
432  * instead of making new proxy do a roundtrip through the server */
433  do
434  {
435  ULONG cPublicRefsNew;
436  cPublicRefsOld = cPublicRefs;
437  stdobjref.cPublicRefs = cPublicRefs / 2;
438  cPublicRefsNew = cPublicRefs - stdobjref.cPublicRefs;
439  cPublicRefs = InterlockedCompareExchange(
440  (LONG *)&ifproxy->refs, cPublicRefsNew, cPublicRefsOld);
441  } while (cPublicRefs != cPublicRefsOld);
442  }
443 
444  /* normal and table-strong marshaling need at least one reference */
445  if (!stdobjref.cPublicRefs && (mshlflags != MSHLFLAGS_TABLEWEAK))
446  {
447  IRemUnknown *remunk;
449  if (hr == S_OK)
450  {
451  HRESULT hrref = S_OK;
452  REMINTERFACEREF rif;
453  rif.ipid = ifproxy->stdobjref.ipid;
454  rif.cPublicRefs = (mshlflags == MSHLFLAGS_TABLESTRONG) ? 1 : NORMALEXTREFS;
455  rif.cPrivateRefs = 0;
456  hr = IRemUnknown_RemAddRef(remunk, 1, &rif, &hrref);
457  IRemUnknown_Release(remunk);
458  if (hr == S_OK && hrref == S_OK)
459  {
460  /* table-strong marshaling doesn't give the refs to the
461  * client that unmarshals the STDOBJREF */
462  if (mshlflags != MSHLFLAGS_TABLESTRONG)
463  stdobjref.cPublicRefs = rif.cPublicRefs;
464  }
465  else
466  ERR("IRemUnknown_RemAddRef returned with 0x%08x, hrref = 0x%08x\n", hr, hrref);
467  }
468  }
469 
470  if (SUCCEEDED(hr))
471  {
472  OBJREF objref;
473 
474  TRACE("writing stdobjref: flags = %04x cPublicRefs = %d oxid = %s oid = %s ipid = %s\n",
479  fill_std_objref(&objref, riid, &stdobjref);
480  hr = IStream_Write(pStm, &objref, FIELD_OFFSET(OBJREF,
481  u_objref.u_standard.saResAddr.aStringArray), NULL);
482  }
483  }
484  else
485  {
486  /* we don't have the interface already unmarshaled so we have to
487  * request the object from the server */
488  IRemUnknown *remunk;
489  IPID *ipid;
490  REMQIRESULT *qiresults = NULL;
491  IID iid = *riid;
492 
493  /* get the ipid of the first entry */
494  /* FIXME: should we implement ClientIdentity on the ifproxies instead
495  * of the proxy_manager so we use the correct ipid here? */
496  ipid = &LIST_ENTRY(list_head(&This->interfaces), struct ifproxy, entry)->stdobjref.ipid;
497 
498  /* get IRemUnknown proxy so we can communicate with the remote object */
500 
501  if (hr == S_OK)
502  {
503  hr = IRemUnknown_RemQueryInterface(remunk, ipid, NORMALEXTREFS,
504  1, &iid, &qiresults);
505  if (SUCCEEDED(hr))
506  {
507  OBJREF objref;
508 
509  fill_std_objref(&objref, riid, &qiresults->std);
510  hr = IStream_Write(pStm, &objref, FIELD_OFFSET(OBJREF,
511  u_objref.u_standard.saResAddr.aStringArray), NULL);
512  if (FAILED(hr))
513  {
514  REMINTERFACEREF rif;
515  rif.ipid = qiresults->std.ipid;
516  rif.cPublicRefs = qiresults->std.cPublicRefs;
517  rif.cPrivateRefs = 0;
518  IRemUnknown_RemRelease(remunk, 1, &rif);
519  }
520  CoTaskMemFree(qiresults);
521  }
522  else
523  ERR("IRemUnknown_RemQueryInterface failed with error 0x%08x\n", hr);
524  IRemUnknown_Release(remunk);
525  }
526  }
527 
528  return hr;
529 }
ULONG flags
Definition: marshal.c:92
IPID ipid
Definition: marshal.c:96
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
HRESULT hr
Definition: shlfolder.c:183
STDOBJREF stdobjref
REFIID riid
Definition: precomp.h:44
static HRESULT proxy_manager_get_remunknown(struct proxy_manager *This, IRemUnknown **remunk)
Definition: marshal.c:1088
#define InterlockedCompareExchange
Definition: interlocked.h:104
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
struct tagOBJREF::@1641::OR_STANDARD u_standard
long LONG
Definition: pedump.c:60
static void fill_std_objref(OBJREF *objref, const GUID *iid, STDOBJREF *std)
Definition: marshal.c:398
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
OXID oxid
Definition: marshal.c:94
LONG HRESULT
Definition: typedefs.h:77
uint32_t entry
Definition: isohybrid.c:63
#define NORMALEXTREFS
Definition: marshal.c:43
static HRESULT proxy_manager_find_ifproxy(struct proxy_manager *This, REFIID riid, struct ifproxy **ifproxy_found)
Definition: marshal.c:1039
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
unsigned int ULONG
Definition: retypes.h:1
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
ULONG cPublicRefs
Definition: marshal.c:93
#define LIST_ENTRY(type)
Definition: queue.h:175
static struct proxy_manager * impl_from_IMarshal(IMarshal *iface)
Definition: marshal.c:78
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ Proxy_QueryInterface()

static HRESULT WINAPI Proxy_QueryInterface ( IMarshal iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 364 of file marshal.c.

365 {
366  struct proxy_manager *This = impl_from_IMarshal( iface );
367  return IMultiQI_QueryInterface(&This->IMultiQI_iface, riid, ppvObject);
368 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppvObject
Definition: precomp.h:44
static struct proxy_manager * impl_from_IMarshal(IMarshal *iface)
Definition: marshal.c:78

◆ Proxy_Release()

static ULONG WINAPI Proxy_Release ( IMarshal iface)
static

Definition at line 376 of file marshal.c.

377 {
378  struct proxy_manager *This = impl_from_IMarshal( iface );
379  return IMultiQI_Release(&This->IMultiQI_iface);
380 }
static struct proxy_manager * impl_from_IMarshal(IMarshal *iface)
Definition: marshal.c:78

◆ Proxy_ReleaseMarshalData()

static HRESULT WINAPI Proxy_ReleaseMarshalData ( IMarshal iface,
IStream pStm 
)
static

Definition at line 550 of file marshal.c.

551 {
552  struct proxy_manager *This = impl_from_IMarshal( iface );
553  IMarshal *marshal;
554  HRESULT hr;
555 
556  TRACE("(%p, %p)\n", This, pStm);
557 
558  hr = StdMarshalImpl_Construct(&IID_IMarshal, This->dest_context,
559  This->dest_context_data, (void**)&marshal);
560  if(FAILED(hr))
561  return hr;
562 
563  hr = IMarshal_ReleaseMarshalData(marshal, pStm);
564  IMarshal_Release(marshal);
565  return hr;
566 }
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static HRESULT StdMarshalImpl_Construct(REFIID, DWORD, void *, void **)
Definition: marshal.c:1633
static struct proxy_manager * impl_from_IMarshal(IMarshal *iface)
Definition: marshal.c:78

◆ Proxy_UnmarshalInterface()

static HRESULT WINAPI Proxy_UnmarshalInterface ( IMarshal iface,
IStream pStm,
REFIID  riid,
void **  ppv 
)
static

Definition at line 531 of file marshal.c.

533 {
534  struct proxy_manager *This = impl_from_IMarshal( iface );
535  IMarshal *marshal;
536  HRESULT hr;
537 
538  TRACE("(%p, %p, %s, %p)\n", This, pStm, wine_dbgstr_guid(riid), ppv);
539 
540  hr = StdMarshalImpl_Construct(&IID_IMarshal, This->dest_context,
541  This->dest_context_data, (void**)&marshal);
542  if(FAILED(hr))
543  return hr;
544 
545  hr = IMarshal_UnmarshalInterface(marshal, pStm, riid, ppv);
546  IMarshal_Release(marshal);
547  return hr;
548 }
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
const char * wine_dbgstr_guid(const GUID *guid)
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static HRESULT StdMarshalImpl_Construct(REFIID, DWORD, void *, void **)
Definition: marshal.c:1633
static struct proxy_manager * impl_from_IMarshal(IMarshal *iface)
Definition: marshal.c:78

◆ ProxyCliSec_AddRef()

static ULONG WINAPI ProxyCliSec_AddRef ( IClientSecurity iface)
static

Definition at line 605 of file marshal.c.

606 {
607  struct proxy_manager *This = impl_from_IClientSecurity( iface );
608  return IMultiQI_AddRef(&This->IMultiQI_iface);
609 }
static struct proxy_manager * impl_from_IClientSecurity(IClientSecurity *iface)
Definition: marshal.c:83

◆ ProxyCliSec_CopyProxy()

static HRESULT WINAPI ProxyCliSec_CopyProxy ( IClientSecurity iface,
IUnknown pProxy,
IUnknown **  ppCopy 
)
static

Definition at line 663 of file marshal.c.

665 {
666  FIXME("(%p, %p): stub\n", pProxy, ppCopy);
667  *ppCopy = NULL;
668  return E_NOTIMPL;
669 }
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ProxyCliSec_QueryBlanket()

static HRESULT WINAPI ProxyCliSec_QueryBlanket ( IClientSecurity iface,
IUnknown pProxy,
DWORD pAuthnSvc,
DWORD pAuthzSvc,
OLECHAR **  ppServerPrincName,
DWORD pAuthnLevel,
DWORD pImpLevel,
void **  pAuthInfo,
DWORD pCapabilities 
)
static

Definition at line 617 of file marshal.c.

626 {
627  FIXME("(%p, %p, %p, %p, %p, %p, %p, %p): stub\n", pProxy, pAuthnSvc,
628  pAuthzSvc, ppServerPrincName, pAuthnLevel, pImpLevel, pAuthInfo,
629  pCapabilities);
630 
631  if (pAuthnSvc)
632  *pAuthnSvc = 0;
633  if (pAuthzSvc)
634  *pAuthzSvc = 0;
635  if (ppServerPrincName)
636  *ppServerPrincName = NULL;
637  if (pAuthnLevel)
638  *pAuthnLevel = RPC_C_AUTHN_LEVEL_DEFAULT;
639  if (pImpLevel)
640  *pImpLevel = RPC_C_IMP_LEVEL_DEFAULT;
641  if (pAuthInfo)
642  *pAuthInfo = NULL;
643  if (pCapabilities)
644  *pCapabilities = EOAC_NONE;
645 
646  return E_NOTIMPL;
647 }
#define RPC_C_AUTHN_LEVEL_DEFAULT
Definition: rpcdce.h:145
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define E_NOTIMPL
Definition: ddrawi.h:99
#define RPC_C_IMP_LEVEL_DEFAULT
Definition: rpcdce.h:173

◆ ProxyCliSec_QueryInterface()

static HRESULT WINAPI ProxyCliSec_QueryInterface ( IClientSecurity iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 599 of file marshal.c.

600 {
601  struct proxy_manager *This = impl_from_IClientSecurity( iface );
602  return IMultiQI_QueryInterface(&This->IMultiQI_iface, riid, ppvObject);
603 }
REFIID riid
Definition: precomp.h:44
static struct proxy_manager * impl_from_IClientSecurity(IClientSecurity *iface)
Definition: marshal.c:83
REFIID LPVOID * ppvObject
Definition: precomp.h:44

◆ ProxyCliSec_Release()

static ULONG WINAPI ProxyCliSec_Release ( IClientSecurity iface)
static

Definition at line 611 of file marshal.c.

612 {
613  struct proxy_manager *This = impl_from_IClientSecurity( iface );
614  return IMultiQI_Release(&This->IMultiQI_iface);
615 }
static struct proxy_manager * impl_from_IClientSecurity(IClientSecurity *iface)
Definition: marshal.c:83

◆ ProxyCliSec_SetBlanket()

static HRESULT WINAPI ProxyCliSec_SetBlanket ( IClientSecurity iface,
IUnknown pProxy,
DWORD  AuthnSvc,
DWORD  AuthzSvc,
OLECHAR pServerPrincName,
DWORD  AuthnLevel,
DWORD  ImpLevel,
void pAuthInfo,
DWORD  Capabilities 
)
static

Definition at line 649 of file marshal.c.

656 {
657  FIXME("(%p, %d, %d, %s, %d, %d, %p, 0x%x): stub\n", pProxy, AuthnSvc, AuthzSvc,
658  pServerPrincName == COLE_DEFAULT_PRINCIPAL ? "<default principal>" : debugstr_w(pServerPrincName),
659  AuthnLevel, ImpLevel, pAuthInfo, Capabilities);
660  return E_NOTIMPL;
661 }
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ std_release_marshal_data()

static HRESULT std_release_marshal_data ( IStream pStm)
static

Definition at line 1537 of file marshal.c.

1538 {
1539  struct OR_STANDARD obj;
1540  ULONG res;
1541  HRESULT hres;
1542  struct stub_manager *stubmgr;
1543  APARTMENT *apt;
1544 
1545  hres = IStream_Read(pStm, &obj, FIELD_OFFSET(struct OR_STANDARD, saResAddr.aStringArray), &res);
1546  if (hres != S_OK) return STG_E_READFAULT;
1547 
1548  if (obj.saResAddr.wNumEntries)
1549  {
1550  ERR("unsupported size of DUALSTRINGARRAY\n");
1551  return E_NOTIMPL;
1552  }
1553 
1554  TRACE("oxid = %s, oid = %s, ipid = %s\n",
1555  wine_dbgstr_longlong(obj.std.oxid),
1556  wine_dbgstr_longlong(obj.std.oid),
1557  wine_dbgstr_guid(&obj.std.ipid));
1558 
1559  if (!(apt = apartment_findfromoxid(obj.std.oxid, TRUE)))
1560  {
1561  WARN("Could not map OXID %s to apartment object\n",
1562  wine_dbgstr_longlong(obj.std.oxid));
1563  return RPC_E_INVALID_OBJREF;
1564  }
1565 
1566  if (!(stubmgr = get_stub_manager(apt, obj.std.oid)))
1567  {
1569  ERR("could not map object ID to stub manager, oxid=%s, oid=%s\n",
1570  wine_dbgstr_longlong(obj.std.oxid), wine_dbgstr_longlong(obj.std.oid));
1571  return RPC_E_INVALID_OBJREF;
1572  }
1573 
1574  stub_manager_release_marshal_data(stubmgr, obj.std.cPublicRefs, &obj.std.ipid, obj.std.flags & SORFP_TABLEWEAK);
1575 
1576  stub_manager_int_release(stubmgr);
1578 
1579  return S_OK;
1580 }
#define TRUE
Definition: types.h:120
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1172
ULONG stub_manager_int_release(struct stub_manager *This) DECLSPEC_HIDDEN
Definition: stubmanager.c:311
#define WARN(fmt,...)
Definition: debug.h:111
APARTMENT * apt
const char * wine_dbgstr_guid(const GUID *guid)
void stub_manager_release_marshal_data(struct stub_manager *m, ULONG refs, const IPID *ipid, BOOL tableweak) DECLSPEC_HIDDEN
Definition: stubmanager.c:593
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
struct stub_manager * get_stub_manager(APARTMENT *apt, OID oid) DECLSPEC_HIDDEN
Definition: stubmanager.c:380
#define ERR(fmt,...)
Definition: debug.h:109
APARTMENT * apartment_findfromoxid(OXID oxid, BOOL ref)
Definition: compobj.c:1276
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define STG_E_READFAULT
Definition: winerror.h:2576
GLuint res
Definition: glext.h:9613
unsigned int ULONG
Definition: retypes.h:1
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
#define RPC_E_INVALID_OBJREF
Definition: winerror.h:2505
#define SORFP_TABLEWEAK
Definition: marshal.c:47

Referenced by CoReleaseMarshalData(), and StdMarshalImpl_ReleaseMarshalData().

◆ std_unmarshal_interface()

static HRESULT std_unmarshal_interface ( MSHCTX  dest_context,
void dest_context_data,
IStream pStm,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1409 of file marshal.c.

1411 {
1412  struct stub_manager *stubmgr = NULL;
1413  struct OR_STANDARD obj;
1414  ULONG res;
1415  HRESULT hres;
1416  APARTMENT *apt;
1417  APARTMENT *stub_apt;
1418  OXID oxid;
1419 
1420  TRACE("(...,%s,....)\n", debugstr_guid(riid));
1421 
1422  /* we need an apartment to unmarshal into */
1423  if (!(apt = apartment_get_current_or_mta()))
1424  {
1425  ERR("Apartment not initialized\n");
1426  return CO_E_NOTINITIALIZED;
1427  }
1428 
1429  /* read STDOBJREF from wire */
1430  hres = IStream_Read(pStm, &obj, FIELD_OFFSET(struct OR_STANDARD, saResAddr.aStringArray), &res);
1431  if (hres != S_OK)
1432  {
1433  apartment_release(apt);
1434  return STG_E_READFAULT;
1435  }
1436 
1437  hres = apartment_getoxid(apt, &oxid);
1438  if (hres != S_OK)
1439  {
1440  apartment_release(apt);
1441  return hres;
1442  }
1443 
1444  if (obj.saResAddr.wNumEntries)
1445  {
1446  ERR("unsupported size of DUALSTRINGARRAY\n");
1447  return E_NOTIMPL;
1448  }
1449 
1450  /* check if we're marshalling back to ourselves */
1451  if ((oxid == obj.std.oxid) && (stubmgr = get_stub_manager(apt, obj.std.oid)))
1452  {
1453  TRACE("Unmarshalling object marshalled in same apartment for iid %s, "
1454  "returning original object %p\n", debugstr_guid(riid), stubmgr->object);
1455 
1456  hres = IUnknown_QueryInterface(stubmgr->object, riid, ppv);
1457 
1458  /* unref the ifstub. FIXME: only do this on success? */
1459  if (!stub_manager_is_table_marshaled(stubmgr, &obj.std.ipid))
1460  stub_manager_ext_release(stubmgr, obj.std.cPublicRefs, obj.std.flags & SORFP_TABLEWEAK, FALSE);
1461 
1462  stub_manager_int_release(stubmgr);
1463  apartment_release(apt);
1464  return hres;
1465  }
1466 
1467  /* notify stub manager about unmarshal if process-local object.
1468  * note: if the oxid is not found then we and native will quite happily
1469  * ignore table marshaling and normal marshaling rules regarding number of
1470  * unmarshals, etc, but if you abuse these rules then your proxy could end
1471  * up returning RPC_E_DISCONNECTED. */
1472  if ((stub_apt = apartment_findfromoxid(obj.std.oxid, TRUE)))
1473  {
1474  if ((stubmgr = get_stub_manager(stub_apt, obj.std.oid)))
1475  {
1476  if (!stub_manager_notify_unmarshal(stubmgr, &obj.std.ipid))
1478  }
1479  else
1480  {
1481  WARN("Couldn't find object for OXID %s, OID %s, assuming disconnected\n",
1482  wine_dbgstr_longlong(obj.std.oxid),
1483  wine_dbgstr_longlong(obj.std.oid));
1485  }
1486  }
1487  else
1488  TRACE("Treating unmarshal from OXID %s as inter-process\n",
1489  wine_dbgstr_longlong(obj.std.oxid));
1490 
1491  if (hres == S_OK)
1492  hres = unmarshal_object(&obj.std, apt, dest_context,
1493  dest_context_data, riid,
1494  stubmgr ? &stubmgr->oxid_info : NULL, ppv);
1495 
1496  if (stubmgr) stub_manager_int_release(stubmgr);
1497  if (stub_apt) apartment_release(stub_apt);
1498 
1499  if (hres != S_OK) WARN("Failed with error 0x%08x\n", hres);
1500  else TRACE("Successfully created proxy %p\n", *ppv);
1501 
1502  apartment_release(apt);
1503  return hres;
1504 }
#define TRUE
Definition: types.h:120
static HRESULT apartment_getoxid(const struct apartment *apt, OXID *oxid)
BOOL stub_manager_notify_unmarshal(struct stub_manager *m, const IPID *ipid) DECLSPEC_HIDDEN
Definition: stubmanager.c:562
REFIID riid
Definition: precomp.h:44
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1172
ULONG stub_manager_int_release(struct stub_manager *This) DECLSPEC_HIDDEN
Definition: stubmanager.c:311
#define WARN(fmt,...)
Definition: debug.h:111
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define CO_E_OBJNOTCONNECTED
Definition: winerror.h:2816
#define CO_E_NOTINITIALIZED
BOOL stub_manager_is_table_marshaled(struct stub_manager *m, const IPID *ipid) DECLSPEC_HIDDEN
Definition: stubmanager.c:609
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT unmarshal_object(const STDOBJREF *stdobjref, APARTMENT *apt, MSHCTX dest_context, void *dest_context_data, REFIID riid, const OXID_INFO *oxid_info, void **object)
Definition: marshal.c:1340
HRESULT hres
Definition: protocol.c:465
OXID_INFO oxid_info
LONG HRESULT
Definition: typedefs.h:77
APARTMENT * apartment_get_current_or_mta(void)
Definition: compobj.c:742
struct stub_manager * get_stub_manager(APARTMENT *apt, OID oid) DECLSPEC_HIDDEN
Definition: stubmanager.c:380
#define ERR(fmt,...)
Definition: debug.h:109
APARTMENT * apartment_findfromoxid(OXID oxid, BOOL ref)
Definition: compobj.c:1276
ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs, BOOL tableweak, BOOL last_unlock_releases) DECLSPEC_HIDDEN
Definition: stubmanager.c:439
#define S_OK
Definition: intsafe.h:59
IUnknown * object
UINT64 OXID
Definition: marshal.c:87
#define E_NOTIMPL
Definition: ddrawi.h:99
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define STG_E_READFAULT
Definition: winerror.h:2576
GLuint res
Definition: glext.h:9613
unsigned int ULONG
Definition: retypes.h:1
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
#define SORFP_TABLEWEAK
Definition: marshal.c:47

Referenced by CoUnmarshalInterface(), and StdMarshalImpl_UnmarshalInterface().

◆ StdMarshalCF_AddRef()

static ULONG WINAPI StdMarshalCF_AddRef ( LPCLASSFACTORY  iface)
static

Definition at line 2169 of file marshal.c.

2170 {
2171  return 2; /* non-heap based object */
2172 }

◆ StdMarshalCF_CreateInstance()

static HRESULT WINAPI StdMarshalCF_CreateInstance ( LPCLASSFACTORY  iface,
LPUNKNOWN  pUnk,
REFIID  riid,
LPVOID ppv 
)
static

Definition at line 2179 of file marshal.c.

2181 {
2182  if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IMarshal))
2183  return StdMarshalImpl_Construct(riid, 0, NULL, ppv);
2184 
2185  FIXME("(%s), not supported.\n",debugstr_guid(riid));
2186  return E_NOINTERFACE;
2187 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IUnknown
static HRESULT StdMarshalImpl_Construct(REFIID, DWORD, void *, void **)
Definition: marshal.c:1633
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ StdMarshalCF_LockServer()

static HRESULT WINAPI StdMarshalCF_LockServer ( LPCLASSFACTORY  iface,
BOOL  fLock 
)
static

Definition at line 2189 of file marshal.c.

2190 {
2191  FIXME("(%d), stub!\n",fLock);
2192  return S_OK;
2193 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59

◆ StdMarshalCF_QueryInterface()

static HRESULT WINAPI StdMarshalCF_QueryInterface ( LPCLASSFACTORY  iface,
REFIID  riid,
LPVOID ppv 
)
static

Definition at line 2157 of file marshal.c.

2159 {
2160  *ppv = NULL;
2162  {
2163  *ppv = iface;
2164  return S_OK;
2165  }
2166  return E_NOINTERFACE;
2167 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
const GUID IID_IClassFactory
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ StdMarshalCF_Release()

static ULONG WINAPI StdMarshalCF_Release ( LPCLASSFACTORY  iface)
static

Definition at line 2174 of file marshal.c.

2175 {
2176  return 1; /* non-heap based object */
2177 }

◆ StdMarshalImpl_AddRef()

static ULONG WINAPI StdMarshalImpl_AddRef ( IMarshal iface)
static

Definition at line 1268 of file marshal.c.

1269 {
1271  return InterlockedIncrement(&This->ref);
1272 }
static StdMarshalImpl * impl_from_StdMarshal(IMarshal *iface)
Definition: marshal.c:1248
#define InterlockedIncrement
Definition: armddk.h:53

◆ StdMarshalImpl_Construct()

static HRESULT StdMarshalImpl_Construct ( REFIID  riid,
DWORD  dest_context,
void dest_context_data,
void **  ppvObject 
)
static

Definition at line 1633 of file marshal.c.

1634 {
1635  HRESULT hr;
1636 
1637  StdMarshalImpl *pStdMarshal = HeapAlloc(GetProcessHeap(), 0, sizeof(StdMarshalImpl));
1638  if (!pStdMarshal)
1639  return E_OUTOFMEMORY;
1640 
1641  pStdMarshal->IMarshal_iface.lpVtbl = &StdMarshalVtbl;
1642  pStdMarshal->ref = 0;
1643  pStdMarshal->dest_context = dest_context;
1644  pStdMarshal->dest_context_data = dest_context_data;
1645 
1646  hr = IMarshal_QueryInterface(&pStdMarshal->IMarshal_iface, riid, ppvObject);
1647  if (FAILED(hr))
1648  HeapFree(GetProcessHeap(), 0, pStdMarshal);
1649 
1650  return hr;
1651 }
DWORD dest_context
Definition: marshal.c:1244
HRESULT hr
Definition: shlfolder.c:183
static const IMarshalVtbl StdMarshalVtbl
Definition: marshal.c:1620
REFIID riid
Definition: precomp.h:44
void * dest_context_data
Definition: marshal.c:1245
IMarshal IMarshal_iface
Definition: marshal.c:1242
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by CoGetStandardMarshal(), Proxy_DisconnectObject(), Proxy_ReleaseMarshalData(), Proxy_UnmarshalInterface(), and StdMarshalCF_CreateInstance().

◆ StdMarshalImpl_DisconnectObject()

static HRESULT WINAPI StdMarshalImpl_DisconnectObject ( IMarshal iface,
DWORD  dwReserved 
)
static

Definition at line 1614 of file marshal.c.

1615 {
1616  FIXME("(), stub!\n");
1617  return S_OK;
1618 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59

◆ StdMarshalImpl_GetMarshalSizeMax()

static HRESULT WINAPI StdMarshalImpl_GetMarshalSizeMax ( IMarshal iface,
REFIID  riid,
void pv,
DWORD  dwDestContext,
void pvDestContext,
DWORD  mshlflags,
DWORD pSize 
)
static

Definition at line 1294 of file marshal.c.

1297 {
1298  *pSize = FIELD_OFFSET(OBJREF, u_objref.u_standard.saResAddr.aStringArray);
1299  return S_OK;
1300 }
struct tagOBJREF::@1641::OR_STANDARD u_standard
#define S_OK
Definition: intsafe.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254

◆ StdMarshalImpl_GetUnmarshalClass()

static HRESULT WINAPI StdMarshalImpl_GetUnmarshalClass ( IMarshal iface,
REFIID  riid,
void pv,
DWORD  dwDestContext,
void pvDestContext,
DWORD  mshlflags,
CLSID pCid 
)
static

Definition at line 1285 of file marshal.c.

1288 {
1289  *pCid = CLSID_StdMarshal;
1290  return S_OK;
1291 }
const CLSID CLSID_StdMarshal
#define S_OK
Definition: intsafe.h:59

◆ StdMarshalImpl_MarshalInterface()

static HRESULT WINAPI StdMarshalImpl_MarshalInterface ( IMarshal iface,
IStream pStm,
REFIID  riid,
void pv,
DWORD  dest_context,
void dest_context_data,
DWORD  mshlflags 
)
static

Definition at line 1303 of file marshal.c.

1306 {
1307  ULONG res;
1308  HRESULT hres;
1309  APARTMENT *apt;
1310  OBJREF objref;
1311 
1312  TRACE("(...,%s,...)\n", debugstr_guid(riid));
1313 
1314  if (!(apt = apartment_get_current_or_mta()))
1315  {
1316  ERR("Apartment not initialized\n");
1317  return CO_E_NOTINITIALIZED;
1318  }
1319 
1320  /* make sure this apartment can be reached from other threads / processes */
1321  RPC_StartRemoting(apt);
1322 
1323  fill_std_objref(&objref, riid, NULL);
1324  hres = marshal_object(apt, &objref.u_objref.u_standard.std, riid,
1325  pv, dest_context, dest_context_data, mshlflags);
1326  apartment_release(apt);
1327  if (hres != S_OK)
1328  {
1329  ERR("Failed to create ifstub, hres=0x%x\n", hres);
1330  return hres;
1331  }
1332 
1333  return IStream_Write(pStm, &objref,
1334  FIELD_OFFSET(OBJREF, u_objref.u_standard.saResAddr.aStringArray), &res);
1335 }
REFIID riid
Definition: precomp.h:44
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1172
union tagOBJREF::@1641 u_objref
#define CO_E_NOTINITIALIZED
struct tagOBJREF::@1641::OR_STANDARD u_standard
static void fill_std_objref(OBJREF *objref, const GUID *iid, STDOBJREF *std)
Definition: marshal.c:398
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
APARTMENT * apartment_get_current_or_mta(void)
Definition: compobj.c:742
#define ERR(fmt,...)
Definition: debug.h:109
void RPC_StartRemoting(struct apartment *apt) DECLSPEC_HIDDEN
Definition: rpc.c:1630
#define S_OK
Definition: intsafe.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
GLuint res
Definition: glext.h:9613
unsigned int ULONG
Definition: retypes.h:1
HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnknown *object, DWORD dest_context, void *dest_context_data, MSHLFLAGS mshlflags)
Definition: marshal.c:121

◆ StdMarshalImpl_QueryInterface()

static HRESULT WINAPI StdMarshalImpl_QueryInterface ( IMarshal iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1254 of file marshal.c.

1255 {
1256  *ppv = NULL;
1257  if (IsEqualIID(&IID_IUnknown, riid) || IsEqualIID(&IID_IMarshal, riid))
1258  {
1259  *ppv = iface;
1260  IMarshal_AddRef(iface);
1261  return S_OK;
1262  }
1263  FIXME("No interface for %s.\n", debugstr_guid(riid));
1264  return E_NOINTERFACE;
1265 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ StdMarshalImpl_Release()

static ULONG WINAPI StdMarshalImpl_Release ( IMarshal iface)
static

Definition at line 1275 of file marshal.c.

1276 {
1279 
1280  if (!ref) HeapFree(GetProcessHeap(),0,This);
1281  return ref;
1282 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
static StdMarshalImpl * impl_from_StdMarshal(IMarshal *iface)
Definition: marshal.c:1248
#define GetProcessHeap()
Definition: compat.h:403
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ StdMarshalImpl_ReleaseMarshalData()

static HRESULT WINAPI StdMarshalImpl_ReleaseMarshalData ( IMarshal iface,
IStream pStm 
)
static

Definition at line 1583 of file marshal.c.

1584 {
1585  OBJREF objref;
1586  HRESULT hr;
1587  ULONG res;
1588 
1589  TRACE("iface=%p, pStm=%p\n", iface, pStm);
1590 
1591  hr = IStream_Read(pStm, &objref, FIELD_OFFSET(OBJREF, u_objref), &res);
1592  if (hr != S_OK || (res != FIELD_OFFSET(OBJREF, u_objref)))
1593  {
1594  ERR("Failed to read common OBJREF header, 0x%08x\n", hr);
1595  return STG_E_READFAULT;
1596  }
1597 
1598  if (objref.signature != OBJREF_SIGNATURE)
1599  {
1600  ERR("Bad OBJREF signature 0x%08x\n", objref.signature);
1601  return RPC_E_INVALID_OBJREF;
1602  }
1603 
1604  if (!(objref.flags & OBJREF_STANDARD))
1605  {
1606  FIXME("unsupported objref.flags = %x\n", objref.flags);
1607  return E_NOTIMPL;
1608  }
1609 
1610  return std_release_marshal_data(pStm);
1611 }
#define OBJREF_SIGNATURE
Definition: marshal.c:77
HRESULT hr
Definition: shlfolder.c:183
ULONG signature
Definition: marshal.c:100
#define FIXME(fmt,...)
Definition: debug.h:110
static HRESULT std_release_marshal_data(IStream *pStm)
Definition: marshal.c:1537
#define OBJREF_STANDARD
Definition: marshal.c:78
ULONG flags
Definition: marshal.c:101
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define STG_E_READFAULT
Definition: winerror.h:2576
GLuint res
Definition: glext.h:9613
unsigned int ULONG
Definition: retypes.h:1
#define RPC_E_INVALID_OBJREF
Definition: winerror.h:2505

◆ StdMarshalImpl_UnmarshalInterface()

static HRESULT WINAPI StdMarshalImpl_UnmarshalInterface ( IMarshal iface,
IStream pStm,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1507 of file marshal.c.

1508 {
1510  OBJREF objref;
1511  HRESULT hr;
1512  ULONG res;
1513 
1514  hr = IStream_Read(pStm, &objref, FIELD_OFFSET(OBJREF, u_objref), &res);
1515  if (hr != S_OK || (res != FIELD_OFFSET(OBJREF, u_objref)))
1516  {
1517  ERR("Failed to read common OBJREF header, 0x%08x\n", hr);
1518  return STG_E_READFAULT;
1519  }
1520 
1521  if (objref.signature != OBJREF_SIGNATURE)
1522  {
1523  ERR("Bad OBJREF signature 0x%08x\n", objref.signature);
1524  return RPC_E_INVALID_OBJREF;
1525  }
1526 
1527  if (!(objref.flags & OBJREF_STANDARD))
1528  {
1529  FIXME("unsupported objref.flags = %x\n", objref.flags);
1530  return E_NOTIMPL;
1531  }
1532 
1533  return std_unmarshal_interface(This->dest_context,
1534  This->dest_context_data, pStm, riid, ppv);
1535 }
#define OBJREF_SIGNATURE
Definition: marshal.c:77
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
ULONG signature
Definition: marshal.c:100
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define FIXME(fmt,...)
Definition: debug.h:110
static StdMarshalImpl * impl_from_StdMarshal(IMarshal *iface)
Definition: marshal.c:1248
#define OBJREF_STANDARD
Definition: marshal.c:78
ULONG flags
Definition: marshal.c:101
LONG HRESULT
Definition: typedefs.h:77
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define STG_E_READFAULT
Definition: winerror.h:2576
GLuint res
Definition: glext.h:9613
unsigned int ULONG
Definition: retypes.h:1
static HRESULT std_unmarshal_interface(MSHCTX dest_context, void *dest_context_data, IStream *pStm, REFIID riid, void **ppv)
Definition: marshal.c:1409
#define RPC_E_INVALID_OBJREF
Definition: winerror.h:2505

◆ unmarshal_object()

static HRESULT unmarshal_object ( const STDOBJREF stdobjref,
APARTMENT apt,
MSHCTX  dest_context,
void dest_context_data,
REFIID  riid,
const OXID_INFO *  oxid_info,
void **  object 
)
static

Definition at line 1340 of file marshal.c.

1344 {
1345  struct proxy_manager *proxy_manager = NULL;
1346  HRESULT hr = S_OK;
1347 
1348  assert(apt);
1349 
1350  TRACE("stdobjref: flags = %04x cPublicRefs = %d oxid = %s oid = %s ipid = %s\n",
1351  stdobjref->flags, stdobjref->cPublicRefs,
1352  wine_dbgstr_longlong(stdobjref->oxid),
1353  wine_dbgstr_longlong(stdobjref->oid),
1354  debugstr_guid(&stdobjref->ipid));
1355 
1356  /* create a new proxy manager if one doesn't already exist for the
1357  * object */
1358  if (!find_proxy_manager(apt, stdobjref->oxid, stdobjref->oid, &proxy_manager))
1359  {
1360  hr = proxy_manager_construct(apt, stdobjref->flags,
1361  stdobjref->oxid, stdobjref->oid, oxid_info,
1362  &proxy_manager);
1363  }
1364  else
1365  TRACE("proxy manager already created, using\n");
1366 
1367  if (hr == S_OK)
1368  {
1369  struct ifproxy * ifproxy;
1370 
1371  proxy_manager_set_context(proxy_manager, dest_context, dest_context_data);
1372 
1374  if (hr == E_NOINTERFACE)
1375  {
1376  IRpcChannelBuffer *chanbuf;
1381  &chanbuf, apt);
1382  if (hr == S_OK)
1384  riid, chanbuf, &ifproxy);
1385  }
1386  else
1387  IUnknown_AddRef((IUnknown *)ifproxy->iface);
1388 
1389  if (hr == S_OK)
1390  {
1392  /* get at least one external reference to the object to keep it alive */
1394  if (FAILED(hr))
1396  }
1397 
1398  if (hr == S_OK)
1399  *object = ifproxy->iface;
1400  }
1401 
1402  /* release our reference to the proxy manager - the client/apartment
1403  * will hold on to the remaining reference for us */
1404  if (proxy_manager) IMultiQI_Release(&proxy_manager->IMultiQI_iface);
1405 
1406  return hr;
1407 }
IMultiQI IMultiQI_iface
Definition: marshal.c:55
static HRESULT ifproxy_get_public_ref(struct ifproxy *This)
Definition: marshal.c:681
static void proxy_manager_set_context(struct proxy_manager *This, MSHCTX dest_context, void *dest_context_data)
Definition: marshal.c:874
ULONG flags
Definition: marshal.c:92
#define E_NOINTERFACE
Definition: winerror.h:2364
IPID ipid
Definition: marshal.c:96
HRESULT hr
Definition: shlfolder.c:183
STDOBJREF stdobjref
REFIID riid
Definition: precomp.h:44
MSHCTX dest_context
Definition: marshal.c:69
#define assert(x)
Definition: debug.h:53
static HRESULT proxy_manager_construct(APARTMENT *apt, ULONG sorflags, OXID oxid, OID oid, const OXID_INFO *oxid_info, struct proxy_manager **proxy_manager)
Definition: marshal.c:793
long LONG
Definition: pedump.c:60
LPVOID iface
smooth NULL
Definition: ftsmooth.c:416
static HRESULT proxy_manager_create_ifproxy(struct proxy_manager *This, const STDOBJREF *stdobjref, REFIID riid, IRpcChannelBuffer *channel, struct ifproxy **iif_out)
Definition: marshal.c:971
#define debugstr_guid
Definition: kernel32.h:35
#define InterlockedExchangeAdd
Definition: interlocked.h:181
#define TRACE(s)
Definition: solgame.cpp:4
OXID oxid
Definition: marshal.c:94
OXID_INFO oxid_info
Definition: marshal.c:61
LONG HRESULT
Definition: typedefs.h:77
static void ifproxy_destroy(struct ifproxy *This)
Definition: marshal.c:772
static HRESULT proxy_manager_find_ifproxy(struct proxy_manager *This, REFIID riid, struct ifproxy **ifproxy_found)
Definition: marshal.c:1039
void * dest_context_data
Definition: marshal.c:70
#define S_OK
Definition: intsafe.h:59
HRESULT RPC_CreateClientChannel(const OXID *oxid, const IPID *ipid, const OXID_INFO *oxid_info, const IID *iid, DWORD dest_context, void *dest_context_data, IRpcChannelBuffer **chan, APARTMENT *apt) DECLSPEC_HIDDEN
Definition: rpc.c:1095
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
ULONG cPublicRefs
Definition: marshal.c:93
static BOOL find_proxy_manager(APARTMENT *apt, OXID oxid, OID oid, struct proxy_manager **proxy_found)
Definition: marshal.c:1200

Referenced by ClientIdentity_QueryMultipleInterfaces(), proxy_manager_get_remunknown(), and std_unmarshal_interface().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )

Variable Documentation

◆ ClientIdentity_Vtbl

const IMultiQIVtbl ClientIdentity_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI ClientIdentity_QueryInterface(IMultiQI *iface, REFIID riid, void **ppv)
Definition: marshal.c:222
static HRESULT WINAPI ClientIdentity_QueryMultipleInterfaces(IMultiQI *iface, ULONG cMQIs, MULTI_QI *pMQIs)
Definition: marshal.c:253
static ULONG WINAPI ClientIdentity_AddRef(IMultiQI *iface)
Definition: marshal.c:236
static ULONG WINAPI ClientIdentity_Release(IMultiQI *iface)
Definition: marshal.c:243

Definition at line 354 of file marshal.c.

Referenced by proxy_manager_construct().

◆ ProxyCliSec_Vtbl

const IClientSecurityVtbl ProxyCliSec_Vtbl
static
Initial value:
=
{
}
static ULONG WINAPI ProxyCliSec_AddRef(IClientSecurity *iface)
Definition: marshal.c:605
static HRESULT WINAPI ProxyCliSec_SetBlanket(IClientSecurity *iface, IUnknown *pProxy, DWORD AuthnSvc, DWORD AuthzSvc, OLECHAR *pServerPrincName, DWORD AuthnLevel, DWORD ImpLevel, void *pAuthInfo, DWORD Capabilities)
Definition: marshal.c:649
static HRESULT WINAPI ProxyCliSec_QueryInterface(IClientSecurity *iface, REFIID riid, void **ppvObject)
Definition: marshal.c:599
static ULONG WINAPI ProxyCliSec_Release(IClientSecurity *iface)
Definition: marshal.c:611
static HRESULT WINAPI ProxyCliSec_QueryBlanket(IClientSecurity *iface, IUnknown *pProxy, DWORD *pAuthnSvc, DWORD *pAuthzSvc, OLECHAR **ppServerPrincName, DWORD *pAuthnLevel, DWORD *pImpLevel, void **pAuthInfo, DWORD *pCapabilities)
Definition: marshal.c:617
static HRESULT WINAPI ProxyCliSec_CopyProxy(IClientSecurity *iface, IUnknown *pProxy, IUnknown **ppCopy)
Definition: marshal.c:663

Definition at line 671 of file marshal.c.

Referenced by proxy_manager_construct().

◆ ProxyMarshal_Vtbl

const IMarshalVtbl ProxyMarshal_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI Proxy_UnmarshalInterface(IMarshal *iface, IStream *pStm, REFIID riid, void **ppv)
Definition: marshal.c:531
static HRESULT WINAPI Proxy_QueryInterface(IMarshal *iface, REFIID riid, void **ppvObject)
Definition: marshal.c:364
static HRESULT WINAPI Proxy_GetUnmarshalClass(IMarshal *iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, CLSID *pCid)
Definition: marshal.c:382
static ULONG WINAPI Proxy_Release(IMarshal *iface)
Definition: marshal.c:376
static HRESULT WINAPI Proxy_ReleaseMarshalData(IMarshal *iface, IStream *pStm)
Definition: marshal.c:550
static HRESULT WINAPI Proxy_GetMarshalSizeMax(IMarshal *iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, DWORD *pSize)
Definition: marshal.c:390
static ULONG WINAPI Proxy_AddRef(IMarshal *iface)
Definition: marshal.c:370
static HRESULT WINAPI Proxy_MarshalInterface(LPMARSHAL iface, IStream *pStm, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags)
Definition: marshal.c:409
static HRESULT WINAPI Proxy_DisconnectObject(IMarshal *iface, DWORD dwReserved)
Definition: marshal.c:568

Definition at line 586 of file marshal.c.

Referenced by proxy_manager_construct().

◆ StdMarshalCF

const IClassFactoryVtbl* StdMarshalCF = &StdMarshalCFVtbl
static

Definition at line 2203 of file marshal.c.

Referenced by MARSHAL_GetStandardMarshalCF().

◆ StdMarshalCFVtbl

const IClassFactoryVtbl StdMarshalCFVtbl
static
Initial value:
=
{
}
static ULONG WINAPI StdMarshalCF_Release(LPCLASSFACTORY iface)
Definition: marshal.c:2174
static ULONG WINAPI StdMarshalCF_AddRef(LPCLASSFACTORY iface)
Definition: marshal.c:2169
static HRESULT WINAPI StdMarshalCF_QueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppv)
Definition: marshal.c:2157
static HRESULT WINAPI StdMarshalCF_LockServer(LPCLASSFACTORY iface, BOOL fLock)
Definition: marshal.c:2189
static HRESULT WINAPI StdMarshalCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv)
Definition: marshal.c:2179

Definition at line 2195 of file marshal.c.

◆ StdMarshalVtbl

const IMarshalVtbl StdMarshalVtbl
static
Initial value:
=
{
}
static HRESULT WINAPI StdMarshalImpl_QueryInterface(IMarshal *iface, REFIID riid, void **ppv)
Definition: marshal.c:1254
static HRESULT WINAPI StdMarshalImpl_GetUnmarshalClass(IMarshal *iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, CLSID *pCid)
Definition: marshal.c:1285
static HRESULT WINAPI StdMarshalImpl_UnmarshalInterface(IMarshal *iface, IStream *pStm, REFIID riid, void **ppv)
Definition: marshal.c:1507
static ULONG WINAPI StdMarshalImpl_AddRef(IMarshal *iface)
Definition: marshal.c:1268
static HRESULT WINAPI StdMarshalImpl_DisconnectObject(IMarshal *iface, DWORD dwReserved)
Definition: marshal.c:1614
static HRESULT WINAPI StdMarshalImpl_GetMarshalSizeMax(IMarshal *iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, DWORD *pSize)
Definition: marshal.c:1294
static HRESULT WINAPI StdMarshalImpl_MarshalInterface(IMarshal *iface, IStream *pStm, REFIID riid, void *pv, DWORD dest_context, void *dest_context_data, DWORD mshlflags)
Definition: marshal.c:1303
static ULONG WINAPI StdMarshalImpl_Release(IMarshal *iface)
Definition: marshal.c:1275
static HRESULT WINAPI StdMarshalImpl_ReleaseMarshalData(IMarshal *iface, IStream *pStm)
Definition: marshal.c:1583

Definition at line 1620 of file marshal.c.

Referenced by StdMarshalImpl_Construct().