Fix DirectWrite font module init error handling

This commit is contained in:
Brad Hughes 2016-03-02 16:23:45 -05:00
parent ad6aaa81a9
commit 028b4c5b21
2 changed files with 15 additions and 2 deletions

View file

@ -665,9 +665,15 @@ public:
{
HRESULT result;
osd_printf_verbose("FontProvider: Initializing DirectWrite\n");
// Make sure we can initialize our api functions
HR_RET1(m_pfnD2D1CreateFactory.initialize());
HR_RET1(m_pfnDWriteCreateFactory.initialize());
if (m_pfnD2D1CreateFactory.initialize()
|| m_pfnDWriteCreateFactory.initialize())
{
osd_printf_error("ERROR: FontProvider: Failed to load DirectWrite functions.\n");
return -1;
}
// Create a Direct2D factory.
HR_RET1(m_pfnD2D1CreateFactory(
@ -692,6 +698,7 @@ public:
__uuidof(IWICImagingFactory),
(void**)&m_wicFactory));
osd_printf_verbose("FontProvider: DirectWrite initialized successfully.\n");
return 0;
}

View file

@ -187,14 +187,20 @@ int lazy_loaded_function::initialize()
}
if (m_module == NULL)
{
osd_printf_verbose("Could not find DLL to dynamically link function %s.\n", m_name.c_str());
return ERROR_DLL_NOT_FOUND;
}
}
if (m_pfn == nullptr)
{
m_pfn = GetProcAddress(m_module, m_name.c_str());
if (m_pfn == nullptr)
{
osd_printf_verbose("Could not find function address to dynamically link function %s.\n", m_name.c_str());
return ERROR_NOT_FOUND;
}
}
m_initialized = true;