Alexandre Julliard : ole32: Don' t continue to wait for a local server if the process has terminated.

Alexandre Julliard julliard at winehq.org
Fri May 20 12:44:32 CDT 2011


Module: wine
Branch: master
Commit: 5a559f181a81d5418d47415661e8e358d98bfaae
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5a559f181a81d5418d47415661e8e358d98bfaae

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri May 20 13:41:18 2011 +0200

ole32: Don't continue to wait for a local server if the process has terminated.

---

 dlls/ole32/rpc.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/dlls/ole32/rpc.c b/dlls/ole32/rpc.c
index 75b6b1f..431f5bc 100644
--- a/dlls/ole32/rpc.c
+++ b/dlls/ole32/rpc.c
@@ -1637,7 +1637,7 @@ void RPC_StartRemoting(struct apartment *apt)
 }
 
 
-static HRESULT create_server(REFCLSID rclsid)
+static HRESULT create_server(REFCLSID rclsid, HANDLE *process)
 {
     static const WCHAR  wszLocalServer32[] = { 'L','o','c','a','l','S','e','r','v','e','r','3','2',0 };
     static const WCHAR  embedding[] = { ' ', '-','E','m','b','e','d','d','i','n','g',0 };
@@ -1676,7 +1676,7 @@ static HRESULT create_server(REFCLSID rclsid)
         WARN("failed to run local server %s\n", debugstr_w(command));
         return HRESULT_FROM_WIN32(GetLastError());
     }
-    CloseHandle(pinfo.hProcess);
+    *process = pinfo.hProcess;
     CloseHandle(pinfo.hThread);
 
     return S_OK;
@@ -1813,9 +1813,10 @@ HRESULT RPC_GetLocalClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
         if (hPipe == INVALID_HANDLE_VALUE) {
             DWORD index;
             DWORD start_ticks;
+            HANDLE process = 0;
             if (tries == 1) {
                 if ( (hres = create_local_service(rclsid)) &&
-                     (hres = create_server(rclsid)) )
+                     (hres = create_server(rclsid, &process)) )
                     return hres;
             } else {
                 WARN("Connecting to %s, no response yet, retrying: le is %u\n", debugstr_w(pipefn), GetLastError());
@@ -1823,8 +1824,16 @@ HRESULT RPC_GetLocalClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
             /* wait for one second, even if messages arrive */
             start_ticks = GetTickCount();
             do {
-                CoWaitForMultipleHandles(0, 1000, 0, NULL, &index);
+                if (SUCCEEDED(CoWaitForMultipleHandles(0, 1000, (process != 0),
+                                                       &process, &index)) && process && !index)
+                {
+                    WARN( "server for %s failed to start\n", debugstr_guid(rclsid) );
+                    CloseHandle( hPipe );
+                    CloseHandle( process );
+                    return E_NOINTERFACE;
+                }
             } while (GetTickCount() - start_ticks < 1000);
+            if (process) CloseHandle( process );
             continue;
         }
         bufferlen = 0;




More information about the wine-cvs mailing list