Commit c4f4b01b authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

gdi32: GetCharABCWidthsW should not crash on a NULL handle.

parent 1bf5e2da
......@@ -2330,6 +2330,8 @@ BOOL WINAPI GetCharABCWidthsW( HDC hdc, UINT firstChar, UINT lastChar,
unsigned int i;
BOOL ret = FALSE;
if (!dc) return FALSE;
if(dc->gdiFont)
ret = WineEngGetCharABCWidths( dc->gdiFont, firstChar, lastChar, abc );
else
......
......@@ -323,6 +323,18 @@ static void test_GdiGetCharDimensions(void)
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();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment