gdi32: Correctly propagate the enumproc's return value.

This commit is contained in:
Huw Davies 2012-03-14 14:15:13 +00:00 committed by Alexandre Julliard
parent 1726427113
commit 41fb856961
2 changed files with 14 additions and 2 deletions

View File

@ -121,6 +121,7 @@ struct font_enum
LPARAM lpData;
BOOL unicode;
HDC hdc;
INT retval;
};
/*
@ -721,6 +722,7 @@ static INT CALLBACK FONT_EnumInstance( const LOGFONTW *plf, const TEXTMETRICW *p
ptm = (TEXTMETRICW *)&tmA;
}
ret = pfe->lpEnumFunc( plf, ptm, fType, pfe->lpData );
pfe->retval = ret;
}
return ret;
}
@ -745,10 +747,11 @@ static INT FONT_EnumFontFamiliesEx( HDC hDC, LPLOGFONTW plf, FONTENUMPROCW efpro
fe.lpData = lParam;
fe.unicode = unicode;
fe.hdc = hDC;
ret = physdev->funcs->pEnumFonts( physdev, plf, FONT_EnumInstance, (LPARAM)&fe );
fe.retval = 1;
ret = physdev->funcs->pEnumFonts( physdev, plf, FONT_EnumInstance, (LPARAM)&fe );
release_dc_ptr( dc );
}
return ret;
return ret ? fe.retval : 0;
}
/***********************************************************************

View File

@ -3756,6 +3756,11 @@ static INT CALLBACK enum_all_fonts_proc(const LOGFONT *elf, const TEXTMETRIC *nt
return 1;
}
static INT CALLBACK enum_with_magic_retval_proc(const LOGFONT *elf, const TEXTMETRIC *ntm, DWORD type, LPARAM lparam)
{
return lparam;
}
static void test_EnumFonts(void)
{
int ret;
@ -3777,6 +3782,10 @@ static void test_EnumFonts(void)
hdc = CreateCompatibleDC(0);
/* check that the enumproc's retval is returned */
ret = EnumFontFamilies(hdc, NULL, enum_with_magic_retval_proc, 0xcafe);
ok(ret == 0xcafe, "got %08x\n", ret);
ret = EnumFontFamilies(hdc, "Arial", enum_fonts_proc, (LPARAM)&lf);
ok(!ret, "font Arial is not enumerated\n");
ret = strcmp(lf.lfFaceName, "Arial");