From: Jacek Caban jacek@codeweavers.com
And use it for MDI client implementation. --- dlls/user32/mdi.c | 15 ++++----------- dlls/win32u/menu.c | 11 +++++++++++ dlls/win32u/win32u_private.h | 1 + dlls/win32u/window.c | 3 +++ include/ntuser.h | 6 ++++++ 5 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c index 11ba1382804..cb278525f13 100644 --- a/dlls/user32/mdi.c +++ b/dlls/user32/mdi.c @@ -1359,17 +1359,12 @@ LRESULT WINAPI DefFrameProcW( HWND hwnd, HWND hwndMDIClient, { /* control menu is between the frame system menu and * the first entry of menu bar */ - WND *wndPtr = WIN_GetPtr(hwnd); - - if( (wParam == VK_LEFT && GetMenu(hwnd) == next_menu->hmenuIn) || - (wParam == VK_RIGHT && GetSubMenu(wndPtr->hSysMenu, 0) == next_menu->hmenuIn) ) + if ((wParam == VK_LEFT && GetMenu(hwnd) == next_menu->hmenuIn) || + (wParam == VK_RIGHT && NtUserGetWindowSysSubMenu( hwnd ) == next_menu->hmenuIn)) { - WIN_ReleasePtr(wndPtr); - wndPtr = WIN_GetPtr(ci->hwndActiveChild); - next_menu->hmenuNext = GetSubMenu(wndPtr->hSysMenu, 0); + next_menu->hmenuNext = NtUserGetWindowSysSubMenu( ci->hwndActiveChild ); next_menu->hwndNext = ci->hwndActiveChild; } - WIN_ReleasePtr(wndPtr); } return 0; } @@ -1551,9 +1546,7 @@ LRESULT WINAPI DefMDIChildProcW( HWND hwnd, UINT message,
if( wParam == VK_LEFT ) /* switch to frame system menu */ { - WND *wndPtr = WIN_GetPtr( parent ); - next_menu->hmenuNext = GetSubMenu( wndPtr->hSysMenu, 0 ); - WIN_ReleasePtr( wndPtr ); + next_menu->hmenuNext = NtUserGetWindowSysSubMenu( parent ); } if( wParam == VK_RIGHT ) /* to frame menu bar */ { diff --git a/dlls/win32u/menu.c b/dlls/win32u/menu.c index 641eb926e16..53dcf3ced8e 100644 --- a/dlls/win32u/menu.c +++ b/dlls/win32u/menu.c @@ -1619,6 +1619,17 @@ BOOL WINAPI NtUserSetSystemMenu( HWND hwnd, HMENU menu ) return TRUE; }
+HMENU get_window_sys_sub_menu( HWND hwnd ) +{ + WND *win; + HMENU ret; + + if (!(win = get_win_ptr( hwnd )) || win == WND_OTHER_PROCESS || win == WND_DESKTOP) return 0; + ret = win->hSysMenu; + release_win_ptr( win ); + return get_sub_menu( ret, 0 ); +} + /********************************************************************** * NtUserSetMenuDefaultItem (win32u.@) */ diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 6e9a1926891..d4b86d1e6a9 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -289,6 +289,7 @@ extern UINT get_menu_bar_height( HWND hwnd, UINT width, INT org_x, INT org_y ) D extern BOOL get_menu_info( HMENU handle, MENUINFO *info ) DECLSPEC_HIDDEN; extern INT get_menu_item_count( HMENU handle ) DECLSPEC_HIDDEN; extern UINT get_menu_state( HMENU handle, UINT item_id, UINT flags ) DECLSPEC_HIDDEN; +extern HMENU get_window_sys_sub_menu( HWND hwnd ) DECLSPEC_HIDDEN; extern BOOL is_menu( HMENU handle ) DECLSPEC_HIDDEN; extern HWND is_menu_active(void) DECLSPEC_HIDDEN; extern LRESULT popup_menu_window_proc( HWND hwnd, UINT message, WPARAM wparam, diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 506af7530d3..41cfde752c7 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -5419,6 +5419,9 @@ ULONG_PTR WINAPI NtUserCallHwnd( HWND hwnd, DWORD code ) case NtUserCallHwnd_GetWindowInputContext: return HandleToUlong( get_window_input_context( hwnd ));
+ case NtUserCallHwnd_GetWindowSysSubMenu: + return HandleToUlong( get_window_sys_sub_menu( hwnd )); + case NtUserCallHwnd_GetWindowTextLength: return get_server_window_text( hwnd, NULL, 0 );
diff --git a/include/ntuser.h b/include/ntuser.h index 86e2d329eb9..65abfc65b18 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -1105,6 +1105,7 @@ enum NtUserCallHwnd_GetWindowContextHelpId, NtUserCallHwnd_GetWindowDpiAwarenessContext, NtUserCallHwnd_GetWindowInputContext, + NtUserCallHwnd_GetWindowSysSubMenu, NtUserCallHwnd_GetWindowTextLength, NtUserCallHwnd_IsWindow, NtUserCallHwnd_IsWindowEnabled, @@ -1163,6 +1164,11 @@ static inline HIMC NtUserGetWindowInputContext( HWND hwnd ) return UlongToHandle( NtUserCallHwnd( hwnd, NtUserCallHwnd_GetWindowInputContext )); }
+static inline HMENU NtUserGetWindowSysSubMenu( HWND hwnd ) +{ + return UlongToHandle( NtUserCallHwnd( hwnd, NtUserCallHwnd_GetWindowSysSubMenu )); +} + static inline INT NtUserGetWindowTextLength( HWND hwnd ) { return NtUserCallHwnd( hwnd, NtUserCallHwnd_GetWindowTextLength );
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/mdi.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c index cb278525f13..d8d26a3b2f1 100644 --- a/dlls/user32/mdi.c +++ b/dlls/user32/mdi.c @@ -127,7 +127,6 @@ typedef struct * states it must keep coherency with USER32 on its own. This is true for * Windows as well. */ - LONG reserved; UINT nActiveChildren; HWND hwndChildMaximized; HWND hwndActiveChild; @@ -187,7 +186,7 @@ const struct builtin_class_descr MDICLIENT_builtin_class = L"MDIClient", /* name */ 0, /* style */ WINPROC_MDICLIENT, /* proc */ - sizeof(MDICLIENTINFO), /* extra */ + 2 * sizeof(void *), /* extra */ IDC_ARROW, /* cursor */ (HBRUSH)(COLOR_APPWORKSPACE+1) /* brush */ }; @@ -205,7 +204,7 @@ static MDICLIENTINFO *get_client_info( HWND client ) return NULL; } if (win->flags & WIN_ISMDICLIENT) - ret = (MDICLIENTINFO *)win->wExtra; + ret = ((MDICLIENTINFO **)win->wExtra)[1]; else WARN( "%p is not an MDI client\n", client ); WIN_ReleasePtr( win ); @@ -1036,7 +1035,12 @@ LRESULT MDIClientWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM
if (!(ci = get_client_info( hwnd ))) { - if (message == WM_NCCREATE) win_set_flags( hwnd, WIN_ISMDICLIENT, 0 ); + if (message == WM_NCCREATE) + { + if (!(ci = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ci) ))) return 0; + SetWindowLongPtrW( hwnd, sizeof(void *), (ULONG_PTR)ci ); + win_set_flags( hwnd, WIN_ISMDICLIENT, 0 ); + } return unicode ? DefWindowProcW( hwnd, message, wParam, lParam ) : DefWindowProcA( hwnd, message, wParam, lParam ); } @@ -1077,7 +1081,7 @@ LRESULT MDIClientWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM
HeapFree( GetProcessHeap(), 0, ci->child ); HeapFree( GetProcessHeap(), 0, ci->frameTitle ); - + HeapFree( GetProcessHeap(), 0, ci ); return 0; }
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/mdi.c | 20 ++------------------ dlls/user32/win.c | 24 +++--------------------- dlls/user32/win.h | 2 -- dlls/win32u/window.c | 8 ++++++++ include/ntuser.h | 12 ++++++++++++ 5 files changed, 25 insertions(+), 41 deletions(-)
diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c index d8d26a3b2f1..12dd61c5376 100644 --- a/dlls/user32/mdi.c +++ b/dlls/user32/mdi.c @@ -194,22 +194,7 @@ const struct builtin_class_descr MDICLIENT_builtin_class =
static MDICLIENTINFO *get_client_info( HWND client ) { - MDICLIENTINFO *ret = NULL; - WND *win = WIN_GetPtr( client ); - if (win) - { - if (win == WND_OTHER_PROCESS || win == WND_DESKTOP) - { - if (IsWindow(client)) WARN( "client %p belongs to other process\n", client ); - return NULL; - } - if (win->flags & WIN_ISMDICLIENT) - ret = ((MDICLIENTINFO **)win->wExtra)[1]; - else - WARN( "%p is not an MDI client\n", client ); - WIN_ReleasePtr( win ); - } - return ret; + return NtUserGetMDIClientInfo( client ); }
static BOOL is_close_enabled(HWND hwnd, HMENU hSysMenu) @@ -1038,8 +1023,7 @@ LRESULT MDIClientWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM if (message == WM_NCCREATE) { if (!(ci = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ci) ))) return 0; - SetWindowLongPtrW( hwnd, sizeof(void *), (ULONG_PTR)ci ); - win_set_flags( hwnd, WIN_ISMDICLIENT, 0 ); + NtUserSetMDIClientInfo( hwnd, ci ); } return unicode ? DefWindowProcW( hwnd, message, wParam, lParam ) : DefWindowProcA( hwnd, message, wParam, lParam ); diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 23263166eeb..5cbef6d2342 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -128,7 +128,7 @@ BOOL is_desktop_window( HWND hwnd ) * or WND_OTHER_PROCESS if handle may be valid in other process. * If ret value is a valid pointer, it must be released with WIN_ReleasePtr. */ -WND *WIN_GetPtr( HWND hwnd ) +static WND *WIN_GetPtr( HWND hwnd ) { WND *ptr = (void *)NtUserCallTwoParam( HandleToUlong(hwnd), NTUSER_OBJ_WINDOW, NtUserGetHandlePtr ); if (ptr == WND_OTHER_PROCESS && is_desktop_window( hwnd )) ptr = WND_DESKTOP; @@ -139,7 +139,7 @@ WND *WIN_GetPtr( HWND hwnd ) /*********************************************************************** * WIN_ReleasePtr */ -void WIN_ReleasePtr( WND *ptr ) +static void WIN_ReleasePtr( WND *ptr ) { assert( ptr && ptr != OBJ_OTHER_PROCESS ); NtUserCallOneParam( 1, NtUserLock ); @@ -168,24 +168,6 @@ HWND WIN_IsCurrentThread( HWND hwnd ) }
-/*********************************************************************** - * win_set_flags - * - * Set the flags of a window and return the previous value. - */ -UINT win_set_flags( HWND hwnd, UINT set_mask, UINT clear_mask ) -{ - UINT ret; - WND *ptr = WIN_GetPtr( hwnd ); - - if (!ptr || ptr == WND_OTHER_PROCESS || ptr == WND_DESKTOP) return 0; - ret = ptr->flags; - ptr->flags = (ret & ~clear_mask) | set_mask; - WIN_ReleasePtr( ptr ); - return ret; -} - - /*********************************************************************** * WIN_GetFullHandle * @@ -494,7 +476,7 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, POINT pos[2]; UINT id = 0;
- if (!(win_get_flags( cs->hwndParent ) & WIN_ISMDICLIENT)) + if (!NtUserGetMDIClientInfo( cs->hwndParent )) { WARN("WS_EX_MDICHILD, but parent %p is not MDIClient\n", cs->hwndParent); return 0; diff --git a/dlls/user32/win.h b/dlls/user32/win.h index 8ef090fe983..5b744ade004 100644 --- a/dlls/user32/win.h +++ b/dlls/user32/win.h @@ -36,8 +36,6 @@ struct tagDIALOGINFO; /* Window functions */ extern HWND get_hwnd_message_parent(void) DECLSPEC_HIDDEN; extern BOOL is_desktop_window( HWND hwnd ) DECLSPEC_HIDDEN; -extern WND *WIN_GetPtr( HWND hwnd ) DECLSPEC_HIDDEN; -extern void WIN_ReleasePtr( WND *ptr ) DECLSPEC_HIDDEN; extern HWND WIN_GetFullHandle( HWND hwnd ) DECLSPEC_HIDDEN; extern HWND WIN_IsCurrentProcess( HWND hwnd ) DECLSPEC_HIDDEN; extern HWND WIN_IsCurrentThread( HWND hwnd ) DECLSPEC_HIDDEN; diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 41cfde752c7..ef8d3dea19e 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -5410,6 +5410,10 @@ ULONG_PTR WINAPI NtUserCallHwnd( HWND hwnd, DWORD code ) case NtUserCallHwnd_GetDialogInfo: return (ULONG_PTR)get_dialog_info( hwnd );
+ case NtUserCallHwnd_GetMDIClientInfo: + if (!(win_get_flags( hwnd ) & WIN_ISMDICLIENT)) return 0; + return get_window_long_ptr( hwnd, sizeof(void *), FALSE ); + case NtUserCallHwnd_GetWindowContextHelpId: return get_window_context_help_id( hwnd );
@@ -5548,6 +5552,10 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code ) case NtUserCallHwndParam_SetDialogInfo: return set_dialog_info( hwnd, (void *)param );
+ case NtUserCallHwndParam_SetMDIClientInfo: + NtUserSetWindowLongPtr( hwnd, sizeof(void *), param, FALSE ); + return win_set_flags( hwnd, WIN_ISMDICLIENT, 0 ); + case NtUserCallHwndParam_SetWindowContextHelpId: return set_window_context_help_id( hwnd, param );
diff --git a/include/ntuser.h b/include/ntuser.h index 65abfc65b18..882bd4fad30 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -1101,6 +1101,7 @@ enum NtUserCallHwnd_GetDefaultImeWindow, NtUserCallHwnd_GetDialogInfo, NtUserCallHwnd_GetDpiForWindow, + NtUserCallHwnd_GetMDIClientInfo, NtUserCallHwnd_GetParent, NtUserCallHwnd_GetWindowContextHelpId, NtUserCallHwnd_GetWindowDpiAwarenessContext, @@ -1148,6 +1149,11 @@ static inline UINT NtUserGetDpiForWindow( HWND hwnd ) return NtUserCallHwnd( hwnd, NtUserCallHwnd_GetDpiForWindow ); }
+static inline void *NtUserGetMDIClientInfo( HWND hwnd ) +{ + return (void *)NtUserCallHwnd( hwnd, NtUserCallHwnd_GetMDIClientInfo ); +} + static inline HWND NtUserGetParent( HWND hwnd ) { return UlongToHandle( NtUserCallHwnd( hwnd, NtUserCallHwnd_GetParent )); @@ -1228,6 +1234,7 @@ enum NtUserCallHwndParam_MonitorFromWindow, NtUserCallHwndParam_ScreenToClient, NtUserCallHwndParam_SetDialogInfo, + NtUserCallHwndParam_SetMDIClientInfo, NtUserCallHwndParam_SetWindowContextHelpId, NtUserCallHwndParam_SetWindowPixelFormat, NtUserCallHwndParam_ShowOwnedPopups, @@ -1394,6 +1401,11 @@ static inline void NtUserSetDialogInfo( HWND hwnd, void *info ) NtUserCallHwndParam( hwnd, (UINT_PTR)info, NtUserCallHwndParam_SetDialogInfo ); }
+static inline void NtUserSetMDIClientInfo( HWND hwnd, void *info ) +{ + NtUserCallHwndParam( hwnd, (UINT_PTR)info, NtUserCallHwndParam_SetMDIClientInfo ); +} + static inline BOOL NtUserSetWindowContextHelpId( HWND hwnd, DWORD id ) { return NtUserCallHwndParam( hwnd, id, NtUserCallHwndParam_SetWindowContextHelpId );
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/edit.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index 80758dd60ef..81296f7deeb 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -3328,11 +3328,16 @@ static void EDIT_WM_ContextMenu(EDITSTATE *es, INT x, INT y)
if (x == -1 && y == -1) /* passed via VK_APPS press/release */ { + POINT pt; RECT rc; + /* Windows places the menu at the edit's center in this case */ - WIN_GetRectangles( es->hwndSelf, COORDS_SCREEN, NULL, &rc ); - x = rc.left + (rc.right - rc.left) / 2; - y = rc.top + (rc.bottom - rc.top) / 2; + GetClientRect( es->hwndSelf, &rc ); + pt.x = rc.right / 2; + pt.y = rc.bottom / 2; + ClientToScreen( es->hwndSelf, &pt ); + x = pt.x; + y = pt.y; }
if (!(es->flags & EF_FOCUSED))
From: Jacek Caban jacek@codeweavers.com
And use it in CalcChildScroll. --- dlls/user32/class.c | 38 --------- dlls/user32/controls.h | 2 - dlls/user32/mdi.c | 2 +- dlls/user32/user_private.h | 3 - dlls/user32/win.c | 160 ------------------------------------- dlls/user32/win.h | 4 - dlls/win32u/sysparams.c | 3 - dlls/win32u/window.c | 3 + include/ntuser.h | 7 +- 9 files changed, 10 insertions(+), 212 deletions(-)
diff --git a/dlls/user32/class.c b/dlls/user32/class.c index 76e2688bb82..c18e48b257a 100644 --- a/dlls/user32/class.c +++ b/dlls/user32/class.c @@ -718,44 +718,6 @@ BOOL WINAPI GetClassInfoExW( HINSTANCE hInstance, LPCWSTR name, WNDCLASSEXW *wc }
-#if 0 /* toolhelp is in kernel, so this cannot work */ - -/*********************************************************************** - * ClassFirst (TOOLHELP.69) - */ -BOOL16 WINAPI ClassFirst16( CLASSENTRY *pClassEntry ) -{ - TRACE("%p\n",pClassEntry); - pClassEntry->wNext = 1; - return ClassNext16( pClassEntry ); -} - - -/*********************************************************************** - * ClassNext (TOOLHELP.70) - */ -BOOL16 WINAPI ClassNext16( CLASSENTRY *pClassEntry ) -{ - int i; - CLASS *class = firstClass; - - TRACE("%p\n",pClassEntry); - - if (!pClassEntry->wNext) return FALSE; - for (i = 1; (i < pClassEntry->wNext) && class; i++) class = class->next; - if (!class) - { - pClassEntry->wNext = 0; - return FALSE; - } - pClassEntry->hInst = class->hInstance; - pClassEntry->wNext++; - GlobalGetAtomNameA( class->atomName, pClassEntry->szClassName, - sizeof(pClassEntry->szClassName) ); - return TRUE; -} -#endif - #ifdef _WIN64
/* 64bit versions */ diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h index 036d872c43c..a6c45ca1652 100644 --- a/dlls/user32/controls.h +++ b/dlls/user32/controls.h @@ -101,8 +101,6 @@ extern LRESULT ScrollBarWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HI extern LRESULT StaticWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
/* Class functions */ -struct tagCLASS; /* opaque structure */ -struct tagWND; extern ATOM get_int_atom_value( UNICODE_STRING *name ) DECLSPEC_HIDDEN; extern void register_desktop_class(void) DECLSPEC_HIDDEN;
diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c index 12dd61c5376..746f8c6f46f 100644 --- a/dlls/user32/mdi.c +++ b/dlls/user32/mdi.c @@ -1688,7 +1688,7 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll ) if (style & WS_VISIBLE) { RECT rect; - WIN_GetRectangles( list[i], COORDS_PARENT, &rect, NULL ); + NtUserGetChildRect( list[i], &rect ); UnionRect( &childRect, &rect, &childRect ); } } diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index d4a296f4bb7..8e3388c6fd5 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -54,9 +54,6 @@ static inline struct user_thread_info *get_user_thread_info(void)
extern HMODULE user32_module DECLSPEC_HIDDEN;
-struct dce; -struct tagWND; - extern BOOL post_dde_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, DWORD dest_tid, DWORD type ) DECLSPEC_HIDDEN; extern BOOL unpack_dde_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 5cbef6d2342..93ac7f7b7c5 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -121,31 +121,6 @@ BOOL is_desktop_window( HWND hwnd ) }
-/*********************************************************************** - * WIN_GetPtr - * - * Return a pointer to the WND structure if local to the process, - * or WND_OTHER_PROCESS if handle may be valid in other process. - * If ret value is a valid pointer, it must be released with WIN_ReleasePtr. - */ -static WND *WIN_GetPtr( HWND hwnd ) -{ - WND *ptr = (void *)NtUserCallTwoParam( HandleToUlong(hwnd), NTUSER_OBJ_WINDOW, NtUserGetHandlePtr ); - if (ptr == WND_OTHER_PROCESS && is_desktop_window( hwnd )) ptr = WND_DESKTOP; - return ptr; -} - - -/*********************************************************************** - * WIN_ReleasePtr - */ -static void WIN_ReleasePtr( WND *ptr ) -{ - assert( ptr && ptr != OBJ_OTHER_PROCESS ); - NtUserCallOneParam( 1, NtUserLock ); -} - - /*********************************************************************** * WIN_IsCurrentProcess * @@ -193,141 +168,6 @@ ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ) }
-/*********************************************************************** - * WIN_GetRectangles - * - * Get the window and client rectangles. - */ -BOOL WIN_GetRectangles( HWND hwnd, enum coords_relative relative, RECT *rectWindow, RECT *rectClient ) -{ - WND *win = WIN_GetPtr( hwnd ); - BOOL ret = TRUE; - - if (!win) - { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); - return FALSE; - } - if (win == WND_DESKTOP) - { - RECT rect; - rect.left = rect.top = 0; - if (hwnd == get_hwnd_message_parent()) - { - rect.right = 100; - rect.bottom = 100; - rect = rect_win_to_thread_dpi( hwnd, rect ); - } - else - { - rect = get_primary_monitor_rect(); - } - if (rectWindow) *rectWindow = rect; - if (rectClient) *rectClient = rect; - return TRUE; - } - if (win != WND_OTHER_PROCESS) - { - RECT window_rect = win->window_rect, client_rect = win->client_rect; - - switch (relative) - { - case COORDS_CLIENT: - OffsetRect( &window_rect, -win->client_rect.left, -win->client_rect.top ); - OffsetRect( &client_rect, -win->client_rect.left, -win->client_rect.top ); - if (win->dwExStyle & WS_EX_LAYOUTRTL) - mirror_rect( &win->client_rect, &window_rect ); - break; - case COORDS_WINDOW: - OffsetRect( &window_rect, -win->window_rect.left, -win->window_rect.top ); - OffsetRect( &client_rect, -win->window_rect.left, -win->window_rect.top ); - if (win->dwExStyle & WS_EX_LAYOUTRTL) - mirror_rect( &win->window_rect, &client_rect ); - break; - case COORDS_PARENT: - if (win->parent) - { - WND *parent = WIN_GetPtr( win->parent ); - if (parent == WND_DESKTOP) break; - if (!parent || parent == WND_OTHER_PROCESS) - { - WIN_ReleasePtr( win ); - goto other_process; - } - if (parent->flags & WIN_CHILDREN_MOVED) - { - WIN_ReleasePtr( parent ); - WIN_ReleasePtr( win ); - goto other_process; - } - if (parent->dwExStyle & WS_EX_LAYOUTRTL) - { - mirror_rect( &parent->client_rect, &window_rect ); - mirror_rect( &parent->client_rect, &client_rect ); - } - WIN_ReleasePtr( parent ); - } - break; - case COORDS_SCREEN: - while (win->parent) - { - WND *parent = WIN_GetPtr( win->parent ); - if (parent == WND_DESKTOP) break; - if (!parent || parent == WND_OTHER_PROCESS) - { - WIN_ReleasePtr( win ); - goto other_process; - } - WIN_ReleasePtr( win ); - if (parent->flags & WIN_CHILDREN_MOVED) - { - WIN_ReleasePtr( parent ); - goto other_process; - } - win = parent; - if (win->parent) - { - OffsetRect( &window_rect, win->client_rect.left, win->client_rect.top ); - OffsetRect( &client_rect, win->client_rect.left, win->client_rect.top ); - } - } - break; - } - if (rectWindow) *rectWindow = rect_win_to_thread_dpi( hwnd, window_rect ); - if (rectClient) *rectClient = rect_win_to_thread_dpi( hwnd, client_rect ); - WIN_ReleasePtr( win ); - return TRUE; - } - -other_process: - SERVER_START_REQ( get_window_rectangles ) - { - req->handle = wine_server_user_handle( hwnd ); - req->relative = relative; - req->dpi = get_thread_dpi(); - if ((ret = !wine_server_call_err( req ))) - { - if (rectWindow) - { - rectWindow->left = reply->window.left; - rectWindow->top = reply->window.top; - rectWindow->right = reply->window.right; - rectWindow->bottom = reply->window.bottom; - } - if (rectClient) - { - rectClient->left = reply->client.left; - rectClient->top = reply->client.top; - rectClient->right = reply->client.right; - rectClient->bottom = reply->client.bottom; - } - } - } - SERVER_END_REQ; - return ret; -} - - /*********************************************************************** * dump_window_styles */ diff --git a/dlls/user32/win.h b/dlls/user32/win.h index 5b744ade004..5107a606414 100644 --- a/dlls/user32/win.h +++ b/dlls/user32/win.h @@ -30,9 +30,6 @@ #include "user_private.h" #include "wine/server_protocol.h"
-struct tagCLASS; -struct tagDIALOGINFO; - /* Window functions */ extern HWND get_hwnd_message_parent(void) DECLSPEC_HIDDEN; extern BOOL is_desktop_window( HWND hwnd ) DECLSPEC_HIDDEN; @@ -40,7 +37,6 @@ extern HWND WIN_GetFullHandle( HWND hwnd ) DECLSPEC_HIDDEN; extern HWND WIN_IsCurrentProcess( HWND hwnd ) DECLSPEC_HIDDEN; extern HWND WIN_IsCurrentThread( HWND hwnd ) DECLSPEC_HIDDEN; extern ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ) DECLSPEC_HIDDEN; -extern BOOL WIN_GetRectangles( HWND hwnd, enum coords_relative relative, RECT *rectWindow, RECT *rectClient ) DECLSPEC_HIDDEN; extern HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, BOOL unicode ) DECLSPEC_HIDDEN; extern HWND *WIN_ListChildren( HWND hwnd ) DECLSPEC_HIDDEN; extern void MDI_CalcDefaultChildPos( HWND hwndClient, INT total, LPPOINT lpPos, INT delta, UINT *id ) DECLSPEC_HIDDEN; diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 0a453f937c3..8bcf3e57624 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -5080,9 +5080,6 @@ ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code case NtUserAllocWinProc: return (UINT_PTR)alloc_winproc( (WNDPROC)arg1, arg2 );
- case NtUserGetHandlePtr: - return (UINT_PTR)get_user_handle_ptr( UlongToHandle(arg1), arg2 ); - default: FIXME( "invalid code %u\n", code ); return 0; diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index ef8d3dea19e..61de6ad1c33 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -5473,6 +5473,9 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code ) case NtUserCallHwndParam_EnableWindow: return enable_window( hwnd, param );
+ case NtUserCallHwndParam_GetChildRect: + return get_window_rects( hwnd, COORDS_PARENT, (RECT *)param, NULL, get_thread_dpi() ); + case NtUserCallHwndParam_GetClassLongA: return get_class_long( hwnd, param, TRUE );
diff --git a/include/ntuser.h b/include/ntuser.h index 882bd4fad30..8811a9e7993 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -1047,7 +1047,6 @@ enum NtUserCallTwoParam_UnhookWindowsHook, /* temporary exports */ NtUserAllocWinProc, - NtUserGetHandlePtr, };
static inline BOOL NtUserGetMenuInfo( HMENU menu, MENUINFO *info ) @@ -1210,6 +1209,7 @@ enum { NtUserCallHwndParam_ClientToScreen, NtUserCallHwndParam_EnableWindow, + NtUserCallHwndParam_GetChildRect, NtUserCallHwndParam_GetClassLongA, NtUserCallHwndParam_GetClassLongW, NtUserCallHwndParam_GetClassLongPtrA, @@ -1253,6 +1253,11 @@ static inline BOOL NtUserEnableWindow( HWND hwnd, BOOL enable ) return NtUserCallHwndParam( hwnd, enable, NtUserCallHwndParam_EnableWindow ); }
+static inline BOOL NtUserGetChildRect( HWND hwnd, RECT *rect ) +{ + return NtUserCallHwndParam( hwnd, (UINT_PTR)rect, NtUserCallHwndParam_GetChildRect ); +} + static inline DWORD NtUserGetClassLongA( HWND hwnd, INT offset ) { return NtUserCallHwndParam( hwnd, offset, NtUserCallHwndParam_GetClassLongA );
From: Jacek Caban jacek@codeweavers.com
It's no longer interesting. Its remaining callers are not used by locked code, which is restricted to win32u. --- dlls/user32/user_main.c | 10 ---------- dlls/user32/user_private.h | 1 - dlls/user32/win.c | 8 -------- dlls/user32/winproc.c | 2 -- dlls/win32u/sysparams.c | 8 -------- include/ntuser.h | 1 - 6 files changed, 30 deletions(-)
diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index 91f2891f198..acbd93cccdd 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -41,16 +41,6 @@ HMODULE user32_module = 0;
extern void WDML_NotifyThreadDetach(void);
-/*********************************************************************** - * USER_CheckNotLock - * - * Make sure that we don't hold the user lock. - */ -void USER_CheckNotLock(void) -{ - NtUserCallOneParam( 2, NtUserLock ); -} -
/*********************************************************************** * UserRealizePalette (USER32.@) diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 8e3388c6fd5..4abb0080a0f 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -73,7 +73,6 @@ extern BOOL map_wparam_AtoW( UINT message, WPARAM *wparam, enum wm_char_mapping extern HPEN SYSCOLOR_GetPen( INT index ) DECLSPEC_HIDDEN; extern HBRUSH SYSCOLOR_Get55AABrush(void) DECLSPEC_HIDDEN; extern void SYSPARAMS_Init(void) DECLSPEC_HIDDEN; -extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN;
typedef LRESULT (*winproc_callback_t)( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, LRESULT *result, void *arg ); diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 93ac7f7b7c5..8ba4b6ea69e 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -1034,8 +1034,6 @@ BOOL WINAPI EnumWindows( WNDENUMPROC lpEnumFunc, LPARAM lParam ) BOOL ret = TRUE; int i;
- USER_CheckNotLock(); - /* We have to build a list of all windows first, to avoid */ /* unpleasant side-effects, for instance if the callback */ /* function changes the Z-order of the windows. */ @@ -1064,8 +1062,6 @@ BOOL WINAPI EnumThreadWindows( DWORD id, WNDENUMPROC func, LPARAM lParam ) int i; BOOL ret = TRUE;
- USER_CheckNotLock(); - if (!(list = list_window_children( 0, GetDesktopWindow(), NULL, id ))) return TRUE;
/* Now call the callback function for every window */ @@ -1085,8 +1081,6 @@ BOOL WINAPI EnumDesktopWindows( HDESK desktop, WNDENUMPROC func, LPARAM lparam ) HWND *list; int i;
- USER_CheckNotLock(); - if (!(list = list_window_children( desktop, 0, NULL, 0 ))) return TRUE;
for (i = 0; list[i]; i++) @@ -1159,8 +1153,6 @@ BOOL WINAPI EnumChildWindows( HWND parent, WNDENUMPROC func, LPARAM lParam ) HWND *list; BOOL ret;
- USER_CheckNotLock(); - if (!(list = WIN_ListChildren( parent ))) return FALSE; ret = WIN_EnumChildWindows( list, func, lParam ); HeapFree( GetProcessHeap(), 0, list ); diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index 3b7927891b5..cc59a290ca5 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -147,8 +147,6 @@ static LRESULT call_dialog_proc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, LRES WNDPROC proc = arg; LRESULT ret;
- USER_CheckNotLock(); - hwnd = WIN_GetFullHandle( hwnd ); TRACE_(relay)( "\1Call dialog proc %p (hwnd=%p,msg=%s,wp=%08Ix,lp=%08Ix)\n", proc, hwnd, SPY_GetMsgName(msg, hwnd), wp, lp ); diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 8bcf3e57624..3a77ec47769 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -5031,14 +5031,6 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code ) case NtUserGetDeskPattern: return get_entry( &entry_DESKPATTERN, 256, (WCHAR *)arg );
- case NtUserLock: - switch( arg ) - { - case 0: user_lock(); return 0; - case 1: user_unlock(); return 0; - default: user_check_not_lock(); return 0; - } - default: FIXME( "invalid code %u\n", code ); return 0; diff --git a/include/ntuser.h b/include/ntuser.h index 8811a9e7993..eb1b860b5c4 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -922,7 +922,6 @@ enum NtUserCallOneParam_SetProcessDefaultLayout, /* temporary exports */ NtUserGetDeskPattern, - NtUserLock, };
static inline HDWP NtUserBeginDeferWindowPos( INT count )
This merge request was approved by Huw Davies.