Commit 730d462b authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

user32: Always use NtCallbackReturn to pass result from User32CallWindowsHook.

parent 8f168ea6
......@@ -457,9 +457,9 @@ BOOL WINAPI User32CallWindowsHook( struct win_hook_params *params, ULONG size )
HOOKPROC proc = params->proc;
const WCHAR *module = NULL;
HMODULE free_module = 0;
void *ret_lparam = NULL;
void *ret_ptr = NULL;
CBT_CREATEWNDW cbtc;
UINT ret_lparam_size = 0;
UINT ret_size = 0;
LRESULT ret;
if (size > sizeof(*params) + params->lparam_size)
......@@ -467,9 +467,9 @@ BOOL WINAPI User32CallWindowsHook( struct win_hook_params *params, ULONG size )
if (params->lparam_size)
{
ret_lparam = (void *)params->lparam;
ret_lparam_size = params->lparam_size;
params->lparam = (LPARAM)(params + 1);
ret_size = params->lparam_size;
ret_ptr = params + 1;
params->lparam = (LPARAM)ret_ptr;
if (params->id == WH_CBT && params->code == HCBT_CREATEWND)
{
......@@ -487,7 +487,7 @@ BOOL WINAPI User32CallWindowsHook( struct win_hook_params *params, ULONG size )
cbtc.hwndInsertAfter = HWND_TOP;
cbtc.lpcs = cs;
params->lparam = (LPARAM)&cbtc;
ret_lparam_size = sizeof(*cs);
ret_size = sizeof(*cs);
}
}
if (module && !(proc = get_hook_proc( proc, module, &free_module ))) return FALSE;
......@@ -496,9 +496,7 @@ BOOL WINAPI User32CallWindowsHook( struct win_hook_params *params, ULONG size )
params->prev_unicode, params->next_unicode );
if (free_module) FreeLibrary( free_module );
if (ret_lparam) memcpy( ret_lparam, params + 1, ret_lparam_size );
else if (ret_lparam_size) NtCallbackReturn( params + 1, ret_lparam_size, ret );
return ret;
return NtCallbackReturn( ret_ptr, ret_size, ret );
}
/***********************************************************************
......
......@@ -769,7 +769,7 @@ static NTSTATUS WINAPI wow64_NtUserCallWindowsHook( void *arg, ULONG size )
params32.id = params->id;
params32.code = params->code;
params32.wparam = params->wparam;
params32.lparam = lparam64_size ? 0 : params->lparam;
params32.lparam = params->lparam;
params32.prev_unicode = params->prev_unicode;
params32.next_unicode = params->next_unicode;
params32.lparam_size = hook_lparam_64to32( params32.id, params32.code, params + 1,
......
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