win32u: Use syscall interface for brush functions.

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 2021-10-08 13:35:41 +02:00 committed by Alexandre Julliard
parent 2cc52c6e45
commit 33dddc84cf
10 changed files with 88 additions and 41 deletions

View File

@ -1081,19 +1081,15 @@ static struct unix_funcs unix_funcs =
NtGdiCreateClientObj,
NtGdiCreateCompatibleBitmap,
NtGdiCreateCompatibleDC,
NtGdiCreateDIBBrush,
NtGdiCreateDIBSection,
NtGdiCreateDIBitmapInternal,
NtGdiCreateEllipticRgn,
NtGdiCreateHalftonePalette,
NtGdiCreateHatchBrushInternal,
NtGdiCreateMetafileDC,
NtGdiCreatePaletteInternal,
NtGdiCreatePatternBrushInternal,
NtGdiCreatePen,
NtGdiCreateRectRgn,
NtGdiCreateRoundRectRgn,
NtGdiCreateSolidBrush,
NtGdiDdDDICheckVidPnExclusiveOwnership,
NtGdiDdDDICloseAdapter,
NtGdiDdDDICreateDCFromMemory,

View File

@ -34,6 +34,10 @@
static void * const syscalls[] =
{
NtGdiCreateDIBBrush,
NtGdiCreateHatchBrushInternal,
NtGdiCreatePatternBrushInternal,
NtGdiCreateSolidBrush,
NtGdiFlush,
};

View File

@ -147,23 +147,23 @@
@ stub NtGdiCreateColorTransform
@ stdcall NtGdiCreateCompatibleBitmap(long long long)
@ stdcall NtGdiCreateCompatibleDC(long)
@ stdcall NtGdiCreateDIBBrush(ptr long long long long ptr)
@ stdcall -syscall NtGdiCreateDIBBrush(ptr long long long long ptr)
@ stdcall NtGdiCreateDIBSection(long long long ptr long long long long ptr)
@ stdcall NtGdiCreateDIBitmapInternal(long long long long ptr ptr long long long long long)
@ stdcall NtGdiCreateEllipticRgn(long long long long)
@ stdcall NtGdiCreateHalftonePalette(long)
@ stdcall NtGdiCreateHatchBrushInternal(long long long)
@ stdcall -syscall NtGdiCreateHatchBrushInternal(long long long)
@ stdcall NtGdiCreateMetafileDC(long)
@ stub NtGdiCreateOPMProtectedOutput
@ stub NtGdiCreateOPMProtectedOutputs
@ stdcall NtGdiCreatePaletteInternal(ptr long)
@ stdcall NtGdiCreatePatternBrushInternal(long long long)
@ stdcall -syscall NtGdiCreatePatternBrushInternal(long long long)
@ stdcall NtGdiCreatePen(long long long long)
@ stdcall NtGdiCreateRectRgn(long long long long)
@ stdcall NtGdiCreateRoundRectRgn(long long long long long long)
@ stub NtGdiCreateServerMetaFile
@ stub NtGdiCreateSessionMappedDIBSection
@ stdcall NtGdiCreateSolidBrush(long long)
@ stdcall -syscall NtGdiCreateSolidBrush(long long)
@ stub NtGdiDDCCIGetCapabilitiesString
@ stub NtGdiDDCCIGetCapabilitiesStringLength
@ stub NtGdiDDCCIGetTimingReport

View File

