From 2dde7c67136a5a3b6e186917cc0c200732af5b95 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Sun, 16 May 2010 09:32:51 +0000 Subject: [PATCH] [user32] -CreateWindow should fail when called with WS_EX_MDICHILD and the specified parent is not an mdiclient svn path=/trunk/; revision=47238 --- reactos/dll/win32/user32/windows/window.c | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/reactos/dll/win32/user32/windows/window.c b/reactos/dll/win32/user32/windows/window.c index 6ed38cce020..2aa01a9941d 100644 --- a/reactos/dll/win32/user32/windows/window.c +++ b/reactos/dll/win32/user32/windows/window.c @@ -287,6 +287,18 @@ CreateWindowExA(DWORD dwExStyle, POINT mPos[2]; UINT id = 0; HWND top_child; + PWND WndParent; + PCLS pcls; + + if(!(WndParent = ValidateHwnd(hWndParent)) || + !(pcls = DesktopPtrToUser(WndParent->pcls))) + return 0; + + if (pcls->fnid != FNID_MDICLIENT) + { + ERR("WS_EX_MDICHILD, but parent %p is not MDIClient\n", hWndParent); + return 0; + } /* lpParams of WM_[NC]CREATE is different for MDI children. * MDICREATESTRUCT members have the originally passed values. @@ -399,6 +411,24 @@ CreateWindowExW(DWORD dwExStyle, POINT mPos[2]; UINT id = 0; HWND top_child; + PWND WndParent; + PCLS pcls; + + WndParent = ValidateHwnd(hWndParent); + + if(!WndParent) + return 0; + + pcls = DesktopPtrToUser(WndParent->pcls); + + if(!pcls) + return 0; + + if (pcls->fnid != FNID_MDICLIENT) + { + ERR("WS_EX_MDICHILD, but parent %p is not MDIClient\n", hWndParent); + return 0; + } /* lpParams of WM_[NC]CREATE is different for MDI children. * MDICREATESTRUCT members have the originally passed values.