Skip to content

Commit

Permalink
mlang: Implement GetGlobalFontLinkObject.
Browse files Browse the repository at this point in the history
  • Loading branch information
tati-frog authored and julliard committed Feb 12, 2024
1 parent 6360992 commit 8293074
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
21 changes: 19 additions & 2 deletions dlls/mlang/mlang.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(mlang);

#include "initguid.h"

static INIT_ONCE font_link_global_init_once = INIT_ONCE_STATIC_INIT;
static IUnknown *font_link_global = NULL;

static HRESULT MultiLanguage_create(IUnknown *pUnkOuter, LPVOID *ppObj);
static HRESULT MLangConvertCharset_create(IUnknown *outer, void **obj);
static HRESULT EnumRfc1766_create(LANGID LangId, IEnumRfc1766 **ppEnum);
Expand Down Expand Up @@ -3882,11 +3885,25 @@ HRESULT WINAPI DllCanUnloadNow(void)
return dll_count == 0 ? S_OK : S_FALSE;
}

static BOOL WINAPI allocate_font_link_cb(PINIT_ONCE init_once, PVOID args, PVOID *context)
{
return SUCCEEDED(MultiLanguage_create(NULL, (void**)&font_link_global));
}

HRESULT WINAPI GetGlobalFontLinkObject(void **unknown)
{
TRACE("%p\n", unknown);

if (!unknown) return E_INVALIDARG;

FIXME("%p: stub\n", unknown);
if (!InitOnceExecuteOnce(&font_link_global_init_once, allocate_font_link_cb, NULL, NULL))
{
ERR("Failed to create global font link object.\n");
return E_FAIL;
}

return S_FALSE;
IUnknown_AddRef(font_link_global);
*unknown = font_link_global;

return S_OK;
}
8 changes: 4 additions & 4 deletions dlls/mlang/tests/mlang.c
Original file line number Diff line number Diff line change
Expand Up @@ -2306,18 +2306,18 @@ static void test_GetGlobalFontLinkObject(void)

unknown = (void *)0xdeadbeef;
ret = GetGlobalFontLinkObject(&unknown);
todo_wine {
ok(ret == S_OK, "expected S_OK got %#lx\n", ret);
ok(unknown != NULL && unknown != (void *)0xdeadbeef,
"GetGlobalFontLinkObject() returned %p\n", unknown);
if (unknown == (void *)0xdeadbeef || !unknown) return;
}

ret = IUnknown_QueryInterface((IUnknown*)unknown, &IID_IMLangFontLink2, (void**)&IMLFL2);
ok(ret == E_NOINTERFACE, "expected E_NOINTERFACE got %#lx\n", ret);
todo_wine ok(ret == E_NOINTERFACE, "expected E_NOINTERFACE got %#lx\n", ret);
if (ret == S_OK) IMLangFontLink2_Release(IMLFL2);

ret = IUnknown_QueryInterface((IUnknown*)unknown, &IID_IMultiLanguage, (void**)&IML);
ok(ret == E_NOINTERFACE, "expected E_NOINTERFACE got %#lx\n", ret);
todo_wine ok(ret == E_NOINTERFACE, "expected E_NOINTERFACE got %#lx\n", ret);
if (ret == S_OK) IMultiLanguage_Release(IML);

ret = IUnknown_QueryInterface((IUnknown*)unknown, &IID_IMLangFontLink, (void**)&IMLFL);
ok(ret == S_OK, "expected S_OK got %#lx\n", ret);
Expand Down

0 comments on commit 8293074

Please sign in to comment.