2003-05-18 17:16:18 +00:00
|
|
|
/*
|
|
|
|
* ReactOS W32 Subsystem
|
|
|
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
2005-01-06 13:58:04 +00:00
|
|
|
/* $Id$
|
2002-01-27 14:47:44 +00:00
|
|
|
*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* PURPOSE: Window classes
|
|
|
|
* FILE: subsys/win32k/ntuser/wndproc.c
|
|
|
|
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
2004-05-22 21:12:15 +00:00
|
|
|
* Thomas Weidenmueller (w3seek@users.sourceforge.net)
|
2002-01-27 14:47:44 +00:00
|
|
|
* REVISION HISTORY:
|
|
|
|
* 06-06-2001 CSH Created
|
2004-05-22 21:12:15 +00:00
|
|
|
* NOTES: Please use the Callback Memory Management functions for
|
|
|
|
* callbacks to make sure, the memory is freed on thread
|
|
|
|
* termination!
|
2002-01-27 14:47:44 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
2004-05-10 17:07:20 +00:00
|
|
|
#include <w32k.h>
|
2002-01-27 14:47:44 +00:00
|
|
|
|
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
2004-05-22 21:12:15 +00:00
|
|
|
/* CALLBACK MEMORY MANAGEMENT ************************************************/
|
|
|
|
|
|
|
|
typedef struct _INT_CALLBACK_HEADER
|
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
/* list entry in the W32THREAD structure */
|
|
|
|
LIST_ENTRY ListEntry;
|
|
|
|
}
|
|
|
|
INT_CALLBACK_HEADER, *PINT_CALLBACK_HEADER;
|
2004-05-22 21:12:15 +00:00
|
|
|
|
|
|
|
PVOID FASTCALL
|
|
|
|
IntCbAllocateMemory(ULONG Size)
|
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
PINT_CALLBACK_HEADER Mem;
|
|
|
|
PW32THREAD W32Thread;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
if(!(Mem = ExAllocatePoolWithTag(PagedPool, Size + sizeof(INT_CALLBACK_HEADER),
|
|
|
|
TAG_CALLBACK)))
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2006-07-20 14:53:47 +00:00
|
|
|
W32Thread = PsGetCurrentThreadWin32Thread();
|
2005-09-07 21:25:42 +00:00
|
|
|
ASSERT(W32Thread);
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
/* insert the callback memory into the thread's callback list */
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
InsertTailList(&W32Thread->W32CallbackListHead, &Mem->ListEntry);
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
return (Mem + 1);
|
2004-05-22 21:12:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID FASTCALL
|
|
|
|
IntCbFreeMemory(PVOID Data)
|
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
PINT_CALLBACK_HEADER Mem;
|
|
|
|
PW32THREAD W32Thread;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
ASSERT(Data);
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
Mem = ((PINT_CALLBACK_HEADER)Data - 1);
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2006-07-20 14:53:47 +00:00
|
|
|
W32Thread = PsGetCurrentThreadWin32Thread();
|
2005-09-07 21:25:42 +00:00
|
|
|
ASSERT(W32Thread);
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
/* remove the memory block from the thread's callback list */
|
|
|
|
RemoveEntryList(&Mem->ListEntry);
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
/* free memory */
|
|
|
|
ExFreePool(Mem);
|
2004-05-22 21:12:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID FASTCALL
|
|
|
|
IntCleanupThreadCallbacks(PW32THREAD W32Thread)
|
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
PLIST_ENTRY CurrentEntry;
|
|
|
|
PINT_CALLBACK_HEADER Mem;
|
|
|
|
|
|
|
|
while (!IsListEmpty(&W32Thread->W32CallbackListHead))
|
|
|
|
{
|
|
|
|
CurrentEntry = RemoveHeadList(&W32Thread->W32CallbackListHead);
|
|
|
|
Mem = CONTAINING_RECORD(CurrentEntry, INT_CALLBACK_HEADER,
|
|
|
|
ListEntry);
|
|
|
|
|
|
|
|
/* free memory */
|
|
|
|
ExFreePool(Mem);
|
|
|
|
}
|
2004-05-22 21:12:15 +00:00
|
|
|
}
|
2003-12-12 14:22:37 +00:00
|
|
|
|
2002-01-27 14:47:44 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2002-05-06 22:20:32 +00:00
|
|
|
VOID STDCALL
|
2005-09-05 21:19:23 +00:00
|
|
|
co_IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
|
2005-09-07 21:25:42 +00:00
|
|
|
HWND hWnd,
|
|
|
|
UINT Msg,
|
|
|
|
ULONG_PTR CompletionCallbackContext,
|
|
|
|
LRESULT Result)
|
2002-05-06 22:20:32 +00:00
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
SENDASYNCPROC_CALLBACK_ARGUMENTS Arguments;
|
2006-01-22 20:34:47 +00:00
|
|
|
PVOID ResultPointer;
|
|
|
|
ULONG ResultLength;
|
2005-09-07 21:25:42 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
Arguments.Callback = CompletionCallback;
|
|
|
|
Arguments.Wnd = hWnd;
|
|
|
|
Arguments.Msg = Msg;
|
|
|
|
Arguments.Context = CompletionCallbackContext;
|
|
|
|
Arguments.Result = Result;
|
|
|
|
|
|
|
|
UserLeaveCo();
|
|
|
|
|
2006-01-22 20:34:47 +00:00
|
|
|
Status = KeUserModeCallback(USER32_CALLBACK_SENDASYNCPROC,
|
|
|
|
&Arguments,
|
|
|
|
sizeof(SENDASYNCPROC_CALLBACK_ARGUMENTS),
|
|
|
|
&ResultPointer,
|
|
|
|
&ResultLength);
|
2005-09-07 21:25:42 +00:00
|
|
|
|
|
|
|
UserEnterCo();
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
2002-07-04 19:56:38 +00:00
|
|
|
return;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
return;
|
2002-05-06 22:20:32 +00:00
|
|
|
}
|
|
|
|
|
2002-01-27 14:47:44 +00:00
|
|
|
LRESULT STDCALL
|
2005-09-05 21:19:23 +00:00
|
|
|
co_IntCallWindowProc(WNDPROC Proc,
|
2005-09-07 21:25:42 +00:00
|
|
|
BOOLEAN IsAnsiProc,
|
|
|
|
HWND Wnd,
|
|
|
|
UINT Message,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam,
|
|
|
|
INT lParamBufferSize)
|
2002-07-17 21:04:57 +00:00
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
WINDOWPROC_CALLBACK_ARGUMENTS StackArguments;
|
|
|
|
PWINDOWPROC_CALLBACK_ARGUMENTS Arguments;
|
|
|
|
NTSTATUS Status;
|
|
|
|
PVOID ResultPointer;
|
|
|
|
ULONG ResultLength;
|
|
|
|
ULONG ArgumentLength;
|
|
|
|
LRESULT Result;
|
|
|
|
|
|
|
|
if (0 < lParamBufferSize)
|
|
|
|
{
|
2003-12-26 22:52:12 +00:00
|
|
|
ArgumentLength = sizeof(WINDOWPROC_CALLBACK_ARGUMENTS) + lParamBufferSize;
|
2004-05-22 21:12:15 +00:00
|
|
|
Arguments = IntCbAllocateMemory(ArgumentLength);
|
2003-12-26 22:52:12 +00:00
|
|
|
if (NULL == Arguments)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
|
|
|
DPRINT1("Unable to allocate buffer for window proc callback\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2003-12-26 22:52:12 +00:00
|
|
|
RtlMoveMemory((PVOID) ((char *) Arguments + sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)),
|
|
|
|
(PVOID) lParam, lParamBufferSize);
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-12-26 22:52:12 +00:00
|
|
|
Arguments = &StackArguments;
|
|
|
|
ArgumentLength = sizeof(WINDOWPROC_CALLBACK_ARGUMENTS);
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
Arguments->Proc = Proc;
|
|
|
|
Arguments->IsAnsiProc = IsAnsiProc;
|
|
|
|
Arguments->Wnd = Wnd;
|
|
|
|
Arguments->Msg = Message;
|
|
|
|
Arguments->wParam = wParam;
|
|
|
|
Arguments->lParam = lParam;
|
|
|
|
Arguments->lParamBufferSize = lParamBufferSize;
|
2006-01-11 23:54:44 +00:00
|
|
|
ResultPointer = NULL;
|
2005-09-07 21:25:42 +00:00
|
|
|
ResultLength = ArgumentLength;
|
|
|
|
|
|
|
|
UserLeaveCo();
|
|
|
|
|
2006-01-22 20:34:47 +00:00
|
|
|
Status = KeUserModeCallback(USER32_CALLBACK_WINDOWPROC,
|
|
|
|
Arguments,
|
|
|
|
ArgumentLength,
|
|
|
|
&ResultPointer,
|
|
|
|
&ResultLength);
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2007-04-27 19:11:22 +00:00
|
|
|
_SEH_TRY
|
|
|
|
{
|
|
|
|
/* Simulate old behaviour: copy into our local buffer */
|
|
|
|
RtlMoveMemory(Arguments, ResultPointer, ArgumentLength);
|
|
|
|
}
|
|
|
|
_SEH_HANDLE
|
|
|
|
{
|
|
|
|
Status = _SEH_GetExceptionCode();
|
|
|
|
}
|
|
|
|
_SEH_END;
|
2006-01-11 23:54:44 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
UserEnterCo();
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
2003-12-26 22:52:12 +00:00
|
|
|
if (0 < lParamBufferSize)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
|
|
|
IntCbFreeMemory(Arguments);
|
|
|
|
}
|
2003-12-26 22:52:12 +00:00
|
|
|
return -1;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
Result = Arguments->Result;
|
2003-06-05 03:55:36 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
if (0 < lParamBufferSize)
|
|
|
|
{
|
2003-12-26 22:52:12 +00:00
|
|
|
RtlMoveMemory((PVOID) lParam,
|
|
|
|
(PVOID) ((char *) Arguments + sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)),
|
|
|
|
lParamBufferSize);
|
2004-05-22 21:12:15 +00:00
|
|
|
IntCbFreeMemory(Arguments);
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2002-07-17 21:04:57 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
return Result;
|
2002-07-17 21:04:57 +00:00
|
|
|
}
|
|
|
|
|
2003-08-21 20:29:44 +00:00
|
|
|
HMENU STDCALL
|
2005-09-05 21:19:23 +00:00
|
|
|
co_IntLoadSysMenuTemplate()
|
2003-08-21 20:29:44 +00:00
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
LRESULT Result;
|
|
|
|
NTSTATUS Status;
|
|
|
|
PVOID ResultPointer;
|
|
|
|
ULONG ResultLength;
|
|
|
|
|
2006-01-11 23:54:44 +00:00
|
|
|
ResultPointer = NULL;
|
2005-09-07 21:25:42 +00:00
|
|
|
ResultLength = sizeof(LRESULT);
|
|
|
|
|
|
|
|
UserLeaveCo();
|
|
|
|
|
2006-01-22 20:34:47 +00:00
|
|
|
Status = KeUserModeCallback(USER32_CALLBACK_LOADSYSMENUTEMPLATE,
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
&ResultPointer,
|
|
|
|
&ResultLength);
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2006-01-11 23:54:44 +00:00
|
|
|
/* Simulate old behaviour: copy into our local buffer */
|
|
|
|
Result = *(LRESULT*)ResultPointer;
|
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
UserEnterCo();
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
2003-08-21 20:29:44 +00:00
|
|
|
return(0);
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
return (HMENU)Result;
|
2003-08-21 20:29:44 +00:00
|
|
|
}
|
|
|
|
|
2004-06-20 12:34:20 +00:00
|
|
|
BOOL STDCALL
|
2005-09-05 21:19:23 +00:00
|
|
|
co_IntLoadDefaultCursors(VOID)
|
2004-06-20 12:34:20 +00:00
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
LRESULT Result;
|
|
|
|
NTSTATUS Status;
|
|
|
|
PVOID ResultPointer;
|
|
|
|
ULONG ResultLength;
|
|
|
|
BOOL DefaultCursor = TRUE;
|
|
|
|
|
2006-01-11 23:54:44 +00:00
|
|
|
ResultPointer = NULL;
|
2005-09-07 21:25:42 +00:00
|
|
|
ResultLength = sizeof(LRESULT);
|
|
|
|
|
|
|
|
UserLeaveCo();
|
|
|
|
|
2006-01-22 20:34:47 +00:00
|
|
|
Status = KeUserModeCallback(USER32_CALLBACK_LOADDEFAULTCURSORS,
|
|
|
|
&DefaultCursor,
|
|
|
|
sizeof(BOOL),
|
|
|
|
&ResultPointer,
|
|
|
|
&ResultLength);
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2006-01-11 23:54:44 +00:00
|
|
|
/* Simulate old behaviour: copy into our local buffer */
|
|
|
|
Result = *(LRESULT*)ResultPointer;
|
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
UserEnterCo();
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
2004-06-20 12:34:20 +00:00
|
|
|
return FALSE;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
2004-06-20 12:34:20 +00:00
|
|
|
}
|
|
|
|
|
2003-12-12 14:22:37 +00:00
|
|
|
LRESULT STDCALL
|
2005-09-05 21:19:23 +00:00
|
|
|
co_IntCallHookProc(INT HookId,
|
2005-09-07 21:25:42 +00:00
|
|
|
INT Code,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam,
|
|
|
|
HOOKPROC Proc,
|
|
|
|
BOOLEAN Ansi,
|
|
|
|
PUNICODE_STRING ModuleName)
|
2003-12-12 14:22:37 +00:00
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
ULONG ArgumentLength;
|
|
|
|
PVOID Argument;
|
|
|
|
LRESULT Result;
|
|
|
|
NTSTATUS Status;
|
|
|
|
PVOID ResultPointer;
|
|
|
|
ULONG ResultLength;
|
|
|
|
PHOOKPROC_CALLBACK_ARGUMENTS Common;
|
|
|
|
CBT_CREATEWNDW *CbtCreateWnd =NULL;
|
|
|
|
PCHAR Extra;
|
|
|
|
PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS CbtCreatewndExtra ;
|
|
|
|
PUNICODE_STRING WindowName = NULL;
|
|
|
|
PUNICODE_STRING ClassName = NULL;
|
|
|
|
|
|
|
|
ArgumentLength = sizeof(HOOKPROC_CALLBACK_ARGUMENTS) - sizeof(WCHAR)
|
|
|
|
+ ModuleName->Length;
|
|
|
|
switch(HookId)
|
|
|
|
{
|
|
|
|
case WH_CBT:
|
|
|
|
switch(Code)
|
|
|
|
{
|
|
|
|
case HCBT_CREATEWND:
|
|
|
|
CbtCreateWnd = (CBT_CREATEWNDW *) lParam;
|
|
|
|
ArgumentLength += sizeof(HOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS);
|
|
|
|
WindowName = (PUNICODE_STRING) (CbtCreateWnd->lpcs->lpszName);
|
|
|
|
ArgumentLength += WindowName->Length + sizeof(WCHAR);
|
|
|
|
ClassName = (PUNICODE_STRING) (CbtCreateWnd->lpcs->lpszClass);
|
|
|
|
if (! IS_ATOM(ClassName->Buffer))
|
|
|
|
{
|
|
|
|
ArgumentLength += ClassName->Length + sizeof(WCHAR);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DPRINT1("Trying to call unsupported CBT hook %d\n", Code);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WH_KEYBOARD_LL:
|
|
|
|
ArgumentLength += sizeof(KBDLLHOOKSTRUCT);
|
|
|
|
break;
|
|
|
|
case WH_MOUSE_LL:
|
|
|
|
ArgumentLength += sizeof(MSLLHOOKSTRUCT);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DPRINT1("Trying to call unsupported window hook %d\n", HookId);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
Argument = IntCbAllocateMemory(ArgumentLength);
|
|
|
|
if (NULL == Argument)
|
|
|
|
{
|
2003-12-12 14:22:37 +00:00
|
|
|
DPRINT1("HookProc callback failed: out of memory\n");
|
|
|
|
return 0;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
Common = (PHOOKPROC_CALLBACK_ARGUMENTS) Argument;
|
|
|
|
Common->HookId = HookId;
|
|
|
|
Common->Code = Code;
|
|
|
|
Common->wParam = wParam;
|
|
|
|
Common->lParam = lParam;
|
|
|
|
Common->Proc = Proc;
|
|
|
|
Common->Ansi = Ansi;
|
|
|
|
Common->ModuleNameLength = ModuleName->Length;
|
|
|
|
memcpy(Common->ModuleName, ModuleName->Buffer, ModuleName->Length);
|
|
|
|
Extra = (PCHAR) Common->ModuleName + Common->ModuleNameLength;
|
|
|
|
|
|
|
|
switch(HookId)
|
|
|
|
{
|
|
|
|
case WH_CBT:
|
|
|
|
switch(Code)
|
|
|
|
{
|
|
|
|
case HCBT_CREATEWND:
|
|
|
|
Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
|
|
|
|
CbtCreatewndExtra = (PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS) Extra;
|
|
|
|
CbtCreatewndExtra->Cs = *(CbtCreateWnd->lpcs);
|
|
|
|
CbtCreatewndExtra->WndInsertAfter = CbtCreateWnd->hwndInsertAfter;
|
|
|
|
Extra = (PCHAR) (CbtCreatewndExtra + 1);
|
|
|
|
RtlCopyMemory(Extra, WindowName->Buffer, WindowName->Length);
|
|
|
|
CbtCreatewndExtra->Cs.lpszName = (LPCWSTR) (Extra - (PCHAR) CbtCreatewndExtra);
|
|
|
|
CbtCreatewndExtra->Cs.lpszClass = ClassName->Buffer;
|
|
|
|
Extra += WindowName->Length;
|
|
|
|
*((WCHAR *) Extra) = L'\0';
|
|
|
|
Extra += sizeof(WCHAR);
|
|
|
|
if (! IS_ATOM(ClassName->Buffer))
|
|
|
|
{
|
|
|
|
RtlCopyMemory(Extra, ClassName->Buffer, ClassName->Length);
|
|
|
|
CbtCreatewndExtra->Cs.lpszClass =
|
|
|
|
(LPCWSTR) MAKELONG(Extra - (PCHAR) CbtCreatewndExtra, 1);
|
|
|
|
Extra += ClassName->Length;
|
|
|
|
*((WCHAR *) Extra) = L'\0';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WH_KEYBOARD_LL:
|
|
|
|
RtlCopyMemory(Extra, (PVOID) lParam, sizeof(KBDLLHOOKSTRUCT));
|
|
|
|
Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
|
|
|
|
break;
|
|
|
|
case WH_MOUSE_LL:
|
|
|
|
RtlCopyMemory(Extra, (PVOID) lParam, sizeof(MSLLHOOKSTRUCT));
|
|
|
|
Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-01-11 23:54:44 +00:00
|
|
|
ResultPointer = NULL;
|
2005-09-07 21:25:42 +00:00
|
|
|
ResultLength = sizeof(LRESULT);
|
|
|
|
|
|
|
|
UserLeaveCo();
|
|
|
|
|
2006-01-22 20:34:47 +00:00
|
|
|
Status = KeUserModeCallback(USER32_CALLBACK_HOOKPROC,
|
|
|
|
Argument,
|
|
|
|
ArgumentLength,
|
|
|
|
&ResultPointer,
|
|
|
|
&ResultLength);
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2006-01-11 23:54:44 +00:00
|
|
|
/* Simulate old behaviour: copy into our local buffer */
|
|
|
|
Result = *(LRESULT*)ResultPointer;
|
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
UserEnterCo();
|
|
|
|
|
|
|
|
IntCbFreeMemory(Argument);
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
2003-12-12 14:22:37 +00:00
|
|
|
return 0;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2003-12-12 14:22:37 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
return Result;
|
2003-12-12 14:22:37 +00:00
|
|
|
}
|
|
|
|
|
2002-01-27 14:47:44 +00:00
|
|
|
/* EOF */
|