diff --git a/win32ss/user/ntuser/input.c b/win32ss/user/ntuser/input.c index cc0c8cf047f..439409c0e0f 100644 --- a/win32ss/user/ntuser/input.c +++ b/win32ss/user/ntuser/input.c @@ -8,6 +8,7 @@ */ #include +#include<../../../../sdk/lib/rtl/heap.h> // Needed for ARENA_FREE_FILLER definition DBG_DEFAULT_CHANNEL(UserInput); /* GLOBALS *******************************************************************/ @@ -486,6 +487,13 @@ UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach) /* Can not be the same thread. */ if (ptiFrom == ptiTo) return STATUS_INVALID_PARAMETER; +#if DBG + if ((DWORD)ptiTo == ARENA_FREE_FILLER) + { + ERR("Accessing Freed Heap Memory\n"); + } +#endif + /* Do not attach to system threads or between different desktops. */ if (ptiFrom->TIF_flags & TIF_DONTATTACHQUEUE || ptiTo->TIF_flags & TIF_DONTATTACHQUEUE || diff --git a/win32ss/user/ntuser/window.c b/win32ss/user/ntuser/window.c index da8da6cf68e..7ef58ed4737 100644 --- a/win32ss/user/ntuser/window.c +++ b/win32ss/user/ntuser/window.c @@ -8,6 +8,7 @@ */ #include +#include<../../../../sdk/lib/rtl/heap.h> // Needed for ARENA_FREE_FILLER definition DBG_DEFAULT_CHANNEL(UserWnd); INT gNestedWindowLimit = 50; @@ -1028,8 +1029,15 @@ VOID FASTCALL IntLinkHwnd(PWND Wnd, HWND hWndPrev) } if (Wnd == WndInsertAfter) + { ERR("IntLinkHwnd -- Trying to link window 0x%p to itself!!\n", Wnd); - IntLinkWindow(Wnd, WndInsertAfter); + IntLinkWindow(Wnd, NULL); + } + else + { + IntLinkWindow(Wnd, WndInsertAfter); + } + /* Fix the WS_EX_TOPMOST flag */ if (!(WndInsertAfter->ExStyle & WS_EX_TOPMOST)) @@ -2789,6 +2797,12 @@ BOOLEAN co_UserDestroyWindow(PVOID Object) if (Window->spwndOwner) { //ERR("DestroyWindow Owner out.\n"); +#if DBG + if ((DWORD)Window->spwndOwner->head.pti == ARENA_FREE_FILLER) + { + ERR("Accessing Freed Heap Memory\n"); + } +#endif UserAttachThreadInput(Window->head.pti, Window->spwndOwner->head.pti, FALSE); } }