[PATCH 0/5] MR2922: win32u: Use syscall interface for all exports.
This is the last piece of PE separation needed to make the new wow64 mode actually useful. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2922
From: Jacek Caban <jacek(a)codeweavers.com> --- dlls/win32u/gdiobj.c | 9 ---- dlls/win32u/syscall.c | 8 ++++ dlls/win32u/win32u.spec | 16 +++---- dlls/win32u/win32u_private.h | 15 ------ dlls/win32u/wrappers.c | 53 ---------------------- dlls/wow64win/syscall.h | 8 ++++ dlls/wow64win/user.c | 88 ++++++++++++++++++++++++++++++++++++ 7 files changed, 112 insertions(+), 85 deletions(-) diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index ac4a0300f2a..44eac99a30d 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -1030,15 +1030,6 @@ BOOL WINAPI NtGdiSetColorAdjustment( HDC hdc, const COLORADJUSTMENT *ca ) static struct unix_funcs unix_funcs = { - NtUserDrawCaptionTemp, - NtUserDrawMenuBarTemp, - NtUserEndPaint, - NtUserExcludeUpdateRgn, - NtUserReleaseDC, - NtUserScrollDC, - NtUserSelectPalette, - NtUserUpdateLayeredWindow, - SetDIBits, __wine_get_brush_bitmap_info, __wine_get_file_outline_text_metric, diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index 08998428d99..a292fccd1f7 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -249,16 +249,20 @@ static void * const syscalls[] = NtUserDisplayConfigGetDeviceInfo, NtUserDragDetect, NtUserDragObject, + NtUserDrawCaptionTemp, NtUserDrawIconEx, + NtUserDrawMenuBarTemp, NtUserEmptyClipboard, NtUserEnableMenuItem, NtUserEnableMouseInPointer, NtUserEnableScrollBar, NtUserEndDeferWindowPosEx, NtUserEndMenu, + NtUserEndPaint, NtUserEnumDisplayDevices, NtUserEnumDisplayMonitors, NtUserEnumDisplaySettings, + NtUserExcludeUpdateRgn, NtUserFindExistingCursorIcon, NtUserFindWindowEx, NtUserFlashWindowEx, @@ -356,10 +360,13 @@ static void * const syscalls[] = NtUserRegisterClassExWOW, NtUserRegisterHotKey, NtUserRegisterRawInputDevices, + NtUserReleaseDC, NtUserRemoveClipboardFormatListener, NtUserRemoveMenu, NtUserRemoveProp, + NtUserScrollDC, NtUserScrollWindowEx, + NtUserSelectPalette, NtUserSendInput, NtUserSetActiveWindow, NtUserSetCapture, @@ -417,6 +424,7 @@ static void * const syscalls[] = NtUserUnregisterClass, NtUserUnregisterHotKey, NtUserUpdateInputContext, + NtUserUpdateLayeredWindow, NtUserValidateRect, NtUserVkKeyScanEx, NtUserWaitForInputIdle, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 95ed5e75ade..9fef6d021d4 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -849,9 +849,9 @@ @ stdcall -syscall NtUserDragObject(long long long long long) @ stub NtUserDrawAnimatedRects @ stub NtUserDrawCaption -@ stdcall NtUserDrawCaptionTemp(long long ptr long long wstr long) +@ stdcall -syscall NtUserDrawCaptionTemp(long long ptr long long wstr long) @ stdcall -syscall NtUserDrawIconEx(long long long long long long long long long) -@ stdcall NtUserDrawMenuBarTemp(long long ptr long long) +@ stdcall -syscall NtUserDrawMenuBarTemp(long long ptr long long) @ stub NtUserDwmGetRemoteSessionOcclusionEvent @ stub NtUserDwmGetRemoteSessionOcclusionState @ stub NtUserDwmKernelShutdown @@ -874,12 +874,12 @@ @ stub NtUserEnableWindowResizeOptimization @ stdcall -syscall NtUserEndDeferWindowPosEx(long long) @ stdcall -syscall NtUserEndMenu() -@ stdcall NtUserEndPaint(long ptr) +@ stdcall -syscall NtUserEndPaint(long ptr) @ stdcall -syscall NtUserEnumDisplayDevices(ptr long ptr long) @ stdcall -syscall NtUserEnumDisplayMonitors(long ptr ptr long) @ stdcall -syscall NtUserEnumDisplaySettings(ptr long ptr long) @ stub NtUserEvent -@ stdcall NtUserExcludeUpdateRgn(long long) +@ stdcall -syscall NtUserExcludeUpdateRgn(long long) @ stub NtUserFillWindow @ stdcall -syscall NtUserFindExistingCursorIcon(ptr ptr ptr) @ stdcall -syscall NtUserFindWindowEx(long long ptr ptr long) @@ -1139,7 +1139,7 @@ @ stub NtUserRegisterTouchPadCapable @ stub NtUserRegisterUserApiHook @ stub NtUserRegisterWindowMessage -@ stdcall NtUserReleaseDC(long long) +@ stdcall -syscall NtUserReleaseDC(long long) @ stub NtUserReleaseDwmHitTestWaiters @ stub NtUserRemoteConnect @ stub NtUserRemoteRedrawRectangle @@ -1155,9 +1155,9 @@ @ stub NtUserResolveDesktopForWOW @ stub NtUserRestoreWindowDpiChanges @ stub NtUserSBGetParms -@ stdcall NtUserScrollDC(long long long ptr ptr long ptr) +@ stdcall -syscall NtUserScrollDC(long long long ptr ptr long ptr) @ stdcall -syscall NtUserScrollWindowEx(long long long ptr ptr long ptr long) -@ stdcall NtUserSelectPalette(long long long) +@ stdcall -syscall NtUserSelectPalette(long long long) @ stub NtUserSendEventMessage @ stdcall -syscall NtUserSendInput(long ptr long) @ stub NtUserSendInteracsetiveControlHapticsReport @@ -1295,7 +1295,7 @@ @ stub NtUserUpdateDefaultDesktopThumbnail @ stdcall -syscall NtUserUpdateInputContext(long long ptr) @ stub NtUserUpdateInstance -@ stdcall NtUserUpdateLayeredWindow(long long ptr ptr long ptr long ptr long ptr) +@ stdcall -syscall NtUserUpdateLayeredWindow(long long ptr ptr long ptr long ptr long ptr) @ stub NtUserUpdatePerUserSystemParameters @ stub NtUserUpdateWindowInputSinkHints @ stub NtUserUpdateWindowTrackingInfo diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 2807fc7a167..cf9167aa2d2 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -34,21 +34,6 @@ struct unix_funcs { - /* win32u functions */ - BOOL (WINAPI *pNtUserDrawCaptionTemp)( HWND hwnd, HDC hdc, const RECT *rect, HFONT font, - HICON icon, const WCHAR *str, UINT flags ); - DWORD (WINAPI *pNtUserDrawMenuBarTemp)( HWND hwnd, HDC hdc, RECT *rect, HMENU handle, HFONT font ); - BOOL (WINAPI *pNtUserEndPaint)( HWND hwnd, const PAINTSTRUCT *ps ); - INT (WINAPI *pNtUserExcludeUpdateRgn)( HDC hdc, HWND hwnd ); - INT (WINAPI *pNtUserReleaseDC)( HWND hwnd, HDC hdc ); - BOOL (WINAPI *pNtUserScrollDC)( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip, - HRGN ret_update_rgn, RECT *update_rect ); - HPALETTE (WINAPI *pNtUserSelectPalette)( HDC hdc, HPALETTE hpal, WORD bkg ); - BOOL (WINAPI *pNtUserUpdateLayeredWindow)( HWND hwnd, HDC hdc_dst, const POINT *pts_dst, - const SIZE *size, HDC hdc_src, const POINT *pts_src, - COLORREF key, const BLENDFUNCTION *blend, - DWORD flags, const RECT *dirty ); - /* Wine-specific functions */ INT (WINAPI *pSetDIBits)( HDC hdc, HBITMAP hbitmap, UINT startscan, UINT lines, const void *bits, const BITMAPINFO *info, diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index 7957f1052c7..c89c0f16edc 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -24,59 +24,6 @@ static const struct unix_funcs *unix_funcs; -BOOL WINAPI NtUserEndPaint( HWND hwnd, const PAINTSTRUCT *ps ) -{ - if (!unix_funcs) return FALSE; - return unix_funcs->pNtUserEndPaint( hwnd, ps ); -} - -BOOL WINAPI NtUserDrawCaptionTemp( HWND hwnd, HDC hdc, const RECT *rect, HFONT font, - HICON icon, const WCHAR *str, UINT flags ) -{ - if (!unix_funcs) return FALSE; - return unix_funcs->pNtUserDrawCaptionTemp( hwnd, hdc, rect, font, icon, str, flags ); -} - -DWORD WINAPI NtUserDrawMenuBarTemp( HWND hwnd, HDC hdc, RECT *rect, HMENU handle, HFONT font ) -{ - if (!unix_funcs) return 0; - return unix_funcs->pNtUserDrawMenuBarTemp( hwnd, hdc, rect, handle, font ); -} - -INT WINAPI NtUserExcludeUpdateRgn( HDC hdc, HWND hwnd ) -{ - if (!unix_funcs) return ERROR; - return unix_funcs->pNtUserExcludeUpdateRgn( hdc, hwnd ); -} - -INT WINAPI NtUserReleaseDC( HWND hwnd, HDC hdc ) -{ - if (!unix_funcs) return 0; - return unix_funcs->pNtUserReleaseDC( hwnd, hdc ); -} - -BOOL WINAPI NtUserScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip, - HRGN ret_update_rgn, RECT *update_rect ) -{ - if (!unix_funcs) return FALSE; - return unix_funcs->pNtUserScrollDC( hdc, dx, dy, scroll, clip, ret_update_rgn, update_rect ); -} - -HPALETTE WINAPI NtUserSelectPalette( HDC hdc, HPALETTE hpal, WORD bkg ) -{ - if (!unix_funcs) return 0; - return unix_funcs->pNtUserSelectPalette( hdc, hpal, bkg ); -} - -BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_dst, const SIZE *size, - HDC hdc_src, const POINT *pts_src, COLORREF key, - const BLENDFUNCTION *blend, DWORD flags, const RECT *dirty ) -{ - if (!unix_funcs) return FALSE; - return unix_funcs->pNtUserUpdateLayeredWindow( hwnd, hdc_dst, pts_dst, size, hdc_src, pts_src, - key, blend, flags, dirty ); -} - INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan, UINT lines, const void *bits, const BITMAPINFO *info, UINT coloruse ) diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index 4a0c4513bca..d2f9cde6d50 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -235,16 +235,20 @@ SYSCALL_ENTRY( NtUserDisplayConfigGetDeviceInfo ) \ SYSCALL_ENTRY( NtUserDragDetect ) \ SYSCALL_ENTRY( NtUserDragObject ) \ + SYSCALL_ENTRY( NtUserDrawCaptionTemp ) \ SYSCALL_ENTRY( NtUserDrawIconEx ) \ + SYSCALL_ENTRY( NtUserDrawMenuBarTemp ) \ SYSCALL_ENTRY( NtUserEmptyClipboard ) \ SYSCALL_ENTRY( NtUserEnableMenuItem ) \ SYSCALL_ENTRY( NtUserEnableMouseInPointer ) \ SYSCALL_ENTRY( NtUserEnableScrollBar ) \ SYSCALL_ENTRY( NtUserEndDeferWindowPosEx ) \ SYSCALL_ENTRY( NtUserEndMenu ) \ + SYSCALL_ENTRY( NtUserEndPaint ) \ SYSCALL_ENTRY( NtUserEnumDisplayDevices ) \ SYSCALL_ENTRY( NtUserEnumDisplayMonitors ) \ SYSCALL_ENTRY( NtUserEnumDisplaySettings ) \ + SYSCALL_ENTRY( NtUserExcludeUpdateRgn ) \ SYSCALL_ENTRY( NtUserFindExistingCursorIcon ) \ SYSCALL_ENTRY( NtUserFindWindowEx ) \ SYSCALL_ENTRY( NtUserFlashWindowEx ) \ @@ -342,10 +346,13 @@ SYSCALL_ENTRY( NtUserRegisterClassExWOW ) \ SYSCALL_ENTRY( NtUserRegisterHotKey ) \ SYSCALL_ENTRY( NtUserRegisterRawInputDevices ) \ + SYSCALL_ENTRY( NtUserReleaseDC ) \ SYSCALL_ENTRY( NtUserRemoveClipboardFormatListener ) \ SYSCALL_ENTRY( NtUserRemoveMenu ) \ SYSCALL_ENTRY( NtUserRemoveProp ) \ + SYSCALL_ENTRY( NtUserScrollDC ) \ SYSCALL_ENTRY( NtUserScrollWindowEx ) \ + SYSCALL_ENTRY( NtUserSelectPalette ) \ SYSCALL_ENTRY( NtUserSendInput ) \ SYSCALL_ENTRY( NtUserSetActiveWindow ) \ SYSCALL_ENTRY( NtUserSetCapture ) \ @@ -403,6 +410,7 @@ SYSCALL_ENTRY( NtUserUnregisterClass ) \ SYSCALL_ENTRY( NtUserUnregisterHotKey ) \ SYSCALL_ENTRY( NtUserUpdateInputContext ) \ + SYSCALL_ENTRY( NtUserUpdateLayeredWindow ) \ SYSCALL_ENTRY( NtUserValidateRect ) \ SYSCALL_ENTRY( NtUserVkKeyScanEx ) \ SYSCALL_ENTRY( NtUserWaitForInputIdle ) \ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 1f378aa0a76..627de08b777 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -1616,6 +1616,19 @@ NTSTATUS WINAPI wow64_NtUserDragObject( UINT *args ) return NtUserDragObject( parent, hwnd, fmt, data, hcursor ); } +NTSTATUS WINAPI wow64_NtUserDrawCaptionTemp( UINT *args ) +{ + HWND hwnd = get_handle( &args ); + HDC hdc = get_handle( &args ); + const RECT *rect = get_ptr( &args ); + HFONT font = get_handle( &args ); + HICON icon = get_handle( &args ); + const WCHAR *str = get_ptr( &args ); + UINT flags = get_ulong( &args ); + + return NtUserDrawCaptionTemp( hwnd, hdc, rect, font, icon, str, flags ); +} + NTSTATUS WINAPI wow64_NtUserDrawIconEx( UINT *args ) { HDC hdc = get_handle( &args ); @@ -1631,6 +1644,17 @@ NTSTATUS WINAPI wow64_NtUserDrawIconEx( UINT *args ) return NtUserDrawIconEx( hdc, x0, y0, icon, width, height, istep, hbr, flags ); } +NTSTATUS WINAPI wow64_NtUserDrawMenuBarTemp( UINT *args ) +{ + HWND hwnd = get_handle( &args ); + HDC hdc = get_handle( &args ); + RECT *rect = get_ptr( &args ); + HMENU handle = get_handle( &args ); + HFONT font = get_handle( &args ); + + return NtUserDrawMenuBarTemp( hwnd, hdc, rect, handle, font ); +} + NTSTATUS WINAPI wow64_NtUserEmptyClipboard( UINT *args ) { return NtUserEmptyClipboard(); @@ -1674,6 +1698,15 @@ NTSTATUS WINAPI wow64_NtUserEndMenu( UINT *args ) return NtUserEndMenu(); } +NTSTATUS WINAPI wow64_NtUserEndPaint( UINT *args ) +{ + HWND hwnd = get_handle( &args ); + const PAINTSTRUCT32 *ps32 = get_ptr( &args ); + PAINTSTRUCT ps; + + return NtUserEndPaint( hwnd, paintstruct_32to64( &ps, ps32 )); +} + NTSTATUS WINAPI wow64_NtUserEnumDisplayDevices( UINT *args ) { UNICODE_STRING32 *device32 = get_ptr( &args ); @@ -1709,6 +1742,14 @@ NTSTATUS WINAPI wow64_NtUserEnumDisplaySettings( UINT *args ) mode, dev_mode, flags ); } +NTSTATUS WINAPI wow64_NtUserExcludeUpdateRgn( UINT *args ) +{ + HDC hdc = get_handle( &args ); + HWND hwnd = get_handle( &args ); + + return NtUserExcludeUpdateRgn( hdc, hwnd ); +} + NTSTATUS WINAPI wow64_NtUserFindExistingCursorIcon( UINT *args ) { UNICODE_STRING32 *module32 = get_ptr( &args ); @@ -3337,6 +3378,14 @@ NTSTATUS WINAPI wow64_NtUserRegisterRawInputDevices( UINT *args ) return NtUserRegisterRawInputDevices( devices64, count, sizeof(*devices64) ); } +NTSTATUS WINAPI wow64_NtUserReleaseDC( UINT *args ) +{ + HWND hwnd = get_handle( &args ); + HDC hdc = get_handle( &args ); + + return NtUserReleaseDC( hwnd, hdc ); +} + NTSTATUS WINAPI wow64_NtUserRemoveClipboardFormatListener( UINT *args ) { HWND hwnd = get_handle( &args ); @@ -3361,6 +3410,19 @@ NTSTATUS WINAPI wow64_NtUserRemoveProp( UINT *args ) return HandleToUlong( NtUserRemoveProp( hwnd, str )); } +NTSTATUS WINAPI wow64_NtUserScrollDC( UINT *args ) +{ + HDC hdc = get_handle( &args ); + INT dx = get_ulong( &args ); + INT dy = get_ulong( &args ); + const RECT *scroll = get_ptr( &args ); + const RECT *clip = get_ptr( &args ); + HRGN ret_update_rgn = get_handle( &args ); + RECT *update_rect = get_ptr( &args ); + + return NtUserScrollDC( hdc, dx, dy, scroll, clip, ret_update_rgn, update_rect ); +} + NTSTATUS WINAPI wow64_NtUserScrollWindowEx( UINT *args ) { HWND hwnd = get_handle( &args ); @@ -3375,6 +3437,15 @@ NTSTATUS WINAPI wow64_NtUserScrollWindowEx( UINT *args ) return NtUserScrollWindowEx( hwnd, dx, dy, rect, clip_rect, update_rgn, update_rect, flags ); } +NTSTATUS WINAPI wow64_NtUserSelectPalette( UINT *args ) +{ + HDC hdc = get_handle( &args ); + HPALETTE hpal = get_handle( &args ); + WORD bkg = get_ulong( &args ); + + return HandleToUlong( NtUserSelectPalette( hdc, hpal, bkg )); +} + NTSTATUS WINAPI wow64_NtUserSendInput( UINT *args ) { UINT count = get_ulong( &args ); @@ -4203,6 +4274,23 @@ NTSTATUS WINAPI wow64_NtUserUpdateInputContext( UINT *args ) return NtUserUpdateInputContext( handle, attr, value ); } +NTSTATUS WINAPI wow64_NtUserUpdateLayeredWindow( UINT *args ) +{ + HWND hwnd = get_handle( &args ); + HDC hdc_dst = get_handle( &args ); + const POINT *pts_dst = get_ptr( &args ); + const SIZE *size = get_ptr( &args ); + HDC hdc_src = get_handle( &args ); + const POINT *pts_src = get_ptr( &args ); + COLORREF key = get_ulong( &args ); + const BLENDFUNCTION *blend = get_ptr( &args ); + DWORD flags = get_ulong( &args ); + const RECT *dirty = get_ptr( &args ); + + return NtUserUpdateLayeredWindow( hwnd, hdc_dst, pts_dst, size, hdc_src, pts_src, + key, blend, flags, dirty ); +} + NTSTATUS WINAPI wow64_NtUserValidateRect( UINT *args ) { HWND hwnd = get_handle( &args ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2922
From: Jacek Caban <jacek(a)codeweavers.com> --- dlls/gdi32/emfdc.c | 4 ++-- dlls/gdi32/metadc.c | 5 +++-- dlls/win32u/brush.c | 12 ++++++++++-- dlls/win32u/gdiobj.c | 1 - dlls/win32u/syscall.c | 1 + dlls/win32u/win32u.spec | 3 +-- dlls/win32u/win32u_private.h | 1 - dlls/win32u/wrappers.c | 6 ------ dlls/wow64win/gdi.c | 14 ++++++++++++++ dlls/wow64win/syscall.h | 1 + include/ntgdi.h | 4 ++-- 11 files changed, 34 insertions(+), 18 deletions(-) diff --git a/dlls/gdi32/emfdc.c b/dlls/gdi32/emfdc.c index 57f39e4c162..45938172a37 100644 --- a/dlls/gdi32/emfdc.c +++ b/dlls/gdi32/emfdc.c @@ -489,7 +489,7 @@ static DWORD emfdc_create_brush( struct emf *emf, HBRUSH brush ) DWORD info_size; UINT usage; - if (!__wine_get_brush_bitmap_info( brush, info, NULL, &usage )) break; + if (!NtGdiIcmBrushInfo( 0, brush, info, NULL, NULL, &usage, NULL, 0 )) break; info_size = get_dib_info_size( info, usage ); emr = HeapAlloc( GetProcessHeap(), 0, @@ -530,7 +530,7 @@ static DWORD emfdc_create_brush( struct emf *emf, HBRUSH brush ) if (info->bmiHeader.biClrUsed == 1 << info->bmiHeader.biBitCount) info->bmiHeader.biClrUsed = 0; memcpy( (BYTE *)emr + emr->offBmi, info, emr->cbBmi ); - __wine_get_brush_bitmap_info( brush, NULL, (char *)emr + emr->offBits, NULL ); + NtGdiIcmBrushInfo( 0, brush, NULL, (char *)emr + emr->offBits, NULL, NULL, NULL, 0 ); if (!emfdc_record( emf, &emr->emr )) index = 0; HeapFree( GetProcessHeap(), 0, emr ); diff --git a/dlls/gdi32/metadc.c b/dlls/gdi32/metadc.c index 2f5842ea90a..dbfa311b711 100644 --- a/dlls/gdi32/metadc.c +++ b/dlls/gdi32/metadc.c @@ -547,7 +547,8 @@ static INT16 metadc_create_brush( struct metadc *metadc, HBRUSH brush ) DWORD info_size; UINT usage; - if (!__wine_get_brush_bitmap_info( brush, src_info, NULL, &usage )) goto done; + if (!NtGdiIcmBrushInfo( 0, brush, src_info, NULL, NULL, &usage, NULL, 0 )) + goto done; info_size = get_dib_info_size( src_info, usage ); size = FIELD_OFFSET( METARECORD, rdParm[2] ) + @@ -559,7 +560,7 @@ static INT16 metadc_create_brush( struct metadc *metadc, HBRUSH brush ) mr->rdParm[0] = logbrush.lbStyle; mr->rdParm[1] = usage; dst_info = (BITMAPINFO *)(mr->rdParm + 2); - __wine_get_brush_bitmap_info( brush, dst_info, (char *)dst_info + info_size, NULL ); + NtGdiIcmBrushInfo( 0, brush, dst_info, (char *)dst_info + info_size, NULL, NULL, NULL, 0 ); if (dst_info->bmiHeader.biClrUsed == 1 << dst_info->bmiHeader.biBitCount) dst_info->bmiHeader.biClrUsed = 0; break; diff --git a/dlls/win32u/brush.c b/dlls/win32u/brush.c index 8523826627e..29a96035599 100644 --- a/dlls/win32u/brush.c +++ b/dlls/win32u/brush.c @@ -145,13 +145,20 @@ void free_brush_pattern( struct brush_pattern *pattern ) } /********************************************************************** - * __wine_get_brush_bitmap_info (win32u.@) + * NtGdiIcmBrushInfo (win32u.@) */ -BOOL CDECL __wine_get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage ) +BOOL WINAPI NtGdiIcmBrushInfo( HDC hdc, HBRUSH handle, BITMAPINFO *info, void *bits, + ULONG *bits_size, UINT *usage, BOOL *unk, UINT mode ) { BRUSHOBJ *brush; BOOL ret = FALSE; + if (mode) + { + FIXME( "unsupported mode %u\n", mode ); + return FALSE; + } + if (!(brush = GDI_GetObjPtr( handle, NTGDI_OBJ_BRUSH ))) return FALSE; if (brush->pattern.info) @@ -183,6 +190,7 @@ BOOL CDECL __wine_get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void * else memcpy( bits, brush->pattern.bits.ptr, brush->pattern.info->bmiHeader.biSizeImage ); } + if (bits_size) *bits_size = brush->pattern.info->bmiHeader.biSizeImage; if (usage) *usage = brush->pattern.usage; ret = TRUE; } diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index 44eac99a30d..be8d3099a49 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -1031,7 +1031,6 @@ BOOL WINAPI NtGdiSetColorAdjustment( HDC hdc, const COLORADJUSTMENT *ca ) static struct unix_funcs unix_funcs = { SetDIBits, - __wine_get_brush_bitmap_info, __wine_get_file_outline_text_metric, __wine_get_icm_profile, __wine_send_input, diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index a292fccd1f7..5e342342362 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -145,6 +145,7 @@ static void * const syscalls[] = NtGdiGetTransform, NtGdiGradientFill, NtGdiHfontCreate, + NtGdiIcmBrushInfo, NtGdiInitSpool, NtGdiIntersectClipRect, NtGdiInvertRgn, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 9fef6d021d4..219442c30eb 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -530,7 +530,7 @@ @ stub NtGdiHT_Get8BPPFormatPalette @ stub NtGdiHT_Get8BPPMaskPalette @ stdcall -syscall NtGdiHfontCreate(ptr long long long ptr) -@ stub NtGdiIcmBrushInfo +@ stdcall -syscall NtGdiIcmBrushInfo(long long ptr ptr ptr ptr ptr long) @ stub NtGdiInit @ stdcall -syscall NtGdiInitSpool() @ stdcall -syscall NtGdiIntersectClipRect(long long long long long) @@ -1325,6 +1325,5 @@ # gdi32 @ stdcall SetDIBits(long long long long ptr ptr long) -@ cdecl __wine_get_brush_bitmap_info(long ptr ptr ptr) @ cdecl __wine_get_icm_profile(long long ptr ptr) @ cdecl __wine_get_file_outline_text_metric(wstr ptr) diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index cf9167aa2d2..7b09ff9aa37 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -38,7 +38,6 @@ struct unix_funcs INT (WINAPI *pSetDIBits)( HDC hdc, HBITMAP hbitmap, UINT startscan, UINT lines, const void *bits, const BITMAPINFO *info, UINT coloruse ); - BOOL (CDECL *get_brush_bitmap_info)( HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage ); BOOL (CDECL *get_file_outline_text_metric)( const WCHAR *path, OUTLINETEXTMETRICW *otm ); BOOL (CDECL *get_icm_profile)( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ); BOOL (CDECL *wine_send_input)( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ); diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index c89c0f16edc..0327416e018 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -38,12 +38,6 @@ BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCH return unix_funcs->get_icm_profile( hdc, allow_default, size, filename ); } -BOOL CDECL __wine_get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage ) -{ - if (!unix_funcs) return FALSE; - return unix_funcs->get_brush_bitmap_info( handle, info, bits, usage ); -} - BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, OUTLINETEXTMETRICW *otm ) { if (!unix_funcs) return FALSE; diff --git a/dlls/wow64win/gdi.c b/dlls/wow64win/gdi.c index 7b5ca3f90ef..b1c79c776d7 100644 --- a/dlls/wow64win/gdi.c +++ b/dlls/wow64win/gdi.c @@ -1377,6 +1377,20 @@ NTSTATUS WINAPI wow64_NtGdiGradientFill( UINT *args ) return NtGdiGradientFill( hdc, vert_array, nvert, grad_array, ngrad, mode ); } +NTSTATUS WINAPI wow64_NtGdiIcmBrushInfo( UINT *args ) +{ + HDC hdc = get_handle( &args ); + HBRUSH handle = get_handle( &args ); + BITMAPINFO *info = get_ptr( &args ); + void *bits = get_ptr( &args ); + ULONG *bits_size = get_ptr( &args ); + UINT *usage = get_ptr( &args ); + BOOL *unk = get_ptr( &args ); + UINT mode = get_ulong( &args ); + + return NtGdiIcmBrushInfo( hdc, handle, info, bits, bits_size, usage, unk, mode ); +} + NTSTATUS WINAPI wow64_NtGdiInvertRgn( UINT *args ) { HDC hdc = get_handle( &args ); diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index d2f9cde6d50..0521ad900d8 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -131,6 +131,7 @@ SYSCALL_ENTRY( NtGdiGetTransform ) \ SYSCALL_ENTRY( NtGdiGradientFill ) \ SYSCALL_ENTRY( NtGdiHfontCreate ) \ + SYSCALL_ENTRY( NtGdiIcmBrushInfo ) \ SYSCALL_ENTRY( NtGdiInitSpool ) \ SYSCALL_ENTRY( NtGdiIntersectClipRect ) \ SYSCALL_ENTRY( NtGdiInvertRgn ) \ diff --git a/include/ntgdi.h b/include/ntgdi.h index 0f989189045..e1c5008e4e9 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -375,6 +375,8 @@ BOOL WINAPI NtGdiGradientFill( HDC hdc, TRIVERTEX *vert_array, ULONG nvert, void *grad_array, ULONG ngrad, ULONG mode ); HFONT WINAPI NtGdiHfontCreate( const void *logfont, ULONG unk2, ULONG unk3, ULONG unk4, void *data ); +BOOL WINAPI NtGdiIcmBrushInfo( HDC hdc, HBRUSH handle, BITMAPINFO *info, void *bits, + ULONG *bits_size, UINT *usage, BOOL *unk, UINT mode ); DWORD WINAPI NtGdiInitSpool(void); INT WINAPI NtGdiIntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bottom ); BOOL WINAPI NtGdiInvertRgn( HDC hdc, HRGN hrgn ); @@ -481,8 +483,6 @@ NTSTATUS WINAPI NtGdiDdDDISetQueuedLimit( D3DKMT_SETQUEUEDLIMIT *desc ); NTSTATUS WINAPI NtGdiDdDDISetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *desc ); /* Wine extensions */ -extern BOOL CDECL __wine_get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void *bits, - UINT *usage ); extern BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ); extern BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2922
From: Jacek Caban <jacek(a)codeweavers.com> --- dlls/gdi32/dc.c | 15 +++++++++++++++ dlls/win32u/dib.c | 29 +++++++---------------------- dlls/win32u/gdiobj.c | 1 - dlls/win32u/win32u.spec | 1 - dlls/win32u/win32u_private.h | 3 --- dlls/win32u/wrappers.c | 8 -------- dlls/winex11.drv/bitblt.c | 4 +++- 7 files changed, 25 insertions(+), 36 deletions(-) diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index 9a33e343f94..368a38db788 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -1970,6 +1970,21 @@ BOOL WINAPI GdiAlphaBlend( HDC hdc_dst, int x_dst, int y_dst, int width_dst, int *(DWORD *)&blend_function, 0 /* FIXME */ ); } +/****************************************************************************** + * SetDIBits (GDI32.@) + * + * Sets pixels in a bitmap using colors from DIB. + */ +INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan, + UINT lines, const void *bits, const BITMAPINFO *info, + UINT coloruse ) +{ + /* Wine-specific: pass hbitmap to NtGdiSetDIBitsToDeviceInternal */ + return NtGdiSetDIBitsToDeviceInternal( hdc, 0, 0, 0, 0, 0, 0, + startscan, lines, bits, info, coloruse, + 0, 0, FALSE, hbitmap ); +} + /*********************************************************************** * SetDIBitsToDevice (GDI32.@) */ diff --git a/dlls/win32u/dib.c b/dlls/win32u/dib.c index 64f96b268c9..7b6b364fb71 100644 --- a/dlls/win32u/dib.c +++ b/dlls/win32u/dib.c @@ -655,27 +655,10 @@ INT WINAPI NtGdiStretchDIBitsInternal( HDC hdc, INT xDst, INT yDst, INT widthDst } -/****************************************************************************** - * SetDIBits [GDI32.@] - * - * Sets pixels in a bitmap using colors from DIB. - * - * PARAMS - * hdc [I] Handle to device context - * hbitmap [I] Handle to bitmap - * startscan [I] Starting scan line - * lines [I] Number of scan lines - * bits [I] Array of bitmap bits - * info [I] Address of structure with data - * coloruse [I] Type of color indexes to use - * - * RETURNS - * Success: Number of scan lines copied - * Failure: 0 - */ -INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan, - UINT lines, LPCVOID bits, const BITMAPINFO *info, - UINT coloruse ) +/* Sets pixels in a bitmap using colors from DIB, see SetDIBits */ +static int set_di_bits( HDC hdc, HBITMAP hbitmap, UINT startscan, + UINT lines, LPCVOID bits, const BITMAPINFO *info, + UINT coloruse ) { BITMAPOBJ *bitmap; char src_bmibuf[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; @@ -913,6 +896,8 @@ INT WINAPI NtGdiSetDIBitsToDeviceInternal( HDC hdc, INT xDest, INT yDest, DWORD INT ret = 0; DC *dc; + if (xform) return set_di_bits( hdc, xform, startscan, lines, bits, bmi, coloruse ); + if (!bits) return 0; if (!bitmapinfo_from_user_bitmapinfo( info, bmi, coloruse, TRUE )) { @@ -1468,7 +1453,7 @@ HBITMAP WINAPI NtGdiCreateDIBitmapInternal( HDC hdc, INT width, INT height, DWOR { if (init & CBM_INIT) { - if (SetDIBits( hdc, handle, 0, height, bits, data, coloruse ) == 0) + if (set_di_bits( hdc, handle, 0, height, bits, data, coloruse ) == 0) { NtGdiDeleteObjectApp( handle ); handle = 0; diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index be8d3099a49..22cd7dd03ba 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -1030,7 +1030,6 @@ BOOL WINAPI NtGdiSetColorAdjustment( HDC hdc, const COLORADJUSTMENT *ca ) static struct unix_funcs unix_funcs = { - SetDIBits, __wine_get_file_outline_text_metric, __wine_get_icm_profile, __wine_send_input, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 219442c30eb..c90505e7d17 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1324,6 +1324,5 @@ @ cdecl __wine_send_input(long ptr ptr) # gdi32 -@ stdcall SetDIBits(long long long long ptr ptr long) @ cdecl __wine_get_icm_profile(long long ptr ptr) @ cdecl __wine_get_file_outline_text_metric(wstr ptr) diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 7b09ff9aa37..3b181fe3121 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -35,9 +35,6 @@ struct unix_funcs { /* Wine-specific functions */ - INT (WINAPI *pSetDIBits)( HDC hdc, HBITMAP hbitmap, UINT startscan, - UINT lines, const void *bits, const BITMAPINFO *info, - UINT coloruse ); BOOL (CDECL *get_file_outline_text_metric)( const WCHAR *path, OUTLINETEXTMETRICW *otm ); BOOL (CDECL *get_icm_profile)( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ); BOOL (CDECL *wine_send_input)( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ); diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index 0327416e018..9e013c64b59 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -24,14 +24,6 @@ static const struct unix_funcs *unix_funcs; -INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan, - UINT lines, const void *bits, const BITMAPINFO *info, - UINT coloruse ) -{ - if (!unix_funcs) return 0; - return unix_funcs->pSetDIBits( hdc, hbitmap, startscan, lines, bits, info, coloruse ); -} - BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ) { if (!unix_funcs) return FALSE; diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index 10388a1cc8f..19fc0b0887c 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -1497,7 +1497,9 @@ Pixmap create_pixmap_from_image( HDC hdc, const XVisualInfo *vis, const BITMAPIN { if (src_info->bmiHeader.biBitCount == 1 && !src_info->bmiHeader.biClrUsed) memcpy( src_info->bmiColors, default_colortable, sizeof(default_colortable) ); - SetDIBits( hdc, dib, 0, abs(info->bmiHeader.biHeight), bits->ptr, src_info, coloruse ); + NtGdiSetDIBitsToDeviceInternal( hdc, 0, 0, 0, 0, 0, 0, 0, + abs(info->bmiHeader.biHeight), bits->ptr, src_info, coloruse, + 0, 0, FALSE, dib ); /* SetDIBits */ dst_bits.free = NULL; dst_bits.is_copy = TRUE; err = put_pixmap_image( pixmap, vis, dst_info, &dst_bits ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2922
From: Jacek Caban <jacek(a)codeweavers.com> --- dlls/gdi32/text.c | 46 ++++++++++++++++++------------------ dlls/win32u/font.c | 7 ++++-- dlls/win32u/win32u.spec | 2 +- dlls/win32u/win32u_private.h | 3 ++- dlls/win32u/wrappers.c | 5 ++-- include/ntgdi.h | 4 ++-- 6 files changed, 36 insertions(+), 31 deletions(-) diff --git a/dlls/gdi32/text.c b/dlls/gdi32/text.c index 3dd50491e08..2ebfea586e4 100644 --- a/dlls/gdi32/text.c +++ b/dlls/gdi32/text.c @@ -2669,10 +2669,11 @@ static BOOL create_fot( const WCHAR *resource, const WCHAR *font_file, const str BOOL WINAPI CreateScalableFontResourceW( DWORD hidden, const WCHAR *resource_file, const WCHAR *font_file, const WCHAR *font_path ) { + WCHAR path[MAX_PATH], face_name[128]; struct fontdir fontdir = { 0 }; UNICODE_STRING nt_name; - OUTLINETEXTMETRICW otm; - WCHAR path[MAX_PATH]; + TEXTMETRICW otm; + UINT em_square; BOOL ret; TRACE("(%ld, %s, %s, %s)\n", hidden, debugstr_w(resource_file), @@ -2689,10 +2690,10 @@ BOOL WINAPI CreateScalableFontResourceW( DWORD hidden, const WCHAR *resource_fil if (!RtlDosPathNameToNtPathName_U( path, &nt_name, NULL, NULL )) goto done; } else if (!RtlDosPathNameToNtPathName_U( font_file, &nt_name, NULL, NULL )) goto done; - ret = __wine_get_file_outline_text_metric( nt_name.Buffer, &otm ); + ret = __wine_get_file_outline_text_metric( nt_name.Buffer, &otm, &em_square, face_name ); RtlFreeUnicodeString( &nt_name ); if (!ret) goto done; - if (!(otm.otmTextMetrics.tmPitchAndFamily & TMPF_TRUETYPE)) goto done; + if (!(otm.tmPitchAndFamily & TMPF_TRUETYPE)) goto done; fontdir.num_of_resources = 1; fontdir.res_id = 0; @@ -2700,32 +2701,31 @@ BOOL WINAPI CreateScalableFontResourceW( DWORD hidden, const WCHAR *resource_fil fontdir.dfSize = sizeof(fontdir); strcpy( fontdir.dfCopyright, "Wine fontdir" ); fontdir.dfType = 0x4003; /* 0x0080 set if private */ - fontdir.dfPoints = otm.otmEMSquare; + fontdir.dfPoints = em_square; fontdir.dfVertRes = 72; fontdir.dfHorizRes = 72; - fontdir.dfAscent = otm.otmTextMetrics.tmAscent; - fontdir.dfInternalLeading = otm.otmTextMetrics.tmInternalLeading; - fontdir.dfExternalLeading = otm.otmTextMetrics.tmExternalLeading; - fontdir.dfItalic = otm.otmTextMetrics.tmItalic; - fontdir.dfUnderline = otm.otmTextMetrics.tmUnderlined; - fontdir.dfStrikeOut = otm.otmTextMetrics.tmStruckOut; - fontdir.dfWeight = otm.otmTextMetrics.tmWeight; - fontdir.dfCharSet = otm.otmTextMetrics.tmCharSet; + fontdir.dfAscent = otm.tmAscent; + fontdir.dfInternalLeading = otm.tmInternalLeading; + fontdir.dfExternalLeading = otm.tmExternalLeading; + fontdir.dfItalic = otm.tmItalic; + fontdir.dfUnderline = otm.tmUnderlined; + fontdir.dfStrikeOut = otm.tmStruckOut; + fontdir.dfWeight = otm.tmWeight; + fontdir.dfCharSet = otm.tmCharSet; fontdir.dfPixWidth = 0; - fontdir.dfPixHeight = otm.otmTextMetrics.tmHeight; - fontdir.dfPitchAndFamily = otm.otmTextMetrics.tmPitchAndFamily; - fontdir.dfAvgWidth = otm.otmTextMetrics.tmAveCharWidth; - fontdir.dfMaxWidth = otm.otmTextMetrics.tmMaxCharWidth; - fontdir.dfFirstChar = otm.otmTextMetrics.tmFirstChar; - fontdir.dfLastChar = otm.otmTextMetrics.tmLastChar; - fontdir.dfDefaultChar = otm.otmTextMetrics.tmDefaultChar; - fontdir.dfBreakChar = otm.otmTextMetrics.tmBreakChar; + fontdir.dfPixHeight = otm.tmHeight; + fontdir.dfPitchAndFamily = otm.tmPitchAndFamily; + fontdir.dfAvgWidth = otm.tmAveCharWidth; + fontdir.dfMaxWidth = otm.tmMaxCharWidth; + fontdir.dfFirstChar = otm.tmFirstChar; + fontdir.dfLastChar = otm.tmLastChar; + fontdir.dfDefaultChar = otm.tmDefaultChar; + fontdir.dfBreakChar = otm.tmBreakChar; fontdir.dfWidthBytes = 0; fontdir.dfDevice = 0; fontdir.dfFace = FIELD_OFFSET( struct fontdir, szFaceName ); fontdir.dfReserved = 0; - WideCharToMultiByte( CP_ACP, 0, (WCHAR *)otm.otmpFamilyName, -1, - fontdir.szFaceName, LF_FACESIZE, NULL, NULL ); + WideCharToMultiByte( CP_ACP, 0, face_name, -1, fontdir.szFaceName, LF_FACESIZE, NULL, NULL ); if (hidden) fontdir.dfType |= 0x80; return create_fot( resource_file, font_file, &fontdir ); diff --git a/dlls/win32u/font.c b/dlls/win32u/font.c index cdac88836b9..c8187e9d07b 100644 --- a/dlls/win32u/font.c +++ b/dlls/win32u/font.c @@ -6341,7 +6341,8 @@ DWORD WINAPI NtGdiGetGlyphOutline( HDC hdc, UINT ch, UINT format, GLYPHMETRICS * /********************************************************************** * __wine_get_file_outline_text_metric (win32u.@) */ -BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, OUTLINETEXTMETRICW *otm ) +BOOL WINAPI __wine_get_file_outline_text_metric( const WCHAR *path, TEXTMETRICW *otm, + UINT *em_square, WCHAR *face_name ) { struct gdi_font *font = NULL; @@ -6351,7 +6352,9 @@ BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, OUTLINETEXTME font->lf.lfHeight = 100; if (!font_funcs->load_font( font )) goto done; if (!font_funcs->set_outline_text_metrics( font )) goto done; - *otm = font->otm; + *otm = font->otm.otmTextMetrics; + *em_square = font->otm.otmEMSquare; + wcscpy( face_name, (const WCHAR *)font->otm.otmpFamilyName ); free_gdi_font( font ); return TRUE; diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index c90505e7d17..178329d6858 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1325,4 +1325,4 @@ # gdi32 @ cdecl __wine_get_icm_profile(long long ptr ptr) -@ cdecl __wine_get_file_outline_text_metric(wstr ptr) +@ stdcall __wine_get_file_outline_text_metric(wstr ptr ptr ptr) diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 3b181fe3121..e7e77bf2427 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -35,7 +35,8 @@ struct unix_funcs { /* Wine-specific functions */ - BOOL (CDECL *get_file_outline_text_metric)( const WCHAR *path, OUTLINETEXTMETRICW *otm ); + BOOL (WINAPI *get_file_outline_text_metric)( const WCHAR *path, TEXTMETRICW *otm, + UINT *em_square, WCHAR *face_name ); BOOL (CDECL *get_icm_profile)( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ); BOOL (CDECL *wine_send_input)( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ); }; diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index 9e013c64b59..23dccd55bf1 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -30,10 +30,11 @@ BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCH return unix_funcs->get_icm_profile( hdc, allow_default, size, filename ); } -BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, OUTLINETEXTMETRICW *otm ) +BOOL WINAPI __wine_get_file_outline_text_metric( const WCHAR *path, TEXTMETRICW *otm, + UINT *em_square, WCHAR *face_name ) { if (!unix_funcs) return FALSE; - return unix_funcs->get_file_outline_text_metric( path, otm ); + return unix_funcs->get_file_outline_text_metric( path, otm, em_square, face_name ); } BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ) diff --git a/include/ntgdi.h b/include/ntgdi.h index e1c5008e4e9..1ac8e0110e2 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -485,7 +485,7 @@ NTSTATUS WINAPI NtGdiDdDDISetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER /* Wine extensions */ extern BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ); -extern BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, - OUTLINETEXTMETRICW *otm ); +BOOL WINAPI __wine_get_file_outline_text_metric( const WCHAR *path, TEXTMETRICW *otm, + UINT *em_square, WCHAR *face_name ); #endif /* _NTGDI_ */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2922
From: Jacek Caban <jacek(a)codeweavers.com> --- dlls/hidclass.sys/device.c | 2 +- dlls/hidclass.sys/pnp.c | 2 +- dlls/win32u/Makefile.in | 3 +-- dlls/win32u/dc.c | 2 +- dlls/win32u/gdiobj.c | 14 ---------- dlls/win32u/input.c | 2 +- dlls/win32u/main.c | 3 --- dlls/win32u/syscall.c | 4 ++- dlls/win32u/win32u.spec | 9 +++---- dlls/win32u/win32u_private.h | 10 -------- dlls/win32u/wrappers.c | 50 ------------------------------------ dlls/wow64win/gdi.c | 20 +++++++++++++++ dlls/wow64win/syscall.h | 5 +++- dlls/wow64win/user.c | 6 +++++ include/ntgdi.h | 3 +-- include/ntuser.h | 3 +++ include/winuser.h | 1 - 17 files changed, 45 insertions(+), 94 deletions(-) delete mode 100644 dlls/win32u/wrappers.c diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index ac201afeddf..d673a8c2e88 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -22,7 +22,7 @@ #include <stdlib.h> #include "hid.h" #include "winreg.h" -#include "winuser.h" +#include "ntuser.h" #include "ddk/hidsdi.h" #include "ddk/hidtypes.h" diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c index c0e2a874788..ab3cd5b2cb5 100644 --- a/dlls/hidclass.sys/pnp.c +++ b/dlls/hidclass.sys/pnp.c @@ -29,7 +29,7 @@ #include "ddk/hidtypes.h" #include "ddk/wdm.h" #include "regstr.h" -#include "winuser.h" +#include "ntuser.h" #include "wine/debug.h" #include "wine/asm.h" #include "wine/list.h" diff --git a/dlls/win32u/Makefile.in b/dlls/win32u/Makefile.in index 7274f132fa5..8e687a0b85f 100644 --- a/dlls/win32u/Makefile.in +++ b/dlls/win32u/Makefile.in @@ -53,7 +53,6 @@ C_SRCS = \ vertical.c \ vulkan.c \ window.c \ - winstation.c \ - wrappers.c + winstation.c font_EXTRADEFS = -DWINE_FONT_DIR=\"`${MAKEDEP} -R ${datadir}/wine ${fontdir}`\" diff --git a/dlls/win32u/dc.c b/dlls/win32u/dc.c index 9e8e2f65212..0b7d2cd023d 100644 --- a/dlls/win32u/dc.c +++ b/dlls/win32u/dc.c @@ -1473,7 +1473,7 @@ DWORD WINAPI NtGdiSetLayout( HDC hdc, LONG wox, DWORD layout ) /********************************************************************** * __wine_get_icm_profile (win32u.@) */ -BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ) +BOOL WINAPI __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ) { PHYSDEV physdev; DC *dc; diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index 22cd7dd03ba..2201ac4b01e 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -1027,14 +1027,6 @@ BOOL WINAPI NtGdiSetColorAdjustment( HDC hdc, const COLORADJUSTMENT *ca ) return FALSE; } - -static struct unix_funcs unix_funcs = -{ - __wine_get_file_outline_text_metric, - __wine_get_icm_profile, - __wine_send_input, -}; - void gdi_init(void) { pthread_mutexattr_t attr; @@ -1052,9 +1044,3 @@ void gdi_init(void) dpi = font_init(); init_stock_objects( dpi ); } - -NTSTATUS callbacks_init( void *args ) -{ - *(const struct unix_funcs **)args = &unix_funcs; - return 0; -} diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index fb9824759b2..868f0ef697e 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -598,7 +598,7 @@ BOOL WINAPI NtUserAttachThreadInput( DWORD from, DWORD to, BOOL attach ) * * Internal SendInput function to allow the graphics driver to inject real events. */ -BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ) +BOOL WINAPI __wine_send_input( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ) { return set_ntstatus( send_hardware_message( hwnd, input, rawinput, 0 )); } diff --git a/dlls/win32u/main.c b/dlls/win32u/main.c index 3d6a9c2d038..e3d2f2c54b2 100644 --- a/dlls/win32u/main.c +++ b/dlls/win32u/main.c @@ -55,10 +55,7 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved ) if (__wine_syscall_dispatcher) break; /* already set through Wow64Transition */ if (!NtQueryVirtualMemory( GetCurrentProcess(), inst, MemoryWineUnixFuncs, &win32u_handle, sizeof(win32u_handle), NULL )) - { __wine_unix_call( win32u_handle, 0, &__wine_syscall_dispatcher ); - wrappers_init( win32u_handle ); - } break; } return TRUE; diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index 5e342342362..3f75424203a 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -432,6 +432,9 @@ static void * const syscalls[] = NtUserWaitMessage, NtUserWindowFromDC, NtUserWindowFromPoint, + __wine_get_file_outline_text_metric, + __wine_get_icm_profile, + __wine_send_input }; static BYTE arguments[ARRAY_SIZE(syscalls)]; @@ -452,5 +455,4 @@ static NTSTATUS init( void *dispatcher ) unixlib_entry_t __wine_unix_call_funcs[] = { init, - callbacks_init, }; diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 178329d6858..b7d364a4e09 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1320,9 +1320,6 @@ ################################################################ # Wine internal extensions -# Graphics drivers -@ cdecl __wine_send_input(long ptr ptr) - -# gdi32 -@ cdecl __wine_get_icm_profile(long long ptr ptr) -@ stdcall __wine_get_file_outline_text_metric(wstr ptr ptr ptr) +@ stdcall -syscall __wine_get_icm_profile(long long ptr ptr) +@ stdcall -syscall __wine_get_file_outline_text_metric(wstr ptr ptr ptr) +@ stdcall -syscall __wine_send_input(long ptr ptr) diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index e7e77bf2427..670fd3b91d8 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -32,14 +32,6 @@ #include "wine/debug.h" #include "wine/server.h" -struct unix_funcs -{ - /* Wine-specific functions */ - BOOL (WINAPI *get_file_outline_text_metric)( const WCHAR *path, TEXTMETRICW *otm, - UINT *em_square, WCHAR *face_name ); - BOOL (CDECL *get_icm_profile)( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ); - BOOL (CDECL *wine_send_input)( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ); -}; /* clipboard.c */ extern UINT enum_clipboard_formats( UINT format ) DECLSPEC_HIDDEN; @@ -247,9 +239,7 @@ static inline void release_win_ptr( struct tagWND *ptr ) user_unlock(); } -extern void wrappers_init( unixlib_handle_t handle ) DECLSPEC_HIDDEN; extern void gdi_init(void) DECLSPEC_HIDDEN; -extern NTSTATUS callbacks_init( void *args ) DECLSPEC_HIDDEN; extern void winstation_init(void) DECLSPEC_HIDDEN; extern void sysparams_init(void) DECLSPEC_HIDDEN; extern int muldiv( int a, int b, int c ) DECLSPEC_HIDDEN; diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c deleted file mode 100644 index 23dccd55bf1..00000000000 --- a/dlls/win32u/wrappers.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Unix call wrappers - * - * 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 "ntstatus.h" -#define WIN32_NO_STATUS -#include "win32u_private.h" - -static const struct unix_funcs *unix_funcs; - -BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ) -{ - if (!unix_funcs) return FALSE; - return unix_funcs->get_icm_profile( hdc, allow_default, size, filename ); -} - -BOOL WINAPI __wine_get_file_outline_text_metric( const WCHAR *path, TEXTMETRICW *otm, - UINT *em_square, WCHAR *face_name ) -{ - if (!unix_funcs) return FALSE; - return unix_funcs->get_file_outline_text_metric( path, otm, em_square, face_name ); -} - -BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ) -{ - if (!unix_funcs) return FALSE; - return unix_funcs->wine_send_input( hwnd, input, rawinput ); -} - -extern void wrappers_init( unixlib_handle_t handle ) -{ - const void *args; - if (!__wine_unix_call( handle, 1, &args )) unix_funcs = args; -} diff --git a/dlls/wow64win/gdi.c b/dlls/wow64win/gdi.c index b1c79c776d7..c846e47ba5e 100644 --- a/dlls/wow64win/gdi.c +++ b/dlls/wow64win/gdi.c @@ -2081,3 +2081,23 @@ NTSTATUS WINAPI wow64_NtGdiWidenPath( UINT *args ) return NtGdiWidenPath( hdc ); } + +NTSTATUS WINAPI wow64___wine_get_icm_profile( UINT *args ) +{ + HDC hdc = get_handle( &args ); + BOOL allow_default = get_ulong( &args ); + DWORD *size = get_ptr( &args ); + WCHAR *filename = get_ptr( &args ); + + return __wine_get_icm_profile( hdc, allow_default, size, filename ); +} + +NTSTATUS WINAPI wow64___wine_get_file_outline_text_metric( UINT *args ) +{ + const WCHAR *path = get_ptr( &args ); + TEXTMETRICW *otm = get_ptr( &args ); + UINT *em_square = get_ptr( &args ); + WCHAR *face_name = get_ptr( &args ); + + return __wine_get_file_outline_text_metric( path, otm, em_square, face_name ); +} diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index 0521ad900d8..121b0701538 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -417,6 +417,9 @@ SYSCALL_ENTRY( NtUserWaitForInputIdle ) \ SYSCALL_ENTRY( NtUserWaitMessage ) \ SYSCALL_ENTRY( NtUserWindowFromDC ) \ - SYSCALL_ENTRY( NtUserWindowFromPoint ) + SYSCALL_ENTRY( NtUserWindowFromPoint ) \ + SYSCALL_ENTRY( __wine_get_file_outline_text_metric ) \ + SYSCALL_ENTRY( __wine_get_icm_profile ) \ + SYSCALL_ENTRY( __wine_send_input ) #endif /* __WOW64WIN_SYSCALL_H */ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 627de08b777..7c9a973b2a5 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -4342,3 +4342,9 @@ NTSTATUS WINAPI wow64_NtUserDisplayConfigGetDeviceInfo( UINT *args ) return NtUserDisplayConfigGetDeviceInfo( packet ); } + +NTSTATUS WINAPI wow64___wine_send_input( UINT *args ) +{ + ERR( "not supported\n "); + return 0; +} diff --git a/include/ntgdi.h b/include/ntgdi.h index 1ac8e0110e2..55c6739a54f 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -483,8 +483,7 @@ NTSTATUS WINAPI NtGdiDdDDISetQueuedLimit( D3DKMT_SETQUEUEDLIMIT *desc ); NTSTATUS WINAPI NtGdiDdDDISetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *desc ); /* Wine extensions */ -extern BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, - WCHAR *filename ); +BOOL WINAPI __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ); BOOL WINAPI __wine_get_file_outline_text_metric( const WCHAR *path, TEXTMETRICW *otm, UINT *em_square, WCHAR *face_name ); diff --git a/include/ntuser.h b/include/ntuser.h index 28ce230334a..be040682e96 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -1527,4 +1527,7 @@ static inline BOOL NtUserShowOwnedPopups( HWND hwnd, BOOL show ) return NtUserCallHwndParam( hwnd, show, NtUserCallHwndParam_ShowOwnedPopups ); } +/* Wine extensions */ +BOOL WINAPI __wine_send_input( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ); + #endif /* _NTUSER_ */ diff --git a/include/winuser.h b/include/winuser.h index d1e03461d07..1d0455c8adf 100644 --- a/include/winuser.h +++ b/include/winuser.h @@ -4765,7 +4765,6 @@ static inline BOOL WINAPI SetRectEmpty(LPRECT rect) WORD WINAPI SYSTEM_KillSystemTimer( WORD ); #ifdef __WINESRC__ -WINUSERAPI BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ); /* Uxtheme hook functions and struct */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2922
This merge request was approved by Huw Davies. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2922
participants (3)
-
Huw Davies (@huw) -
Jacek Caban -
Jacek Caban (@jacek)