Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
June 2022
- 68 participants
- 3274 messages
[PATCH 5/7] win32u: Move WM_PRINT implementation from user32.
by Jacek Caban
From: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/user32/defwnd.c | 43 -------------------------------------------
dlls/win32u/defwnd.c | 10 ++++++++++
2 files changed, 10 insertions(+), 43 deletions(-)
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c
index be41f6c47a0..dcc0f4d2138 100644
--- a/dlls/user32/defwnd.c
+++ b/dlls/user32/defwnd.c
@@ -75,45 +75,6 @@ HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType )
}
-/***********************************************************************
- * DEFWND_Print
- *
- * This method handles the default behavior for the WM_PRINT message.
- */
-static void DEFWND_Print( HWND hwnd, HDC hdc, ULONG uFlags)
-{
- /*
- * Visibility flag.
- */
- if ( (uFlags & PRF_CHECKVISIBLE) &&
- !IsWindowVisible(hwnd) )
- return;
-
- /*
- * Unimplemented flags.
- */
- if ( (uFlags & PRF_CHILDREN) ||
- (uFlags & PRF_OWNED) ||
- (uFlags & PRF_NONCLIENT) )
- {
- WARN("WM_PRINT message with unsupported flags\n");
- }
-
- /*
- * Background
- */
- if ( uFlags & PRF_ERASEBKGND)
- SendMessageW(hwnd, WM_ERASEBKGND, (WPARAM)hdc, 0);
-
- /*
- * Client area
- */
- if ( uFlags & PRF_CLIENT)
- SendMessageW(hwnd, WM_PRINTCLIENT, (WPARAM)hdc, uFlags);
-}
-
-
-
/***********************************************************************
* DEFWND_DefWinProc
*
@@ -157,10 +118,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
}
break;
- case WM_PRINT:
- DEFWND_Print(hwnd, (HDC)wParam, lParam);
- return 0;
-
case WM_SYSCOMMAND:
return NC_HandleSysCommand( hwnd, wParam, lParam );
diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c
index 506ff0f9fd9..0470ed77eac 100644
--- a/dlls/win32u/defwnd.c
+++ b/dlls/win32u/defwnd.c
@@ -2621,6 +2621,16 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
break;
}
+ case WM_PRINT:
+ if ((lparam & PRF_CHECKVISIBLE) && !is_window_visible ( hwnd )) break;
+
+ if (lparam & (PRF_CHILDREN | PRF_OWNED | PRF_NONCLIENT))
+ WARN( "WM_PRINT message with unsupported lparam %lx\n", lparam );
+
+ if (lparam & PRF_ERASEBKGND) send_message( hwnd, WM_ERASEBKGND, wparam, 0 );
+ if (lparam & PRF_CLIENT) send_message(hwnd, WM_PRINTCLIENT, wparam, lparam );
+ break;
+
case WM_APPCOMMAND:
{
HWND parent = get_parent( hwnd );
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/285
June 20, 2022
[PATCH 4/7] win32u: Move default WM_CTL* window message implementation from user32.
by Jacek Caban
From: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/user32/defwnd.c | 12 ------------
dlls/win32u/defwnd.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 12 deletions(-)
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c
index c40d2ebedab..be41f6c47a0 100644
--- a/dlls/user32/defwnd.c
+++ b/dlls/user32/defwnd.c
@@ -161,18 +161,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
DEFWND_Print(hwnd, (HDC)wParam, lParam);
return 0;
- case WM_CTLCOLORMSGBOX:
- case WM_CTLCOLOREDIT:
- case WM_CTLCOLORLISTBOX:
- case WM_CTLCOLORBTN:
- case WM_CTLCOLORDLG:
- case WM_CTLCOLORSTATIC:
- case WM_CTLCOLORSCROLLBAR:
- return (LRESULT)DEFWND_ControlColor( (HDC)wParam, msg - WM_CTLCOLORMSGBOX );
-
- case WM_CTLCOLOR:
- return (LRESULT)DEFWND_ControlColor( (HDC)wParam, HIWORD(lParam) );
-
case WM_SYSCOMMAND:
return NC_HandleSysCommand( hwnd, wParam, lParam );
diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c
index e367a769401..506ff0f9fd9 100644
--- a/dlls/win32u/defwnd.c
+++ b/dlls/win32u/defwnd.c
@@ -2261,6 +2261,38 @@ static LRESULT handle_nc_button_dbl_click( HWND hwnd, WPARAM wparam, LPARAM lpar
return 0;
}
+static HBRUSH handle_control_color( HDC hdc, UINT type )
+{
+ if (type == CTLCOLOR_SCROLLBAR)
+ {
+ HBRUSH hb = get_sys_color_brush( COLOR_SCROLLBAR );
+ COLORREF bk = get_sys_color( COLOR_3DHILIGHT );
+ NtGdiGetAndSetDCDword( hdc, NtGdiSetTextColor, get_sys_color( COLOR_3DFACE ), NULL );
+ NtGdiGetAndSetDCDword( hdc, NtGdiSetBkColor, bk, NULL );
+
+ /* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT
+ * we better use 0x55aa bitmap brush to make scrollbar's background
+ * look different from the window background.
+ */
+ if (bk == get_sys_color( COLOR_WINDOW )) return get_55aa_brush();
+
+ NtGdiUnrealizeObject( hb );
+ return hb;
+ }
+
+ NtGdiGetAndSetDCDword( hdc, NtGdiSetTextColor, get_sys_color( COLOR_WINDOWTEXT ), NULL );
+
+ if (type == CTLCOLOR_EDIT || type == CTLCOLOR_LISTBOX)
+ NtGdiGetAndSetDCDword( hdc, NtGdiSetBkColor, get_sys_color( COLOR_WINDOW ), NULL );
+ else
+ {
+ NtGdiGetAndSetDCDword( hdc, NtGdiSetBkColor, get_sys_color( COLOR_3DFACE ), NULL);
+ return get_sys_color_brush( COLOR_3DFACE );
+ }
+
+ return get_sys_color_brush( COLOR_WINDOW );
+}
+
LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi )
{
LRESULT result = 0;
@@ -2474,6 +2506,18 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
handle_set_cursor( hwnd, wparam, lparam );
break;
+ case WM_CTLCOLORMSGBOX:
+ case WM_CTLCOLOREDIT:
+ case WM_CTLCOLORLISTBOX:
+ case WM_CTLCOLORBTN:
+ case WM_CTLCOLORDLG:
+ case WM_CTLCOLORSTATIC:
+ case WM_CTLCOLORSCROLLBAR:
+ return (LRESULT)handle_control_color( (HDC)wparam, msg - WM_CTLCOLORMSGBOX );
+
+ case WM_CTLCOLOR:
+ return (LRESULT)handle_control_color( (HDC)wparam, HIWORD( lparam ));
+
case WM_SYSCOMMAND:
result = handle_sys_command( hwnd, wparam, lparam );
break;
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/285
June 20, 2022
[PATCH 3/7] win32u: Move WM_WINDOWPOSCHANGED implementation from user32.
by Jacek Caban
From: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/user32/defwnd.c | 33 ---------------------------------
dlls/win32u/defwnd.c | 27 +++++++++++++++++++++++++++
2 files changed, 27 insertions(+), 33 deletions(-)
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c
index 3eebc952ee1..c40d2ebedab 100644
--- a/dlls/user32/defwnd.c
+++ b/dlls/user32/defwnd.c
@@ -38,35 +38,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(win);
#define DRAG_FILE 0x454C4946
-/***********************************************************************
- * DEFWND_HandleWindowPosChanged
- *
- * Handle the WM_WINDOWPOSCHANGED message.
- */
-static void DEFWND_HandleWindowPosChanged( HWND hwnd, const WINDOWPOS *winpos )
-{
- RECT rect;
-
- WIN_GetRectangles( hwnd, COORDS_PARENT, NULL, &rect );
- if (!(winpos->flags & SWP_NOCLIENTMOVE))
- SendMessageW( hwnd, WM_MOVE, 0, MAKELONG(rect.left, rect.top));
-
- if (!(winpos->flags & SWP_NOCLIENTSIZE) || (winpos->flags & SWP_STATECHANGED))
- {
- if (IsIconic( hwnd ))
- {
- SendMessageW( hwnd, WM_SIZE, SIZE_MINIMIZED, 0 );
- }
- else
- {
- WPARAM wp = IsZoomed( hwnd ) ? SIZE_MAXIMIZED : SIZE_RESTORED;
-
- SendMessageW( hwnd, WM_SIZE, wp, MAKELONG(rect.right-rect.left, rect.bottom-rect.top) );
- }
- }
-}
-
-
/***********************************************************************
* DEFWND_ControlColor
*
@@ -158,10 +129,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
case WM_NCMOUSELEAVE:
return NC_HandleNCMouseLeave( hwnd );
- case WM_WINDOWPOSCHANGED:
- DEFWND_HandleWindowPosChanged( hwnd, (const WINDOWPOS *)lParam );
- break;
-
case WM_RBUTTONUP:
{
POINT pt;
diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c
index b3726bf8e88..e367a769401 100644
--- a/dlls/win32u/defwnd.c
+++ b/dlls/win32u/defwnd.c
@@ -489,6 +489,29 @@ static LONG handle_window_pos_changing( HWND hwnd, WINDOWPOS *winpos )
return 0;
}
+static void handle_window_pos_changed( HWND hwnd, const WINDOWPOS *winpos )
+{
+ RECT rect;
+
+ get_window_rects( hwnd, COORDS_PARENT, NULL, &rect, get_thread_dpi() );
+ if (!(winpos->flags & SWP_NOCLIENTMOVE))
+ send_message( hwnd, WM_MOVE, 0, MAKELONG( rect.left, rect.top ));
+
+ if (!(winpos->flags & SWP_NOCLIENTSIZE) || (winpos->flags & SWP_STATECHANGED))
+ {
+ if (is_iconic( hwnd ))
+ {
+ send_message( hwnd, WM_SIZE, SIZE_MINIMIZED, 0 );
+ }
+ else
+ {
+ WPARAM wp = is_zoomed( hwnd ) ? SIZE_MAXIMIZED : SIZE_RESTORED;
+ send_message( hwnd, WM_SIZE, wp,
+ MAKELONG( rect.right-rect.left, rect.bottom-rect.top ));
+ }
+ }
+}
+
/***********************************************************************
* draw_moving_frame
*
@@ -2324,6 +2347,10 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
case WM_WINDOWPOSCHANGING:
return handle_window_pos_changing( hwnd, (WINDOWPOS *)lparam );
+ case WM_WINDOWPOSCHANGED:
+ handle_window_pos_changed( hwnd, (const WINDOWPOS *)lparam );
+ break;
+
case WM_PAINTICON:
case WM_PAINT:
{
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/285
June 20, 2022
[PATCH 2/7] win32u: Move WM_APPCOMMAND implementation from user32.
by Jacek Caban
From: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/user32/defwnd.c | 10 ----------
dlls/user32/hook.c | 15 ---------------
dlls/user32/win.h | 2 --
dlls/win32u/defwnd.c | 10 ++++++++++
dlls/win32u/sysparams.c | 7 -------
include/ntuser.h | 1 -
6 files changed, 10 insertions(+), 35 deletions(-)
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c
index 2cfc0b14ff5..3eebc952ee1 100644
--- a/dlls/user32/defwnd.c
+++ b/dlls/user32/defwnd.c
@@ -283,16 +283,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
}
break;
- case WM_APPCOMMAND:
- {
- HWND parent = GetParent(hwnd);
- if(!parent)
- HOOK_CallHooks(WH_SHELL, HSHELL_APPCOMMAND, wParam, lParam, TRUE);
- else
- SendMessageW( parent, msg, wParam, lParam );
- break;
- }
-
case WM_INPUTLANGCHANGEREQUEST:
NtUserActivateKeyboardLayout( (HKL)lParam, 0 );
break;
diff --git a/dlls/user32/hook.c b/dlls/user32/hook.c
index 7dddfb02638..4ef1e029609 100644
--- a/dlls/user32/hook.c
+++ b/dlls/user32/hook.c
@@ -334,21 +334,6 @@ void *get_hook_proc( void *proc, const WCHAR *module, HMODULE *free_module )
}
-/***********************************************************************
- * HOOK_CallHooks
- */
-LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode )
-{
- struct win_hook_params params;
- params.id = id;
- params.code = code;
- params.wparam = wparam;
- params.lparam = lparam;
- params.next_unicode = unicode;
- return NtUserCallOneParam( (UINT_PTR)¶ms, NtUserCallHooks );
-}
-
-
/***********************************************************************
* SetWindowsHookA (USER32.@)
*/
diff --git a/dlls/user32/win.h b/dlls/user32/win.h
index 1dfc8eb0ad1..5e4ac056c60 100644
--- a/dlls/user32/win.h
+++ b/dlls/user32/win.h
@@ -54,8 +54,6 @@ static inline void WIN_ReleasePtr( WND *ptr )
release_user_handle_ptr( ptr );
}
-extern LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode ) DECLSPEC_HIDDEN;
-
extern void WINPOS_ActivateOtherWindow( HWND hwnd ) DECLSPEC_HIDDEN;
extern UINT get_monitor_dpi( HMONITOR monitor ) DECLSPEC_HIDDEN;
diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c
index 71429884b2f..b3726bf8e88 100644
--- a/dlls/win32u/defwnd.c
+++ b/dlls/win32u/defwnd.c
@@ -2549,6 +2549,16 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
send_message( hwnd, WM_HELP, 0, (LPARAM)&hi );
break;
}
+
+ case WM_APPCOMMAND:
+ {
+ HWND parent = get_parent( hwnd );
+ if (!parent)
+ call_hooks( WH_SHELL, HSHELL_APPCOMMAND, wparam, lparam, TRUE );
+ else
+ send_message( parent, msg, wparam, lparam );
+ break;
+ }
}
return result;
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c
index 01469c345c2..a8c1d977c7d 100644
--- a/dlls/win32u/sysparams.c
+++ b/dlls/win32u/sysparams.c
@@ -4814,13 +4814,6 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code )
return TRUE;
/* temporary exports */
- case NtUserCallHooks:
- {
- const struct win_hook_params *params = (struct win_hook_params *)arg;
- return call_hooks( params->id, params->code, params->wparam, params->lparam,
- params->next_unicode );
- }
-
case NtUserGetDeskPattern:
return get_entry( &entry_DESKPATTERN, 256, (WCHAR *)arg );
diff --git a/include/ntuser.h b/include/ntuser.h
index 679179851a9..6e6819038ac 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -797,7 +797,6 @@ enum
NtUserCallOneParam_SetCaretBlinkTime,
NtUserCallOneParam_SetProcessDefaultLayout,
/* temporary exports */
- NtUserCallHooks,
NtUserGetDeskPattern,
NtUserGetWinProcPtr,
NtUserLock,
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/285
June 20, 2022
[PATCH 1/7] win32u: Move default key messages implementation from user32.
by Jacek Caban
From: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/user32/defwnd.c | 90 +-------------------------------------------
dlls/win32u/defwnd.c | 80 +++++++++++++++++++++++++++++++++++++++
2 files changed, 81 insertions(+), 89 deletions(-)
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c
index 45f1842714f..2cfc0b14ff5 100644
--- a/dlls/user32/defwnd.c
+++ b/dlls/user32/defwnd.c
@@ -36,15 +36,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(win);
- /* bits in the dwKeyData */
-#define KEYDATA_ALT 0x2000
-#define KEYDATA_PREVSTATE 0x4000
-
#define DRAG_FILE 0x454C4946
-static short iF10Key = 0;
-static short iMenuSysKey = 0;
-
/***********************************************************************
* DEFWND_HandleWindowPosChanged
*
@@ -169,12 +162,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
DEFWND_HandleWindowPosChanged( hwnd, (const WINDOWPOS *)lParam );
break;
- case WM_LBUTTONDOWN:
- case WM_RBUTTONDOWN:
- case WM_MBUTTONDOWN:
- iF10Key = iMenuSysKey = 0;
- break;
-
case WM_RBUTTONUP:
{
POINT pt;
@@ -222,69 +209,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
case WM_SYSCOMMAND:
return NC_HandleSysCommand( hwnd, wParam, lParam );
- case WM_KEYDOWN:
- if(wParam == VK_F10) iF10Key = VK_F10;
- break;
-
- case WM_SYSKEYDOWN:
- if( HIWORD(lParam) & KEYDATA_ALT )
- {
- /* if( HIWORD(lParam) & ~KEYDATA_PREVSTATE ) */
- if ( (wParam == VK_MENU || wParam == VK_LMENU
- || wParam == VK_RMENU) && !iMenuSysKey )
- iMenuSysKey = 1;
- else
- iMenuSysKey = 0;
-
- iF10Key = 0;
-
- if( wParam == VK_F4 ) /* try to close the window */
- {
- HWND top = NtUserGetAncestor( hwnd, GA_ROOT );
- if (!(GetClassLongW( top, GCL_STYLE ) & CS_NOCLOSE))
- PostMessageW( top, WM_SYSCOMMAND, SC_CLOSE, 0 );
- }
- }
- else if( wParam == VK_F10 )
- {
- if (NtUserGetKeyState(VK_SHIFT) & 0x8000)
- SendMessageW( hwnd, WM_CONTEXTMENU, (WPARAM)hwnd, -1 );
- iF10Key = 1;
- }
- else if (wParam == VK_ESCAPE && (NtUserGetKeyState(VK_SHIFT) & 0x8000))
- SendMessageW( hwnd, WM_SYSCOMMAND, SC_KEYMENU, ' ' );
- break;
-
- case WM_KEYUP:
- case WM_SYSKEYUP:
- /* Press and release F10 or ALT */
- if (((wParam == VK_MENU || wParam == VK_LMENU || wParam == VK_RMENU)
- && iMenuSysKey) || ((wParam == VK_F10) && iF10Key))
- SendMessageW( NtUserGetAncestor( hwnd, GA_ROOT ), WM_SYSCOMMAND, SC_KEYMENU, 0L );
- iMenuSysKey = iF10Key = 0;
- break;
-
- case WM_SYSCHAR:
- {
- iMenuSysKey = 0;
- if (wParam == '\r' && IsIconic(hwnd))
- {
- PostMessageW( hwnd, WM_SYSCOMMAND, SC_RESTORE, 0L );
- break;
- }
- if ((HIWORD(lParam) & KEYDATA_ALT) && wParam)
- {
- if (wParam == '\t' || wParam == '\x1b') break;
- if (wParam == ' ' && (GetWindowLongW( hwnd, GWL_STYLE ) & WS_CHILD))
- SendMessageW( GetParent(hwnd), msg, wParam, lParam );
- else
- SendMessageW( hwnd, WM_SYSCOMMAND, SC_KEYMENU, wParam );
- }
- else /* check for Ctrl-Esc */
- if (wParam != '\x1b') MessageBeep(0);
- break;
- }
-
case WM_SHOWWINDOW:
{
LONG style = GetWindowLongW( hwnd, GWL_STYLE );
@@ -310,11 +234,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
break;
}
- case WM_CANCELMODE:
- iMenuSysKey = 0;
- NtUserMessageCall( hwnd, msg, wParam, lParam, 0, NtUserDefWindowProc, FALSE );
- break;
-
case WM_VKEYTOITEM:
case WM_CHARTOITEM:
return -1;
@@ -485,6 +404,7 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
break;
case WM_SETTEXT:
+ case WM_SYSCHAR:
result = NtUserMessageCall( hwnd, msg, wParam, lParam, 0, NtUserDefWindowProc, TRUE );
break;
@@ -556,14 +476,6 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
}
break;
- case WM_SYSCHAR:
- {
- CHAR ch = LOWORD(wParam);
- WCHAR wch;
- MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wch, 1);
- wParam = MAKEWPARAM( wch, HIWORD(wParam) );
- }
- /* fall through */
default:
result = DEFWND_DefWinProc( hwnd, msg, wParam, lParam );
break;
diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c
index b67f4de2dd9..71429884b2f 100644
--- a/dlls/win32u/defwnd.c
+++ b/dlls/win32u/defwnd.c
@@ -31,6 +31,13 @@
WINE_DEFAULT_DEBUG_CHANNEL(win);
+/* bits in the dwKeyData */
+#define KEYDATA_ALT 0x2000
+#define KEYDATA_PREVSTATE 0x4000
+
+static short f10_key = 0;
+static short menu_sys_key = 0;
+
static BOOL has_dialog_frame( UINT style, UINT ex_style )
{
return (ex_style & WS_EX_DLGMODALFRAME) || ((style & WS_DLGFRAME) && !(style & WS_THICKFRAME));
@@ -2404,6 +2411,7 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
break;
case WM_CANCELMODE:
+ menu_sys_key = 0;
end_menu( hwnd );
if (get_capture() == hwnd) release_capture();
break;
@@ -2443,6 +2451,78 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
result = handle_sys_command( hwnd, wparam, lparam );
break;
+ case WM_LBUTTONDOWN:
+ case WM_RBUTTONDOWN:
+ case WM_MBUTTONDOWN:
+ f10_key = menu_sys_key = 0;
+ break;
+
+ case WM_KEYDOWN:
+ if (wparam == VK_F10) f10_key = VK_F10;
+ break;
+
+ case WM_SYSKEYDOWN:
+ if (HIWORD( lparam ) & KEYDATA_ALT)
+ {
+ if ((wparam == VK_MENU || wparam == VK_LMENU || wparam == VK_RMENU) && !menu_sys_key)
+ menu_sys_key = 1;
+ else
+ menu_sys_key = 0;
+
+ f10_key = 0;
+
+ if (wparam == VK_F4) /* try to close the window */
+ {
+ HWND top = NtUserGetAncestor( hwnd, GA_ROOT );
+ if (!(get_class_long( top, GCL_STYLE, FALSE ) & CS_NOCLOSE))
+ NtUserPostMessage( top, WM_SYSCOMMAND, SC_CLOSE, 0 );
+ }
+ }
+ else if (wparam == VK_F10)
+ {
+ if (NtUserGetKeyState(VK_SHIFT) & 0x8000)
+ send_message( hwnd, WM_CONTEXTMENU, (WPARAM)hwnd, -1 );
+ f10_key = 1;
+ }
+ else if (wparam == VK_ESCAPE && (NtUserGetKeyState( VK_SHIFT ) & 0x8000))
+ send_message( hwnd, WM_SYSCOMMAND, SC_KEYMENU, ' ' );
+ break;
+
+ case WM_KEYUP:
+ case WM_SYSKEYUP:
+ /* Press and release F10 or ALT */
+ if (((wparam == VK_MENU || wparam == VK_LMENU || wparam == VK_RMENU) && menu_sys_key) ||
+ (wparam == VK_F10 && f10_key))
+ send_message( NtUserGetAncestor( hwnd, GA_ROOT ), WM_SYSCOMMAND, SC_KEYMENU, 0 );
+ menu_sys_key = f10_key = 0;
+ break;
+
+ case WM_SYSCHAR:
+ menu_sys_key = 0;
+ if (wparam == '\r' && is_iconic( hwnd ))
+ {
+ NtUserPostMessage( hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 );
+ break;
+ }
+ if ((HIWORD( lparam ) & KEYDATA_ALT) && wparam)
+ {
+ WCHAR wch;
+ if (ansi)
+ {
+ char ch = wparam;
+ win32u_mbtowc( &ansi_cp, &wch, 1, &ch, 1 );
+ }
+ else wch = wparam;
+ if (wch == '\t' || wch == '\x1b') break;
+ if (wch == ' ' && (get_window_long( hwnd, GWL_STYLE ) & WS_CHILD))
+ send_message( get_parent( hwnd ), msg, wch, lparam );
+ else
+ send_message( hwnd, WM_SYSCOMMAND, SC_KEYMENU, wch );
+ }
+ else if (wparam != '\x1b') /* Ctrl-Esc */
+ message_beep(0);
+ break;
+
case WM_KEYF1:
{
HELPINFO hi;
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/285
June 20, 2022
[PATCH 0/7] MR285: win32u: Default window proc conversion
by Jacek Caban (@jacek)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/285
June 20, 2022
[PATCH v2 2/2] ntdll: Filter EFlags from user-supplied CONTEXT on x86 and x64.
by Jinoh Kang
From: Jinoh Kang <jinoh.kang.kr(a)gmail.com>
Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com>
---
dlls/ntdll/tests/exception.c | 2 --
dlls/ntdll/unix/signal_i386.c | 2 +-
dlls/ntdll/unix/signal_x86_64.c | 4 ++--
dlls/ntdll/unix/thread.c | 20 +++++++++++++++++++-
dlls/ntdll/unix/unix_private.h | 17 +++++++++++++++++
5 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index c0ac31f7acf..9aa4a81f2a8 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -10725,7 +10725,6 @@ static void test_eflags_sanitization(void)
ok(status == STATUS_SUCCESS, "NtSetContextThread failed with %lx\n", status);
status = pNtGetContextThread(thread, &context);
ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %lx\n", status);
- todo_wine
ok(context.EFlags == min_eflags, "Expected EFlags to be %#lx, got %#lx\n", min_eflags, context.EFlags);
context.EFlags = -1;
@@ -10733,7 +10732,6 @@ static void test_eflags_sanitization(void)
ok(status == STATUS_SUCCESS, "NtSetContextThread failed with %lx\n", status);
status = pNtGetContextThread(thread, &context);
ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %lx\n", status);
- todo_wine
ok(context.EFlags == max_eflags || broken(context.EFlags == max_eflags_broken),
"Expected EFlags to be %#lx, got %#lx\n", max_eflags, context.EFlags);
diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c
index 7be0c39c424..9be0769904d 100644
--- a/dlls/ntdll/unix/signal_i386.c
+++ b/dlls/ntdll/unix/signal_i386.c
@@ -941,7 +941,7 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
frame->esp = context->Esp;
frame->ebp = context->Ebp;
frame->eip = context->Eip;
- frame->eflags = context->EFlags;
+ frame->eflags = arch_flags_reg_from_user( context->EFlags, IMAGE_FILE_MACHINE_I386 );
frame->cs = context->SegCs;
frame->ss = context->SegSs;
}
diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c
index 6c87e347eac..c4f67a16cc9 100644
--- a/dlls/ntdll/unix/signal_x86_64.c
+++ b/dlls/ntdll/unix/signal_x86_64.c
@@ -1788,7 +1788,7 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
frame->rsp = context->Rsp;
frame->rbp = context->Rbp;
frame->rip = context->Rip;
- frame->eflags = context->EFlags;
+ frame->eflags = arch_flags_reg_from_user( context->EFlags, IMAGE_FILE_MACHINE_AMD64 );
frame->cs = context->SegCs;
frame->ss = context->SegSs;
}
@@ -2002,7 +2002,7 @@ NTSTATUS set_thread_wow64_context( HANDLE handle, const void *ctx, ULONG size )
wow_frame->Esp = context->Esp;
wow_frame->Ebp = context->Ebp;
wow_frame->Eip = context->Eip;
- wow_frame->EFlags = context->EFlags;
+ wow_frame->EFlags = arch_flags_reg_from_user( context->EFlags, IMAGE_FILE_MACHINE_I386 );
wow_frame->SegCs = cs32_sel;
wow_frame->SegSs = ds64_sel;
cpu->Flags |= WOW64_CPURESERVED_FLAG_RESET_STATE;
diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c
index ad47a5fce74..e0d44bb4a38 100644
--- a/dlls/ntdll/unix/thread.c
+++ b/dlls/ntdll/unix/thread.c
@@ -1663,13 +1663,31 @@ NTSTATUS WINAPI NtQueueApcThread( HANDLE handle, PNTAPCFUNC func, ULONG_PTR arg1
NTSTATUS set_thread_context( HANDLE handle, const void *context, BOOL *self, USHORT machine )
{
context_t server_contexts[2];
- unsigned int count = 0;
+ unsigned int count = 0, i;
NTSTATUS ret;
context_to_server( &server_contexts[count++], native_machine, context, machine );
if (machine != native_machine)
context_to_server( &server_contexts[count++], machine, context, machine );
+ for (i = 0; i < count; i++)
+ {
+ unsigned int *flags_ptr;
+ if (!(server_contexts[i].flags & SERVER_CTX_CONTROL)) continue;
+ switch (server_contexts[i].machine)
+ {
+ case IMAGE_FILE_MACHINE_I386:
+ flags_ptr = &server_contexts[i].ctl.i386_regs.eflags;
+ break;
+ case IMAGE_FILE_MACHINE_AMD64:
+ flags_ptr = &server_contexts[i].ctl.x86_64_regs.flags;
+ break;
+ default:
+ continue;
+ }
+ *flags_ptr = arch_flags_reg_from_user( *flags_ptr, machine );
+ }
+
SERVER_START_REQ( set_thread_context )
{
req->handle = wine_server_obj_handle( handle );
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index 795fc148479..4160f731563 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -458,4 +458,21 @@ static inline NTSTATUS map_section( HANDLE mapping, void **ptr, SIZE_T *size, UL
0, NULL, size, ViewShare, 0, protect );
}
+static inline DWORD arch_flags_reg_from_user( DWORD flags, USHORT machine )
+{
+ switch (machine)
+ {
+ case IMAGE_FILE_MACHINE_I386:
+ if (machine == native_machine)
+ {
+ return (flags & 0x003f4fd7) | 0x00000200;
+ }
+ return (flags & 0x003f0fd7) | 0x00000202;
+ case IMAGE_FILE_MACHINE_AMD64:
+ return (flags & 0x00210fd5) | 0x00000200;
+ default:
+ return flags;
+ }
+}
+
#endif /* __NTDLL_UNIX_PRIVATE_H */
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/283
June 20, 2022
[PATCH v2 1/2] ntdll/tests: Test for setting x86 / x64 EFLAGS register in context.
by Jinoh Kang
From: Jinoh Kang <jinoh.kang.kr(a)gmail.com>
Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com>
---
dlls/ntdll/tests/exception.c | 91 ++++++++++++++++++++++++++++++++++++
1 file changed, 91 insertions(+)
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index 820e435bc1b..c0ac31f7acf 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -10673,6 +10673,95 @@ static void test_copy_context(void)
dst_xs->Mask == 4, sizeof(dst_xs->YmmContext));
}
}
+
+static DWORD WINAPI signal_and_wait_proc( void *arg )
+{
+ HANDLE *events = arg;
+ /* Atomically signal and wait to put thread in blocking state */
+ return SignalObjectAndWait(events[0], events[1], INFINITE, FALSE);
+}
+
+static void test_eflags_sanitization(void)
+{
+ DWORD min_eflags, max_eflags, max_eflags_broken;
+ HANDLE event_in, event_out;
+ HANDLE thread;
+ HANDLE thread_args[2];
+ HANDLE waits[2];
+ NTSTATUS status;
+ CONTEXT context;
+ DWORD result, old_eflags;
+ int i;
+
+#if defined(__x86_64__)
+ min_eflags = 0x00000200;
+ max_eflags = 0x00210fd5;
+ max_eflags_broken = max_eflags;
+#elif defined(__i386__)
+ min_eflags = is_wow64 ? 0x00000202 : 0x00000200;
+ max_eflags = is_wow64 ? 0x003f0fd7 : 0x003f4fd7;
+ max_eflags_broken = max_eflags & ~((DWORD)!is_wow64 << 17);
+#endif
+
+ event_in = CreateEventW(NULL, FALSE, FALSE, NULL);
+ ok(event_in != NULL, "CreateEventW failed with %#lx\n", GetLastError());
+ event_out = CreateEventW(NULL, FALSE, FALSE, NULL);
+ ok(event_out != NULL, "CreateEventW failed with %#lx\n", GetLastError());
+
+ thread_args[0] = event_in;
+ thread_args[1] = event_out;
+ thread = CreateThread(NULL, 0, signal_and_wait_proc, thread_args, CREATE_SUSPENDED, NULL);
+ ok(thread != NULL, "CreateThread failed with %#lx.\n", GetLastError());
+
+ for (i = 0; ; i++)
+ {
+ context.ContextFlags = CONTEXT_CONTROL;
+ status = pNtGetContextThread(thread, &context);
+ ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %lx\n", status);
+ old_eflags = context.EFlags;
+
+ context.EFlags = 0;
+ status = pNtSetContextThread(thread, &context);
+ ok(status == STATUS_SUCCESS, "NtSetContextThread failed with %lx\n", status);
+ status = pNtGetContextThread(thread, &context);
+ ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %lx\n", status);
+ todo_wine
+ ok(context.EFlags == min_eflags, "Expected EFlags to be %#lx, got %#lx\n", min_eflags, context.EFlags);
+
+ context.EFlags = -1;
+ status = pNtSetContextThread(thread, &context);
+ ok(status == STATUS_SUCCESS, "NtSetContextThread failed with %lx\n", status);
+ status = pNtGetContextThread(thread, &context);
+ ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %lx\n", status);
+ todo_wine
+ ok(context.EFlags == max_eflags || broken(context.EFlags == max_eflags_broken),
+ "Expected EFlags to be %#lx, got %#lx\n", max_eflags, context.EFlags);
+
+ context.EFlags = old_eflags;
+ status = pNtSetContextThread(thread, &context);
+ ok(status == STATUS_SUCCESS, "NtSetContextThread failed with %lx\n", status);
+
+ if (i == 1) break;
+
+ ResumeThread(thread);
+ waits[0] = event_in;
+ waits[1] = thread;
+ result = WaitForMultipleObjects(2, waits, FALSE, INFINITE);
+ ok(result == WAIT_OBJECT_0, "Expected WAIT_OBJECT_0, got %#lx\n", result);
+ }
+
+ ok(SetEvent(event_out), "SetEvent failed: %#lx\n", GetLastError());
+
+ result = WaitForSingleObject(thread, INFINITE);
+ ok(result == WAIT_OBJECT_0, "Expected WAIT_OBJECT_0, got %#lx\n", result);
+
+ ok(GetExitCodeThread(thread, &result), "Failed to get thread exit code: %#lx\n", GetLastError());
+ ok(result == WAIT_OBJECT_0, "Expected WAIT_OBJECT_0, got %#lx\n", result);
+
+ CloseHandle(thread);
+ CloseHandle(event_in);
+ CloseHandle(event_out);
+}
#endif
START_TEST(exception)
@@ -10847,6 +10936,7 @@ START_TEST(exception)
test_kiuserexceptiondispatcher();
test_extended_context();
test_copy_context();
+ test_eflags_sanitization();
#elif defined(__x86_64__)
@@ -10891,6 +10981,7 @@ START_TEST(exception)
test_copy_context();
test_unwind_from_apc();
test_syscall_clobbered_regs();
+ test_eflags_sanitization();
#elif defined(__aarch64__)
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/283
June 20, 2022
[PATCH v2 0/2] MR283: ntdll: Filter EFlags from user-supplied CONTEXT on x86 and x64.
by Jinoh Kang (@iamahuman)
--
v2: ntdll: Filter EFlags from user-supplied CONTEXT on x86 and x64.
ntdll/tests: Test for setting x86 / x64 EFLAGS register in context.
https://gitlab.winehq.org/wine/wine/-/merge_requests/283
June 20, 2022
Re: [PATCH v2 0/2] MR244: winex11.drv: Keep GLX pbuffer alive while its drawable is used - approved
by Matteo Bruni (@Mystral)
This merge request was approved by Matteo Bruni.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/244
June 20, 2022