Catch broadcast window handles in functions that are implemented using
SendMessage.
This commit is contained in:
parent
020f8a4c82
commit
d0af123a41
|
@ -274,12 +274,6 @@ inline static BOOL listbox_has_strings( HWND hwnd )
|
|||
return (!(style & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE)) || (style & LBS_HASSTRINGS));
|
||||
}
|
||||
|
||||
/* check if hwnd is a broadcast magic handle */
|
||||
inline static BOOL is_broadcast( HWND hwnd )
|
||||
{
|
||||
return (hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* broadcast_message_callback
|
||||
|
|
|
@ -136,4 +136,10 @@ extern HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType ); /* windows/defwnd.c
|
|||
|
||||
extern BOOL FOCUS_MouseActivate( HWND hwnd );
|
||||
|
||||
/* check if hwnd is a broadcast magic handle */
|
||||
inline static BOOL is_broadcast( HWND hwnd )
|
||||
{
|
||||
return (hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST);
|
||||
}
|
||||
|
||||
#endif /* __WINE_WIN_H */
|
||||
|
|
|
@ -1691,6 +1691,12 @@ BOOL WINAPI EnableWindow( HWND hwnd, BOOL enable )
|
|||
LONG style;
|
||||
HWND full_handle;
|
||||
|
||||
if (is_broadcast(hwnd))
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(full_handle = WIN_IsCurrentThread( hwnd )))
|
||||
return SendMessageW( hwnd, WM_WINE_ENABLEWINDOW, enable, 0 );
|
||||
|
||||
|
@ -1983,6 +1989,11 @@ static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval,
|
|||
|
||||
TRACE( "%p %d %lx %x\n", hwnd, offset, newval, type );
|
||||
|
||||
if (is_broadcast(hwnd))
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
if (!WIN_IsCurrentProcess( hwnd ))
|
||||
{
|
||||
if (offset == GWL_WNDPROC)
|
||||
|
@ -2322,6 +2333,11 @@ INT WINAPI GetWindowTextW( HWND hwnd, LPWSTR lpString, INT nMaxCount )
|
|||
*/
|
||||
BOOL WINAPI SetWindowTextA( HWND hwnd, LPCSTR lpString )
|
||||
{
|
||||
if (is_broadcast(hwnd))
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
if (!WIN_IsCurrentProcess( hwnd ))
|
||||
{
|
||||
FIXME( "cannot set text %s of other process window %p\n", debugstr_a(lpString), hwnd );
|
||||
|
@ -2337,6 +2353,11 @@ BOOL WINAPI SetWindowTextA( HWND hwnd, LPCSTR lpString )
|
|||
*/
|
||||
BOOL WINAPI SetWindowTextW( HWND hwnd, LPCWSTR lpString )
|
||||
{
|
||||
if (is_broadcast(hwnd))
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
if (!WIN_IsCurrentProcess( hwnd ))
|
||||
{
|
||||
FIXME( "cannot set text %s of other process window %p\n", debugstr_w(lpString), hwnd );
|
||||
|
@ -2537,6 +2558,12 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent )
|
|||
HWND retvalue, full_handle;
|
||||
BOOL was_visible;
|
||||
|
||||
if (is_broadcast(hwnd) || is_broadcast(parent))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!parent) parent = GetDesktopWindow();
|
||||
else parent = WIN_GetFullHandle( parent );
|
||||
|
||||
|
|
|
@ -834,6 +834,12 @@ BOOL WINAPI ShowWindowAsync( HWND hwnd, INT cmd )
|
|||
{
|
||||
HWND full_handle;
|
||||
|
||||
if (is_broadcast(hwnd))
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((full_handle = WIN_IsCurrentThread( hwnd )))
|
||||
return USER_Driver.pShowWindow( full_handle, cmd );
|
||||
return SendNotifyMessageW( hwnd, WM_WINE_SHOWWINDOW, cmd, 0 );
|
||||
|
@ -847,8 +853,17 @@ BOOL WINAPI ShowWindow( HWND hwnd, INT cmd )
|
|||
{
|
||||
HWND full_handle;
|
||||
|
||||
if (is_broadcast(hwnd))
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
if ((full_handle = WIN_IsCurrentThread( hwnd )))
|
||||
return USER_Driver.pShowWindow( full_handle, cmd );
|
||||
{
|
||||
if (USER_Driver.pShowWindow)
|
||||
return USER_Driver.pShowWindow( full_handle, cmd );
|
||||
return FALSE;
|
||||
}
|
||||
return SendMessageW( hwnd, WM_WINE_SHOWWINDOW, cmd, 0 );
|
||||
}
|
||||
|
||||
|
@ -1173,6 +1188,12 @@ BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter,
|
|||
hwnd, hwndInsertAfter, x, y, cx, cy, flags);
|
||||
if(TRACE_ON(win)) dump_winpos_flags(flags);
|
||||
|
||||
if (is_broadcast(hwnd))
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
winpos.hwnd = WIN_GetFullHandle(hwnd);
|
||||
winpos.hwndInsertAfter = WIN_GetFullHandle(hwndInsertAfter);
|
||||
winpos.x = x;
|
||||
|
|
Loading…
Reference in New Issue