Bug Fix With Delay load function in Shell32 (version3!!!)

Robert Shearman R.J.Shearman at warwick.ac.uk
Sun Jan 12 11:42:46 CST 2003


> -----Original Message-----
> From: Dimitrie O. Paun [mailto:dpaun at rogers.com]
> Sent: 12 January 2003 15:51
> To: wine-devel at winehq.com; Robert Shearman
> Subject: Re: Bug Fix With Delay load function in Shell32 (version2)
> > Index: shellole.c
>
> Please make your patches relative to wine's root.

My attempt to save time backfired, it would seem :)

> > -HINSTANCE hShellOle32 = 0;
> > +HINSTANCE g_hShellOle32 = 0; /* global handle to ole32.dll */
>
> Also, please do not introduce ugly naming conventions like the above,
> especially when the style the DLL is written in does not call for it.

Ok, I was just trying to make sure that the same thing wouldn't happen
again, but I am happy as my patch is smaller without this.

ChangeLog:
- Seperate the HINSTANCEs used by GetShellOle() and other delay load
functions

Rob
-------------- next part --------------
Index: wine/dlls/shell32/clipboard.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/clipboard.c,v
retrieving revision 1.13
diff -u -r1.13 wine/dlls/shell32/clipboard.c
--- clipboard.c	13 Dec 2002 00:36:52 -0000	1.13
+++ clipboard.c	12 Jan 2003 16:38:40 -0000
@@ -63,24 +63,25 @@
  */
 BOOL GetShellOle(void)
 {
-	if(!hShellOle32)
-	{
-	  hShellOle32 = LoadLibraryA("ole32.dll");
-	  if(hShellOle32)
-	  {
-	    pOleInitialize=(void*)GetProcAddress(hShellOle32,"OleInitialize");
-	    pOleUninitialize=(void*)GetProcAddress(hShellOle32,"OleUninitialize");
-	    pRegisterDragDrop=(void*)GetProcAddress(hShellOle32,"RegisterDragDrop");
-	    pRevokeDragDrop=(void*)GetProcAddress(hShellOle32,"RevokeDragDrop");
-	    pDoDragDrop=(void*)GetProcAddress(hShellOle32,"DoDragDrop");
-	    pReleaseStgMedium=(void*)GetProcAddress(hShellOle32,"ReleaseStgMedium");
-	    pOleSetClipboard=(void*)GetProcAddress(hShellOle32,"OleSetClipboard");
-	    pOleGetClipboard=(void*)GetProcAddress(hShellOle32,"OleGetClipboard");
+    static HANDLE hOle32 = NULL;
+    if(!hOle32)
+    {
+        hOle32 = LoadLibraryA("ole32.dll");
+        if(hOle32)
+        {
+            pOleInitialize=(void*)GetProcAddress(hOle32,"OleInitialize");
+            pOleUninitialize=(void*)GetProcAddress(hOle32,"OleUninitialize");
+            pRegisterDragDrop=(void*)GetProcAddress(hOle32,"RegisterDragDrop");
+            pRevokeDragDrop=(void*)GetProcAddress(hOle32,"RevokeDragDrop");
+            pDoDragDrop=(void*)GetProcAddress(hOle32,"DoDragDrop");
+            pReleaseStgMedium=(void*)GetProcAddress(hOle32,"ReleaseStgMedium");
+            pOleSetClipboard=(void*)GetProcAddress(hOle32,"OleSetClipboard");
+            pOleGetClipboard=(void*)GetProcAddress(hOle32,"OleGetClipboard");
 
-	    pOleInitialize(NULL);
-	  }
-	}
-	return TRUE;
+            pOleInitialize(NULL);
+        }
+    }
+    return TRUE;
 }
 
 /**************************************************************************
-------------- next part --------------
Index: wine/dlls/shell32/clipboard.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/clipboard.c,v
retrieving revision 1.13
diff -u -r1.13 wine/dlls/shell32/clipboard.c
--- clipboard.c	13 Dec 2002 00:36:52 -0000	1.13
+++ clipboard.c	12 Jan 2003 16:38:40 -0000
@@ -63,24 +63,25 @@
  */
 BOOL GetShellOle(void)
 {
-	if(!hShellOle32)
-	{
-	  hShellOle32 = LoadLibraryA("ole32.dll");
-	  if(hShellOle32)
-	  {
-	    pOleInitialize=(void*)GetProcAddress(hShellOle32,"OleInitialize");
-	    pOleUninitialize=(void*)GetProcAddress(hShellOle32,"OleUninitialize");
-	    pRegisterDragDrop=(void*)GetProcAddress(hShellOle32,"RegisterDragDrop");
-	    pRevokeDragDrop=(void*)GetProcAddress(hShellOle32,"RevokeDragDrop");
-	    pDoDragDrop=(void*)GetProcAddress(hShellOle32,"DoDragDrop");
-	    pReleaseStgMedium=(void*)GetProcAddress(hShellOle32,"ReleaseStgMedium");
-	    pOleSetClipboard=(void*)GetProcAddress(hShellOle32,"OleSetClipboard");
-	    pOleGetClipboard=(void*)GetProcAddress(hShellOle32,"OleGetClipboard");
+    static HANDLE hOle32 = NULL;
+    if(!hOle32)
+    {
+        hOle32 = LoadLibraryA("ole32.dll");
+        if(hOle32)
+        {
+            pOleInitialize=(void*)GetProcAddress(hOle32,"OleInitialize");
+            pOleUninitialize=(void*)GetProcAddress(hOle32,"OleUninitialize");
+            pRegisterDragDrop=(void*)GetProcAddress(hOle32,"RegisterDragDrop");
+            pRevokeDragDrop=(void*)GetProcAddress(hOle32,"RevokeDragDrop");
+            pDoDragDrop=(void*)GetProcAddress(hOle32,"DoDragDrop");
+            pReleaseStgMedium=(void*)GetProcAddress(hOle32,"ReleaseStgMedium");
+            pOleSetClipboard=(void*)GetProcAddress(hOle32,"OleSetClipboard");
+            pOleGetClipboard=(void*)GetProcAddress(hOle32,"OleGetClipboard");
 
-	    pOleInitialize(NULL);
-	  }
-	}
-	return TRUE;
+            pOleInitialize(NULL);
+        }
+    }
+    return TRUE;
 }
 
 /**************************************************************************


More information about the wine-patches mailing list