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 );