oleaut32: Standardize the COM usage in tmarshal.c.
This commit is contained in:
parent
366a92146d
commit
80a08012d8
|
@ -390,7 +390,7 @@ typedef struct _TMAsmProxy {
|
||||||
|
|
||||||
typedef struct _TMProxyImpl {
|
typedef struct _TMProxyImpl {
|
||||||
LPVOID *lpvtbl;
|
LPVOID *lpvtbl;
|
||||||
const IRpcProxyBufferVtbl *lpvtbl2;
|
IRpcProxyBuffer IRpcProxyBuffer_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
TMAsmProxy *asmstubs;
|
TMAsmProxy *asmstubs;
|
||||||
|
@ -405,7 +405,7 @@ typedef struct _TMProxyImpl {
|
||||||
|
|
||||||
static inline TMProxyImpl *impl_from_IRpcProxyBuffer( IRpcProxyBuffer *iface )
|
static inline TMProxyImpl *impl_from_IRpcProxyBuffer( IRpcProxyBuffer *iface )
|
||||||
{
|
{
|
||||||
return (TMProxyImpl *)((char*)iface - FIELD_OFFSET(TMProxyImpl, lpvtbl2));
|
return CONTAINING_RECORD(iface, TMProxyImpl, IRpcProxyBuffer_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI
|
static HRESULT WINAPI
|
||||||
|
@ -1743,7 +1743,7 @@ PSFacBuf_CreateProxy(
|
||||||
CoTaskMemFree(proxy);
|
CoTaskMemFree(proxy);
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
proxy->lpvtbl2 = &tmproxyvtable;
|
proxy->IRpcProxyBuffer_iface.lpVtbl = &tmproxyvtable;
|
||||||
/* one reference for the proxy */
|
/* one reference for the proxy */
|
||||||
proxy->ref = 1;
|
proxy->ref = 1;
|
||||||
proxy->tinfo = tinfo;
|
proxy->tinfo = tinfo;
|
||||||
|
@ -1835,17 +1835,17 @@ PSFacBuf_CreateProxy(
|
||||||
if (hres == S_OK)
|
if (hres == S_OK)
|
||||||
{
|
{
|
||||||
*ppv = proxy;
|
*ppv = proxy;
|
||||||
*ppProxy = (IRpcProxyBuffer *)&(proxy->lpvtbl2);
|
*ppProxy = &proxy->IRpcProxyBuffer_iface;
|
||||||
IUnknown_AddRef((IUnknown *)*ppv);
|
IUnknown_AddRef((IUnknown *)*ppv);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
TMProxyImpl_Release((IRpcProxyBuffer *)&proxy->lpvtbl2);
|
TMProxyImpl_Release(&proxy->IRpcProxyBuffer_iface);
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct _TMStubImpl {
|
typedef struct _TMStubImpl {
|
||||||
const IRpcStubBufferVtbl *lpvtbl;
|
IRpcStubBuffer IRpcStubBuffer_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
LPUNKNOWN pUnk;
|
LPUNKNOWN pUnk;
|
||||||
|
@ -1855,6 +1855,11 @@ typedef struct _TMStubImpl {
|
||||||
BOOL dispatch_derivative;
|
BOOL dispatch_derivative;
|
||||||
} TMStubImpl;
|
} TMStubImpl;
|
||||||
|
|
||||||
|
static inline TMStubImpl *impl_from_IRpcStubBuffer(IRpcStubBuffer *iface)
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD(iface, TMStubImpl, IRpcStubBuffer_iface);
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI
|
static HRESULT WINAPI
|
||||||
TMStubImpl_QueryInterface(LPRPCSTUBBUFFER iface, REFIID riid, LPVOID *ppv)
|
TMStubImpl_QueryInterface(LPRPCSTUBBUFFER iface, REFIID riid, LPVOID *ppv)
|
||||||
{
|
{
|
||||||
|
@ -1870,9 +1875,9 @@ TMStubImpl_QueryInterface(LPRPCSTUBBUFFER iface, REFIID riid, LPVOID *ppv)
|
||||||
static ULONG WINAPI
|
static ULONG WINAPI
|
||||||
TMStubImpl_AddRef(LPRPCSTUBBUFFER iface)
|
TMStubImpl_AddRef(LPRPCSTUBBUFFER iface)
|
||||||
{
|
{
|
||||||
TMStubImpl *This = (TMStubImpl *)iface;
|
TMStubImpl *This = impl_from_IRpcStubBuffer(iface);
|
||||||
ULONG refCount = InterlockedIncrement(&This->ref);
|
ULONG refCount = InterlockedIncrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
|
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
|
||||||
|
|
||||||
return refCount;
|
return refCount;
|
||||||
|
@ -1881,7 +1886,7 @@ TMStubImpl_AddRef(LPRPCSTUBBUFFER iface)
|
||||||
static ULONG WINAPI
|
static ULONG WINAPI
|
||||||
TMStubImpl_Release(LPRPCSTUBBUFFER iface)
|
TMStubImpl_Release(LPRPCSTUBBUFFER iface)
|
||||||
{
|
{
|
||||||
TMStubImpl *This = (TMStubImpl *)iface;
|
TMStubImpl *This = impl_from_IRpcStubBuffer(iface);
|
||||||
ULONG refCount = InterlockedDecrement(&This->ref);
|
ULONG refCount = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
|
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
|
||||||
|
@ -1900,7 +1905,7 @@ TMStubImpl_Release(LPRPCSTUBBUFFER iface)
|
||||||
static HRESULT WINAPI
|
static HRESULT WINAPI
|
||||||
TMStubImpl_Connect(LPRPCSTUBBUFFER iface, LPUNKNOWN pUnkServer)
|
TMStubImpl_Connect(LPRPCSTUBBUFFER iface, LPUNKNOWN pUnkServer)
|
||||||
{
|
{
|
||||||
TMStubImpl *This = (TMStubImpl *)iface;
|
TMStubImpl *This = impl_from_IRpcStubBuffer(iface);
|
||||||
|
|
||||||
TRACE("(%p)->(%p)\n", This, pUnkServer);
|
TRACE("(%p)->(%p)\n", This, pUnkServer);
|
||||||
|
|
||||||
|
@ -1916,7 +1921,7 @@ TMStubImpl_Connect(LPRPCSTUBBUFFER iface, LPUNKNOWN pUnkServer)
|
||||||
static void WINAPI
|
static void WINAPI
|
||||||
TMStubImpl_Disconnect(LPRPCSTUBBUFFER iface)
|
TMStubImpl_Disconnect(LPRPCSTUBBUFFER iface)
|
||||||
{
|
{
|
||||||
TMStubImpl *This = (TMStubImpl *)iface;
|
TMStubImpl *This = impl_from_IRpcStubBuffer(iface);
|
||||||
|
|
||||||
TRACE("(%p)->()\n", This);
|
TRACE("(%p)->()\n", This);
|
||||||
|
|
||||||
|
@ -1937,7 +1942,7 @@ TMStubImpl_Invoke(
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
int i;
|
int i;
|
||||||
const FUNCDESC *fdesc;
|
const FUNCDESC *fdesc;
|
||||||
TMStubImpl *This = (TMStubImpl *)iface;
|
TMStubImpl *This = impl_from_IRpcStubBuffer(iface);
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
DWORD *args = NULL, res, *xargs, nrofargs;
|
DWORD *args = NULL, res, *xargs, nrofargs;
|
||||||
marshal_state buf;
|
marshal_state buf;
|
||||||
|
@ -2113,7 +2118,7 @@ TMStubImpl_IsIIDSupported(LPRPCSTUBBUFFER iface, REFIID riid) {
|
||||||
|
|
||||||
static ULONG WINAPI
|
static ULONG WINAPI
|
||||||
TMStubImpl_CountRefs(LPRPCSTUBBUFFER iface) {
|
TMStubImpl_CountRefs(LPRPCSTUBBUFFER iface) {
|
||||||
TMStubImpl *This = (TMStubImpl *)iface;
|
TMStubImpl *This = impl_from_IRpcStubBuffer(iface);
|
||||||
|
|
||||||
FIXME("()\n");
|
FIXME("()\n");
|
||||||
return This->ref; /*FIXME? */
|
return This->ref; /*FIXME? */
|
||||||
|
@ -2163,14 +2168,14 @@ PSFacBuf_CreateStub(
|
||||||
stub = CoTaskMemAlloc(sizeof(TMStubImpl));
|
stub = CoTaskMemAlloc(sizeof(TMStubImpl));
|
||||||
if (!stub)
|
if (!stub)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
stub->lpvtbl = &tmstubvtbl;
|
stub->IRpcStubBuffer_iface.lpVtbl = &tmstubvtbl;
|
||||||
stub->ref = 1;
|
stub->ref = 1;
|
||||||
stub->tinfo = tinfo;
|
stub->tinfo = tinfo;
|
||||||
stub->dispatch_stub = NULL;
|
stub->dispatch_stub = NULL;
|
||||||
stub->dispatch_derivative = FALSE;
|
stub->dispatch_derivative = FALSE;
|
||||||
stub->iid = *riid;
|
stub->iid = *riid;
|
||||||
hres = IRpcStubBuffer_Connect((LPRPCSTUBBUFFER)stub,pUnkServer);
|
hres = IRpcStubBuffer_Connect(&stub->IRpcStubBuffer_iface,pUnkServer);
|
||||||
*ppStub = (LPRPCSTUBBUFFER)stub;
|
*ppStub = &stub->IRpcStubBuffer_iface;
|
||||||
TRACE("IRpcStubBuffer: %p\n", stub);
|
TRACE("IRpcStubBuffer: %p\n", stub);
|
||||||
if (hres)
|
if (hres)
|
||||||
ERR("Connect to pUnkServer failed?\n");
|
ERR("Connect to pUnkServer failed?\n");
|
||||||
|
|
Loading…
Reference in New Issue