From fe96d12a89b8d43ab1d8dd3bd5432695ecc2869d Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 11 Oct 2021 18:51:06 +0200 Subject: [PATCH] win32u: Use syscall interface for some palette functions. Signed-off-by: Jacek Caban Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/win32u/gdiobj.c | 5 ----- dlls/win32u/syscall.c | 5 +++++ dlls/win32u/win32u.spec | 10 +++++----- dlls/win32u/win32u_private.h | 5 ----- dlls/win32u/wrappers.c | 25 ------------------------- dlls/wow64win/gdi.c | 39 +++++++++++++++++++++++++++++++++++++++ dlls/wow64win/syscall.h | 5 +++++ 7 files changed, 54 insertions(+), 40 deletions(-) diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index 0c355f4d94c..4a6af99c94a 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -1077,9 +1077,7 @@ static struct unix_funcs unix_funcs = NtGdiCreateCompatibleBitmap, NtGdiCreateCompatibleDC, NtGdiCreateDIBitmapInternal, - NtGdiCreateHalftonePalette, NtGdiCreateMetafileDC, - NtGdiCreatePaletteInternal, NtGdiCreatePen, NtGdiDdDDICheckVidPnExclusiveOwnership, NtGdiDdDDICloseAdapter, @@ -1127,7 +1125,6 @@ static struct unix_funcs unix_funcs = NtGdiGetGlyphOutline, NtGdiGetKerningPairs, NtGdiGetNearestColor, - NtGdiGetNearestPaletteIndex, NtGdiGetOutlineTextMetricsInternalW, NtGdiGetPath, NtGdiGetPixel, @@ -1135,7 +1132,6 @@ static struct unix_funcs unix_funcs = NtGdiGetRasterizerCaps, NtGdiGetRealizationInfo, NtGdiGetSpoolMessage, - NtGdiGetSystemPaletteUse, NtGdiGetTextCharsetInfo, NtGdiGetTextExtentExW, NtGdiGetTextFaceW, @@ -1173,7 +1169,6 @@ static struct unix_funcs unix_funcs = NtGdiSetDIBitsToDeviceInternal, NtGdiSetDeviceGammaRamp, NtGdiSetLayout, - NtGdiSetMagicColors, NtGdiSetPixel, NtGdiSetSystemPaletteUse, NtGdiStartDoc, diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index 984e7b13e7a..99db48f27ec 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -42,7 +42,9 @@ static void * const syscalls[] = NtGdiCreateDIBBrush, NtGdiCreateDIBSection, NtGdiCreateEllipticRgn, + NtGdiCreateHalftonePalette, NtGdiCreateHatchBrushInternal, + NtGdiCreatePaletteInternal, NtGdiCreatePatternBrushInternal, NtGdiCreateRectRgn, NtGdiCreateRoundRectRgn, @@ -60,8 +62,10 @@ static void * const syscalls[] = NtGdiGetDCObject, NtGdiGetFontFileData, NtGdiGetFontFileInfo, + NtGdiGetNearestPaletteIndex, NtGdiGetRegionData, NtGdiGetRgnBox, + NtGdiGetSystemPaletteUse, NtGdiGetTransform, NtGdiHfontCreate, NtGdiOffsetRgn, @@ -74,6 +78,7 @@ static void * const syscalls[] = NtGdiSetBitmapDimension, NtGdiSetBrushOrg, NtGdiSetColorAdjustment, + NtGdiSetMagicColors, NtGdiSetMetaRgn, NtGdiSetPixelFormat, NtGdiSetRectRgn, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 8874894d4e7..8bd29d33f8b 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -151,12 +151,12 @@ @ stdcall -syscall NtGdiCreateDIBSection(long long long ptr long long long long ptr) @ stdcall NtGdiCreateDIBitmapInternal(long long long long ptr ptr long long long long long) @ stdcall -syscall NtGdiCreateEllipticRgn(long long long long) -@ stdcall NtGdiCreateHalftonePalette(long) +@ stdcall -syscall NtGdiCreateHalftonePalette(long) @ stdcall -syscall NtGdiCreateHatchBrushInternal(long long long) @ stdcall NtGdiCreateMetafileDC(long) @ stub NtGdiCreateOPMProtectedOutput @ stub NtGdiCreateOPMProtectedOutputs -@ stdcall NtGdiCreatePaletteInternal(ptr long) +@ stdcall -syscall NtGdiCreatePaletteInternal(ptr long) @ stdcall -syscall NtGdiCreatePatternBrushInternal(long long long) @ stdcall NtGdiCreatePen(long long long long) @ stdcall -syscall NtGdiCreateRectRgn(long long long long) @@ -491,7 +491,7 @@ @ stub NtGdiGetMiterLimit @ stub NtGdiGetMonitorID @ stdcall NtGdiGetNearestColor(long long) -@ stdcall NtGdiGetNearestPaletteIndex(long long) +@ stdcall -syscall NtGdiGetNearestPaletteIndex(long long) @ stub NtGdiGetNumberOfPhysicalMonitors @ stub NtGdiGetOPMInformation @ stub NtGdiGetOPMRandomNumber @@ -514,7 +514,7 @@ @ stub NtGdiGetStats @ stub NtGdiGetStringBitmapW @ stub NtGdiGetSuggestedOPMProtectedOutputArraySize -@ stdcall NtGdiGetSystemPaletteUse(long) +@ stdcall -syscall NtGdiGetSystemPaletteUse(long) @ stdcall NtGdiGetTextCharsetInfo(long ptr long) @ stub NtGdiGetTextExtent @ stdcall NtGdiGetTextExtentExW(long wstr long long ptr ptr ptr long) @@ -604,7 +604,7 @@ @ stub NtGdiSetIcmMode @ stdcall NtGdiSetLayout(long long long) @ stub NtGdiSetLinkedUFIs -@ stdcall NtGdiSetMagicColors(long long long) +@ stdcall -syscall NtGdiSetMagicColors(long long long) @ stdcall -syscall NtGdiSetMetaRgn(long) @ stub NtGdiSetMiterLimit @ stub NtGdiSetOPMSigningKeyAndSequenceNumbers diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index ff956dbf167..1cf7c66b1b0 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -62,9 +62,7 @@ struct unix_funcs const void *bits, const BITMAPINFO *data, UINT coloruse, UINT max_info, UINT max_bits, ULONG flags, HANDLE xform ); - HPALETTE (WINAPI *pNtGdiCreateHalftonePalette)( HDC hdc ); HDC (WINAPI *pNtGdiCreateMetafileDC)( HDC hdc ); - HPALETTE (WINAPI *pNtGdiCreatePaletteInternal)( const LOGPALETTE *palette, UINT count ); HPEN (WINAPI *pNtGdiCreatePen)( INT style, INT width, COLORREF color, HBRUSH brush ); NTSTATUS (WINAPI *pNtGdiDdDDICheckVidPnExclusiveOwnership)( const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *desc ); NTSTATUS (WINAPI *pNtGdiDdDDICloseAdapter)( const D3DKMT_CLOSEADAPTER *desc ); @@ -126,7 +124,6 @@ struct unix_funcs BOOL ignore_rotation ); DWORD (WINAPI *pNtGdiGetKerningPairs)( HDC hdc, DWORD count, KERNINGPAIR *kern_pair ); COLORREF (WINAPI *pNtGdiGetNearestColor)( HDC hdc, COLORREF color ); - UINT (WINAPI *pNtGdiGetNearestPaletteIndex)( HPALETTE hpalette, COLORREF color ); UINT (WINAPI *pNtGdiGetOutlineTextMetricsInternalW)( HDC hdc, UINT cbData, OUTLINETEXTMETRICW *otm, ULONG opts ); INT (WINAPI *pNtGdiGetPath)( HDC hdc, POINT *points, BYTE *types, INT size ); @@ -135,7 +132,6 @@ struct unix_funcs BOOL (WINAPI *pNtGdiGetRasterizerCaps)( RASTERIZER_STATUS *status, UINT size ); BOOL (WINAPI *pNtGdiGetRealizationInfo)( HDC hdc, struct font_realization_info *info ); DWORD (WINAPI *pNtGdiGetSpoolMessage)( void *ptr1, DWORD data2, void *ptr3, DWORD data4 ); - UINT (WINAPI *pNtGdiGetSystemPaletteUse)( HDC hdc ); UINT (WINAPI *pNtGdiGetTextCharsetInfo)( HDC hdc, FONTSIGNATURE *fs, DWORD flags ); BOOL (WINAPI *pNtGdiGetTextExtentExW)( HDC hdc, const WCHAR *str, INT count, INT max_ext, INT *nfit, INT *dxs, SIZE *size, UINT flags ); @@ -190,7 +186,6 @@ struct unix_funcs BOOL xform_coords, HANDLE xform ); BOOL (WINAPI *pNtGdiSetDeviceGammaRamp)( HDC hdc, void *ptr ); DWORD (WINAPI *pNtGdiSetLayout)( HDC hdc, LONG wox, DWORD layout ); - BOOL (WINAPI *pNtGdiSetMagicColors)( HDC hdc, DWORD magic, ULONG index ); COLORREF (WINAPI *pNtGdiSetPixel)( HDC hdc, INT x, INT y, COLORREF color ); UINT (WINAPI *pNtGdiSetSystemPaletteUse)( HDC hdc, UINT use ); INT (WINAPI *pNtGdiStartDoc)( HDC hdc, const DOCINFOW *doc, BOOL *banding, INT job ); diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index dea3e072a3d..e4bfe6f172f 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -100,21 +100,11 @@ HBITMAP WINAPI NtGdiCreateDIBitmapInternal( HDC hdc, INT width, INT height, DWOR coloruse, max_info, max_bits, flags, xform ); } -HPALETTE WINAPI NtGdiCreateHalftonePalette( HDC hdc ) -{ - return unix_funcs->pNtGdiCreateHalftonePalette( hdc ); -} - HDC WINAPI NtGdiCreateMetafileDC( HDC hdc ) { return unix_funcs->pNtGdiCreateMetafileDC( hdc ); } -HPALETTE WINAPI NtGdiCreatePaletteInternal( const LOGPALETTE *palette, UINT count ) -{ - return unix_funcs->pNtGdiCreatePaletteInternal( palette, count ); -} - HPEN WINAPI NtGdiCreatePen( INT style, INT width, COLORREF color, HBRUSH brush ) { return unix_funcs->pNtGdiCreatePen( style, width, color, brush ); @@ -303,11 +293,6 @@ COLORREF WINAPI NtGdiGetNearestColor( HDC hdc, COLORREF color ) return unix_funcs->pNtGdiGetNearestColor( hdc, color ); } -UINT WINAPI NtGdiGetNearestPaletteIndex( HPALETTE hpalette, COLORREF color ) -{ - return unix_funcs->pNtGdiGetNearestPaletteIndex( hpalette, color ); -} - UINT WINAPI NtGdiGetOutlineTextMetricsInternalW( HDC hdc, UINT cbData, OUTLINETEXTMETRICW *otm, ULONG opts ) { @@ -344,11 +329,6 @@ DWORD WINAPI NtGdiGetSpoolMessage( void *ptr1, DWORD data2, void *ptr3, DWORD da return unix_funcs->pNtGdiGetSpoolMessage( ptr1, data2, ptr3, data4 ); } -UINT WINAPI NtGdiGetSystemPaletteUse( HDC hdc ) -{ - return unix_funcs->pNtGdiGetSystemPaletteUse( hdc ); -} - UINT WINAPI NtGdiGetTextCharsetInfo( HDC hdc, FONTSIGNATURE *fs, DWORD flags ) { return unix_funcs->pNtGdiGetTextCharsetInfo( hdc, fs, flags ); @@ -556,11 +536,6 @@ DWORD WINAPI NtGdiSetLayout( HDC hdc, LONG wox, DWORD layout ) return unix_funcs->pNtGdiSetLayout( hdc, wox, layout ); } -BOOL WINAPI NtGdiSetMagicColors( HDC hdc, DWORD magic, ULONG index ) -{ - return unix_funcs->pNtGdiSetMagicColors( hdc, magic, index ); -} - COLORREF WINAPI NtGdiSetPixel( HDC hdc, INT x, INT y, COLORREF color ) { return unix_funcs->pNtGdiSetPixel( hdc, x, y, color ); diff --git a/dlls/wow64win/gdi.c b/dlls/wow64win/gdi.c index 42a13cc3676..5f32a65c2fd 100644 --- a/dlls/wow64win/gdi.c +++ b/dlls/wow64win/gdi.c @@ -472,6 +472,45 @@ NTSTATUS WINAPI wow64_NtGdiTransformPoints( UINT *args ) return NtGdiTransformPoints( hdc, points_in, points_out, count, mode ); } +NTSTATUS WINAPI wow64_NtGdiCreatePaletteInternal( UINT *args ) +{ + const LOGPALETTE *palette = get_ptr( &args ); + UINT count = get_ulong( &args ); + + return HandleToUlong( NtGdiCreatePaletteInternal( palette, count )); +} + +NTSTATUS WINAPI wow64_NtGdiCreateHalftonePalette( UINT *args ) +{ + HDC hdc = get_handle( &args ); + + return HandleToUlong( NtGdiCreateHalftonePalette( hdc )); +} + +NTSTATUS WINAPI wow64_NtGdiGetNearestPaletteIndex( UINT *args ) +{ + HPALETTE hpalette = get_handle( &args ); + COLORREF color = get_ulong( &args ); + + return NtGdiGetNearestPaletteIndex( hpalette, color ); +} + +NTSTATUS WINAPI wow64_NtGdiGetSystemPaletteUse( UINT *args ) +{ + HDC hdc = get_handle( &args ); + + return NtGdiGetSystemPaletteUse( hdc ); +} + +NTSTATUS WINAPI wow64_NtGdiSetMagicColors( UINT *args ) +{ + HDC hdc = get_handle( &args ); + DWORD magic = get_ulong( &args ); + ULONG index = get_ulong( &args ); + + return NtGdiSetMagicColors( hdc, magic, index ); +} + NTSTATUS WINAPI wow64_NtGdiFlush( UINT *args ) { return NtGdiFlush(); diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index c5f04b240bd..143fd1f97ae 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -30,7 +30,9 @@ SYSCALL_ENTRY( NtGdiCreateDIBBrush ) \ SYSCALL_ENTRY( NtGdiCreateDIBSection ) \ SYSCALL_ENTRY( NtGdiCreateEllipticRgn ) \ + SYSCALL_ENTRY( NtGdiCreateHalftonePalette ) \ SYSCALL_ENTRY( NtGdiCreateHatchBrushInternal ) \ + SYSCALL_ENTRY( NtGdiCreatePaletteInternal ) \ SYSCALL_ENTRY( NtGdiCreatePatternBrushInternal ) \ SYSCALL_ENTRY( NtGdiCreateRectRgn ) \ SYSCALL_ENTRY( NtGdiCreateRoundRectRgn ) \ @@ -48,8 +50,10 @@ SYSCALL_ENTRY( NtGdiGetDCObject ) \ SYSCALL_ENTRY( NtGdiGetFontFileData ) \ SYSCALL_ENTRY( NtGdiGetFontFileInfo ) \ + SYSCALL_ENTRY( NtGdiGetNearestPaletteIndex ) \ SYSCALL_ENTRY( NtGdiGetRegionData ) \ SYSCALL_ENTRY( NtGdiGetRgnBox ) \ + SYSCALL_ENTRY( NtGdiGetSystemPaletteUse ) \ SYSCALL_ENTRY( NtGdiGetTransform ) \ SYSCALL_ENTRY( NtGdiHfontCreate ) \ SYSCALL_ENTRY( NtGdiOffsetRgn ) \ @@ -62,6 +66,7 @@ SYSCALL_ENTRY( NtGdiSetBitmapDimension ) \ SYSCALL_ENTRY( NtGdiSetBrushOrg ) \ SYSCALL_ENTRY( NtGdiSetColorAdjustment ) \ + SYSCALL_ENTRY( NtGdiSetMagicColors ) \ SYSCALL_ENTRY( NtGdiSetMetaRgn ) \ SYSCALL_ENTRY( NtGdiSetPixelFormat ) \ SYSCALL_ENTRY( NtGdiSetRectRgn ) \ -- 2.11.4.GIT