Make sure that HWND comparisons are always done with full 32-bit

handles.
This commit is contained in:
Alexandre Julliard 2001-09-14 00:24:39 +00:00
parent d97fe2655b
commit f44bbb8d10
19 changed files with 116 additions and 101 deletions

View File

@ -16,6 +16,7 @@
#include "wine/unicode.h"
#include "spy.h"
#include "user.h"
#include "win.h"
#include "controls.h"
#include "debugtools.h"
@ -1941,14 +1942,15 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
COMBO_SetFocus( lphc );
return TRUE;
case WM_KILLFOCUS:
#define hwndFocus ((HWND16)wParam)
{
HWND hwndFocus = WIN_GetFullHandle( (HWND)wParam );
if( !hwndFocus ||
(hwndFocus != lphc->hWndEdit && hwndFocus != lphc->hWndLBox ))
COMBO_KillFocus( lphc );
#undef hwndFocus
return TRUE;
}
case WM_COMMAND:
return COMBO_Command( lphc, wParam, (HWND)lParam );
return COMBO_Command( lphc, wParam, WIN_GetFullHandle( (HWND)lParam ) );
case WM_GETTEXT:
return COMBO_GetText( lphc, (INT)wParam, lParam, unicode );
case WM_SETTEXT:

View File

@ -353,7 +353,7 @@ HMENU MENU_GetSysMenu( HWND hWnd, HMENU hPopupMenu )
{
POPUPMENU *menu = MENU_GetMenu(hMenu);
menu->wFlags = MF_SYSMENU;
menu->hWnd = hWnd;
menu->hWnd = WIN_GetFullHandle( hWnd );
if (hPopupMenu == (HMENU)(-1))
hPopupMenu = MENU_CopySysPopup();
@ -2362,7 +2362,7 @@ static LRESULT MENU_DoNextMenu( MTRACKER* pmt, UINT vk )
else /* application returned a new menu to switch to */
{
hNewMenu = next_menu.hmenuNext;
hNewWnd = next_menu.hwndNext;
hNewWnd = WIN_GetFullHandle( next_menu.hwndNext );
if( IsMenu(hNewMenu) && IsWindow(hNewWnd) )
{
@ -2609,7 +2609,7 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
mt.trackFlags = 0;
mt.hCurrentMenu = hmenu;
mt.hTopMenu = hmenu;
mt.hOwnerWnd = hwnd;
mt.hOwnerWnd = WIN_GetFullHandle( hwnd );
mt.pt.x = x;
mt.pt.y = y;
@ -3968,6 +3968,7 @@ BOOL WINAPI SetMenu( HWND hWnd, HMENU hMenu )
}
if (GetWindowLongA( hWnd, GWL_STYLE ) & WS_CHILD) return FALSE;
hWnd = WIN_GetFullHandle( hWnd );
if (GetCapture() == hWnd) ReleaseCapture();
if (hMenu != 0)

View File

@ -791,6 +791,7 @@ void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar,
((nBar == SB_VERT) && !(wndPtr->dwStyle & WS_VSCROLL)) ||
((nBar == SB_HORZ) && !(wndPtr->dwStyle & WS_HSCROLL))) goto END;
if (!WIN_IsWindowDrawable( wndPtr, FALSE )) goto END;
hwnd = wndPtr->hwndSelf; /* make it a full handle */
vertical = SCROLL_GetScrollBarRect( hwnd, nBar, &rect,
&arrowSize, &thumbSize, &thumbPos );
@ -1516,7 +1517,7 @@ BOOL WINAPI GetScrollInfo(
if (info->fMask & SIF_PAGE) info->nPage = infoPtr->Page;
if (info->fMask & SIF_POS) info->nPos = infoPtr->CurVal;
if ((info->fMask & SIF_TRACKPOS) && (info->cbSize == sizeof(*info)))
info->nTrackPos = (SCROLL_TrackingWin==hwnd) ? SCROLL_TrackingVal : infoPtr->CurVal;
info->nTrackPos = (SCROLL_TrackingWin == WIN_GetFullHandle(hwnd)) ? SCROLL_TrackingVal : infoPtr->CurVal;
if (info->fMask & SIF_RANGE)
{
info->nMin = infoPtr->MinVal;

View File

@ -50,6 +50,7 @@
#include "wine/winuser16.h"
#include "wine/port.h"
#include "heap.h"
#include "win.h"
#include "winerror.h"
#include "debugtools.h"
@ -82,7 +83,8 @@ struct DosDeviceStruct {
unsigned ibuf_size,ibuf_head,ibuf_tail;
unsigned obuf_size,obuf_head,obuf_tail;
/* notifications */
int wnd, n_read, n_write;
HWND wnd;
int n_read, n_write;
OVERLAPPED read_ov, write_ov;
/* save terminal states */
DCB16 dcb;
@ -1123,7 +1125,7 @@ BOOL16 WINAPI EnableCommNotification16( INT16 cid, HWND16 hwnd,
FIXME("no handle for cid = %0x!\n",cid);
return -1;
}
ptr->wnd = hwnd;
ptr->wnd = WIN_Handle32( hwnd );
ptr->n_read = cbWriteNotify;
ptr->n_write = cbOutQueue;
return TRUE;

View File

@ -19,6 +19,7 @@
#include "winnls.h"
#include "dde.h"
#include "ddeml.h"
#include "win.h"
#include "debugtools.h"
#include "dde/dde_private.h"
@ -343,7 +344,7 @@ static WDML_QUEUE_STATE WDML_HandleAdviseReply(WDML_CONV* pConv, MSG* msg, WDML_
UINT uiLo, uiHi;
HSZ hsz;
if (msg->message != WM_DDE_ACK || msg->wParam != pConv->hwndServer)
if (msg->message != WM_DDE_ACK || WIN_GetFullHandle(msg->wParam) != pConv->hwndServer)
{
return WDML_QS_PASS;
}
@ -427,7 +428,7 @@ static WDML_QUEUE_STATE WDML_HandleUnadviseReply(WDML_CONV* pConv, MSG* msg, WDM
UINT uiLo, uiHi;
HSZ hsz;
if (msg->message != WM_DDE_ACK || msg->wParam != pConv->hwndServer)
if (msg->message != WM_DDE_ACK || WIN_GetFullHandle(msg->wParam) != pConv->hwndServer)
{
return WDML_QS_PASS;
}
@ -498,7 +499,7 @@ static WDML_QUEUE_STATE WDML_HandleRequestReply(WDML_CONV* pConv, MSG* msg, WDML
UINT uiLo, uiHi;
HSZ hsz;
if (msg->wParam != pConv->hwndServer)
if (WIN_GetFullHandle(msg->wParam) != pConv->hwndServer)
return WDML_QS_PASS;
UnpackDDElParam(WM_DDE_ACK, msg->lParam, &uiLo, &uiHi);
@ -658,7 +659,7 @@ static WDML_QUEUE_STATE WDML_HandleExecuteReply(WDML_CONV* pConv, MSG* msg, WDML
DDEACK ddeAck;
UINT uiLo, uiHi;
if (msg->message != WM_DDE_ACK || msg->wParam != pConv->hwndServer)
if (msg->message != WM_DDE_ACK || WIN_GetFullHandle(msg->wParam) != pConv->hwndServer)
{
return WDML_QS_PASS;
}
@ -738,7 +739,7 @@ static WDML_QUEUE_STATE WDML_HandlePokeReply(WDML_CONV* pConv, MSG* msg, WDML_XA
UINT uiLo, uiHi;
HSZ hsz;
if (msg->message != WM_DDE_ACK && msg->wParam != pConv->hwndServer)
if (msg->message != WM_DDE_ACK && WIN_GetFullHandle(msg->wParam) != pConv->hwndServer)
{
return WDML_QS_PASS;
}
@ -791,7 +792,7 @@ static WDML_QUEUE_STATE WDML_HandleTerminateReply(WDML_CONV* pConv, MSG* msg, WD
return WDML_QS_SWALLOWED;
}
if (msg->wParam != pConv->hwndServer)
if (WIN_GetFullHandle(msg->wParam) != pConv->hwndServer)
{
FIXME("hmmm shouldn't happen\n");
return WDML_QS_PASS;
@ -875,7 +876,7 @@ static WDML_QUEUE_STATE WDML_HandleIncomingData(WDML_CONV* pConv, MSG* msg, HDDE
*/
static WDML_QUEUE_STATE WDML_HandleIncomingTerminate(WDML_CONV* pConv, MSG* msg, HDDEDATA* hdd)
{
if (pConv->hwndServer != (HWND)msg->wParam)
if (pConv->hwndServer != WIN_GetFullHandle(msg->wParam))
return WDML_QS_PASS;
pConv->wStatus |= ST_TERMINATED;
@ -1243,7 +1244,7 @@ static LRESULT CALLBACK WDML_ClientProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA
pConv->wStatus |= ST_ISLOCAL;
}
WDML_BroadcastDDEWindows(WDML_szEventClass, WM_WDML_CONNECT_CONFIRM, hwnd, (HWND)wParam);
WDML_BroadcastDDEWindows(WDML_szEventClass, WM_WDML_CONNECT_CONFIRM, (WPARAM)hwnd, wParam);
GlobalDeleteAtom(uiLo);
GlobalDeleteAtom(uiHi);

View File

@ -19,6 +19,7 @@
#include "winerror.h"
#include "dde.h"
#include "ddeml.h"
#include "win.h"
#include "debugtools.h"
#include "dde/dde_private.h"
@ -302,9 +303,11 @@ static LRESULT CALLBACK WDML_EventProc(HWND hwndEvent, UINT uMsg, WPARAM wParam,
/* confirm connection...
* lookup for this conv handle
*/
HWND client = WIN_GetFullHandle( (HWND)wParam );
HWND server = WIN_GetFullHandle( (HWND)lParam );
for (pConv = pInstance->convs[WDML_SERVER_SIDE]; pConv != NULL; pConv = pConv->next)
{
if (pConv->hwndClient == (HWND)wParam && pConv->hwndServer == (HWND)lParam)
if (pConv->hwndClient == client && pConv->hwndServer == server)
break;
}
if (pConv)
@ -1873,7 +1876,7 @@ static BOOL WDML_GetLocalConvInfo(WDML_CONV* pConv, CONVINFO* ci, DWORD id)
for (pLink = pConv->instance->links[side]; pLink != NULL; pLink = pLink->next)
{
if (pLink->hConv == (HWND)pConv)
if (pLink->hConv == (HCONV)pConv)
{
ci->wStatus |= ST_ADVISE;
break;

View File

@ -18,6 +18,7 @@
#include "winerror.h"
#include "dde.h"
#include "ddeml.h"
#include "win.h"
#include "debugtools.h"
#include "dde/dde_private.h"
@ -983,7 +984,7 @@ static LRESULT CALLBACK WDML_ServerConvProc(HWND hwndServer, UINT iMsg, WPARAM w
ERR("Got a message (%u) on a not known conversation, dropping request\n", iMsg);
goto theError;
}
if (pConv->hwndClient != (HWND)wParam || pConv->hwndServer != hwndServer)
if (pConv->hwndClient != WIN_GetFullHandle( (HWND)wParam ) || pConv->hwndServer != hwndServer)
{
ERR("mismatch between C/S windows and converstation\n");
goto theError;

View File

@ -1815,6 +1815,7 @@ BOOL WINAPI PeekMessageW( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT f
if (USER_Driver.pMsgWaitForMultipleObjectsEx)
USER_Driver.pMsgWaitForMultipleObjectsEx( 0, NULL, 0, 0, 0 );
hwnd = WIN_GetFullHandle( hwnd );
locks = WIN_SuspendWndsLock();
if (!MSG_peek_message( &msg, hwnd, first, last,

View File

@ -149,6 +149,7 @@ INT X11DRV_ScrollWindowEx( HWND hwnd, INT dx, INT dy,
retVal = ERROR;
goto END;
}
hwnd = wnd->hwndSelf; /* make it a full handle */
GetClientRect(hwnd, &rc);
if (rect) IntersectRect(&rc, &rc, rect);

View File

@ -489,6 +489,8 @@ int X11DRV_sync_whole_window_position( Display *display, WND *win, int zorder )
{
/* find window that this one must be after */
HWND prev = GetWindow( win->hwndSelf, GW_HWNDPREV );
while (prev && !(GetWindowLongW( prev, GWL_STYLE ) & WS_VISIBLE))
prev = GetWindow( prev, GW_HWNDPREV );
if (!prev) /* top child */
{
changes.stack_mode = Above;
@ -972,7 +974,6 @@ HWND X11DRV_SetParent( HWND hwnd, HWND parent )
{
Display *display = thread_display();
WND *wndPtr;
WND *pWndParent;
DWORD dwStyle;
HWND retvalue;
@ -982,18 +983,12 @@ HWND X11DRV_SetParent( HWND hwnd, HWND parent )
if (!parent) parent = GetDesktopWindow();
if (!(pWndParent = WIN_FindWndPtr(parent)))
{
WIN_ReleaseWndPtr( wndPtr );
return 0;
}
/* Windows hides the window first, then shows it again
* including the WM_SHOWWINDOW messages and all */
if (dwStyle & WS_VISIBLE) ShowWindow( hwnd, SW_HIDE );
retvalue = wndPtr->parent->hwndSelf; /* old parent */
if (pWndParent != wndPtr->parent)
if (parent != retvalue)
{
struct x11drv_win_data *data = wndPtr->pDriverData;
@ -1001,21 +996,20 @@ HWND X11DRV_SetParent( HWND hwnd, HWND parent )
if (parent != GetDesktopWindow()) /* a child window */
{
if (!(wndPtr->dwStyle & WS_CHILD) && wndPtr->wIDmenu)
if (!(dwStyle & WS_CHILD))
{
DestroyMenu( (HMENU)wndPtr->wIDmenu );
wndPtr->wIDmenu = 0;
HMENU menu = (HMENU)SetWindowLongW( hwnd, GWL_ID, 0 );
if (menu) DestroyMenu( menu );
}
}
if (is_window_top_level( wndPtr )) set_wm_hints( display, wndPtr );
wine_tsx11_lock();
sync_window_style( display, wndPtr );
XReparentWindow( display, data->whole_window, get_client_window(pWndParent),
XReparentWindow( display, data->whole_window, X11DRV_get_client_window(parent),
data->whole_rect.left, data->whole_rect.top );
wine_tsx11_unlock();
}
WIN_ReleaseWndPtr( pWndParent );
WIN_ReleaseWndPtr( wndPtr );
/* SetParent additionally needs to make hwnd the topmost window
@ -1043,6 +1037,7 @@ BOOL X11DRV_EnableWindow( HWND hwnd, BOOL enable )
BOOL retvalue;
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
hwnd = wndPtr->hwndSelf; /* make it a full handle */
retvalue = ((wndPtr->dwStyle & WS_DISABLED) != 0);

View File

@ -618,6 +618,7 @@ static BOOL fixup_flags( WINDOWPOS *winpos )
BOOL ret = TRUE;
if (!wndPtr) return FALSE;
winpos->hwnd = wndPtr->hwndSelf; /* make it a full handle */
if (wndPtr->dwStyle & WS_VISIBLE) winpos->flags &= ~SWP_SHOWWINDOW;
else
@ -660,6 +661,7 @@ static BOOL fixup_flags( WINDOWPOS *winpos )
WND* wnd = WIN_FindWndPtr(winpos->hwndInsertAfter);
if (wnd)
{
winpos->hwndInsertAfter = wnd->hwndSelf; /* make it a full handle */
if (wnd->parent != wndPtr->parent) ret = FALSE;
else
{
@ -696,12 +698,12 @@ BOOL X11DRV_SetWindowPos( WINDOWPOS *winpos )
bChangePos = !(winpos->flags & SWP_WINE_NOHOSTMOVE);
winpos->flags &= ~SWP_WINE_NOHOSTMOVE;
/* Check window handle */
if (winpos->hwnd == GetDesktopWindow()) return FALSE;
/* Fix redundant flags */
if (!fixup_flags( winpos )) return FALSE;
/* Check window handle */
if (winpos->hwnd == GetDesktopWindow()) return FALSE;
SWP_DoWinPosChanging( winpos, &newWindowRect, &newClientRect );
if (!(wndPtr = WIN_FindWndPtr( winpos->hwnd ))) return FALSE;
@ -1023,6 +1025,7 @@ BOOL X11DRV_ShowWindow( HWND hwnd, INT cmd )
UINT swp = 0;
if (!wndPtr) return FALSE;
hwnd = wndPtr->hwndSelf; /* make it a full handle */
TRACE("hwnd=%04x, cmd=%d\n", hwnd, cmd);

View File

@ -25,7 +25,7 @@ typedef struct
INT y;
INT width;
INT height;
HBRUSH16 hBrush;
HBRUSH hBrush;
UINT timeout;
UINT timerid;
} CARET;
@ -62,7 +62,7 @@ void CARET_GetRect(LPRECT lprc)
static void CARET_DisplayCaret( DISPLAY_CARET status )
{
HDC hdc;
HBRUSH16 hPrevBrush;
HBRUSH hPrevBrush;
if (Caret.on && (status == CARET_ON)) return;
if (!Caret.on && (status == CARET_OFF)) return;
@ -168,7 +168,7 @@ BOOL WINAPI CreateCaret( HWND hwnd, HBITMAP bitmap,
GetSysColor(COLOR_WINDOW) );
}
Caret.hwnd = hwnd;
Caret.hwnd = WIN_GetFullHandle( hwnd );
Caret.hidden = 1;
Caret.on = FALSE;
Caret.x = 0;
@ -253,7 +253,7 @@ void WINAPI HideCaret16( HWND16 hwnd )
BOOL WINAPI HideCaret( HWND hwnd )
{
if (!Caret.hwnd) return FALSE;
if (hwnd && (Caret.hwnd != hwnd)) return FALSE;
if (hwnd && (Caret.hwnd != WIN_GetFullHandle(hwnd))) return FALSE;
TRACE("hwnd=%04x, hidden=%d\n",
hwnd, Caret.hidden);
@ -280,7 +280,7 @@ void WINAPI ShowCaret16( HWND16 hwnd )
BOOL WINAPI ShowCaret( HWND hwnd )
{
if (!Caret.hwnd) return FALSE;
if (hwnd && (Caret.hwnd != hwnd)) return FALSE;
if (hwnd && (Caret.hwnd != WIN_GetFullHandle(hwnd))) return FALSE;
TRACE("hwnd=%04x, hidden=%d\n",
hwnd, Caret.hidden);

View File

@ -1366,7 +1366,7 @@ BOOL WINAPI ChangeClipboardChain(HWND hWnd, HWND hWndNext)
else
WARN("hWndViewer is lost\n");
if( hWnd == hWndViewer ) hWndViewer = WIN_GetFullHandle( hWndNext );
if( WIN_GetFullHandle(hWnd) == hWndViewer ) hWndViewer = WIN_GetFullHandle( hWndNext );
return bRet;
}

View File

@ -716,6 +716,7 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
LRESULT result = 0;
if (!IsWindow( hwnd )) return 0;
hwnd = WIN_GetFullHandle( hwnd );
SPY_EnterMessage( SPY_DEFWNDPROC, hwnd, msg, wParam, lParam );
switch(msg)
@ -845,6 +846,7 @@ LRESULT WINAPI DefWindowProcW(
LRESULT result = 0;
if (!IsWindow( hwnd )) return 0;
hwnd = WIN_GetFullHandle( hwnd );
SPY_EnterMessage( SPY_DEFWNDPROC, hwnd, msg, wParam, lParam );
switch(msg)

View File

@ -1480,7 +1480,7 @@ static BOOL DIALOG_IsDialogMessage( HWND hwnd, HWND hwndDlg,
/* drop through */
case WM_SYSCHAR:
if (DIALOG_IsAccelerator( hwnd, hwndDlg, wParam ))
if (DIALOG_IsAccelerator( WIN_GetFullHandle(hwnd), hwndDlg, wParam ))
{
/* don't translate or dispatch */
return TRUE;
@ -1516,8 +1516,8 @@ BOOL16 WINAPI IsDialogMessage16( HWND16 hwndDlg, SEGPTR msg16 )
{
dlgCode = SendMessage16( msg->hwnd, WM_GETDLGCODE, 0, (LPARAM)msg16);
}
ret = DIALOG_IsDialogMessage( msg->hwnd, hwndDlg, msg->message,
msg->wParam, msg->lParam,
ret = DIALOG_IsDialogMessage( WIN_Handle32(msg->hwnd), WIN_Handle32(hwndDlg),
msg->message, msg->wParam, msg->lParam,
&translate, &dispatch, dlgCode );
if (translate) TranslateMessage16( msg );
if (dispatch) DispatchMessage16( msg );
@ -1534,6 +1534,7 @@ BOOL WINAPI IsDialogMessageA( HWND hwndDlg, LPMSG msg )
BOOL ret, translate, dispatch;
INT dlgCode = 0;
hwndDlg = WIN_GetFullHandle( hwndDlg );
if ((hwndDlg != msg->hwnd) && !IsChild( hwndDlg, msg->hwnd ))
return FALSE;
@ -1559,6 +1560,7 @@ BOOL WINAPI IsDialogMessageW( HWND hwndDlg, LPMSG msg )
BOOL ret, translate, dispatch;
INT dlgCode = 0;
hwndDlg = WIN_GetFullHandle( hwndDlg );
if ((hwndDlg != msg->hwnd) && !IsChild( hwndDlg, msg->hwnd ))
return FALSE;
@ -2033,36 +2035,23 @@ static HWND DIALOG_GetNextTabItem( HWND hwndMain, HWND hwndDlg, HWND hwndCtrl, B
hChildFirst = GetWindow(hwndDlg,GW_CHILD);
if(fPrevious) hChildFirst = GetWindow(hChildFirst,GW_HWNDLAST);
}
else
else if (IsChild( hwndMain, hwndCtrl ))
{
HWND hParent = GetParent(hwndCtrl);
BOOL bValid = FALSE;
while( hParent)
hChildFirst = GetWindow(hwndCtrl,wndSearch);
if(!hChildFirst)
{
if(hParent == hwndMain)
if(GetParent(hwndCtrl) != hwndMain)
hChildFirst = GetWindow(GetParent(hwndCtrl),wndSearch);
else
{
bValid = TRUE;
break;
}
hParent = GetParent(hParent);
}
if(bValid)
{
hChildFirst = GetWindow(hwndCtrl,wndSearch);
if(!hChildFirst)
{
if(GetParent(hwndCtrl) != hwndMain)
hChildFirst = GetWindow(GetParent(hwndCtrl),wndSearch);
if(fPrevious)
hChildFirst = GetWindow(hwndCtrl,GW_HWNDLAST);
else
{
if(fPrevious)
hChildFirst = GetWindow(hwndCtrl,GW_HWNDLAST);
else
hChildFirst = GetWindow(hwndCtrl,GW_HWNDFIRST);
}
hChildFirst = GetWindow(hwndCtrl,GW_HWNDFIRST);
}
}
}
}
while(hChildFirst)
{
BOOL bCtrl = FALSE;

View File

@ -1292,10 +1292,10 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message,
else return 0;
case WM_MDIDESTROY:
return MDIDestroyChild( hwnd, ci, (HWND)wParam, TRUE );
return MDIDestroyChild( hwnd, ci, WIN_GetFullHandle( (HWND)wParam ), TRUE );
case WM_MDIGETACTIVE:
if (lParam) *(BOOL *)lParam = (ci->hwndChildMaximized > 0);
if (lParam) *(BOOL *)lParam = (ci->hwndChildMaximized != 0);
return ci->hwndActiveChild;
case WM_MDIICONARRANGE:
@ -1310,7 +1310,7 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message,
return 0;
case WM_MDINEXT: /* lParam != 0 means previous window */
MDI_SwitchActiveChild( hwnd, (HWND)wParam, !lParam );
MDI_SwitchActiveChild( hwnd, WIN_GetFullHandle( (HWND)wParam ), !lParam );
break;
case WM_MDIRESTORE:
@ -1577,7 +1577,7 @@ LRESULT WINAPI DefMDIChildProc16( HWND16 hwnd, UINT16 message,
switch (message)
{
case WM_SETTEXT:
return DefMDIChildProcA( hwnd, message, wParam, (LPARAM)MapSL(lParam) );
return DefMDIChildProcA( WIN_Handle32(hwnd), message, wParam, (LPARAM)MapSL(lParam) );
case WM_MENUCHAR:
case WM_CLOSE:
case WM_SETFOCUS:
@ -1586,20 +1586,20 @@ LRESULT WINAPI DefMDIChildProc16( HWND16 hwnd, UINT16 message,
case WM_SETVISIBLE:
case WM_SIZE:
case WM_SYSCHAR:
return DefMDIChildProcW( hwnd, message, wParam, lParam );
return DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, lParam );
case WM_GETMINMAXINFO:
{
MINMAXINFO16 *mmi16 = (MINMAXINFO16 *)MapSL(lParam);
MINMAXINFO mmi;
STRUCT32_MINMAXINFO16to32( mmi16, &mmi );
DefMDIChildProcW( hwnd, message, wParam, (LPARAM)&mmi );
DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, (LPARAM)&mmi );
STRUCT32_MINMAXINFO32to16( &mmi, mmi16 );
return 0;
}
case WM_NEXTMENU:
{
MDINEXTMENU next_menu;
DefMDIChildProcW( hwnd, message, wParam, (LPARAM)&next_menu );
DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, (LPARAM)&next_menu );
return MAKELONG( next_menu.hmenuNext, next_menu.hwndNext );
}
default:
@ -1617,6 +1617,7 @@ LRESULT WINAPI DefMDIChildProcA( HWND hwnd, UINT message,
HWND client = GetParent(hwnd);
MDICLIENTINFO *ci = get_client_info( client );
hwnd = WIN_GetFullHandle( hwnd );
if (!ci) return DefWindowProcA( hwnd, message, wParam, lParam );
switch (message)
@ -1653,6 +1654,7 @@ LRESULT WINAPI DefMDIChildProcW( HWND hwnd, UINT message,
HWND client = GetParent(hwnd);
MDICLIENTINFO *ci = get_client_info( client );
hwnd = WIN_GetFullHandle( hwnd );
if (!ci) return DefWindowProcW( hwnd, message, wParam, lParam );
switch (message)

View File

@ -12,6 +12,7 @@
#include "winproc.h"
#include "message.h"
#include "win.h"
#include "wine/server.h"
#include "debugtools.h"
@ -229,7 +230,7 @@ UINT16 WINAPI SetTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout,
{
TRACE("%04x %d %d %08lx\n",
hwnd, id, timeout, (LONG)proc );
return TIMER_SetTimer( hwnd, id, timeout, (WNDPROC16)proc,
return TIMER_SetTimer( WIN_Handle32(hwnd), id, timeout, (WNDPROC16)proc,
WIN_PROC_16, FALSE );
}
@ -242,7 +243,7 @@ UINT WINAPI SetTimer( HWND hwnd, UINT id, UINT timeout,
{
TRACE("%04x %d %d %08lx\n",
hwnd, id, timeout, (LONG)proc );
return TIMER_SetTimer( hwnd, id, timeout, (WNDPROC16)proc,
return TIMER_SetTimer( WIN_GetFullHandle(hwnd), id, timeout, (WNDPROC16)proc,
WIN_PROC_32A, FALSE );
}
@ -256,8 +257,9 @@ BOOL TIMER_IsTimerValid( HWND hwnd, UINT id, HWINDOWPROC hProc )
TIMER *pTimer;
BOOL ret = FALSE;
hwnd = WIN_GetFullHandle( hwnd );
EnterCriticalSection( &csTimer );
for (i = 0, pTimer = TimersArray; i < NB_TIMERS; i++, pTimer++)
if ((pTimer->hwnd == hwnd) && (pTimer->id == id) &&
(pTimer->proc == hProc))
@ -279,7 +281,7 @@ UINT16 WINAPI SetSystemTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout,
{
TRACE("%04x %d %d %08lx\n",
hwnd, id, timeout, (LONG)proc );
return TIMER_SetTimer( hwnd, id, timeout, (WNDPROC16)proc,
return TIMER_SetTimer( WIN_Handle32(hwnd), id, timeout, (WNDPROC16)proc,
WIN_PROC_16, TRUE );
}
@ -292,7 +294,7 @@ UINT WINAPI SetSystemTimer( HWND hwnd, UINT id, UINT timeout,
{
TRACE("%04x %d %d %08lx\n",
hwnd, id, timeout, (LONG)proc );
return TIMER_SetTimer( hwnd, id, timeout, (WNDPROC16)proc,
return TIMER_SetTimer( WIN_GetFullHandle(hwnd), id, timeout, (WNDPROC16)proc,
WIN_PROC_32A, TRUE );
}

View File

@ -683,7 +683,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
DCE *dce;
BOOL unicode = (type == WIN_PROC_32W);
TRACE("%s %s %08lx %08lx %d,%d %dx%d %04x %04x %08x %p\n",
TRACE("%s %s ex=%08lx style=%08lx %d,%d %dx%d parent=%04x menu=%04x inst=%08x params=%p\n",
(type == WIN_PROC_32W) ? debugres_w((LPWSTR)cs->lpszName) : debugres_a(cs->lpszName),
(type == WIN_PROC_32W) ? debugres_w((LPWSTR)cs->lpszClass) : debugres_a(cs->lpszClass),
cs->dwExStyle, cs->style, cs->x, cs->y, cs->cx, cs->cy,
@ -1170,6 +1170,7 @@ BOOL WINAPI DestroyWindow( HWND hwnd )
BOOL retvalue;
HWND h;
hwnd = WIN_GetFullHandle( hwnd );
TRACE("(%04x)\n", hwnd);
/* Initialization */
@ -1369,6 +1370,7 @@ static HWND WIN_FindWindow( HWND parent, HWND child, ATOM className, LPCWSTR tit
if (child)
{
child = WIN_GetFullHandle( child );
while (list[i] && list[i] != child) i++;
if (!list[i]) return 0;
i++; /* start from next window */
@ -1540,6 +1542,7 @@ BOOL WINAPI EnableWindow( HWND hwnd, BOOL enable )
return USER_Driver.pEnableWindow( hwnd, enable );
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
hwnd = wndPtr->hwndSelf; /* make it a full handle */
retvalue = ((wndPtr->dwStyle & WS_DISABLED) != 0);
@ -1550,7 +1553,7 @@ BOOL WINAPI EnableWindow( HWND hwnd, BOOL enable )
}
else if (!enable && !(wndPtr->dwStyle & WS_DISABLED))
{
SendMessageA( wndPtr->hwndSelf, WM_CANCELMODE, 0, 0);
SendMessageA( hwnd, WM_CANCELMODE, 0, 0);
wndPtr->dwStyle |= WS_DISABLED; /* Disable window */
@ -2197,11 +2200,11 @@ HWND WINAPI GetParent( HWND hwnd )
*/
HWND WINAPI GetAncestor( HWND hwnd, UINT type )
{
HWND ret;
HWND ret = 0;
WND *wndPtr;
if (hwnd == GetDesktopWindow()) return 0;
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
if (wndPtr->hwndSelf == GetDesktopWindow()) goto done;
switch(type)
{
@ -2224,6 +2227,7 @@ HWND WINAPI GetAncestor( HWND hwnd, UINT type )
break;
}
ret = wndPtr ? wndPtr->hwndSelf : 0;
done:
WIN_ReleaseWndPtr( wndPtr );
return ret;
}
@ -2248,9 +2252,10 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent )
HWND retvalue;
if (!parent) parent = GetDesktopWindow();
else parent = WIN_GetFullHandle( parent );
/* sanity checks */
if (hwnd == GetDesktopWindow() || !IsWindow( parent ))
if (WIN_GetFullHandle(hwnd) == GetDesktopWindow() || !IsWindow( parent ))
{
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return 0;
@ -2315,6 +2320,7 @@ BOOL WINAPI IsChild( HWND parent, HWND child )
BOOL ret;
if (!list) return FALSE;
parent = WIN_GetFullHandle( parent );
for (i = 0; list[i]; i++) if (list[i] == parent) break;
ret = (list[i] != 0);
HeapFree( GetProcessHeap(), 0, list );
@ -2414,6 +2420,8 @@ HWND WINAPI GetWindow( HWND hwnd, WORD rel )
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return 0;
hwnd = wndPtr->hwndSelf; /* make it a full handle */
switch(rel)
{
case GW_HWNDFIRST:
@ -2883,6 +2891,7 @@ BOOL WINAPI FlashWindow( HWND hWnd, BOOL bInvert )
TRACE("%04x\n", hWnd);
if (!wndPtr) return FALSE;
hWnd = wndPtr->hwndSelf; /* make it a full handle */
if (wndPtr->dwStyle & WS_MINIMIZE)
{
@ -2910,8 +2919,8 @@ BOOL WINAPI FlashWindow( HWND hWnd, BOOL bInvert )
if (bInvert) wparam = !(wndPtr->flags & WIN_NCACTIVATED);
else wparam = (hWnd == GetActiveWindow());
SendMessageW( hWnd, WM_NCACTIVATE, wparam, (LPARAM)0 );
WIN_ReleaseWndPtr(wndPtr);
SendMessageW( hWnd, WM_NCACTIVATE, wparam, (LPARAM)0 );
return wparam;
}
}

View File

@ -636,7 +636,7 @@ void WINAPI MapWindowPoints16( HWND16 hwndFrom, HWND16 hwndTo,
{
POINT offset;
WINPOS_GetWinOffset( hwndFrom, hwndTo, &offset );
WINPOS_GetWinOffset( WIN_Handle32(hwndFrom), WIN_Handle32(hwndTo), &offset );
while (count--)
{
lppt->x += offset.x;
@ -654,7 +654,7 @@ INT WINAPI MapWindowPoints( HWND hwndFrom, HWND hwndTo,
{
POINT offset;
WINPOS_GetWinOffset( hwndFrom, hwndTo, &offset );
WINPOS_GetWinOffset( WIN_GetFullHandle(hwndFrom), WIN_GetFullHandle(hwndTo), &offset );
while (count--)
{
lppt->x += offset.x;
@ -1641,10 +1641,12 @@ BOOL WINPOS_ActivateOtherWindow(HWND hwnd)
}
}
pWnd = WIN_FindWndPtr( hwnd );
hwnd = pWnd->hwndSelf;
if( hwnd == hwndPrevActive )
hwndPrevActive = 0;
pWnd = WIN_FindWndPtr( hwnd );
if( hwndActive != hwnd &&
( hwndActive || QUEUE_IsExitingQueue(pWnd->hmemTaskQ)) )
{
@ -1698,14 +1700,14 @@ BOOL WINPOS_ChangeActiveWindow( HWND hWnd, BOOL mouseMsg )
if (!hWnd)
return WINPOS_SetActiveWindow( 0, mouseMsg, TRUE );
wndPtr = WIN_FindWndPtr(hWnd);
if( !wndPtr ) return FALSE;
if (!(wndPtr = WIN_FindWndPtr(hWnd))) return FALSE;
hWnd = wndPtr->hwndSelf;
/* child windows get WM_CHILDACTIVATE message */
if( (wndPtr->dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD )
{
retvalue = SendMessageA(hWnd, WM_CHILDACTIVATE, 0, 0L);
goto end;
WIN_ReleaseWndPtr(wndPtr);
return SendMessageA(hWnd, WM_CHILDACTIVATE, 0, 0L);
}
if( hWnd == hwndActive )
@ -1907,15 +1909,13 @@ HDWP WINAPI DeferWindowPos( HDWP hdwp, HWND hwnd, HWND hwndAfter,
/* HWND parent; */
WND *pWnd;
pDWP = (DWP *) USER_HEAP_LIN_ADDR( hdwp );
if (!pDWP) return 0;
hwnd = WIN_GetFullHandle( hwnd );
if (hwnd == GetDesktopWindow()) return 0;
if (!(pWnd=WIN_FindWndPtr( hwnd ))) {
USER_HEAP_FREE( hdwp );
return 0;
}
if (!(pDWP = USER_HEAP_LIN_ADDR( hdwp ))) return 0;
if (!(pWnd = WIN_FindWndPtr( hwnd ))) return 0;
/* Numega Bounds Checker Demo dislikes the following code.
In fact, I've not been able to find any "same parent" requirement in any docu
[AM 980509]