From: Rémi Bernon rbernon@codeweavers.com
--- dlls/opengl32/make_opengl | 2 +- dlls/opengl32/unix_wgl.c | 28 +++++++++++++++------------- dlls/opengl32/unixlib.h | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 7d906ae43dd..4c2b2f77167 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -1088,7 +1088,7 @@ print OUT " UINT32 type;\n"; print OUT " UINT32 id;\n"; print OUT " UINT32 severity;\n"; print OUT " UINT32 length;\n"; -print OUT " const char *message;\n"; +print OUT " char message[1];\n"; print OUT "};\n\n";
print OUT "#define UNIX_CALL( func, params ) WINE_UNIX_CALL( unix_ ## func, params )\n\n"; diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index c7d380d894b..c5c584fc848 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -898,18 +898,11 @@ static BOOL wrap_wglSetPbufferAttribARB( HPBUFFERARB handle, const int *attribs static void gl_debug_message_callback( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *user ) { - struct wine_gl_debug_message_params params = - { - .source = source, - .type = type, - .id = id, - .severity = severity, - .length = length, - .message = message, - }; + struct wine_gl_debug_message_params *params; void *ret_ptr; ULONG ret_len; struct wgl_handle *ptr = (struct wgl_handle *)user; + UINT len = strlen( message ) + 1, size;
if (!ptr->u.context->debug_callback) return; if (!NtCurrentTeb()) @@ -919,11 +912,20 @@ static void gl_debug_message_callback( GLenum source, GLenum type, GLuint id, GL return; }
- params.debug_callback = ptr->u.context->debug_callback; - params.debug_user = ptr->u.context->debug_user; - - KeUserModeCallback( NtUserCallOpenGLDebugMessageCallback, ¶ms, sizeof(params), + size = offsetof(struct wine_gl_debug_message_params, message[len] ); + if (!(params = malloc( size ))) return; + params->debug_callback = ptr->u.context->debug_callback; + params->debug_user = ptr->u.context->debug_user; + params->source = source; + params->type = type; + params->id = id; + params->severity = severity; + params->length = length; + memcpy( params->message, message, len ); + + KeUserModeCallback( NtUserCallOpenGLDebugMessageCallback, params, size, &ret_ptr, &ret_len ); + free( params ); }
static void wrap_glDebugMessageCallback( TEB *teb, GLDEBUGPROC callback, const void *user ) diff --git a/dlls/opengl32/unixlib.h b/dlls/opengl32/unixlib.h index 900932ff8ce..46b081e0b18 100644 --- a/dlls/opengl32/unixlib.h +++ b/dlls/opengl32/unixlib.h @@ -28386,7 +28386,7 @@ struct wine_gl_debug_message_params UINT32 id; UINT32 severity; UINT32 length; - const char *message; + char message[1]; };
#define UNIX_CALL( func, params ) WINE_UNIX_CALL( unix_ ## func, params )