mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 14:38:13 +02:00
Win32: Load system DLLs from System32
This commit is contained in:
parent
995c09ba67
commit
864ede8e1a
4 changed files with 35 additions and 2 deletions
|
|
@ -137,8 +137,9 @@ public:
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||
#endif
|
||||
HMODULE d2d1 = _cairo_win32_load_library_from_system32 (L"d2d1.dll");
|
||||
D2D1CreateFactoryFunc createD2DFactory = (D2D1CreateFactoryFunc)
|
||||
GetProcAddress(LoadLibraryW(L"d2d1.dll"), "D2D1CreateFactory");
|
||||
GetProcAddress(d2d1, "D2D1CreateFactory");
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -83,8 +83,9 @@ public:
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||
#endif
|
||||
HMODULE dwrite = _cairo_win32_load_library_from_system32 (L"dwrite.dll");
|
||||
DWriteCreateFactoryFunc createDWriteFactory = (DWriteCreateFactoryFunc)
|
||||
GetProcAddress(LoadLibraryW(L"dwrite.dll"), "DWriteCreateFactory");
|
||||
GetProcAddress(dwrite, "DWriteCreateFactory");
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -237,6 +237,9 @@ _cairo_win32_scaled_font_is_bitmap (cairo_scaled_font_t *scaled_font);
|
|||
cairo_public BYTE
|
||||
cairo_win32_get_system_text_quality (void);
|
||||
|
||||
HMODULE
|
||||
_cairo_win32_load_library_from_system32 (const wchar_t *name);
|
||||
|
||||
#if CAIRO_HAS_DWRITE_FONT
|
||||
|
||||
cairo_int_status_t
|
||||
|
|
|
|||
|
|
@ -79,6 +79,34 @@ _cairo_win32_print_api_error (const char *context, const char *api)
|
|||
return _cairo_error (CAIRO_STATUS_WIN32_GDI_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* _cairo_win32_load_library_from_system32:
|
||||
* @name: name of the module to load from System32
|
||||
*
|
||||
* Helper function to load system modules in the System32
|
||||
* folder.
|
||||
*
|
||||
* Return value: An module HANDLE, NULL on error.
|
||||
**/
|
||||
HMODULE
|
||||
_cairo_win32_load_library_from_system32 (const wchar_t *name)
|
||||
{
|
||||
HMODULE module_handle;
|
||||
|
||||
module_handle = LoadLibraryExW (name, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||
if (module_handle == NULL) {
|
||||
DWORD code = GetLastError();
|
||||
if (code == ERROR_INVALID_PARAMETER) {
|
||||
/* Support for flag LOAD_LIBRARY_SEARCH_SYSTEM32 was backported
|
||||
* to Windows Vista / 7 with Update KB2533623. If the flag is
|
||||
* not supported, simply use LoadLibrary */
|
||||
return LoadLibraryW (name);
|
||||
}
|
||||
}
|
||||
|
||||
return module_handle;
|
||||
}
|
||||
|
||||
#if CAIRO_MUTEX_IMPL_WIN32
|
||||
|
||||
static void NTAPI
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue