Index: /trunk/openjdk/jdk/src/windows/native/sun/java2d/d3d/D3DContext.h
===================================================================
--- /trunk/openjdk/jdk/src/windows/native/sun/java2d/d3d/D3DContext.h	(revision 181)
+++ /trunk/openjdk/jdk/src/windows/native/sun/java2d/d3d/D3DContext.h	(revision 182)
@@ -230,5 +230,9 @@
     DWORD GetMaxTextureHeight() { return d3dDevDesc.dwMaxTextureHeight; }
     DWORD GetMaxTextureAspectRatio()
+#ifdef __WIN32OS2__
+        { return 0; };
+#else
         { return d3dDevDesc.dwMaxTextureAspectRatio; };
+#endif
     BOOL IsPow2TexturesOnly()
         { return d3dDevDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2; };
@@ -444,3 +448,3 @@
     sun_java2d_d3d_D3DContext_J2D_D3D_ENABLED_OK
 
-#endif D3DCONTEXT_H
+#endif // D3DCONTEXT_H
Index: /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/DDBlitLoops.cpp
===================================================================
--- /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/DDBlitLoops.cpp	(revision 181)
+++ /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/DDBlitLoops.cpp	(revision 182)
@@ -36,4 +36,11 @@
 extern CriticalSection windowMoveLock;
 
+#ifndef max
+#define max(a,b) ( (a>b) ? a : b )
+#endif
+#ifndef min
+#define min(a,b) ( (a<b) ? a : b )
+#endif
+
 extern "C" {
 
Index: /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/Win32SurfaceData.cpp
===================================================================
--- /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/Win32SurfaceData.cpp	(revision 181)
+++ /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/Win32SurfaceData.cpp	(revision 182)
@@ -83,4 +83,5 @@
         ZeroMemory(info, sizeof(ThreadGraphicsInfo));
         TlsSetValue(threadInfoIndex, (LPVOID)info);
+#ifndef __WIN32OS2__
         J2dTraceLn2(J2D_TRACE_VERBOSE,
                     "  current batch limit for for thread 0x%x is %d",
@@ -89,4 +90,5 @@
         // Fix for bug 4374079
         ::GdiSetBatchLimit(1);
+#endif
 
         Disposer_AddRecord(env, JNI_GetCurrentThread(env),
Index: /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/WindowsFlags.cpp
===================================================================
--- /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/WindowsFlags.cpp	(revision 181)
+++ /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/WindowsFlags.cpp	(revision 182)
@@ -119,5 +119,5 @@
                                        sizeof(WCHAR));
     wcscpy(j2dAccelKey, J2D_ACCEL_KEY_ROOT);
-    wcscat(j2dAccelKey, javaVersion);
+    wcscat(j2dAccelKey, (WCHAR *)javaVersion);
     wcscat(j2dAccelKey, L"\\");
     j2dAccelDriverKey =
Index: /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/WindowsFlags.h
===================================================================
--- /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/WindowsFlags.h	(revision 181)
+++ /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/WindowsFlags.h	(revision 182)
@@ -43,3 +43,3 @@
 void SetDDEnabledFlag(JNIEnv *env, BOOL ddEnabled);
 
-#endif WINDOWSFLAGS_H
+#endif // WINDOWSFLAGS_H
Index: /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/ddrawObject.cpp
===================================================================
--- /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/ddrawObject.cpp	(revision 181)
+++ /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/ddrawObject.cpp	(revision 182)
@@ -278,4 +278,5 @@
     DXObject *newDXObject;
 
+#ifndef __WIN32OS2__
     // First, try to create a DX7 object
     FnDDCreateExFunc ddCreateEx = NULL;
@@ -316,4 +317,25 @@
         return NULL;
     }
+#else
+    J2dTraceLn(J2D_TRACE_VERBOSE, "  Using DX4");
+    IDirectDraw4    *ddObject;
+
+    ddResult = DirectDrawCreate(lpGUID, &ddObject, NULL);
+    if (ddResult != DD_OK) {
+        DebugPrintDirectDrawError(ddResult,
+                                  "DDraw::CreateDDrawObject: "\
+                                  "DirectDrawCreate failed");
+        return NULL;
+    }
+    ddResult = ddObject->SetCooperativeLevel(NULL,
+                                             DDSCL_NORMAL);
+    if (ddResult != DD_OK) {
+        DebugPrintDirectDrawError(ddResult,
+                                  "DDraw::CreateDDrawObject: Error "\
+                                  "setting cooperative level");
+        return NULL;
+    }
+    newDXObject = new DXObject(ddObject, hMonitor);
+#endif
 
     return new DDraw(newDXObject);
Index: /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/ddrawObject.h
===================================================================
--- /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/ddrawObject.h	(revision 181)
+++ /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/ddrawObject.h	(revision 182)
@@ -71,4 +71,11 @@
 class D3DContext;
 
+#ifdef __WIN32OS2__
+#define IDirectDraw7        IDirectDraw4
+#define IDirectDrawSurface7 IDirectDrawSurface4
+#define IDirect3D7          IDirect3D2
+#define IDirect3DDevice7    IDirect3DDevice2
+#define D3DDEVICEDESC7      D3DDEVICEDESC
+#endif
 
 class DXObject {
@@ -138,5 +145,9 @@
     HRESULT SetCooperativeLevel(HWND hWnd, DWORD dwFlags) {
         return ddObject->SetCooperativeLevel(hWnd,
+#ifdef DDSCL_FPUPRESERVE
                                              (dwFlags | DDSCL_FPUPRESERVE));
+#else
+                                             dwFlags);
+#endif
     }
     HRESULT CreateD3DObject(IDirect3D7 **d3dObject);
@@ -441,6 +452,6 @@
         if (count == 0) {
             //J2dTraceLn1(J2D_TRACE_VERBOSE,
-            //            "DDCriticalSection::Leave Invalid "\
-            //            "decrement in DDCriticalSection "\
+            //            "DDCriticalSection::Leave Invalid "
+            //            "decrement in DDCriticalSection "
             //            "for surface 0x%x\n",
             //            lpSurface);
@@ -479,3 +490,3 @@
 
 
-#endif DDRAWOBJECT_H
+#endif // DDRAWOBJECT_H
Index: /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/ddrawUtils.h
===================================================================
--- /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/ddrawUtils.h	(revision 181)
+++ /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/ddrawUtils.h	(revision 182)
@@ -133,3 +133,3 @@
     } while(0)
 
-#endif DDRAWUTILS_H
+#endif // DDRAWUTILS_H
Index: /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/dxInit.h
===================================================================
--- /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/dxInit.h	(revision 181)
+++ /trunk/openjdk/jdk/src/windows/native/sun/java2d/windows/dxInit.h	(revision 182)
@@ -56,3 +56,3 @@
 BOOL    DDCreateObject();
 
-#endif DXINIT_H
+#endif // DXINIT_H
