Make window handles 32-bit before calling window procedure.

Don't clear window parent field when unlinking it.
This commit is contained in:
Alexandre Julliard 2001-08-29 00:16:00 +00:00
parent 1a66d226eb
commit 6bf2abfab1
3 changed files with 33 additions and 22 deletions

View File

@ -85,8 +85,7 @@ extern WND* WIN_FindWndPtr( HWND hwnd );
extern WND* WIN_LockWndPtr(WND *wndPtr);
extern void WIN_ReleaseWndPtr(WND *wndPtr);
extern void WIN_UpdateWndPtr(WND **oldPtr,WND *newPtr);
extern void WIN_DumpWindow( HWND hwnd );
extern void WIN_WalkWindows( HWND hwnd, int indent );
extern HWND WIN_GetFullHandle( HWND hwnd );
extern void WIN_LinkWindow( HWND hwnd, HWND parent, HWND hwndInsertAfter );
extern void WIN_UnlinkWindow( HWND hwnd );
extern HWND WIN_FindWinToRepaint( HWND hwnd );

View File

@ -146,6 +146,26 @@ static WND *free_window_handle( HWND hwnd )
}
/***********************************************************************
* WIN_GetFullHandle
*
* Get the full 32-bit window handle from a possibly truncated handle.
*/
HWND WIN_GetFullHandle( HWND hwnd )
{
if (!HIWORD(hwnd))
{
SERVER_START_REQ( get_window_info )
{
req->handle = hwnd;
if (!SERVER_CALL_ERR()) hwnd = req->full_handle;
}
SERVER_END_REQ;
}
return hwnd;
}
/***********************************************************************
* WIN_FindWndPtr
*
@ -294,10 +314,9 @@ void WIN_LinkWindow( HWND hwnd, HWND parent, HWND hwndInsertAfter )
if (*ppWnd) *ppWnd = wndPtr->next;
}
wndPtr->parent = parentPtr;
if (parentPtr)
{
wndPtr->parent = parentPtr;
if ((hwndInsertAfter == HWND_TOP) || (hwndInsertAfter == HWND_BOTTOM))
{
ppWnd = &parentPtr->child; /* Point to first sibling hwnd */
@ -314,6 +333,7 @@ void WIN_LinkWindow( HWND hwnd, HWND parent, HWND hwndInsertAfter )
wndPtr->next = *ppWnd;
*ppWnd = wndPtr;
}
else wndPtr->next = NULL; /* unlinked */
done:
WIN_ReleaseWndPtr( parentPtr );
@ -2155,11 +2175,10 @@ HWND WINAPI GetParent( HWND hwnd )
HWND WINAPI GetAncestor( HWND hwnd, UINT type )
{
HWND ret;
WND *wndPtr, *parent;
WND *wndPtr;
if (hwnd == GetDesktopWindow()) return 0;
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
parent = wndPtr->parent;
switch(type)
{
@ -2173,7 +2192,7 @@ HWND WINAPI GetAncestor( HWND hwnd, UINT type )
case GA_ROOTOWNER:
while (wndPtr->parent->hwndSelf != GetDesktopWindow())
WIN_UpdateWndPtr( &wndPtr, wndPtr->parent );
while (wndPtr->owner)
while (wndPtr && wndPtr->owner)
{
WND *ptr = WIN_FindWndPtr( wndPtr->owner );
WIN_ReleaseWndPtr( wndPtr );
@ -2181,7 +2200,7 @@ HWND WINAPI GetAncestor( HWND hwnd, UINT type )
}
break;
}
ret = wndPtr->hwndSelf;
ret = wndPtr ? wndPtr->hwndSelf : 0;
WIN_ReleaseWndPtr( wndPtr );
return ret;
}

View File

@ -162,6 +162,7 @@ static LRESULT WINPROC_CallWndProc( WNDPROC proc, HWND hwnd, UINT msg,
LRESULT retvalue;
int iWndsLocks;
hwnd = WIN_GetFullHandle( hwnd );
if (TRACE_ON(relay))
DPRINTF( "%08lx:Call window proc %p (hwnd=%08x,msg=%s,wp=%08x,lp=%08lx)\n",
GetCurrentThreadId(), proc, hwnd, SPY_GetMsgName(msg), wParam, lParam );
@ -516,28 +517,20 @@ WINDOWPROCTYPE WINPROC_GetProcType( HWINDOWPROC proc )
*
* Return TRUE if the lparam is a string
*/
static BOOL WINPROC_TestCBForStr ( HWND hwnd )
inline static BOOL WINPROC_TestCBForStr( HWND hwnd )
{
BOOL retvalue;
WND * wnd = WIN_FindWndPtr(hwnd);
retvalue = ( !(LOWORD(wnd->dwStyle) & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) ||
(LOWORD(wnd->dwStyle) & CBS_HASSTRINGS) );
WIN_ReleaseWndPtr(wnd);
return retvalue;
DWORD style = GetWindowLongA( hwnd, GWL_STYLE );
return (!(style & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) || (style & CBS_HASSTRINGS));
}
/**********************************************************************
* WINPROC_TestLBForStr
*
* Return TRUE if the lparam is a string
*/
static BOOL WINPROC_TestLBForStr ( HWND hwnd )
inline static BOOL WINPROC_TestLBForStr( HWND hwnd )
{
BOOL retvalue;
WND * wnd = WIN_FindWndPtr(hwnd);
retvalue = ( !(LOWORD(wnd->dwStyle) & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE)) ||
(LOWORD(wnd->dwStyle) & LBS_HASSTRINGS) );
WIN_ReleaseWndPtr(wnd);
return retvalue;
DWORD style = GetWindowLongA( hwnd, GWL_STYLE );
return (!(style & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE)) || (style & LBS_HASSTRINGS));
}
/**********************************************************************