Make the ClassFactory proxy support aggregation.
This commit is contained in:
parent
75f87dd43f
commit
dee74a6ec9
@ -270,6 +270,7 @@ typedef struct _CFProxy {
|
|||||||
DWORD ref;
|
DWORD ref;
|
||||||
|
|
||||||
IRpcChannelBuffer *chanbuf;
|
IRpcChannelBuffer *chanbuf;
|
||||||
|
IUnknown *outer_unknown;
|
||||||
} CFProxy;
|
} CFProxy;
|
||||||
|
|
||||||
static HRESULT WINAPI IRpcProxyBufferImpl_QueryInterface(LPRPCPROXYBUFFER iface,REFIID riid,LPVOID *ppv) {
|
static HRESULT WINAPI IRpcProxyBufferImpl_QueryInterface(LPRPCPROXYBUFFER iface,REFIID riid,LPVOID *ppv) {
|
||||||
@ -316,6 +317,8 @@ static void WINAPI IRpcProxyBufferImpl_Disconnect(LPRPCPROXYBUFFER iface) {
|
|||||||
|
|
||||||
static HRESULT WINAPI
|
static HRESULT WINAPI
|
||||||
CFProxy_QueryInterface(LPCLASSFACTORY iface,REFIID riid, LPVOID *ppv) {
|
CFProxy_QueryInterface(LPCLASSFACTORY iface,REFIID riid, LPVOID *ppv) {
|
||||||
|
ICOM_THIS_MULTI(CFProxy,lpvtbl_proxy,iface);
|
||||||
|
if (This->outer_unknown) return IUnknown_QueryInterface(This->outer_unknown, riid, ppv);
|
||||||
*ppv = NULL;
|
*ppv = NULL;
|
||||||
if (IsEqualIID(&IID_IClassFactory,riid) || IsEqualIID(&IID_IUnknown,riid)) {
|
if (IsEqualIID(&IID_IClassFactory,riid) || IsEqualIID(&IID_IUnknown,riid)) {
|
||||||
*ppv = (LPVOID)iface;
|
*ppv = (LPVOID)iface;
|
||||||
@ -330,15 +333,22 @@ CFProxy_QueryInterface(LPCLASSFACTORY iface,REFIID riid, LPVOID *ppv) {
|
|||||||
|
|
||||||
static ULONG WINAPI CFProxy_AddRef(LPCLASSFACTORY iface) {
|
static ULONG WINAPI CFProxy_AddRef(LPCLASSFACTORY iface) {
|
||||||
ICOM_THIS_MULTI(CFProxy,lpvtbl_cf,iface);
|
ICOM_THIS_MULTI(CFProxy,lpvtbl_cf,iface);
|
||||||
|
if (This->outer_unknown) return IUnknown_AddRef(This->outer_unknown);
|
||||||
return InterlockedIncrement(&This->ref);
|
return InterlockedIncrement(&This->ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI CFProxy_Release(LPCLASSFACTORY iface) {
|
static ULONG WINAPI CFProxy_Release(LPCLASSFACTORY iface) {
|
||||||
ULONG ref;
|
ULONG ref;
|
||||||
ICOM_THIS_MULTI(CFProxy,lpvtbl_cf,iface);
|
ICOM_THIS_MULTI(CFProxy,lpvtbl_cf,iface);
|
||||||
|
if (This->outer_unknown)
|
||||||
|
ref = IUnknown_Release(This->outer_unknown);
|
||||||
|
else
|
||||||
ref = InterlockedDecrement(&This->ref);
|
ref = InterlockedDecrement(&This->ref);
|
||||||
if (!ref) HeapFree(GetProcessHeap(),0,This);
|
|
||||||
|
if (!ref) {
|
||||||
|
IRpcChannelBuffer_Release(This->chanbuf);
|
||||||
|
HeapFree(GetProcessHeap(),0,This);
|
||||||
|
}
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,7 +434,7 @@ static IClassFactoryVtbl cfproxyvt = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static HRESULT
|
static HRESULT
|
||||||
CFProxy_Construct(LPVOID *ppv,LPVOID *ppProxy) {
|
CFProxy_Construct(IUnknown *pUnkOuter, LPVOID *ppv,LPVOID *ppProxy) {
|
||||||
CFProxy *cf;
|
CFProxy *cf;
|
||||||
|
|
||||||
cf = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(CFProxy));
|
cf = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(CFProxy));
|
||||||
@ -433,10 +443,13 @@ CFProxy_Construct(LPVOID *ppv,LPVOID *ppProxy) {
|
|||||||
|
|
||||||
cf->lpvtbl_cf = &cfproxyvt;
|
cf->lpvtbl_cf = &cfproxyvt;
|
||||||
cf->lpvtbl_proxy = &pspbvtbl;
|
cf->lpvtbl_proxy = &pspbvtbl;
|
||||||
/* 1 reference for the proxy and 1 for the object */
|
/* 1 reference for the proxy... */
|
||||||
cf->ref = 2;
|
cf->ref = 1;
|
||||||
|
cf->outer_unknown = pUnkOuter;
|
||||||
*ppv = &(cf->lpvtbl_cf);
|
*ppv = &(cf->lpvtbl_cf);
|
||||||
*ppProxy = &(cf->lpvtbl_proxy);
|
*ppProxy = &(cf->lpvtbl_proxy);
|
||||||
|
/* ...and 1 for the object */
|
||||||
|
IUnknown_AddRef((IUnknown *)*ppv);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,7 +477,7 @@ PSFacBuf_CreateProxy(
|
|||||||
if (IsEqualIID(&IID_IClassFactory,riid) ||
|
if (IsEqualIID(&IID_IClassFactory,riid) ||
|
||||||
IsEqualIID(&IID_IUnknown,riid)
|
IsEqualIID(&IID_IUnknown,riid)
|
||||||
)
|
)
|
||||||
return CFProxy_Construct(ppv,(LPVOID*)ppProxy);
|
return CFProxy_Construct(pUnkOuter, ppv,(LPVOID*)ppProxy);
|
||||||
FIXME("proxying not implemented for (%s) yet!\n",debugstr_guid(riid));
|
FIXME("proxying not implemented for (%s) yet!\n",debugstr_guid(riid));
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user