[Win32k|User32]

- Fix all the user32 wine win test_SetParent tests.


svn path=/trunk/; revision=50181
This commit is contained in:
James Tabor
2010-12-28 07:22:42 +00:00
parent 18910c84c6
commit 2bf00ca962
2 changed files with 77 additions and 67 deletions
+1 -4
View File
@@ -1450,15 +1450,12 @@ IsChild(HWND hWndParent,
_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)
{
Ret = TRUE;
+76 -63
View File
@@ -899,16 +899,12 @@ IntIsChildWindow(PWND Parent, PWND BaseWindow)
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 @@ IntSetOwner(HWND hWnd, HWND hWndNewOwner)
PWND FASTCALL
co_IntSetParent(PWND Wnd, PWND WndNewParent)
{
PWND WndOldParent;
PWND WndOldParent, pWndExam;
BOOL WasVisible;
ASSERT(Wnd);
@@ -1098,6 +1094,12 @@ co_IntSetParent(PWND Wnd, PWND WndNewParent)
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))
{
@@ -1105,6 +1107,18 @@ co_IntSetParent(PWND Wnd, PWND WndNewParent)
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;
}
/*
* Windows hides the window first, then shows it again
* including the WM_SHOWWINDOW messages and all
@@ -1150,6 +1164,62 @@ co_IntSetParent(PWND Wnd, PWND WndNewParent)
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
IntSetSystemMenu(PWND Window, PMENU_OBJECT Menu)
{
@@ -3057,63 +3127,6 @@ CLEANUP:
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);
}
/*
* NtUserSetParent
*