From: Haoyang Chen chenhaoyang@kylinos.cn
--- dlls/mlang/mlang.c | 5 +++++ dlls/mlang/tests/mlang.c | 9 +++++++++ 2 files changed, 14 insertions(+)
diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c index 9f7d1159e57..2606e24a90d 100644 --- a/dlls/mlang/mlang.c +++ b/dlls/mlang/mlang.c @@ -3471,6 +3471,11 @@ static HRESULT WINAPI fnIMLangFontLink2_GetFontCodePages(IMLangFontLink2 *iface,
TRACE("(%p)->(%p %p %p)\n", This, hdc, hfont, codepages);
+ if (codepages) *codepages = 0; + + if (!hdc || !hfont) + return E_FAIL; + old_font = SelectObject(hdc, hfont); GetTextCharsetInfo(hdc, &fontsig, 0); SelectObject(hdc, old_font); diff --git a/dlls/mlang/tests/mlang.c b/dlls/mlang/tests/mlang.c index 42847406eb8..17f73211082 100644 --- a/dlls/mlang/tests/mlang.c +++ b/dlls/mlang/tests/mlang.c @@ -2809,6 +2809,15 @@ static void test_MapFont(IMLangFontLink *font_link, IMLangFontLink2 *font_link2) ok((codepages & (~font_codepages)) != 0 && (codepages & font_codepages) != 0, "code pages of font is incorrect\n");
+ font_codepages = 1; + ret = IMLangFontLink_GetFontCodePages(font_link, NULL, font1, &font_codepages); + ok(ret == E_FAIL && !font_codepages, "expected E_FAIL, but got: %lx, font_codepages:%lx \n", + ret, font_codepages); + font_codepages = 2; + ret = IMLangFontLink_GetFontCodePages(font_link, hdc, NULL, &font_codepages); + ok(ret == E_FAIL && !font_codepages, "expected E_FAIL, but got: %lx, font_codepages:%lx \n", + ret, font_codepages); + IMLangFontLink_ResetFontMapping(font_link); IMLangFontLink2_ResetFontMapping(font_link2); ReleaseDC(NULL, hdc);