ole32: Don't lookup the address for the DllGetClassObject function for ole32.dll in the apartment loaded dll list.

Robert Shearman rob at codeweavers.com
Sun May 13 16:18:11 CDT 2007


Call the function directly for a small performance boost.
---
  dlls/ole32/compobj.c |   14 ++++++++++++++
  1 files changed, 14 insertions(+), 0 deletions(-)
-------------- next part --------------
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 614b426..0524733 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -594,10 +594,24 @@ void apartment_joinmta(void)
 static HRESULT apartment_getclassobject(struct apartment *apt, LPCWSTR dllpath,
                                         REFCLSID rclsid, REFIID riid, void **ppv)
 {
+    static const WCHAR wszOle32[] = {'o','l','e','3','2','.','d','l','l',0};
     HRESULT hr = S_OK;
     BOOL found = FALSE;
     struct apartment_loaded_dll *apartment_loaded_dll;
 
+    if (!strcmpiW(dllpath, wszOle32))
+    {
+        /* we don't need to control the lifetime of this dll, so use the local
+         * implementation of DllGetClassObject directly */
+        TRACE("calling ole32!DllGetClassObject\n");
+        hr = DllGetClassObject(rclsid, riid, ppv);
+        
+        if (hr != S_OK)
+            ERR("DllGetClassObject returned error 0x%08x\n", hr);
+
+        return hr;
+    }
+    
     EnterCriticalSection(&apt->cs);
 
     LIST_FOR_EACH_ENTRY(apartment_loaded_dll, &apt->loaded_dlls, struct apartment_loaded_dll, entry)


More information about the wine-patches mailing list