CopyImage for IMAGE_BITMAP still not right, next Try

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Tue Sep 20 06:26:56 CDT 2005


Changelog:
	wine/dlls/user/cursoricon.c: CopyImage()
	Fix memory corruption
This fixes the memory coruption, while leaving the code path active.

-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/user/cursoricon.c
===================================================================
RCS file: /home/wine/wine/dlls/user/cursoricon.c,v
retrieving revision 1.17
diff -u -w -r1.17 cursoricon.c
--- wine/dlls/user/cursoricon.c	12 Sep 2005 10:30:06 -0000	1.17
+++ wine/dlls/user/cursoricon.c	20 Sep 2005 09:26:41 -0000
@@ -2307,9 +2307,10 @@
             bm.bmBits = NULL;
             if ((res = CreateBitmapIndirect(&bm)))
             {
-                char *buf = HeapAlloc( GetProcessHeap(), 0, bm.bmWidthBytes * bm.bmHeight );
+                LONG size = GetBitmapBits( hnd, 0, NULL );
+                char *buf = HeapAlloc( GetProcessHeap(), 0, size );
                 GetBitmapBits( hnd, bm.bmWidthBytes * bm.bmHeight, buf );
-                SetBitmapBits( res, bm.bmWidthBytes * bm.bmHeight, buf );
+                SetBitmapBits( res, size, buf );
                 HeapFree( GetProcessHeap(), 0, buf );
             }
             return (HICON)res;



More information about the wine-patches mailing list