GetCurrentObject(hdc,OBJ_BITMAP) should not return zero.

Rein Klazes rklazes at xs4all.nl
Wed Jan 22 07:32:29 CST 2003


Hi,

( cc'd to the developer list. There might well be some better way to
solve the problem.)

Eurdora 4.x and 5.x crash when handling a WM_PAINT message. The program
gets a hdc from BeginPaint() and does a GetCurrentObject(hdc,OBJ_BITMAP)
on that device context. In wine zero is returned and the program crashes
as a result of that (step tracing it shows some math on it and then uses
the result as a pointer).
The same problem was reported on the developer list in:
http://www.winehq.com/hypermail/wine-devel/2002/11/0599.htm

Since the program does not do anything suspicious between aquiring the
dc handle and the GetCurrentObject, Checking under Windows (Win2000).
I found that GetCurrentObject(,OBJ_BITMAP) on the the dc returned both
by BeginPaint() and CreateDC(), retrieves a non-zero handle. The handle
looks genuine, but the bitmap does not appear to be valid (funny
dimensions and so).
   
My proposed solution is to do what CreatCompatibleDC already does: load
a default bitmap in CreateDC(). This has worked here for a long time
without any aparent problems.

Changelog:

	objects:	dc.c
	Load default stock bitmap in CreateDC()

Rein.
-- 
Rein Klazes
rklazes at xs4all.nl
-------------- next part --------------
--- wine/objects/dc.c	2002-12-03 20:18:41.000000000 +0100
+++ mywine/objects/dc.c	2003-01-19 15:58:45.000000000 +0100
@@ -596,6 +596,7 @@
         return 0;
     }
 
+    dc->hBitmap      = GetStockObject( DEFAULT_BITMAP );
     dc->flags = 0;
 
     TRACE("(driver=%s, device=%s, output=%s): returning %p\n",


More information about the wine-devel mailing list