gdi32: GetCharABCWidthsW should not crash on a NULL handle.

This commit is contained in:
Hans Leidekker 2006-04-08 22:27:34 +02:00 committed by Alexandre Julliard
parent 1bf5e2da0a
commit c4f4b01b05
2 changed files with 15 additions and 0 deletions

View File

@ -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

View File

@ -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();
}