- Use InterlockedIncrement for the ipid counter instead of a critical
authorRobert Shearman <rob@codeweavers.com>
Wed, 26 Jan 2005 20:53:06 +0000 (20:53 +0000)
committerAlexandre Julliard <julliard@winehq.org>
Wed, 26 Jan 2005 20:53:06 +0000 (20:53 +0000)
  section (suggested by Mike Hearn).
- Remove a line added by a bad merge.
- Implement RemUnkStub_Disconnect.
- Remove all of the RPC disconnect code.

dlls/ole32/compobj.c
dlls/ole32/compobj_private.h
dlls/ole32/marshal.c
dlls/ole32/oleproxy.c
dlls/ole32/rpc.c
dlls/ole32/stubmanager.c

index 575f04fd23085e79a90c6b71d4bd9f0de4c31309..afa73db3ae68bb118422a3dca1f59b441a7c8442 100644 (file)
@@ -246,7 +246,7 @@ APARTMENT* COM_CreateApartment(DWORD model)
 
         list_init(&apt->proxies);
         list_init(&apt->stubmgrs);
-        apt->ipidc = 1;
+        apt->ipidc = 0;
         apt->refs = 1;
         apt->remunk_exported = FALSE;
         apt->oidc = 1;
index ee9ed9a305807e039f9ca8b1b43c3d25119bcbc0..6b7686bd791e80e06d9b5cec572e76c77b36b976 100644 (file)
@@ -123,7 +123,7 @@ struct apartment
   DWORD tid;               /* thread id (RO) */
   HANDLE thread;           /* thread handle (RO) */
   OXID oxid;               /* object exporter ID (RO) */
-  DWORD ipidc;             /* interface pointer ID counter, starts at 1 (CS cs) */
+  DWORD ipidc;             /* interface pointer ID counter, starts at 1 (LOCK) */
   HWND win;                /* message window (RO) */
   CRITICAL_SECTION cs;     /* thread safety */
   LPMESSAGEFILTER filter;  /* message filter (CS cs) */
index fa0d7e72643adfa46ec87248db318be135e32be1..ca050700479b55d8bc40027408cb8f2b001316b3 100644 (file)
@@ -349,7 +349,6 @@ static HRESULT proxy_manager_construct(
     This->oid = oid;
 
     This->refs = 1;
-    This->sorflags = sorflags;
 
     /* the DCOM draft specification states that the SORF_NOPING flag is
      * proxy manager specific, not ifproxy specific, so this implies that we
index eeb051c2ceca4b648e187389c79a23f2b1cda31b..6c8ecf9719873a236b0011c0e8bd0ca8f2485cd3 100644 (file)
@@ -509,6 +509,8 @@ static void WINAPI RemUnkStub_Disconnect(LPRPCSTUBBUFFER iface)
 {
   RemUnkStub *This = (RemUnkStub *)iface;
   TRACE("(%p)->Disconnect()\n",This);
+  IUnknown_Release(This->iface);
+  This->iface = NULL;
 }
 
 static HRESULT WINAPI RemUnkStub_Invoke(LPRPCSTUBBUFFER iface,
index bee0d189ce5d546dfdba06e967272de70d85bc36..f440c6e520149de47ec61753ecb114bda026360b 100644 (file)
@@ -54,7 +54,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
 
 #define REQTYPE_REQUEST                0
 #define REQTYPE_RESPONSE       1
-#define REQTYPE_DISCONNECT     2
 
 struct request_header
 {
@@ -71,13 +70,6 @@ struct response_header
     DWORD              retval;
 };
 
-/* used when shutting down a pipe, e.g. at the end of a process */
-struct disconnect_header
-{
-  DWORD reqid;
-  wine_marshal_id mid; /* mid of stub to delete */
-};
-
 
 #define REQSTATE_START                 0
 #define REQSTATE_REQ_QUEUED            1
@@ -291,34 +283,11 @@ static ULONG WINAPI
 PipeBuf_Release(LPRPCCHANNELBUFFER iface) {
     PipeBuf *This = (PipeBuf *)iface;
     ULONG ref;
-#if 0
-    struct disconnect_header header;
-    HANDLE pipe;
-    DWORD reqtype = REQTYPE_DISCONNECT;
-    DWORD magic;
-#endif
 
     ref = InterlockedDecrement(&This->ref);
     if (ref)
        return ref;
 
-#if 0 /* no longer needed now we've got IRemUnknown ref counting */
-    memcpy(&header.mid, &This->mid, sizeof(wine_marshal_id));
-
-    pipe = PIPE_FindByMID(&This->mid);
-
-    write_pipe(pipe, &reqtype, sizeof(reqtype));
-    write_pipe(pipe, &header, sizeof(struct disconnect_header));
-
-    TRACE("written disconnect packet\n");
-
-    /* prevent a disconnect race with the other side: this isn't
-     * necessary for real dcom but the test suite needs it */
-    
-    read_pipe(pipe, &magic, sizeof(magic));
-    if (magic != 0xcafebabe) ERR("bad disconnection magic: expecting 0xcafebabe but got 0x%lx\n", magic);
-#endif
-
     HeapFree(GetProcessHeap(),0,This);
     return 0;
 }
@@ -771,42 +740,7 @@ COM_RpcReceive(struct pipe *xpipe) {
     EnterCriticalSection(&(xpipe->crit));
 
     /* only received by servers */
-    if (reqtype == REQTYPE_DISCONNECT) { 
-        struct disconnect_header header;
-        struct stub_manager *stubmgr;
-        DWORD magic = 0xcafebabe;
-        APARTMENT *apt;
-
-        hres = read_pipe(xhPipe, &header, sizeof(header));
-        if (hres) {
-            ERR("could not read disconnect header\n");
-            goto disconnect_end;
-        }
-
-        TRACE("read disconnect header\n");
-
-        if (!(apt = COM_ApartmentFromOXID(header.mid.oxid, TRUE)))
-        {
-            ERR("Could not map OXID %s to apartment object in disconnect\n", wine_dbgstr_longlong(header.mid.oxid));
-            goto disconnect_end;
-        }
-
-        if (!(stubmgr = get_stub_manager(apt, header.mid.oid)))
-        {
-            ERR("could not locate stub to disconnect, mid.oid=%s\n", wine_dbgstr_longlong(header.mid.oid));
-            COM_ApartmentRelease(apt);
-            goto disconnect_end;
-        }
-
-        stub_manager_ext_release(stubmgr, 1);
-
-        stub_manager_int_release(stubmgr);
-        COM_ApartmentRelease(apt);
-
-disconnect_end:
-        write_pipe(xhPipe, &magic, sizeof(magic));
-        goto end;
-    } else if (reqtype == REQTYPE_REQUEST) {
+    if (reqtype == REQTYPE_REQUEST) {
        struct rpc *xreq;
         
        RPC_GetRequest(&xreq);
index 47df17414fc77bda84f357f61545de79c0727f7c..c9e754bee757f4a5be939a33ce224f7ac26344cc 100644 (file)
@@ -334,9 +334,7 @@ static inline HRESULT generate_ipid(struct stub_manager *m, IPID *ipid)
         return hr;
     }
 
-    EnterCriticalSection(&m->apt->cs);
-    ipid->Data1 = m->apt->ipidc++;
-    LeaveCriticalSection(&m->apt->cs);
+    ipid->Data1 = InterlockedIncrement(&m->apt->ipidc);
     ipid->Data2 = (USHORT)m->apt->tid;
     ipid->Data3 = (USHORT)GetCurrentProcessId();
     return S_OK;