Set the ownership before locking the bitmap in EngCreateDeviceSurface, because GDIOBJ_SetOwnership runs in a dead lock if the object is already locked by the same process. 
This may fix bug 747.
Modified: trunk/reactos/subsys/win32k/eng/surface.c

Modified: trunk/reactos/subsys/win32k/eng/surface.c
--- trunk/reactos/subsys/win32k/eng/surface.c	2005-09-03 11:51:22 UTC (rev 17620)
+++ trunk/reactos/subsys/win32k/eng/surface.c	2005-09-03 17:40:33 UTC (rev 17621)
@@ -394,6 +394,8 @@
   if (NewSurface == NULL)
 	return 0;
 
+  GDIOBJ_SetOwnership(NewSurface, NULL);
+
   BitmapObj = BITMAPOBJ_LockBitmap(NewSurface);
   if (! BITMAPOBJ_InitBitsLock(BitmapObj))
     {
@@ -403,8 +405,6 @@
     }
   SurfObj = &BitmapObj->SurfObj;
 
-  GDIOBJ_SetOwnership(NewSurface, NULL);
-
   SurfObj->dhsurf = dhsurf;
   SurfObj->hsurf = NewSurface;
   SurfObj->sizlBitmap = Size;