[PATCH 4/14] user32: Move window size check from graphics drivers'CreateWindow to user32's CreateWindow

Pierre d'Herbemont pdherbemont at free.fr
Sun Jan 21 17:35:20 CST 2007


---
   dlls/user32/win.c         |   21 +++++++++++++++++++++
   dlls/winex11.drv/window.c |   21 ---------------------
   2 files changed, 21 insertions(+), 21 deletions(-)

-------------- next part --------------
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 35144bd..6be3924 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -1077,6 +1077,27 @@ static HWND WIN_CreateWindowEx( CREATEST
     else SetWindowLongPtrW( hwnd, GWLP_ID, (ULONG_PTR)cs->hMenu );
     WIN_ReleasePtr( wndPtr );
 
+    if (cs->cx > 65535)
+    {
+        ERR( "invalid window width %d\n", cs->cx );
+        cs->cx = 65535;
+    }
+    if (cs->cy > 65535)
+    {
+        ERR( "invalid window height %d\n", cs->cy );
+        cs->cy = 65535;
+    }
+    if (cs->cx < 0)
+    {
+        ERR( "invalid window width %d\n", cs->cx );
+        cs->cx = 0;
+    }
+    if (cs->cy < 0)
+    {
+        ERR( "invalid window height %d\n", cs->cy );
+        cs->cy = 0;
+    }
+
     if (!USER_Driver->pCreateWindow( hwnd, cs, unicode))
     {
         WIN_DestroyWindow( hwnd );
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 4e6f979..949a401 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -1016,27 +1016,6 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CRE
 
     if (!(data = alloc_win_data( display, hwnd ))) return FALSE;
 
-    if (cs->cx > 65535)
-    {
-        ERR( "invalid window width %d\n", cs->cx );
-        cs->cx = 65535;
-    }
-    if (cs->cy > 65535)
-    {
-        ERR( "invalid window height %d\n", cs->cy );
-        cs->cy = 65535;
-    }
-    if (cs->cx < 0)
-    {
-        ERR( "invalid window width %d\n", cs->cx );
-        cs->cx = 0;
-    }
-    if (cs->cy < 0)
-    {
-        ERR( "invalid window height %d\n", cs->cy );
-        cs->cy = 0;
-    }
-
     /* initialize the dimensions before sending WM_GETMINMAXINFO */
     SetRect( &rect, cs->x, cs->y, cs->x + cs->cx, cs->y + cs->cy );
     X11DRV_SetWindowPos( hwnd, 0, &rect, &rect, SWP_NOZORDER, NULL );


More information about the wine-patches mailing list