- Removed SEH abuse and add notes for the hook code, in NtUserDefSetText.

- Update NtUserCallHwndLock subfunctions.

svn path=/trunk/; revision=38518
This commit is contained in:
James Tabor 2009-01-03 04:02:54 +00:00
parent 140f031357
commit de1fd1f76d
2 changed files with 73 additions and 50 deletions

View file

@ -713,7 +713,7 @@ NtUserCallHwndLock(
DPRINT("Enter NtUserCallHwndLock\n"); DPRINT("Enter NtUserCallHwndLock\n");
UserEnterExclusive(); UserEnterExclusive();
if (!(Window = UserGetWindowObject(hWnd))) if (!(Window = UserGetWindowObject(hWnd)) || !Window->Wnd)
{ {
RETURN( FALSE); RETURN( FALSE);
} }
@ -742,15 +742,45 @@ NtUserCallHwndLock(
Menu->MenuInfo.WndOwner = hWnd; Menu->MenuInfo.WndOwner = hWnd;
Menu->MenuInfo.Height = 0; Menu->MenuInfo.Height = 0;
co_WinPosSetWindowPos(Window, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | co_WinPosSetWindowPos( Window,
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED ); HWND_DESKTOP,
0,0,0,0,
SWP_NOSIZE|
SWP_NOMOVE|
SWP_NOZORDER|
SWP_NOACTIVATE|
SWP_FRAMECHANGED );
Ret = TRUE; Ret = TRUE;
break; break;
} }
case HWNDLOCK_ROUTINE_REDRAWFRAME: case HWNDLOCK_ROUTINE_REDRAWFRAME:
/* FIXME */ co_WinPosSetWindowPos( Window,
HWND_DESKTOP,
0,0,0,0,
SWP_NOSIZE|
SWP_NOMOVE|
SWP_NOZORDER|
SWP_NOACTIVATE|
SWP_FRAMECHANGED );
Ret = TRUE;
break;
case HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK:
co_WinPosSetWindowPos( Window,
HWND_DESKTOP,
0,0,0,0,
SWP_NOSIZE|
SWP_NOMOVE|
SWP_NOZORDER|
SWP_NOACTIVATE|
SWP_FRAMECHANGED );
if (!IntGetOwner(Window) && !IntGetParent(Window))
{
co_IntShellHookNotify(HSHELL_REDRAW, (LPARAM) hWnd);
}
Ret = TRUE;
break; break;
case HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOW: case HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOW:
@ -758,7 +788,7 @@ NtUserCallHwndLock(
break; break;
case HWNDLOCK_ROUTINE_UPDATEWINDOW: case HWNDLOCK_ROUTINE_UPDATEWINDOW:
/* FIXME */ Ret = co_UserRedrawWindow( Window, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN);
break; break;
} }

View file

@ -4570,8 +4570,6 @@ NtUserDefSetText(HWND hWnd, PUNICODE_STRING WindowText)
Wnd = Window->Wnd; Wnd = Window->Wnd;
if (SafeText.Length != 0) if (SafeText.Length != 0)
{
_SEH2_TRY
{ {
if (Wnd->WindowName.MaximumLength > 0 && if (Wnd->WindowName.MaximumLength > 0 &&
SafeText.Length <= Wnd->WindowName.MaximumLength - sizeof(UNICODE_NULL)) SafeText.Length <= Wnd->WindowName.MaximumLength - sizeof(UNICODE_NULL))
@ -4592,8 +4590,7 @@ NtUserDefSetText(HWND hWnd, PUNICODE_STRING WindowText)
Wnd->WindowName.Buffer = NULL; Wnd->WindowName.Buffer = NULL;
if (buf != NULL) if (buf != NULL)
{ {
DesktopHeapFree(Wnd->pdesktop, DesktopHeapFree(Wnd->pdesktop, buf);
buf);
} }
Wnd->WindowName.Buffer = DesktopHeapAlloc(Wnd->pdesktop, Wnd->WindowName.Buffer = DesktopHeapAlloc(Wnd->pdesktop,
@ -4614,13 +4611,6 @@ NtUserDefSetText(HWND hWnd, PUNICODE_STRING WindowText)
} }
} }
} }
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
SetLastNtError(_SEH2_GetExceptionCode());
Ret = FALSE;
}
_SEH2_END;
}
else else
{ {
Wnd->WindowName.Length = 0; Wnd->WindowName.Length = 0;
@ -4628,6 +4618,9 @@ NtUserDefSetText(HWND hWnd, PUNICODE_STRING WindowText)
Wnd->WindowName.Buffer[0] = L'\0'; Wnd->WindowName.Buffer[0] = L'\0';
} }
// HAX! FIXME! Windows does not do this in here!
// In User32, these are called after: NotifyWinEvent EVENT_OBJECT_NAMECHANGE than
// RepaintButton, StaticRepaint, NtUserCallHwndLock HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK, etc.
/* Send shell notifications */ /* Send shell notifications */
if (!IntGetOwner(Window) && !IntGetParent(Window)) if (!IntGetOwner(Window) && !IntGetParent(Window))
{ {