From: Torge Matthies tmatthies@codeweavers.com
Signed-off-by: Torge Matthies tmatthies@codeweavers.com --- dlls/opengl32/make_opengl | 14 +++++++++++++- dlls/opengl32/unix_thunks.c | 2 ++ dlls/opengl32/unix_wgl.c | 13 +++++++++++-- dlls/opengl32/unixlib.h | 10 ++++++++++ dlls/opengl32/wgl.c | 12 ++++++++---- dlls/wow64win/user.c | 8 -------- include/ntuser.h | 2 -- include/wine/wgl_driver.h | 2 +- 8 files changed, 45 insertions(+), 18 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index ad9def8dcec..2ac56d357df 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -793,10 +793,18 @@ print OUT "#define WIN32_NO_STATUS\n"; print OUT "#include "windef.h"\n"; print OUT "#include "winbase.h"\n"; print OUT "#include "winternl.h"\n"; -print OUT "#include "wingdi.h"\n\n"; +print OUT "#include "wingdi.h"\n"; +print OUT "#include "ntuser.h"\n\n"; print OUT "#include "wine/wgl.h"\n"; print OUT "#include "wine/unixlib.h"\n\n";
+print OUT "struct wine_gl_debug_message_params;\n\n"; + +print OUT "struct wglInit_params\n"; +print OUT "{\n"; +print OUT " BOOL (*WINAPI call_opengl_debug_message_callback)( void *args, ULONG len );\n"; +print OUT "};\n\n"; + foreach (sort keys %wgl_functions) { next if defined $manual_win_functions{$_}; @@ -815,6 +823,7 @@ foreach (sort keys %ext_functions)
print OUT "enum unix_funcs\n"; print OUT "{\n"; +print OUT " unix_wglInit,\n"; print OUT " unix_thread_attach,\n"; foreach (sort keys %wgl_functions) { @@ -836,6 +845,7 @@ print OUT "};\n\n"; print OUT "typedef void (WINAPI *gl_debug_cb)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar *, const void *);\n"; print OUT "struct wine_gl_debug_message_params\n"; print OUT "{\n"; +print OUT " struct user32_callback_params cbparams;\n"; print OUT " gl_debug_cb user_callback;\n"; print OUT " const void *user_data;\n"; print OUT "\n"; @@ -933,6 +943,7 @@ print OUT "#include "wingdi.h"\n\n"; print OUT "#include "unixlib.h"\n"; print OUT "#include "unix_private.h"\n\n";
+print OUT "extern NTSTATUS wgl_wglInit( void *args ) DECLSPEC_HIDDEN;\n"; print OUT "extern NTSTATUS thread_attach( void *args ) DECLSPEC_HIDDEN;\n"; foreach (sort keys %wgl_functions) { @@ -975,6 +986,7 @@ foreach (sort keys %ext_functions)
print OUT "const unixlib_entry_t __wine_unix_call_funcs[] =\n"; print OUT "{\n"; +print OUT " &wgl_wglInit,\n"; print OUT " &thread_attach,\n"; foreach (sort keys %wgl_functions) { diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index 7511621cf67..e6f5545d9a9 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -16,6 +16,7 @@ #include "unixlib.h" #include "unix_private.h"
+extern NTSTATUS wgl_wglInit( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS thread_attach( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wgl_wglCopyContext( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wgl_wglCreateContext( void *args ) DECLSPEC_HIDDEN; @@ -24148,6 +24149,7 @@ static NTSTATUS ext_wglSwapIntervalEXT( void *args )
const unixlib_entry_t __wine_unix_call_funcs[] = { + &wgl_wglInit, &thread_attach, &wgl_wglCopyContext, &wgl_wglCreateContext, diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 7a6b3bb0ca4..89424e45b0f 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -43,6 +43,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(wgl);
+static BOOL (*WINAPI call_opengl_debug_message_callback)( void *args, ULONG len ); + static pthread_mutex_t wgl_lock = PTHREAD_MUTEX_INITIALIZER;
/* handle management */ @@ -799,6 +801,7 @@ static void gl_debug_message_callback( GLenum source, GLenum type, GLuint id, GL { struct wine_gl_debug_message_params params = { + .cbparams = { .func = call_opengl_debug_message_callback, }, .source = source, .type = type, .id = id, @@ -813,8 +816,7 @@ static void gl_debug_message_callback( GLenum source, GLenum type, GLuint id, GL if (!(params.user_callback = ptr->u.context->debug_callback)) return; params.user_data = ptr->u.context->debug_user;
- KeUserModeCallback( NtUserCallOpenGLDebugMessageCallback, ¶ms, sizeof(params), - &ret_ptr, &ret_len ); + KeUserModeCallback( NtUserDispatchCallback, ¶ms.cbparams, sizeof(params), &ret_ptr, &ret_len ); }
static void WINAPI wrap_glDebugMessageCallback( GLDEBUGPROC callback, const void *userParam ) @@ -853,6 +855,13 @@ static void WINAPI wrap_glDebugMessageCallbackARB( GLDEBUGPROCARB callback, cons funcs->ext.p_glDebugMessageCallbackARB( gl_debug_message_callback, ptr ); }
+NTSTATUS wgl_wglInit( void *args ) +{ + struct wglInit_params *params = args; + call_opengl_debug_message_callback = params->call_opengl_debug_message_callback; + return STATUS_SUCCESS; +} + NTSTATUS wgl_wglCopyContext( void *args ) { struct wglCopyContext_params *params = args; diff --git a/dlls/opengl32/unixlib.h b/dlls/opengl32/unixlib.h index b76858a2e13..985f994027a 100644 --- a/dlls/opengl32/unixlib.h +++ b/dlls/opengl32/unixlib.h @@ -12,10 +12,18 @@ #include "winbase.h" #include "winternl.h" #include "wingdi.h" +#include "ntuser.h"
#include "wine/wgl.h" #include "wine/unixlib.h"
+struct wine_gl_debug_message_params; + +struct wglInit_params +{ + BOOL (*WINAPI call_opengl_debug_message_callback)( void *args, ULONG len ); +}; + struct wglCopyContext_params { HGLRC hglrcSrc; @@ -22293,6 +22301,7 @@ struct wglSwapIntervalEXT_params
enum unix_funcs { + unix_wglInit, unix_thread_attach, unix_wglCopyContext, unix_wglCreateContext, @@ -25339,6 +25348,7 @@ enum unix_funcs typedef void (WINAPI *gl_debug_cb)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar *, const void *); struct wine_gl_debug_message_params { + struct user32_callback_params cbparams; gl_debug_cb user_callback; const void *user_data;
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 274fd7d5333..f0b197bb628 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -857,8 +857,10 @@ GLint WINAPI glDebugEntry( GLint unknown1, GLint unknown2 ) return 0; }
-static BOOL WINAPI call_opengl_debug_message_callback( struct wine_gl_debug_message_params *params, ULONG size ) +static BOOL WINAPI call_opengl_debug_message_callback( void *args, ULONG len ) { + struct wine_gl_debug_message_params *params = + CONTAINING_RECORD( args, struct wine_gl_debug_message_params, cbparams ); params->user_callback( params->source, params->type, params->id, params->severity, params->length, params->message, params->user_data ); return TRUE; @@ -875,6 +877,9 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) switch(reason) { case DLL_PROCESS_ATTACH: + { + struct wglInit_params args = { (void*)call_opengl_debug_message_callback, }; + if ((status = NtQueryVirtualMemory( GetCurrentProcess(), hinst, MemoryWineUnixFuncs, &unixlib_handle, sizeof(unixlib_handle), NULL ))) { @@ -882,9 +887,8 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) return FALSE; }
- kernel_callback_table = NtCurrentTeb()->Peb->KernelCallbackTable; - kernel_callback_table[NtUserCallOpenGLDebugMessageCallback] = call_opengl_debug_message_callback; - /* fallthrough */ + return !UNIX_CALL( wglInit, &args ); + } case DLL_THREAD_ATTACH: if ((status = UNIX_CALL( thread_attach, NULL ))) { diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index ddb3966a0b0..6276e8d8e1d 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -1045,12 +1045,6 @@ static NTSTATUS WINAPI wow64_NtUserThunkLock( void *arg, ULONG size ) return dispatch_callback( NtUserThunkLock, arg, size ); }
-static NTSTATUS WINAPI wow64_NtUserCallOpenGLDebugMessageCallback( void *arg, ULONG size ) -{ - FIXME( "\n" ); - return 0; -} - static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst0( void *arg, ULONG size ) { return dispatch_callback( NtUserDriverCallbackFirst + 0, arg, size ); @@ -1127,8 +1121,6 @@ user_callback user_callbacks[] = /* win16 hooks */ wow64_NtUserCallFreeIcon, wow64_NtUserThunkLock, - /* OpenGL support */ - wow64_NtUserCallOpenGLDebugMessageCallback, /* Driver-specific callbacks */ wow64_NtUserDriverCallbackFirst0, wow64_NtUserDriverCallbackFirst1, diff --git a/include/ntuser.h b/include/ntuser.h index 1065b5e3e92..343d22bd9bd 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -51,8 +51,6 @@ enum /* win16 hooks */ NtUserCallFreeIcon, NtUserThunkLock, - /* OpenGL support */ - NtUserCallOpenGLDebugMessageCallback, /* Driver-specific callbacks */ NtUserDriverCallbackFirst, NtUserDriverCallbackLast = NtUserDriverCallbackFirst + 9, diff --git a/include/wine/wgl_driver.h b/include/wine/wgl_driver.h index 36b1f384ddf..24ade7399c7 100644 --- a/include/wine/wgl_driver.h +++ b/include/wine/wgl_driver.h @@ -7,7 +7,7 @@ #define WINE_GLAPI #endif
-#define WINE_WGL_DRIVER_VERSION 21 +#define WINE_WGL_DRIVER_VERSION 22
struct wgl_context; struct wgl_pbuffer;