windows/dce.c:GetDCEx sanity check
Willem Jan Palenstijn
palenstijn at planet.nl
Sun Sep 23 11:58:51 CDT 2001
Hi,
While trying to get Avernum (the free demo available from
www.spiderwebsoftware.com) to run using Wine, I found that (probably
because of a bug in Avernum) GetDCEx sometimes returns a handle
belonging to an already deleted DCE. Avernum appears to call DeleteDC on
a DC returned from GetDCEx, which is forbidden according to MSDN. (But
the Windows version works properly despite this bug)
To work around this bug, I added a small sanity check to GetDCEx that
checks if the DCE that it attempts to re-use is indeed valid.
After this small patch, Avernum appears to work very well. (just a bit
slow)
-Willem Jan
ChangeLog:
Willem Jan Palenstijn <wjpalenstijn at users.sourceforge.net>
* windows/dce.c: GetDCEx: only try to re-use valid handles
-------------- next part --------------
diff -ur ../wine.orig/windows/dce.c ./windows/dce.c
--- ../wine.orig/windows/dce.c Sun Sep 23 18:10:45 2001
+++ ./windows/dce.c Sun Sep 23 18:10:51 2001
@@ -450,6 +450,12 @@
for (dce = firstDCE; (dce); dce = dce->next)
{
+ if (!DC_GetDCPtr(dce->hDC)) {
+ WARN("Invalid DCE found in DCE list [%08x]\n", (unsigned)dce);
+ continue;
+ }
+ GDI_ReleaseObj(dce->hDC);
+
if ((dce->DCXflags & (DCX_CACHE | DCX_DCEBUSY)) == DCX_CACHE )
{
dceUnused = dce;
More information about the wine-patches
mailing list