From bc082227911e6918639d2d0cf5eb73bce4bbd0ad Mon Sep 17 00:00:00 2001 From: James Tabor Date: Sat, 26 Mar 2016 23:12:01 +0000 Subject: [PATCH] =?UTF-8?q?[User32]=20-=20Fix=20crash=20by=20use=20of=20MD?= =?UTF-8?q?I=20container=20rules.=20-=20Patch=20by=20Michael=20M=C3=BCller?= =?UTF-8?q?:=20Preserve=20beginning=20of=20extra=20data=20for=20MDI=20wind?= =?UTF-8?q?ows.=20-=20Patch=20by=20Jacek=20Caban=20:=20Ignore=20WM=5FCHILD?= =?UTF-8?q?ACTIVATE=20on=20disabled=20windows=20in=20DefMDIChildProc.=20-?= =?UTF-8?q?=20CORE-10912=20Wine=20Staging=201.9.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/trunk/; revision=71059 --- reactos/win32ss/include/ntuser.h | 9 +++++++++ reactos/win32ss/user/user32/windows/mdi.c | 12 +++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/reactos/win32ss/include/ntuser.h b/reactos/win32ss/include/ntuser.h index f0790d742a2..76299d22e4b 100644 --- a/reactos/win32ss/include/ntuser.h +++ b/reactos/win32ss/include/ntuser.h @@ -731,6 +731,15 @@ typedef struct _SBWND SBCALC SBCalc; } SBWND, *PSBWND; +typedef struct _MDIWND +{ + WND wnd; + DWORD dwReserved; + PVOID pmdi; +} MDIWND, *PMDIWND; + +#define GWLP_MDIWND 4 + typedef struct _MENUWND { WND wnd; diff --git a/reactos/win32ss/user/user32/windows/mdi.c b/reactos/win32ss/user/user32/windows/mdi.c index d30f90691cd..5b56ffac9dd 100644 --- a/reactos/win32ss/user/user32/windows/mdi.c +++ b/reactos/win32ss/user/user32/windows/mdi.c @@ -112,6 +112,7 @@ typedef struct * states it must keep coherency with USER32 on its own. This is true for * Windows as well. */ + LONG reserved; UINT nActiveChildren; HWND hwndChildMaximized; HWND hwndActiveChild; @@ -216,7 +217,7 @@ const struct builtin_class_descr MDICLIENT_builtin_class = 0, /* style */ MDIClientWndProcA, /* procA */ MDIClientWndProcW, /* procW */ - sizeof(MDICLIENTINFO), /* extra */ + sizeof(MDIWND), /* extra */ IDC_ARROW, /* cursor */ (HBRUSH)(COLOR_APPWORKSPACE+1) /* brush */ }; @@ -225,7 +226,7 @@ const struct builtin_class_descr MDICLIENT_builtin_class = static MDICLIENTINFO *get_client_info( HWND client ) { #ifdef __REACTOS__ - return (MDICLIENTINFO *)GetWindowLongPtr(client, 0); + return (MDICLIENTINFO *)GetWindowLongPtr(client, GWLP_MDIWND); #else MDICLIENTINFO *ret = NULL; WND *win = WIN_GetPtr( client ); @@ -1123,7 +1124,7 @@ LRESULT WINAPI MDIClientWndProc_common( HWND hwnd, UINT message, WPARAM wParam, #ifdef __REACTOS__ if (!(ci = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ci)))) return FALSE; - SetWindowLongPtrW( hwnd, 0, (LONG_PTR)ci ); + SetWindowLongPtrW( hwnd, GWLP_MDIWND, (LONG_PTR)ci ); ci->hBmpClose = 0; NtUserSetWindowFNID( hwnd, FNID_MDICLIENT); // wine uses WIN_ISMDICLIENT #else @@ -1174,7 +1175,7 @@ LRESULT WINAPI MDIClientWndProc_common( HWND hwnd, UINT message, WPARAM wParam, HeapFree( GetProcessHeap(), 0, ci->frameTitle ); #ifdef __REACTOS__ HeapFree( GetProcessHeap(), 0, ci ); - SetWindowLongPtrW( hwnd, 0, 0 ); + SetWindowLongPtrW( hwnd, GWLP_MDIWND, 0 ); #endif return 0; } @@ -1592,7 +1593,8 @@ LRESULT WINAPI DefMDIChildProcW( HWND hwnd, UINT message, break; case WM_CHILDACTIVATE: - MDI_ChildActivate( client, hwnd ); + if (IsWindowEnabled( hwnd )) + MDI_ChildActivate( client, hwnd ); return 0; case WM_SYSCOMMAND: