Jacek Caban : gdi32: Use NtGdiAddFontMemResourceEx for AddFontMemResourceEx.

Alexandre Julliard julliard at winehq.org
Wed Sep 1 15:45:10 CDT 2021


Module: wine
Branch: master
Commit: 8a68a9ee3193149c3f8825c31af7d5a6480f4ee4
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=8a68a9ee3193149c3f8825c31af7d5a6480f4ee4

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Sep  1 14:08:41 2021 +0200

gdi32: Use NtGdiAddFontMemResourceEx for AddFontMemResourceEx.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/font.c     | 19 ++++++++++---------
 dlls/gdi32/gdi32.spec |  2 +-
 dlls/gdi32/text.c     |  8 ++++++++
 include/ntgdi.h       |  3 +++
 4 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index ef57c4f9e49..99b018513d3 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -6286,15 +6286,16 @@ INT WINAPI AddFontResourceExW( LPCWSTR str, DWORD flags, PVOID pdv )
 }
 
 /***********************************************************************
- *           AddFontMemResourceEx    (GDI32.@)
+ *           NtGdiAddFontMemResourceEx    (win32u.@)
  */
-HANDLE WINAPI AddFontMemResourceEx( PVOID ptr, DWORD size, PVOID pdv, DWORD *pcFonts )
+HANDLE WINAPI NtGdiAddFontMemResourceEx( void *ptr, DWORD size, void *dv, ULONG dv_size,
+                                         DWORD *count )
 {
     HANDLE ret;
     DWORD num_fonts;
     void *copy;
 
-    if (!ptr || !size || !pcFonts)
+    if (!ptr || !size || !count)
     {
         SetLastError(ERROR_INVALID_PARAMETER);
         return NULL;
@@ -6320,12 +6321,12 @@ HANDLE WINAPI AddFontMemResourceEx( PVOID ptr, DWORD size, PVOID pdv, DWORD *pcF
 
     __TRY
     {
-        *pcFonts = num_fonts;
+        *count = num_fonts;
     }
     __EXCEPT_PAGE_FAULT
     {
-        WARN("page fault while writing to *pcFonts (%p)\n", pcFonts);
-        RemoveFontMemResourceEx( ret );
+        WARN( "page fault while writing to *count (%p)\n", count );
+        NtGdiRemoveFontMemResourceEx( ret );
         ret = 0;
     }
     __ENDTRY
@@ -6334,11 +6335,11 @@ HANDLE WINAPI AddFontMemResourceEx( PVOID ptr, DWORD size, PVOID pdv, DWORD *pcF
 }
 
 /***********************************************************************
- *           RemoveFontMemResourceEx    (GDI32.@)
+ *           NtGdiRemoveFontMemResourceEx    (win32u.@)
  */
-BOOL WINAPI RemoveFontMemResourceEx( HANDLE fh )
+BOOL WINAPI NtGdiRemoveFontMemResourceEx( HANDLE handle )
 {
-    FIXME("(%p) stub\n", fh);
+    FIXME( "(%p) stub\n", handle );
     return TRUE;
 }
 
diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec
index 0e5c83926f8..569468bc3c1 100644
--- a/dlls/gdi32/gdi32.spec
+++ b/dlls/gdi32/gdi32.spec
@@ -414,7 +414,7 @@
 @ stdcall RectInRegion(long ptr) NtGdiRectInRegion
 @ stdcall RectVisible(long ptr) NtGdiRectVisible
 @ stdcall Rectangle(long long long long long)
-@ stdcall RemoveFontMemResourceEx(ptr)
+@ stdcall RemoveFontMemResourceEx(ptr) NtGdiRemoveFontMemResourceEx
 @ stdcall RemoveFontResourceA(str)
 @ stdcall RemoveFontResourceExA(str long ptr)
 @ stdcall RemoveFontResourceExW(wstr long ptr)
diff --git a/dlls/gdi32/text.c b/dlls/gdi32/text.c
index 8cc6ec25353..227651f2afc 100644
--- a/dlls/gdi32/text.c
+++ b/dlls/gdi32/text.c
@@ -2283,3 +2283,11 @@ BOOL WINAPI GetFontResourceInfoW( const WCHAR *str, DWORD *size, void *buffer, D
     FIXME( "%s %p(%d) %p %d\n", debugstr_w(str), size, size ? *size : 0, buffer, type );
     return FALSE;
 }
+
+/***********************************************************************
+ *           AddFontMemResourceEx    (GDI32.@)
+ */
+HANDLE WINAPI AddFontMemResourceEx( void *ptr, DWORD size, void *dv, DWORD *count )
+{
+    return NtGdiAddFontMemResourceEx( ptr, size, dv, 0, count );
+}
diff --git a/include/ntgdi.h b/include/ntgdi.h
index a3cf54d785a..47777b3f129 100644
--- a/include/ntgdi.h
+++ b/include/ntgdi.h
@@ -208,6 +208,8 @@ struct font_fileinfo
 
 INT      WINAPI NtGdiAbortDoc( HDC hdc );
 BOOL     WINAPI NtGdiAbortPath( HDC hdc );
+HANDLE   WINAPI NtGdiAddFontMemResourceEx( void *ptr, DWORD size, void *dv, ULONG dv_size,
+                                           DWORD *count );
 BOOL     WINAPI NtGdiAlphaBlend( HDC hdc_dst, int x_dst, int y_dst, int width_dst, int height_dst,
                                  HDC hdc_src, int x_src, int y_src, int width_src, int height_src,
                                  BLENDFUNCTION blend_function, HANDLE xform );
@@ -348,6 +350,7 @@ BOOL     WINAPI NtGdiPtVisible( HDC hdc, INT x, INT y );
 BOOL     WINAPI NtGdiRectInRegion( HRGN hrgn, const RECT *rect );
 BOOL     WINAPI NtGdiRectVisible( HDC hdc, const RECT *rect );
 BOOL     WINAPI NtGdiRectangle( HDC hdc, INT left, INT top, INT right, INT bottom );
+BOOL     WINAPI NtGdiRemoveFontMemResourceEx( HANDLE handle );
 BOOL     WINAPI NtGdiResetDC( HDC hdc, const DEVMODEW *devmode, BOOL *banding,
                               DRIVER_INFO_2W *driver_info, void *dev );
 BOOL     WINAPI NtGdiResizePalette( HPALETTE palette, UINT count );




More information about the wine-cvs mailing list