Author: jimtabor
Date: Tue Dec 28 07:22:42 2010
New Revision: 50181
URL:
http://svn.reactos.org/svn/reactos?rev=50181&view=rev
Log:
[Win32k|User32]
- Fix all the user32 wine win test_SetParent tests.
Modified:
trunk/reactos/dll/win32/user32/windows/window.c
trunk/reactos/subsystems/win32/win32k/ntuser/window.c
Modified: trunk/reactos/dll/win32/user32/windows/window.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/w…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] Tue Dec 28 07:22:42 2010
@@ -1450,14 +1450,11 @@
_SEH2_TRY
{
- while (Wnd != NULL)
+ while (Wnd != NULL && ((Wnd->style & (WS_POPUP|WS_CHILD)) ==
WS_CHILD))
{
if (Wnd->spwndParent != NULL)
{
Wnd = DesktopPtrToUser(Wnd->spwndParent);
-
- if(Wnd == DesktopWnd)
- Wnd = NULL;
if (Wnd == WndParent)
{
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Tue Dec 28 07:22:42
2010
@@ -899,15 +899,11 @@
PWND Window;
Window = BaseWindow;
- while (Window)
+ while (Window && ((Window->style & (WS_POPUP|WS_CHILD)) == WS_CHILD))
{
if (Window == Parent)
{
return(TRUE);
- }
- if(!(Window->style & WS_CHILD))
- {
- break;
}
Window = Window->spwndParent;
@@ -1090,7 +1086,7 @@
PWND FASTCALL
co_IntSetParent(PWND Wnd, PWND WndNewParent)
{
- PWND WndOldParent;
+ PWND WndOldParent, pWndExam;
BOOL WasVisible;
ASSERT(Wnd);
@@ -1098,11 +1094,29 @@
ASSERT_REFS_CO(Wnd);
ASSERT_REFS_CO(WndNewParent);
+ if (Wnd == Wnd->head.rpdesk->spwndMessage)
+ {
+ EngSetLastError(ERROR_ACCESS_DENIED);
+ return( NULL);
+ }
+
/* Some applications try to set a child as a parent */
if (IntIsChildWindow(Wnd, WndNewParent))
{
EngSetLastError( ERROR_INVALID_PARAMETER );
return NULL;
+ }
+
+ pWndExam = WndNewParent; // Load parent Window to examine.
+ // Now test for set parent to parent hit.
+ while (pWndExam)
+ {
+ if (Wnd == pWndExam)
+ {
+ EngSetLastError(ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+ pWndExam = pWndExam->spwndParent;
}
/*
@@ -1148,6 +1162,62 @@
*/
return WndOldParent;
+}
+
+HWND FASTCALL
+co_UserSetParent(HWND hWndChild, HWND hWndNewParent)
+{
+ PWND Wnd = NULL, WndParent = NULL, WndOldParent;
+ HWND hWndOldParent = NULL;
+ USER_REFERENCE_ENTRY Ref, ParentRef;
+
+ if (IntIsBroadcastHwnd(hWndChild) || IntIsBroadcastHwnd(hWndNewParent))
+ {
+ EngSetLastError(ERROR_INVALID_PARAMETER);
+ return( NULL);
+ }
+
+ if (hWndChild == IntGetDesktopWindow())
+ {
+ EngSetLastError(ERROR_ACCESS_DENIED);
+ return( NULL);
+ }
+
+ if (hWndNewParent)
+ {
+ if (!(WndParent = UserGetWindowObject(hWndNewParent)))
+ {
+ return( NULL);
+ }
+ }
+ else
+ {
+ if (!(WndParent = UserGetWindowObject(IntGetDesktopWindow())))
+ {
+ return( NULL);
+ }
+ }
+
+ if (!(Wnd = UserGetWindowObject(hWndChild)))
+ {
+ return( NULL);
+ }
+
+ UserRefObjectCo(Wnd, &Ref);
+ UserRefObjectCo(WndParent, &ParentRef);
+
+ WndOldParent = co_IntSetParent(Wnd, WndParent);
+
+ UserDerefObjectCo(WndParent);
+ UserDerefObjectCo(Wnd);
+
+ if (WndOldParent)
+ {
+ hWndOldParent = WndOldParent->head.h;
+ UserDereferenceObject(WndOldParent);
+ }
+
+ return( hWndOldParent);
}
BOOL FASTCALL
@@ -3055,63 +3125,6 @@
DPRINT("Leave NtUserGetListBoxInfo, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
-}
-
-
-HWND FASTCALL
-co_UserSetParent(HWND hWndChild, HWND hWndNewParent)
-{
- PWND Wnd = NULL, WndParent = NULL, WndOldParent;
- HWND hWndOldParent = NULL;
- USER_REFERENCE_ENTRY Ref, ParentRef;
-
- if (IntIsBroadcastHwnd(hWndChild) || IntIsBroadcastHwnd(hWndNewParent))
- {
- EngSetLastError(ERROR_INVALID_PARAMETER);
- return( NULL);
- }
-
- if (hWndChild == IntGetDesktopWindow())
- {
- EngSetLastError(ERROR_ACCESS_DENIED);
- return( NULL);
- }
-
- if (hWndNewParent)
- {
- if (!(WndParent = UserGetWindowObject(hWndNewParent)))
- {
- return( NULL);
- }
- }
- else
- {
- if (!(WndParent = UserGetWindowObject(IntGetDesktopWindow())))
- {
- return( NULL);
- }
- }
-
- if (!(Wnd = UserGetWindowObject(hWndChild)))
- {
- return( NULL);
- }
-
- UserRefObjectCo(Wnd, &Ref);
- UserRefObjectCo(WndParent, &ParentRef);
-
- WndOldParent = co_IntSetParent(Wnd, WndParent);
-
- UserDerefObjectCo(WndParent);
- UserDerefObjectCo(Wnd);
-
- if (WndOldParent)
- {
- hWndOldParent = WndOldParent->head.h;
- UserDereferenceObject(WndOldParent);
- }
-
- return( hWndOldParent);
}
/*