Commit 41fb8569 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

gdi32: Correctly propagate the enumproc's return value.

parent 17264271
......@@ -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;
}
/***********************************************************************
......
......@@ -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");
......
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