win32u: Move NtUserGetWindowRgnEx implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-03-10 14:31:20 +01:00 committed by Alexandre Julliard
parent 56accc2532
commit 929052a9c6
7 changed files with 63 additions and 44 deletions

View file

@ -97,50 +97,9 @@ BOOL WINAPI GetWindowRect( HWND hwnd, LPRECT rect )
/***********************************************************************
* GetWindowRgn (USER32.@)
*/
int WINAPI GetWindowRgn ( HWND hwnd, HRGN hrgn )
int WINAPI GetWindowRgn( HWND hwnd, HRGN hrgn )
{
int nRet = ERROR;
NTSTATUS status;
HRGN win_rgn = 0;
RGNDATA *data;
size_t size = 256;
do
{
if (!(data = HeapAlloc( GetProcessHeap(), 0, sizeof(*data) + size - 1 )))
{
SetLastError( ERROR_OUTOFMEMORY );
return ERROR;
}
SERVER_START_REQ( get_window_region )
{
req->window = wine_server_user_handle( hwnd );
wine_server_set_reply( req, data->Buffer, size );
if (!(status = wine_server_call( req )))
{
size_t reply_size = wine_server_reply_size( reply );
if (reply_size)
{
data->rdh.dwSize = sizeof(data->rdh);
data->rdh.iType = RDH_RECTANGLES;
data->rdh.nCount = reply_size / sizeof(RECT);
data->rdh.nRgnSize = reply_size;
win_rgn = ExtCreateRegion( NULL, data->rdh.dwSize + data->rdh.nRgnSize, data );
}
}
else size = reply->total_size;
}
SERVER_END_REQ;
HeapFree( GetProcessHeap(), 0, data );
} while (status == STATUS_BUFFER_OVERFLOW);
if (status) SetLastError( RtlNtStatusToDosError(status) );
else if (win_rgn)
{
nRet = CombineRgn( hrgn, win_rgn, 0, RGN_COPY );
DeleteObject( win_rgn );
}
return nRet;
return NtUserGetWindowRgnEx( hwnd, hrgn, 0 );
}
/***********************************************************************

View file

@ -139,6 +139,7 @@ static void * const syscalls[] =
NtUserGetProp,
NtUserGetSystemDpiForProcess,
NtUserGetThreadDesktop,
NtUserGetWindowRgnEx,
NtUserInitializeClientPfnArrays,
NtUserInternalGetWindowText,
NtUserNotifyWinEvent,

View file

@ -1016,7 +1016,7 @@
@ stub NtUserGetWindowMinimizeRect
@ stub NtUserGetWindowPlacement
@ stub NtUserGetWindowProcessHandle
@ stub NtUserGetWindowRgnEx
@ stdcall -syscall NtUserGetWindowRgnEx(long long long)
@ stub NtUserGhostWindowFromHungWindow
@ stub NtUserHandleDelegatedInput
@ stub NtUserHardErrorControl

View file

@ -1163,6 +1163,54 @@ static BOOL get_window_info( HWND hwnd, WINDOWINFO *info )
return TRUE;
}
/*******************************************************************
* NtUserGetWindowRgnEx (win32u.@)
*/
int WINAPI NtUserGetWindowRgnEx( HWND hwnd, HRGN hrgn, UINT unk )
{
NTSTATUS status;
HRGN win_rgn = 0;
RGNDATA *data;
size_t size = 256;
int ret = ERROR;
do
{
if (!(data = malloc( sizeof(*data) + size - 1 )))
{
SetLastError( ERROR_OUTOFMEMORY );
return ERROR;
}
SERVER_START_REQ( get_window_region )
{
req->window = wine_server_user_handle( hwnd );
wine_server_set_reply( req, data->Buffer, size );
if (!(status = wine_server_call( req )))
{
size_t reply_size = wine_server_reply_size( reply );
if (reply_size)
{
data->rdh.dwSize = sizeof(data->rdh);
data->rdh.iType = RDH_RECTANGLES;
data->rdh.nCount = reply_size / sizeof(RECT);
data->rdh.nRgnSize = reply_size;
win_rgn = NtGdiExtCreateRegion( NULL, data->rdh.dwSize + data->rdh.nRgnSize, data );
}
}
else size = reply->total_size;
}
SERVER_END_REQ;
free( data );
} while (status == STATUS_BUFFER_OVERFLOW);
if (set_ntstatus( status ) && win_rgn)
{
ret = NtGdiCombineRgn( hrgn, win_rgn, 0, RGN_COPY );
NtGdiDeleteObjectApp( win_rgn );
}
return ret;
}
/*****************************************************************************
* NtUserGetLayeredWindowAttributes (win32u.@)
*/

View file

@ -124,6 +124,7 @@
SYSCALL_ENTRY( NtUserGetProp ) \
SYSCALL_ENTRY( NtUserGetSystemDpiForProcess ) \
SYSCALL_ENTRY( NtUserGetThreadDesktop ) \
SYSCALL_ENTRY( NtUserGetWindowRgnEx ) \
SYSCALL_ENTRY( NtUserInitializeClientPfnArrays ) \
SYSCALL_ENTRY( NtUserInternalGetWindowText ) \
SYSCALL_ENTRY( NtUserNotifyWinEvent ) \

View file

@ -197,6 +197,15 @@ NTSTATUS WINAPI wow64_NtUserGetAncestor( UINT *args )
return HandleToUlong( NtUserGetAncestor( hwnd, type ));
}
NTSTATUS WINAPI wow64_NtUserGetWindowRgnEx( UINT *args )
{
HWND hwnd = get_handle( &args );
HRGN hrgn = get_handle( &args );
UINT unk = get_ulong( &args );
return NtUserGetWindowRgnEx( hwnd, hrgn, unk );
}
NTSTATUS WINAPI wow64_NtUserBuildHwndList( UINT *args )
{
HDESK desktop = get_handle( &args );

View file

@ -333,6 +333,7 @@ DWORD WINAPI NtUserGetQueueStatus( UINT flags );
ULONG WINAPI NtUserGetSystemDpiForProcess( HANDLE process );
HDESK WINAPI NtUserGetThreadDesktop( DWORD thread );
BOOL WINAPI NtUserGetUpdatedClipboardFormats( UINT *formats, UINT size, UINT *out_size );
int WINAPI NtUserGetWindowRgnEx( HWND hwnd, HRGN hrgn, UINT unk );
NTSTATUS WINAPI NtUserInitializeClientPfnArrays( const struct user_client_procs *client_procsA,
const struct user_client_procs *client_procsW,
const void *client_workers, HINSTANCE user_module );