Commit f309721d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use __wine_unix_call interface for Unix library.

parent e0a934d0
EXTRADEFS = -D_GDI32_
MODULE = gdi32.dll
UNIXLIB = gdi32.so
IMPORTLIB = gdi32
IMPORTS = advapi32
EXTRAINCL = $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS)
EXTRALIBS = $(CARBON_LIBS) $(APPKIT_LIBS) $(PTHREAD_LIBS)
EXTRALIBS = $(CARBON_LIBS) $(APPKIT_LIBS) $(PTHREAD_LIBS) -lm
DELAYIMPORTS = setupapi
C_SRCS = \
......
......@@ -27,9 +27,9 @@
#include "ntgdi_private.h"
#include "dibdrv.h"
#include "wine/unixlib.h"
#include "wine/wgl.h"
#include "wine/wgl_driver.h"
#include "wine/exception.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(dib);
......@@ -232,7 +232,7 @@ DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bit
dst_dib.funcs->convert_to( &dst_dib, &src_dib, &src->visrect, FALSE );
ret = TRUE;
}
__EXCEPT_PAGE_FAULT
__EXCEPT
{
WARN( "invalid bits pointer %p\n", src_bits );
ret = FALSE;
......
......@@ -40,7 +40,8 @@
#include "winternl.h"
#include "winreg.h"
#include "ntgdi_private.h"
#include "wine/exception.h"
#include "wine/unixlib.h"
#include "wine/rbtree.h"
#include "wine/debug.h"
......@@ -528,17 +529,19 @@ static pthread_mutex_t font_lock = PTHREAD_MUTEX_INITIALIZER;
static void get_fonts_data_dir_path( const WCHAR *file, WCHAR *path )
{
SIZE_T len;
static const WCHAR winedatadirW[] = {'W','I','N','E','D','A','T','A','D','I','R'};
static const WCHAR winebuilddirW[] = {'W','I','N','E','B','U','I','L','D','D','I','R'};
const char *dir;
ULONG len = MAX_PATH;
if (!RtlQueryEnvironmentVariable( NULL, winedatadirW, ARRAYSIZE(winedatadirW),
path, MAX_PATH, &len ))
asciiz_to_unicode( path + len, "\\" WINE_FONT_DIR "\\" );
else if (!RtlQueryEnvironmentVariable( NULL, winebuilddirW, ARRAYSIZE(winebuilddirW),
path, MAX_PATH, &len ))
asciiz_to_unicode( path + len, "\\fonts\\" );
if ((dir = ntdll_get_data_dir()))
{
wine_unix_to_nt_file_name( dir, path, &len );
asciiz_to_unicode( path + len - 1, "\\" WINE_FONT_DIR "\\" );
}
else if ((dir = ntdll_get_build_dir()))
{
wine_unix_to_nt_file_name( dir, path, &len );
asciiz_to_unicode( path + len - 1, "\\fonts\\" );
}
if (file) lstrcatW( path, file );
}
......@@ -6456,7 +6459,7 @@ HANDLE WINAPI NtGdiAddFontMemResourceEx( void *ptr, DWORD size, void *dv, ULONG
{
*count = num_fonts;
}
__EXCEPT_PAGE_FAULT
__EXCEPT
{
WARN( "page fault while writing to *count (%p)\n", count );
NtGdiRemoveFontMemResourceEx( ret );
......
......@@ -38,6 +38,7 @@
#include "ntgdi_private.h"
#include "wine/debug.h"
#include "wine/unixlib.h"
WINE_DEFAULT_DEBUG_CHANNEL(gdi);
......@@ -1250,13 +1251,11 @@ static struct unix_funcs unix_funcs =
__wine_set_visible_region,
};
NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out )
NTSTATUS initialize( void *args )
{
pthread_mutexattr_t attr;
unsigned int dpi;
if (reason != DLL_PROCESS_ATTACH) return 0;
pthread_mutexattr_init( &attr );
pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE );
pthread_mutex_init( &gdi_lock, &attr );
......@@ -1268,7 +1267,12 @@ NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *p
dpi = font_init();
init_stock_objects( dpi );
user_callbacks = ptr_in;
*(struct unix_funcs **)ptr_out = &unix_funcs;
user_callbacks = *(const struct user_callbacks **)args;
*(const struct unix_funcs **)args = &unix_funcs;
return 0;
}
const unixlib_entry_t __wine_unix_call_funcs[] =
{
initialize
};
......@@ -20,11 +20,12 @@
#include "gdi_private.h"
#include "win32u_private.h"
#include "wine/unixlib.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(gdi);
static struct unix_funcs *unix_funcs;
static const struct unix_funcs *unix_funcs;
INT WINAPI NtGdiAbortDoc( HDC hdc )
{
......@@ -1151,5 +1152,14 @@ static const struct user_callbacks user_callbacks =
BOOL wrappers_init(void)
{
return !__wine_init_unix_lib( gdi32_module, DLL_PROCESS_ATTACH, &user_callbacks, &unix_funcs );
unixlib_handle_t handle;
const void *args = &user_callbacks;
if (NtQueryVirtualMemory( GetCurrentProcess(), gdi32_module, MemoryWineUnixFuncs,
&handle, sizeof(handle), NULL ))
return FALSE;
if (__wine_unix_call( handle, 0, &args )) return FALSE;
unix_funcs = args;
return TRUE;
}
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