patch for multimon CreateDC invocation

Andreas Mohr andi at rhlx01.fht-esslingen.de
Mon Feb 3 10:39:43 CST 2003


Hi all,

Reason 2.0 calls CreateDC from the EnumDisplayMonitors's callback
function like that:

080762e0:Call
user32.EnumDisplayMonitors(00000000,00000000,006e6680,40692ad0)
ret=006e64b1
080762e0:Call user32.GetMonitorInfoA(12340042,406928bc) ret=006e66db
080762e0:Ret  user32.GetMonitorInfoA() retval=00000001 ret=006e66db
080762e0:Call gdi32.CreateDCA(00000000,406928e4
"DISPLAY",00000000,00000000) ret=006e6747
080762e0:Call kernel32._CheckNotSysLevel(40963f84) ret=4093a0f8
080762e0:Ret  kernel32._CheckNotSysLevel() retval=080762e0 ret=4093a0f8
080762e0:Call kernel32.GetProfileStringA(409589b4 "devices",406928e4
"DISPLAY",409589b3 "",406926c4,0000012c) ret=40942bc4
080762e0:Ret  kernel32.GetProfileStringA() retval=00000000 ret=40942bc4
080762e0:Ret  gdi32.CreateDCA() retval=00000000 ret=006e6747
080762e0:Ret  user32.EnumDisplayMonitors() retval=00000001 ret=006e64b1
080762e0:Call ntdll.RtlFreeHeap(41220000,00000000,41700ea0) ret=0077d45a
080762e0:Ret  ntdll.RtlFreeHeap() retval=00000001 ret=0077d45a
080762e0:Call user32.MessageBoxA(00000000,008823c0 "Unsupported color
depth, application will quit.",41429771 "Reason",00000000) ret=006f2742

Needless to say, CreateDCA fails since it's an "uncommon" argument setup
(which is being mentioned together with Win98 multimon support on the
net, BTW!)
Thus make sure we "properly" hack^H^H^H^Hsupport this kind of multimon
invocation.

And no, Reason 2.0 doesn't entirely work yet, but I'll try some more...

Andreas Mohr

Index: objects/dc.c
===================================================================
RCS file: /home/wine/wine/objects/dc.c,v
retrieving revision 1.89
diff -u -r1.89 dc.c
--- objects/dc.c	24 Jan 2003 00:44:54 -0000	1.89
+++ objects/dc.c	3 Feb 2003 16:51:49 -0000
@@ -568,6 +568,15 @@
 
 /***********************************************************************
  *           CreateDCA    (GDI32.@)
+ *
+ * CreateDC is quite some mess.
+ * Many invocations are with (driver, NULL, NULL, NULL),
+ * e.g. ("DISPLAY", NULL, NULL, NULL),
+ * however in the Win98 multi monitor case, there are invocations
+ * documented such as (NULL, MONITORINFOEX.szDevice ["DISPLAY"], NULL, NULL).
+ * Thus getting argument parsing right is everything but trivial
+ * (I've been reviewing some CreateDC argument problem >= 3 times in the
+ * last years!)
  */
 HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
                           const DEVMODEA *initData )
@@ -581,8 +590,16 @@
 
     if (!device || !DRIVER_GetDriverName( device, buf, sizeof(buf) ))
     {
-        if (!driver) return 0;
-        strcpy(buf, driver);
+        if (!driver)
+	{
+	    /* special hack for our multimon support */
+	    if ((device) && (!strcmp(device, "DISPLAY")))
+	        strcpy(buf, "DISPLAY");
+	    else
+	        return 0;
+	}
+	else
+            strcpy(buf, driver);
     }
 
     if (!(funcs = DRIVER_load_driver( buf )))

-- 
Andreas Mohr                        Stauferstr. 6, D-71272 Renningen, Germany



More information about the wine-patches mailing list