@ -66,8 +66,6 @@ struct unix_funcs
HANDLE (WINAPI *pNtGdiCreateClientObj)( ULONG type );
HBITMAP (WINAPI *pNtGdiCreateCompatibleBitmap)( HDC hdc, INT width, INT height );
HDC (WINAPI *pNtGdiCreateCompatibleDC)( HDC hdc );
HBRUSH (WINAPI *pNtGdiCreateDIBBrush)( const void *data, UINT coloruse, UINT size,
BOOL is_8x8, BOOL pen, const void *client );
HBITMAP (WINAPI *pNtGdiCreateDIBSection)( HDC hdc, HANDLE section, DWORD offset, const BITMAPINFO *bmi,
UINT usage, UINT header_size, ULONG flags,
ULONG_PTR color_space, void **bits );
@ -77,15 +75,12 @@ struct unix_funcs
ULONG flags, HANDLE xform );
HRGN (WINAPI *pNtGdiCreateEllipticRgn)( INT left, INT top, INT right, INT bottom );
HPALETTE (WINAPI *pNtGdiCreateHalftonePalette)( HDC hdc );
HBRUSH (WINAPI *pNtGdiCreateHatchBrushInternal)( INT style, COLORREF color, BOOL pen );
HDC (WINAPI *pNtGdiCreateMetafileDC)( HDC hdc );
HPALETTE (WINAPI *pNtGdiCreatePaletteInternal)( const LOGPALETTE *palette, UINT count );
HBRUSH (WINAPI *pNtGdiCreatePatternBrushInternal)( HBITMAP hbitmap, BOOL pen, BOOL is_8x8 );
HPEN (WINAPI *pNtGdiCreatePen)( INT style, INT width, COLORREF color, HBRUSH brush );
HRGN (WINAPI *pNtGdiCreateRectRgn)( INT left, INT top, INT right, INT bottom );
HRGN (WINAPI *pNtGdiCreateRoundRectRgn)( INT left, INT top, INT right, INT bottom,
INT ellipse_width, INT ellipse_height );
HBRUSH (WINAPI *pNtGdiCreateSolidBrush)( COLORREF color, HBRUSH brush );
NTSTATUS (WINAPI *pNtGdiDdDDICheckVidPnExclusiveOwnership)( const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *desc );
NTSTATUS (WINAPI *pNtGdiDdDDICloseAdapter)( const D3DKMT_CLOSEADAPTER *desc );
NTSTATUS (WINAPI *pNtGdiDdDDICreateDCFromMemory)( D3DKMT_CREATEDCFROMMEMORY *desc );

View File

@ -118,12 +118,6 @@ HDC WINAPI NtGdiCreateCompatibleDC( HDC hdc )
return unix_funcs->pNtGdiCreateCompatibleDC( hdc );
}
HBRUSH WINAPI NtGdiCreateDIBBrush( const void *data, UINT coloruse, UINT size,
BOOL is_8x8, BOOL pen, const void *client )
{
return unix_funcs->pNtGdiCreateDIBBrush( data, coloruse, size, is_8x8, pen, client );
}
HBITMAP WINAPI NtGdiCreateDIBSection( HDC hdc, HANDLE section, DWORD offset, const BITMAPINFO *bmi,
UINT usage, UINT header_size, ULONG flags,
ULONG_PTR color_space, void **bits )
@ -151,11 +145,6 @@ HPALETTE WINAPI NtGdiCreateHalftonePalette( HDC hdc )
return unix_funcs->pNtGdiCreateHalftonePalette( hdc );
}
HBRUSH WINAPI NtGdiCreateHatchBrushInternal( INT style, COLORREF color, BOOL pen )
{
return unix_funcs->pNtGdiCreateHatchBrushInternal( style, color, pen );
}
HDC WINAPI NtGdiCreateMetafileDC( HDC hdc )
{
return unix_funcs->pNtGdiCreateMetafileDC( hdc );
@ -166,11 +155,6 @@ HPALETTE WINAPI NtGdiCreatePaletteInternal( const LOGPALETTE *palette, UINT coun
return unix_funcs->pNtGdiCreatePaletteInternal( palette, count );
}
HBRUSH WINAPI NtGdiCreatePatternBrushInternal( HBITMAP hbitmap, BOOL pen, BOOL is_8x8 )
{
return unix_funcs->pNtGdiCreatePatternBrushInternal( hbitmap, pen, is_8x8 );
}
HPEN WINAPI NtGdiCreatePen( INT style, INT width, COLORREF color, HBRUSH brush )
{
return unix_funcs->pNtGdiCreatePen( style, width, color, brush );
@ -187,11 +171,6 @@ HRGN WINAPI NtGdiCreateRoundRectRgn( INT left, INT top, INT right, INT bottom,
return unix_funcs->pNtGdiCreateRoundRectRgn( left, top, right, bottom, ellipse_width, ellipse_height );
}
HBRUSH WINAPI NtGdiCreateSolidBrush( COLORREF color, HBRUSH brush )
{
return unix_funcs->pNtGdiCreateSolidBrush( color, brush );
}
BOOL WINAPI NtGdiDeleteClientObj( HGDIOBJ obj )
{
return unix_funcs->pNtGdiDeleteClientObj( obj );

View File

@ -4,4 +4,5 @@ IMPORTS = win32u ntdll winecrt0
EXTRADLLFLAGS = -nodefaultlibs -Wl,--image-base,0x6f200000
C_SRCS = \
gdi.c \
syscall.c

71
dlls/wow64win/gdi.c Normal file
View File

@ -0,0 +1,71 @@
/*
* WoW64 GDI functions
*
* Copyright 2021 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
#include "ntgdi.h"
#include "wow64win_private.h"
NTSTATUS WINAPI wow64_NtGdiCreateDIBBrush( UINT *args )
{
const void *data = get_ptr( &args );
UINT coloruse = get_ulong( &args );
UINT size = get_ulong( &args );
BOOL is_8x8 = get_ulong( &args );
BOOL pen = get_ulong( &args );
const void *client = get_ptr( &args );
return HandleToUlong( NtGdiCreateDIBBrush( data, coloruse, size, is_8x8, pen, client ));
}
NTSTATUS WINAPI wow64_NtGdiCreateHatchBrushInternal( UINT *args )
{
INT style = get_ulong( &args );
COLORREF color = get_ulong( &args );
BOOL pen = get_ulong( &args );
return HandleToULong( NtGdiCreateHatchBrushInternal( style, color, pen ));
}
NTSTATUS WINAPI wow64_NtGdiCreatePatternBrushInternal( UINT *args )
{
HBITMAP hbitmap = get_handle( &args );
BOOL pen = get_ulong( &args );
BOOL is_8x8 = get_ulong( &args );
return HandleToUlong( NtGdiCreatePatternBrushInternal( hbitmap, pen, is_8x8 ));
}
NTSTATUS WINAPI wow64_NtGdiCreateSolidBrush( UINT *args )
{
COLORREF color = get_ulong( &args );
HBRUSH brush = get_handle( &args );
return HandleToUlong( NtGdiCreateSolidBrush( color, brush ));
}
NTSTATUS WINAPI wow64_NtGdiFlush( UINT *args )
{
return NtGdiFlush();
}

View File

@ -28,13 +28,6 @@
#include "winternl.h"
#include "wow64win_private.h"
extern BOOL WINAPI NtGdiFlush(void);
NTSTATUS WINAPI wow64_NtGdiFlush( UINT *args )
{
return NtGdiFlush();
}
static void * const win32_syscalls[] =
{
#define SYSCALL_ENTRY(func) wow64_ ## func,

View File

@ -22,6 +22,10 @@
#define __WOW64WIN_SYSCALL_H
#define ALL_WIN32_SYSCALLS \
SYSCALL_ENTRY( NtGdiCreateDIBBrush ) \
SYSCALL_ENTRY( NtGdiCreateHatchBrushInternal ) \
SYSCALL_ENTRY( NtGdiCreatePatternBrushInternal ) \
SYSCALL_ENTRY( NtGdiCreateSolidBrush ) \
SYSCALL_ENTRY( NtGdiFlush )
#endif /* __WOW64WIN_SYSCALL_H */

View File

@ -27,4 +27,8 @@
ALL_WIN32_SYSCALLS
#undef SYSCALL_ENTRY
static inline ULONG get_ulong( UINT **args ) { return *(*args)++; }
static inline HANDLE get_handle( UINT **args ) { return LongToHandle( *(*args)++ ); }
static inline void *get_ptr( UINT **args ) { return ULongToPtr( *(*args)++ ); }
#endif /* __WOW64WIN_PRIVATE_H */