Commit b26d1278 authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Return a proper NTSTATUS in all user callbacks.

parent 621bcd0d
......@@ -2583,9 +2583,11 @@ HWND create_window16( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE instance,
}
static void WINAPI User16CallFreeIcon( ULONG *param, ULONG size )
static NTSTATUS WINAPI User16CallFreeIcon( void *args, ULONG size )
{
ULONG *param = args;
GlobalFree16( LOWORD(*param) );
return STATUS_SUCCESS;
}
......
......@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "user_private.h"
#include "controls.h"
#include "wine/debug.h"
......@@ -268,7 +270,7 @@ static void load_uxtheme(void)
/***********************************************************************
* User32InitBuiltinClasses
*/
BOOL WINAPI User32InitBuiltinClasses( const struct win_hook_params *params, ULONG size )
NTSTATUS WINAPI User32InitBuiltinClasses( void *args, ULONG size )
{
DWORD layout;
......@@ -276,7 +278,7 @@ BOOL WINAPI User32InitBuiltinClasses( const struct win_hook_params *params, ULON
/* Load uxtheme.dll so that standard scrollbars and dialogs are hooked for theming support */
load_uxtheme();
return TRUE;
return STATUS_SUCCESS;
}
......
......@@ -432,12 +432,14 @@ HWINEVENTHOOK WINAPI SetWinEventHook(DWORD event_min, DWORD event_max,
return NtUserSetWinEventHook( event_min, event_max, inst, &str, proc, pid, tid, flags );
}
BOOL WINAPI User32CallWinEventHook( const struct win_event_hook_params *params, ULONG size )
NTSTATUS WINAPI User32CallWinEventHook( void *args, ULONG size )
{
const struct win_event_hook_params *params = args;
WINEVENTPROC proc = params->proc;
HMODULE free_module = 0;
if (params->module[0] && !(proc = get_hook_proc( proc, params->module, &free_module ))) return FALSE;
if (params->module[0] && !(proc = get_hook_proc( proc, params->module, &free_module )))
return STATUS_INVALID_PARAMETER;
TRACE_(relay)( "\1Call winevent hook proc %p (hhook=%p,event=%lx,hwnd=%p,object_id=%lx,child_id=%lx,tid=%04lx,time=%lx)\n",
proc, params->handle, params->event, params->hwnd, params->object_id,
......@@ -451,7 +453,7 @@ BOOL WINAPI User32CallWinEventHook( const struct win_event_hook_params *params,
params->child_id, params->tid, params->time );
if (free_module) FreeLibrary( free_module );
return TRUE;
return STATUS_SUCCESS;
}
NTSTATUS WINAPI User32CallWindowsHook( void *args, ULONG size )
......
......@@ -112,7 +112,7 @@ static NTSTATUS WINAPI User32DrawNonClientButton( const struct draw_non_client_b
{
user_api->pNonClientButtonDraw( params->hwnd, params->hdc, params->type, params->rect,
params->down, params->grayed );
return 0;
return STATUS_SUCCESS;
}
static NTSTATUS WINAPI User32DrawScrollBar( const struct draw_scroll_bar_params *params, ULONG size )
......@@ -122,7 +122,7 @@ static NTSTATUS WINAPI User32DrawScrollBar( const struct draw_scroll_bar_params
&params->tracking_info, params->arrows, params->interior,
&rect, params->enable_flags, params->arrow_size, params->thumb_pos,
params->thumb_size, params->vertical );
return 0;
return STATUS_SUCCESS;
}
static NTSTATUS WINAPI User32DrawText( void *args, ULONG size )
......@@ -136,15 +136,20 @@ static NTSTATUS WINAPI User32DrawText( void *args, ULONG size )
return NtCallbackReturn( &result, sizeof(result), STATUS_SUCCESS );
}
static NTSTATUS WINAPI User32ImmProcessKey( const struct imm_process_key_params *params, ULONG size )
static NTSTATUS WINAPI User32ImmProcessKey( void *args, ULONG size )
{
return ImmProcessKey( params->hwnd, params->hkl, params->vkey, params->key_data, 0 );
const struct imm_process_key_params *params = args;
if (ImmProcessKey( params->hwnd, params->hkl, params->vkey, params->key_data, 0 ))
return STATUS_SUCCESS;
return STATUS_INVALID_PARAMETER;
}
static NTSTATUS WINAPI User32ImmTranslateMessage( const struct imm_translate_message_params *params,
ULONG size )
static NTSTATUS WINAPI User32ImmTranslateMessage( void *args, ULONG size )
{
return ImmTranslateMessage( params->hwnd, params->msg, params->wparam, params->key_data );
const struct imm_translate_message_params *params = args;
if (ImmTranslateMessage( params->hwnd, params->msg, params->wparam, params->key_data ))
return STATUS_SUCCESS;
return STATUS_INVALID_PARAMETER;
}
static NTSTATUS WINAPI User32LoadImage( void *args, ULONG size )
......@@ -168,7 +173,7 @@ static NTSTATUS WINAPI User32FreeCachedClipboardData( const struct free_cached_d
ULONG size )
{
free_cached_data( params->format, params->handle );
return 0;
return STATUS_SUCCESS;
}
static NTSTATUS WINAPI User32PostDDEMessage( const struct post_dde_message_params *params, ULONG size )
......@@ -181,7 +186,7 @@ static NTSTATUS WINAPI User32RenderSsynthesizedFormat( const struct render_synth
ULONG size )
{
render_synthesized_format( params->format, params->from );
return 0;
return STATUS_SUCCESS;
}
static NTSTATUS WINAPI User32LoadDriver( void *args, ULONG size )
......
......@@ -82,11 +82,11 @@ extern ATOM get_class_info( HINSTANCE instance, const WCHAR *name, WNDCLASSEXW *
/* kernel callbacks */
NTSTATUS WINAPI User32CallEnumDisplayMonitor( void *args, ULONG size );
BOOL WINAPI User32CallSendAsyncCallback( const struct send_async_params *params, ULONG size );
BOOL WINAPI User32CallWinEventHook( const struct win_event_hook_params *params, ULONG size );
BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size );
NTSTATUS WINAPI User32CallSendAsyncCallback( void *args, ULONG size );
NTSTATUS WINAPI User32CallWinEventHook( void *args, ULONG size );
NTSTATUS WINAPI User32CallWindowProc( void *args, ULONG size );
NTSTATUS WINAPI User32CallWindowsHook( void *args, ULONG size );
BOOL WINAPI User32InitBuiltinClasses( const struct win_hook_params *params, ULONG size );
NTSTATUS WINAPI User32InitBuiltinClasses( void *args, ULONG size );
/* message spy definitions */
......
......@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "user_private.h"
#include "controls.h"
#include "dbt.h"
......@@ -802,8 +804,9 @@ void unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, vo
*lparam = (LPARAM)buffer;
}
BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size )
NTSTATUS WINAPI User32CallWindowProc( void *args, ULONG size )
{
struct win_proc_params *params = args;
size_t packed_size = 0;
void *buffer = NULL;
LRESULT result;
......@@ -824,15 +827,16 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size )
{
LRESULT *result_ptr = (LRESULT *)buffer - 1;
*result_ptr = result;
return NtCallbackReturn( result_ptr, sizeof(*result_ptr) + packed_size, TRUE );
return NtCallbackReturn( result_ptr, sizeof(*result_ptr) + packed_size, STATUS_SUCCESS );
}
return NtCallbackReturn( &result, sizeof(result), TRUE );
return NtCallbackReturn( &result, sizeof(result), STATUS_SUCCESS );
}
BOOL WINAPI User32CallSendAsyncCallback( const struct send_async_params *params, ULONG size )
NTSTATUS WINAPI User32CallSendAsyncCallback( void *args, ULONG size )
{
const struct send_async_params *params = args;
params->callback( params->hwnd, params->msg, params->data, params->result );
return TRUE;
return STATUS_SUCCESS;
}
/**********************************************************************
......
......@@ -1362,8 +1362,7 @@ static BOOL draw_frame_caption( HDC dc, RECT *r, UINT flags )
return TRUE;
}
BOOL draw_menu_button( HWND hwnd, HDC dc, RECT *r, enum NONCLIENT_BUTTON_TYPE type, BOOL down,
BOOL grayed )
void draw_menu_button( HWND hwnd, HDC dc, RECT *r, enum NONCLIENT_BUTTON_TYPE type, BOOL down, BOOL grayed )
{
struct draw_non_client_button_params params;
void *ret_ptr;
......@@ -1375,7 +1374,7 @@ BOOL draw_menu_button( HWND hwnd, HDC dc, RECT *r, enum NONCLIENT_BUTTON_TYPE ty
params.rect = *r;
params.down = down;
params.grayed = grayed;
return KeUserModeCallback( NtUserDrawNonClientButton, &params, sizeof(params), &ret_ptr, &ret_len );
KeUserModeCallback( NtUserDrawNonClientButton, &params, sizeof(params), &ret_ptr, &ret_len );
}
BOOL draw_frame_menu( HDC dc, RECT *r, UINT flags )
......
......@@ -614,7 +614,7 @@ BOOL WINAPI ImmProcessKey( HWND hwnd, HKL hkl, UINT vkey, LPARAM key_data, DWORD
{ .hwnd = hwnd, .hkl = hkl, .vkey = vkey, .key_data = key_data };
void *ret_ptr;
ULONG ret_len;
return KeUserModeCallback( NtUserImmProcessKey, &params, sizeof(params), &ret_ptr, &ret_len );
return !KeUserModeCallback( NtUserImmProcessKey, &params, sizeof(params), &ret_ptr, &ret_len );
}
BOOL WINAPI ImmTranslateMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM key_data )
......@@ -623,6 +623,5 @@ BOOL WINAPI ImmTranslateMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM key_
{ .hwnd = hwnd, .msg = msg, .wparam = wparam, .key_data = key_data };
void *ret_ptr;
ULONG ret_len;
return KeUserModeCallback( NtUserImmTranslateMessage, &params, sizeof(params),
&ret_ptr, &ret_len );
return !KeUserModeCallback( NtUserImmTranslateMessage, &params, sizeof(params), &ret_ptr, &ret_len );
}
......@@ -63,7 +63,7 @@ extern void register_window_surface( struct window_surface *old,
extern LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
BOOL ansi );
extern LRESULT desktop_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam );
extern BOOL draw_menu_button( HWND hwnd, HDC dc, RECT *r, enum NONCLIENT_BUTTON_TYPE, BOOL down, BOOL grayed );
extern void draw_menu_button( HWND hwnd, HDC dc, RECT *r, enum NONCLIENT_BUTTON_TYPE, BOOL down, BOOL grayed );
extern BOOL draw_frame_menu( HDC dc, RECT *r, UINT flags );
extern BOOL draw_nc_sys_button( HWND hwnd, HDC hdc, BOOL down );
extern BOOL draw_rect_edge( HDC hdc, RECT *rc, UINT uType, UINT uFlags, UINT width );
......
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