Module: wine Branch: refs/heads/master Commit: c4f4b01b058d840c350581a58671d9f531d0c310 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=c4f4b01b058d840c350581a5...
Author: Hans Leidekker hans@it.vu.nl Date: Sat Apr 8 22:27:34 2006 +0200
gdi32: GetCharABCWidthsW should not crash on a NULL handle.
---
dlls/gdi/font.c | 2 ++ dlls/gdi/tests/font.c | 13 +++++++++++++ 2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/dlls/gdi/font.c b/dlls/gdi/font.c index ffebd7e..1e17d5a 100644 --- a/dlls/gdi/font.c +++ b/dlls/gdi/font.c @@ -2330,6 +2330,8 @@ BOOL WINAPI GetCharABCWidthsW( HDC hdc, unsigned int i; BOOL ret = FALSE;
+ if (!dc) return FALSE; + if(dc->gdiFont) ret = WineEngGetCharABCWidths( dc->gdiFont, firstChar, lastChar, abc ); else diff --git a/dlls/gdi/tests/font.c b/dlls/gdi/tests/font.c index 9ed33b7..ef0b9b2 100644 --- a/dlls/gdi/tests/font.c +++ b/dlls/gdi/tests/font.c @@ -323,6 +323,18 @@ static void test_GdiGetCharDimensions(vo DeleteDC(hdc); }
+static void test_GetCharABCWidthsW(void) +{ + BOOL ret; + ABC abc[1]; + typedef BOOL (WINAPI *fnGetCharABCWidthsW)(HDC hdc, UINT first, UINT last, LPABC abc); + fnGetCharABCWidthsW GetCharABCWidthsW = (fnGetCharABCWidthsW)GetProcAddress(LoadLibrary("gdi32"), "GetCharABCWidthsW"); + if (!GetCharABCWidthsW) return; + + ret = GetCharABCWidthsW(NULL, 'a', 'a', abc); + ok(!ret, "GetCharABCWidthsW should have returned FALSE\n"); +} + static void test_text_extents(void) { LOGFONTA lf; @@ -353,5 +365,6 @@ START_TEST(font) test_bitmap_font(); test_bitmap_font_metrics(); test_GdiGetCharDimensions(); + test_GetCharABCWidthsW(); test_text_extents(); }