Commit 929052a9 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserGetWindowRgnEx implementation from user32.

parent 56accc25
......@@ -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 );
}
/***********************************************************************
......
......@@ -139,6 +139,7 @@ static void * const syscalls[] =
NtUserGetProp,
NtUserGetSystemDpiForProcess,
NtUserGetThreadDesktop,
NtUserGetWindowRgnEx,
NtUserInitializeClientPfnArrays,
NtUserInternalGetWindowText,
NtUserNotifyWinEvent,
......
......@@ -1016,7 +1016,7 @@
@ stub NtUserGetWindowMinimizeRect
@ stub NtUserGetWindowPlacement
@ stub NtUserGetWindowProcessHandle
@ stub NtUserGetWindowRgnEx
@ stdcall -syscall NtUserGetWindowRgnEx(long long long)
@ stub NtUserGhostWindowFromHungWindow
@ stub NtUserHandleDelegatedInput
@ stub NtUserHardErrorControl
......
......@@ -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.@)
*/
......
......@@ -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 ) \
......
......@@ -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 );
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment