diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index 2b980cefbe2..0449d087741 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -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, diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index 8516c913707..54593fcd3a3 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -34,6 +34,10 @@ static void * const syscalls[] = { + NtGdiCreateDIBBrush, + NtGdiCreateHatchBrushInternal, + NtGdiCreatePatternBrushInternal, + NtGdiCreateSolidBrush, NtGdiFlush, }; diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index de44ccd40c1..19dbe44fecb 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -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 diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index eb2e856a887..4466d5e9f77 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -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 ); diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index 63748449587..3ba39ea8596 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -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 ); diff --git a/dlls/wow64win/Makefile.in b/dlls/wow64win/Makefile.in index 7bfb0d43ea5..9445182af5c 100644 --- a/dlls/wow64win/Makefile.in +++ b/dlls/wow64win/Makefile.in @@ -4,4 +4,5 @@ IMPORTS = win32u ntdll winecrt0 EXTRADLLFLAGS = -nodefaultlibs -Wl,--image-base,0x6f200000 C_SRCS = \ + gdi.c \ syscall.c diff --git a/dlls/wow64win/gdi.c b/dlls/wow64win/gdi.c new file mode 100644 index 00000000000..dbaefb48a22 --- /dev/null +++ b/dlls/wow64win/gdi.c @@ -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 + +#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(); +} diff --git a/dlls/wow64win/syscall.c b/dlls/wow64win/syscall.c index 1d4918a6025..0be70421b74 100644 --- a/dlls/wow64win/syscall.c +++ b/dlls/wow64win/syscall.c @@ -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, diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index 3e4cc0def33..350c4020822 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -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 */ diff --git a/dlls/wow64win/wow64win_private.h b/dlls/wow64win/wow64win_private.h index 466dfe5f6e0..162c6e1cf23 100644 --- a/dlls/wow64win/wow64win_private.h +++ b/dlls/wow64win/wow64win_private.h @@ -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 */