HRESULT hr;
CLSID clsid;
- if ((hr = CoGetPSClsid(riid, &clsid)))
+ hr = CoGetPSClsid(riid, &clsid);
+ if (hr != S_OK)
return hr;
return CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER | WINE_CLSCTX_DONT_HOST,
NULL, &IID_IPSFactoryBuffer, (LPVOID*)facbuf);
/********************** StdMarshal implementation ****************************/
typedef struct _StdMarshalImpl
{
- const IMarshalVtbl *lpvtbl;
- LONG ref;
-
- IID iid;
- DWORD dwDestContext;
- LPVOID pvDestContext;
- DWORD mshlflags;
+ IMarshal IMarshal_iface;
+ LONG ref;
+ DWORD dest_context;
+ void *dest_context_data;
} StdMarshalImpl;
+static inline StdMarshalImpl *impl_from_StdMarshal(IMarshal *iface)
+{
+ return CONTAINING_RECORD(iface, StdMarshalImpl, IMarshal_iface);
+}
+
static HRESULT WINAPI
StdMarshalImpl_QueryInterface(IMarshal *iface, REFIID riid, void **ppv)
{
}
static ULONG WINAPI
-StdMarshalImpl_AddRef(LPMARSHAL iface)
+StdMarshalImpl_AddRef(IMarshal *iface)
{
- StdMarshalImpl *This = (StdMarshalImpl *)iface;
+ StdMarshalImpl *This = impl_from_StdMarshal(iface);
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI
-StdMarshalImpl_Release(LPMARSHAL iface)
+StdMarshalImpl_Release(IMarshal *iface)
{
- StdMarshalImpl *This = (StdMarshalImpl *)iface;
+ StdMarshalImpl *This = impl_from_StdMarshal(iface);
ULONG ref = InterlockedDecrement(&This->ref);
if (!ref) HeapFree(GetProcessHeap(),0,This);
static HRESULT WINAPI
StdMarshalImpl_GetUnmarshalClass(
- LPMARSHAL iface, REFIID riid, void* pv, DWORD dwDestContext,
+ IMarshal *iface, REFIID riid, void* pv, DWORD dwDestContext,
void* pvDestContext, DWORD mshlflags, CLSID* pCid)
{
*pCid = CLSID_DfMarshal;
static HRESULT WINAPI
StdMarshalImpl_GetMarshalSizeMax(
- LPMARSHAL iface, REFIID riid, void* pv, DWORD dwDestContext,
+ IMarshal *iface, REFIID riid, void* pv, DWORD dwDestContext,
void* pvDestContext, DWORD mshlflags, DWORD* pSize)
{
*pSize = sizeof(STDOBJREF);
static HRESULT WINAPI
StdMarshalImpl_MarshalInterface(
- LPMARSHAL iface, IStream *pStm,REFIID riid, void* pv, DWORD dest_context,
+ IMarshal *iface, IStream *pStm,REFIID riid, void* pv, DWORD dest_context,
void* dest_context_data, DWORD mshlflags)
{
STDOBJREF stdobjref;
}
static HRESULT WINAPI
-StdMarshalImpl_UnmarshalInterface(LPMARSHAL iface, IStream *pStm, REFIID riid, void **ppv)
+StdMarshalImpl_UnmarshalInterface(IMarshal *iface, IStream *pStm, REFIID riid, void **ppv)
{
- StdMarshalImpl *This = (StdMarshalImpl *)iface;
+ StdMarshalImpl *This = impl_from_StdMarshal(iface);
struct stub_manager *stubmgr = NULL;
STDOBJREF stdobjref;
ULONG res;
wine_dbgstr_longlong(stdobjref.oxid));
if (hres == S_OK)
- hres = unmarshal_object(&stdobjref, apt, This->dwDestContext,
- This->pvDestContext, riid,
+ hres = unmarshal_object(&stdobjref, apt, This->dest_context,
+ This->dest_context_data, riid,
stubmgr ? &stubmgr->oxid_info : NULL, ppv);
if (stubmgr) stub_manager_int_release(stubmgr);
}
static HRESULT WINAPI
-StdMarshalImpl_ReleaseMarshalData(LPMARSHAL iface, IStream *pStm)
+StdMarshalImpl_ReleaseMarshalData(IMarshal *iface, IStream *pStm)
{
STDOBJREF stdobjref;
ULONG res;
}
static HRESULT WINAPI
-StdMarshalImpl_DisconnectObject(LPMARSHAL iface, DWORD dwReserved)
+StdMarshalImpl_DisconnectObject(IMarshal *iface, DWORD dwReserved)
{
FIXME("(), stub!\n");
return S_OK;
}
-static const IMarshalVtbl VT_StdMarshal =
+static const IMarshalVtbl StdMarshalVtbl =
{
StdMarshalImpl_QueryInterface,
StdMarshalImpl_AddRef,
StdMarshalImpl_DisconnectObject
};
-static HRESULT StdMarshalImpl_Construct(REFIID riid, void** ppvObject)
+static HRESULT StdMarshalImpl_Construct(REFIID riid, DWORD dest_context, void *dest_context_data, void** ppvObject)
{
- StdMarshalImpl * pStdMarshal =
- HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(StdMarshalImpl));
+ HRESULT hr;
+
+ StdMarshalImpl *pStdMarshal = HeapAlloc(GetProcessHeap(), 0, sizeof(StdMarshalImpl));
if (!pStdMarshal)
return E_OUTOFMEMORY;
- pStdMarshal->lpvtbl = &VT_StdMarshal;
+
+ pStdMarshal->IMarshal_iface.lpVtbl = &StdMarshalVtbl;
pStdMarshal->ref = 0;
- return IMarshal_QueryInterface((IMarshal*)pStdMarshal, riid, ppvObject);
+ pStdMarshal->dest_context = dest_context;
+ pStdMarshal->dest_context_data = dest_context_data;
+
+ hr = IMarshal_QueryInterface(&pStdMarshal->IMarshal_iface, riid, ppvObject);
+ if (FAILED(hr))
+ HeapFree(GetProcessHeap(), 0, pStdMarshal);
+
+ return hr;
}
/***********************************************************************
DWORD dwDestContext, LPVOID pvDestContext,
DWORD mshlflags, LPMARSHAL *ppMarshal)
{
- StdMarshalImpl *dm;
-
if (pUnk == NULL)
{
FIXME("(%s,NULL,%x,%p,%x,%p), unimplemented yet.\n",
}
TRACE("(%s,%p,%x,%p,%x,%p)\n",
debugstr_guid(riid),pUnk,dwDestContext,pvDestContext,mshlflags,ppMarshal);
- *ppMarshal = HeapAlloc(GetProcessHeap(),0,sizeof(StdMarshalImpl));
- dm = (StdMarshalImpl*) *ppMarshal;
- if (!dm) return E_FAIL;
- dm->lpvtbl = &VT_StdMarshal;
- dm->ref = 1;
-
- dm->iid = *riid;
- dm->dwDestContext = dwDestContext;
- dm->pvDestContext = pvDestContext;
- dm->mshlflags = mshlflags;
- return S_OK;
+
+ return StdMarshalImpl_Construct(&IID_IMarshal, dwDestContext, pvDestContext, (void**)ppMarshal);
}
/***********************************************************************
if (objref.flags & OBJREF_STANDARD)
{
TRACE("Using standard unmarshaling\n");
- hr = StdMarshalImpl_Construct(&IID_IMarshal, (LPVOID*)marshal);
+ hr = StdMarshalImpl_Construct(&IID_IMarshal, 0, NULL, (LPVOID*)marshal);
}
else if (objref.flags & OBJREF_CUSTOM)
{
LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv)
{
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IMarshal))
- return StdMarshalImpl_Construct(riid, ppv);
+ return StdMarshalImpl_Construct(riid, 0, NULL, ppv);
FIXME("(%s), not supported.\n",debugstr_guid(riid));
return E_NOINTERFACE;