Index: trunk/src/gdi32/gdi32.cpp
===================================================================
--- trunk/src/gdi32/gdi32.cpp	(revision 1952)
+++ trunk/src/gdi32/gdi32.cpp	(revision 1954)
@@ -1,3 +1,3 @@
-/* $Id: gdi32.cpp,v 1.20 1999-12-02 18:46:21 achimha Exp $ */
+/* $Id: gdi32.cpp,v 1.21 1999-12-03 11:55:45 sandervl Exp $ */
 
 /*
@@ -282,4 +282,8 @@
 {
     dprintf(("GDI32: CreateDIBitmap\n"));
+//TEMPORARY HACK TO PREVENT CRASH IN OPEN32 (WSeB GA)
+    if(arg2->biHeight < 0) {
+	((BITMAPINFOHEADER *)arg2)->biHeight = -arg2->biHeight;
+    }
     return O32_CreateDIBitmap(arg1, arg2, arg3, arg4, arg5, arg6);
 }
@@ -667,9 +671,14 @@
 HDC WIN32API CreateDCW( LPCWSTR arg1, LPCWSTR arg2, LPCWSTR arg3, const DEVMODEW * arg4)
 {
+    char *astring4, *astring5;
+
     char *astring1 = UnicodeToAsciiString((LPWSTR)arg1);
     char *astring2 = UnicodeToAsciiString((LPWSTR)arg2);
     char *astring3 = UnicodeToAsciiString((LPWSTR)arg3);
-    char *astring4 = UnicodeToAsciiString((LPWSTR)(arg4->dmDeviceName));
-    char *astring5 = UnicodeToAsciiString((LPWSTR)(arg4->dmFormName));
+    if(arg4)
+    {
+      astring4 = UnicodeToAsciiString((LPWSTR)(arg4->dmDeviceName));
+      astring5 = UnicodeToAsciiString((LPWSTR)(arg4->dmFormName));
+    }
 
     HDC   rc;
@@ -678,44 +687,53 @@
     dprintf(("GDI32: CreateDCW"));
 
-    strcpy((char*)devmode.dmDeviceName, astring4);
-    strcpy((char*)devmode.dmFormName, astring5);
-
-    devmode.dmSpecVersion      = arg4->dmSpecVersion;
-    devmode.dmDriverVersion    = arg4->dmDriverVersion;
-    devmode.dmSize             = arg4->dmSize;
-    devmode.dmDriverExtra      = arg4->dmDriverExtra;
-    devmode.dmFields           = arg4->dmFields;
-    devmode.dmOrientation      = arg4->dmOrientation;
-    devmode.dmPaperSize        = arg4->dmPaperSize;
-    devmode.dmPaperLength      = arg4->dmPaperLength;
-    devmode.dmPaperWidth       = arg4->dmPaperWidth;
-    devmode.dmScale            = arg4->dmScale;
-    devmode.dmCopies           = arg4->dmCopies;
-    devmode.dmDefaultSource    = arg4->dmDefaultSource;
-    devmode.dmPrintQuality     = arg4->dmPrintQuality;
-    devmode.dmColor            = arg4->dmColor;
-    devmode.dmDuplex           = arg4->dmDuplex;
-    devmode.dmYResolution      = arg4->dmYResolution;
-    devmode.dmTTOption         = arg4->dmTTOption;
-    devmode.dmCollate          = arg4->dmCollate;
-    devmode.dmLogPixels        = arg4->dmLogPixels;
-    devmode.dmBitsPerPel       = arg4->dmBitsPerPel;
-    devmode.dmPelsWidth        = arg4->dmPelsWidth;
-    devmode.dmPelsHeight       = arg4->dmPelsHeight;
-    devmode.dmDisplayFlags     = arg4->dmDisplayFlags;
-    devmode.dmDisplayFrequency = arg4->dmDisplayFrequency;
-    devmode.dmICMMethod        = arg4->dmICMMethod;
-    devmode.dmICMIntent        = arg4->dmICMIntent;
-    devmode.dmMediaType        = arg4->dmMediaType;
-    devmode.dmDitherType       = arg4->dmDitherType;
-    devmode.dmReserved1        = arg4->dmReserved1;
-    devmode.dmReserved2        = arg4->dmReserved2;
-
-    rc = O32_CreateDC(astring1,astring2,astring3,&devmode);
+    if(arg4)
+    {
+      strcpy((char*)devmode.dmDeviceName, astring4);
+      strcpy((char*)devmode.dmFormName, astring5);
+
+      devmode.dmSpecVersion      = arg4->dmSpecVersion;
+      devmode.dmDriverVersion    = arg4->dmDriverVersion;
+      devmode.dmSize             = arg4->dmSize;
+      devmode.dmDriverExtra      = arg4->dmDriverExtra;
+      devmode.dmFields           = arg4->dmFields;
+      devmode.dmOrientation      = arg4->dmOrientation;
+      devmode.dmPaperSize        = arg4->dmPaperSize;
+      devmode.dmPaperLength      = arg4->dmPaperLength;
+      devmode.dmPaperWidth       = arg4->dmPaperWidth;
+      devmode.dmScale            = arg4->dmScale;
+      devmode.dmCopies           = arg4->dmCopies;
+      devmode.dmDefaultSource    = arg4->dmDefaultSource;
+      devmode.dmPrintQuality     = arg4->dmPrintQuality;
+      devmode.dmColor            = arg4->dmColor;
+      devmode.dmDuplex           = arg4->dmDuplex;
+      devmode.dmYResolution      = arg4->dmYResolution;
+      devmode.dmTTOption         = arg4->dmTTOption;
+      devmode.dmCollate          = arg4->dmCollate;
+      devmode.dmLogPixels        = arg4->dmLogPixels;
+      devmode.dmBitsPerPel       = arg4->dmBitsPerPel;
+      devmode.dmPelsWidth        = arg4->dmPelsWidth;
+      devmode.dmPelsHeight       = arg4->dmPelsHeight;
+      devmode.dmDisplayFlags     = arg4->dmDisplayFlags;
+      devmode.dmDisplayFrequency = arg4->dmDisplayFrequency;
+      devmode.dmICMMethod        = arg4->dmICMMethod;
+      devmode.dmICMIntent        = arg4->dmICMIntent;
+      devmode.dmMediaType        = arg4->dmMediaType;
+      devmode.dmDitherType       = arg4->dmDitherType;
+      devmode.dmReserved1        = arg4->dmReserved1;
+      devmode.dmReserved2        = arg4->dmReserved2;
+
+      rc = O32_CreateDC(astring1,astring2,astring3,&devmode);
+    }
+    else
+      rc = O32_CreateDC(astring1,astring2,astring3, NULL);
+
     FreeAsciiString(astring1);
     FreeAsciiString(astring2);
     FreeAsciiString(astring3);
-    FreeAsciiString(astring4);
-    FreeAsciiString(astring5);
+    if(arg4)
+    {
+      FreeAsciiString(astring4);
+      FreeAsciiString(astring5);
+    }
 
     return rc;
@@ -771,9 +789,14 @@
 HDC WIN32API CreateICW( LPCWSTR arg1, LPCWSTR arg2, LPCWSTR arg3, const DEVMODEW * arg4)
 {
+    char *astring4, *astring5;
+
     char *astring1 = UnicodeToAsciiString((LPWSTR)arg1);
     char *astring2 = UnicodeToAsciiString((LPWSTR)arg2);
     char *astring3 = UnicodeToAsciiString((LPWSTR)arg3);
-    char *astring4 = UnicodeToAsciiString((LPWSTR)(arg4->dmDeviceName));
-    char *astring5 = UnicodeToAsciiString((LPWSTR)(arg4->dmFormName));
+    if(arg4)
+    {
+      astring4 = UnicodeToAsciiString((LPWSTR)(arg4->dmDeviceName));
+      astring5 = UnicodeToAsciiString((LPWSTR)(arg4->dmFormName));
+    }
 
     HDC   rc;
@@ -782,44 +805,54 @@
     dprintf(("GDI32: CreateICW"));
 
-    strcpy((char*)devmode.dmDeviceName, astring4);
-    strcpy((char*)devmode.dmFormName, astring5);
-
-    devmode.dmSpecVersion      = arg4->dmSpecVersion;
-    devmode.dmDriverVersion    = arg4->dmDriverVersion;
-    devmode.dmSize             = arg4->dmSize;
-    devmode.dmDriverExtra      = arg4->dmDriverExtra;
-    devmode.dmFields           = arg4->dmFields;
-    devmode.dmOrientation      = arg4->dmOrientation;
-    devmode.dmPaperSize        = arg4->dmPaperSize;
-    devmode.dmPaperLength      = arg4->dmPaperLength;
-    devmode.dmPaperWidth       = arg4->dmPaperWidth;
-    devmode.dmScale            = arg4->dmScale;
-    devmode.dmCopies           = arg4->dmCopies;
-    devmode.dmDefaultSource    = arg4->dmDefaultSource;
-    devmode.dmPrintQuality     = arg4->dmPrintQuality;
-    devmode.dmColor            = arg4->dmColor;
-    devmode.dmDuplex           = arg4->dmDuplex;
-    devmode.dmYResolution      = arg4->dmYResolution;
-    devmode.dmTTOption         = arg4->dmTTOption;
-    devmode.dmCollate          = arg4->dmCollate;
-    devmode.dmLogPixels        = arg4->dmLogPixels;
-    devmode.dmBitsPerPel       = arg4->dmBitsPerPel;
-    devmode.dmPelsWidth        = arg4->dmPelsWidth;
-    devmode.dmPelsHeight       = arg4->dmPelsHeight;
-    devmode.dmDisplayFlags     = arg4->dmDisplayFlags;
-    devmode.dmDisplayFrequency = arg4->dmDisplayFrequency;
-    devmode.dmICMMethod        = arg4->dmICMMethod;
-    devmode.dmICMIntent        = arg4->dmICMIntent;
-    devmode.dmMediaType        = arg4->dmMediaType;
-    devmode.dmDitherType       = arg4->dmDitherType;
-    devmode.dmReserved1        = arg4->dmReserved1;
-    devmode.dmReserved2        = arg4->dmReserved2;
-
-    rc = O32_CreateIC(astring1,astring2,astring3,&devmode);
+    if(arg4)
+    {
+      strcpy((char*)devmode.dmDeviceName, astring4);
+      strcpy((char*)devmode.dmFormName, astring5);
+
+      devmode.dmSpecVersion      = arg4->dmSpecVersion;
+      devmode.dmDriverVersion    = arg4->dmDriverVersion;
+      devmode.dmSize             = arg4->dmSize;
+      devmode.dmDriverExtra      = arg4->dmDriverExtra;
+      devmode.dmFields           = arg4->dmFields;
+      devmode.dmOrientation      = arg4->dmOrientation;
+      devmode.dmPaperSize        = arg4->dmPaperSize;
+      devmode.dmPaperLength      = arg4->dmPaperLength;
+      devmode.dmPaperWidth       = arg4->dmPaperWidth;
+      devmode.dmScale            = arg4->dmScale;
+      devmode.dmCopies           = arg4->dmCopies;
+      devmode.dmDefaultSource    = arg4->dmDefaultSource;
+      devmode.dmPrintQuality     = arg4->dmPrintQuality;
+      devmode.dmColor            = arg4->dmColor;
+      devmode.dmDuplex           = arg4->dmDuplex;
+      devmode.dmYResolution      = arg4->dmYResolution;
+      devmode.dmTTOption         = arg4->dmTTOption;
+      devmode.dmCollate          = arg4->dmCollate;
+      devmode.dmLogPixels        = arg4->dmLogPixels;
+      devmode.dmBitsPerPel       = arg4->dmBitsPerPel;
+      devmode.dmPelsWidth        = arg4->dmPelsWidth;
+      devmode.dmPelsHeight       = arg4->dmPelsHeight;
+      devmode.dmDisplayFlags     = arg4->dmDisplayFlags;
+      devmode.dmDisplayFrequency = arg4->dmDisplayFrequency;
+      devmode.dmICMMethod        = arg4->dmICMMethod;
+      devmode.dmICMIntent        = arg4->dmICMIntent;
+      devmode.dmMediaType        = arg4->dmMediaType;
+      devmode.dmDitherType       = arg4->dmDitherType;
+      devmode.dmReserved1        = arg4->dmReserved1;
+      devmode.dmReserved2        = arg4->dmReserved2;
+
+      rc = O32_CreateIC(astring1,astring2,astring3,&devmode);
+    }
+    else
+      rc = O32_CreateIC(astring1,astring2,astring3, NULL);
+
     FreeAsciiString(astring1);
     FreeAsciiString(astring2);
     FreeAsciiString(astring3);
-    FreeAsciiString(astring4);
-    FreeAsciiString(astring5);
+    if(arg4)
+    {
+      FreeAsciiString(astring4);
+      FreeAsciiString(astring5);
+    }
+
     return rc;
 }
