Commit ad663360 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

gdiplus: GdipGetFamilyName() should not crash when given a NULL name.

It used to crash on Windows XP and Vista but does not since Windows 7. Signed-off-by: 's avatarFrancois Gouget <fgouget@codeweavers.com> Signed-off-by: 's avatarEsme Povirk <esme@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 261956b6
......@@ -798,17 +798,20 @@ GpStatus WINGDIPAPI GdipCloneFontFamily(GpFontFamily *family, GpFontFamily **clo
* FAILURE: InvalidParameter if family is NULL
*
* NOTES
* If name is a NULL ptr, then both XP and Vista will crash (so we do as well)
* If name is NULL, XP and Vista crash but not Windows 7+
*/
GpStatus WINGDIPAPI GdipGetFamilyName (GDIPCONST GpFontFamily *family,
WCHAR *name, LANGID language)
{
static int lang_fixme;
TRACE("%p, %p, %d\n", family, name, language);
if (family == NULL)
return InvalidParameter;
TRACE("%p, %p, %d\n", family, name, language);
if (name == NULL)
return Ok;
if (language != LANG_NEUTRAL && !lang_fixme++)
FIXME("No support for handling of multiple languages!\n");
......
......@@ -388,12 +388,9 @@ static void test_fontfamily (void)
expect (Ok, stat);
expect (0, lstrcmpiW(itsName, L"Tahoma"));
if (0)
{
/* Crashes on Windows XP SP2, Vista, and so Wine as well */
stat = GdipGetFamilyName (family, NULL, LANG_NEUTRAL);
expect (Ok, stat);
}
/* Crashes on Windows XP SP2 and Vista */
stat = GdipGetFamilyName (family, NULL, LANG_NEUTRAL);
expect (Ok, stat);
/* Make sure we don't read old data */
ZeroMemory (itsName, sizeof(itsName));
......
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