Author: jimtabor Date: Wed Dec 29 04:43:51 2010 New Revision: 50205
URL: http://svn.reactos.org/svn/reactos?rev=50205&view=rev Log: [Win32k] - Fix all the user32 wine win test_enum_thread_windows tests.
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Wed Dec 29 04:43:51 2010 @@ -1423,7 +1423,7 @@ ObDereferenceObject(Desktop); } } - else + else // Build EnumThreadWindows list! { PETHREAD Thread; PTHREADINFO W32Thread; @@ -1431,37 +1431,46 @@ PWND Window;
Status = PsLookupThreadByThreadId((HANDLE)dwThreadId, &Thread); - if(!NT_SUCCESS(Status)) - { + if (!NT_SUCCESS(Status)) + { + DPRINT1("Thread Id is not valid!\n"); return ERROR_INVALID_PARAMETER; } - if(!(W32Thread = (PTHREADINFO)Thread->Tcb.Win32Thread)) + if (!(W32Thread = (PTHREADINFO)Thread->Tcb.Win32Thread)) { ObDereferenceObject(Thread); - DPRINT("Thread is not a GUI Thread!\n"); + DPRINT1("Thread is not initialized!\n"); return ERROR_INVALID_PARAMETER; }
Current = W32Thread->WindowListHead.Flink; - while(Current != &(W32Thread->WindowListHead)) + while (Current != &(W32Thread->WindowListHead)) { Window = CONTAINING_RECORD(Current, WND, ThreadListEntry); ASSERT(Window);
- if(bChildren || Window->spwndOwner != NULL) + if (dwCount < *pBufSize && pWnd) { - if(dwCount < *pBufSize && pWnd) - { - Status = MmCopyToCaller(pWnd++, &Window->head.h, sizeof(HWND)); - if(!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - break; - } - } - dwCount++; + _SEH2_TRY + { + ProbeForWrite(pWnd, sizeof(HWND), 1); + *pWnd = Window->head.h; + pWnd++; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failure to build window list!\n"); + SetLastNtError(Status); + break; + } } - Current = Current->Flink; + dwCount++; + Current = Window->ThreadListEntry.Flink; }
ObDereferenceObject(Thread);