Zebediah Figura : rpcrt4: Fail with CO_E_OBJNOTCONNECTED when trying to call methods on a disconnected proxy.

Alexandre Julliard julliard at winehq.org
Tue May 21 16:45:22 CDT 2019


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon May 20 23:30:53 2019 -0500

rpcrt4: Fail with CO_E_OBJNOTCONNECTED when trying to call methods on a disconnected proxy.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ole32/tests/marshal.c | 12 +++++++++---
 dlls/rpcrt4/cproxy.c       |  2 ++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c
index 33b155d..2aaa34e 100644
--- a/dlls/ole32/tests/marshal.c
+++ b/dlls/ole32/tests/marshal.c
@@ -1203,7 +1203,9 @@ static void test_marshal_proxy_apartment_shutdown(void)
 {
     HRESULT hr;
     IStream *pStream = NULL;
-    IUnknown *pProxy = NULL;
+    IClassFactory *proxy;
+    IUnknown *unk;
+    ULONG ref;
     DWORD tid;
     HANDLE thread;
 
@@ -1218,7 +1220,7 @@ static void test_marshal_proxy_apartment_shutdown(void)
     ok_non_zero_external_conn();
     
     IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
-    hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy);
+    hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&proxy);
     ok_ole_success(hr, CoUnmarshalInterface);
     IStream_Release(pStream);
 
@@ -1231,7 +1233,11 @@ static void test_marshal_proxy_apartment_shutdown(void)
     ok_zero_external_conn();
     ok_last_release_closes(TRUE);
 
-    IUnknown_Release(pProxy);
+    hr = IClassFactory_CreateInstance(proxy, NULL, &IID_IUnknown, (void **)&unk);
+    ok(hr == CO_E_OBJNOTCONNECTED, "got %#x\n", hr);
+
+    ref = IClassFactory_Release(proxy);
+    ok(!ref, "got %d refs\n", ref);
 
     ok_no_locks();
 
diff --git a/dlls/rpcrt4/cproxy.c b/dlls/rpcrt4/cproxy.c
index ddbd58c..a56a04b 100644
--- a/dlls/rpcrt4/cproxy.c
+++ b/dlls/rpcrt4/cproxy.c
@@ -458,6 +458,8 @@ void WINAPI NdrProxyInitialize(void *This,
   TRACE("(%p,%p,%p,%p,%d)\n", This, pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
   NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
   StdProxy_GetChannel(This, &pStubMsg->pRpcChannelBuffer);
+  if (!pStubMsg->pRpcChannelBuffer)
+    RpcRaiseException(CO_E_OBJNOTCONNECTED);
   IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer,
                                &pStubMsg->dwDestContext,
                                &pStubMsg->pvDestContext);




More information about the wine-cvs mailing list