Author: jimtabor
Date: Tue Oct 26 06:24:50 2010
New Revision: 49278
URL:
http://svn.reactos.org/svn/reactos?rev=49278&view=rev
Log:
[Win32k|User32]
- Add fix for KsStudio for Olaf Siejka and debug prints for WH_KEYBOARD_LL. See bug 5670
for more details.
Modified:
trunk/reactos/dll/win32/user32/windows/hook.c
trunk/reactos/subsystems/win32/win32k/ntuser/callback.c
trunk/reactos/subsystems/win32/win32k/ntuser/hook.c
trunk/reactos/subsystems/win32/win32k/ntuser/input.c
Modified: trunk/reactos/dll/win32/user32/windows/hook.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/h…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/hook.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/hook.c [iso-8859-1] Tue Oct 26 06:24:50 2010
@@ -452,8 +452,6 @@
LRESULT Result;
CREATESTRUCTW Csw;
CBT_CREATEWNDW CbtCreatewndw;
- CREATESTRUCTA Csa;
- CBT_CREATEWNDA CbtCreatewnda;
PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS CbtCreatewndExtra = NULL;
WPARAM wParam = 0;
LPARAM lParam = 0;
@@ -479,30 +477,12 @@
CbtCreatewndExtra = (PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS)
((PCHAR) Common + Common->lParam);
Csw = CbtCreatewndExtra->Cs;
- if (NULL != CbtCreatewndExtra->Cs.lpszName)
- {
- Csw.lpszName = (LPCWSTR)((PCHAR) CbtCreatewndExtra
- + (ULONG_PTR) CbtCreatewndExtra->Cs.lpszName);
- }
- if (0 != HIWORD(CbtCreatewndExtra->Cs.lpszClass))
- {
- Csw.lpszClass = (LPCWSTR)((PCHAR) CbtCreatewndExtra
- + LOWORD((ULONG_PTR)
CbtCreatewndExtra->Cs.lpszClass));
- }
+ Csw.lpszName = CbtCreatewndExtra->Cs.lpszName;
+ Csw.lpszClass = CbtCreatewndExtra->Cs.lpszClass;
wParam = Common->wParam;
- if (Common->Ansi)
- {
- memcpy(&Csa, &Csw, sizeof(CREATESTRUCTW));
- CbtCreatewnda.lpcs = &Csa;
- CbtCreatewnda.hwndInsertAfter = CbtCreatewndExtra->WndInsertAfter;
- lParam = (LPARAM) &CbtCreatewnda;
- }
- else
- {
- CbtCreatewndw.lpcs = &Csw;
- CbtCreatewndw.hwndInsertAfter = CbtCreatewndExtra->WndInsertAfter;
- lParam = (LPARAM) &CbtCreatewndw;
- }
+ CbtCreatewndw.lpcs = &Csw;
+ CbtCreatewndw.hwndInsertAfter = CbtCreatewndExtra->WndInsertAfter;
+ lParam = (LPARAM) &CbtCreatewndw;
break;
case HCBT_CLICKSKIPPED:
pMHook = (PMOUSEHOOKSTRUCT)((PCHAR) Common + Common->lParam);
@@ -555,6 +535,7 @@
break;
}
case WH_KEYBOARD_LL:
+ ERR("WH_KEYBOARD_LL: Code %d, wParam
%d\n",Common->Code,Common->wParam);
pKeyboardLlData = (PKBDLLHOOKSTRUCT)((PCHAR) Common + Common->lParam);
Result = Common->Proc(Common->Code, Common->wParam, (LPARAM)
pKeyboardLlData);
break;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/callback.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/callback.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/callback.c [iso-8859-1] Tue Oct 26
06:24:50 2010
@@ -333,8 +333,6 @@
CBT_CREATEWNDW *CbtCreateWnd = NULL;
PCHAR Extra;
PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS CbtCreatewndExtra = NULL;
- UNICODE_STRING WindowName, ClassName;
- ANSI_STRING asWindowName, asClassName;
PTHREADINFO pti;
PWND pWnd;
BOOL Hit = FALSE;
@@ -362,64 +360,11 @@
DPRINT1("WH_CBT HCBT_CREATEWND wParam bad hWnd!\n");
goto Fault_Exit;
}
-
+ // Due to KsStudio.exe, just pass the callers original pointers
+ // except class which point to kernel space if not an atom.
+ // Found by, Olaf Siejka
CbtCreateWnd = (CBT_CREATEWNDW *) lParam;
ArgumentLength += sizeof(HOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS);
-
- if (Ansi)
- {
- RtlInitAnsiString(&asWindowName, NULL);
- _SEH2_TRY
- {
- ProbeForRead(CbtCreateWnd->lpcs->lpszName, sizeof(CHAR), 1);
- }
- _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
- {
- Hit = TRUE;
- }
- _SEH2_END;
- if (Hit) // Client is at deaths door.
- goto Fault_Exit;
- if (CbtCreateWnd->lpcs->lpszName)
- RtlInitAnsiString(&asWindowName,
(PCSZ)CbtCreateWnd->lpcs->lpszName);
- ArgumentLength += asWindowName.Length + sizeof(CHAR);
- }
- else
- {
- RtlInitUnicodeString(&WindowName, NULL);
- _SEH2_TRY
- {
- ProbeForRead(CbtCreateWnd->lpcs->lpszName, sizeof(WCHAR), 1);
- }
- _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
- {
- Hit = TRUE;
- }
- _SEH2_END;
- if (Hit)
- goto Fault_Exit;
- if (CbtCreateWnd->lpcs->lpszName)
- RtlInitUnicodeString(&WindowName,
CbtCreateWnd->lpcs->lpszName);
- ArgumentLength += WindowName.Length + sizeof(WCHAR);
- }
-
- if (!IS_ATOM(CbtCreateWnd->lpcs->lpszClass))
- {
- if (Ansi)
- {
- RtlInitAnsiString(&asClassName, NULL);
- if (CbtCreateWnd->lpcs->lpszClass)
- RtlInitAnsiString(&asClassName,
(PCSZ)CbtCreateWnd->lpcs->lpszClass);
- ArgumentLength += asClassName.Length + sizeof(CHAR);
- }
- else
- {
- RtlInitUnicodeString(&ClassName, NULL);
- if (CbtCreateWnd->lpcs->lpszClass)
- RtlInitUnicodeString(&ClassName,
CbtCreateWnd->lpcs->lpszClass);
- ArgumentLength += ClassName.Length + sizeof(WCHAR);
- }
- }
break;
case HCBT_MOVESIZE:
@@ -502,55 +447,9 @@
CbtCreatewndExtra = (PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS) Extra;
RtlCopyMemory( &CbtCreatewndExtra->Cs, CbtCreateWnd->lpcs,
sizeof(CREATESTRUCTW) );
CbtCreatewndExtra->WndInsertAfter = CbtCreateWnd->hwndInsertAfter;
+ CbtCreatewndExtra->Cs.lpszClass = CbtCreateWnd->lpcs->lpszClass;
// if Atom
+ CbtCreatewndExtra->Cs.lpszName = CbtCreateWnd->lpcs->lpszName;
Extra = (PCHAR) (CbtCreatewndExtra + 1);
- CbtCreatewndExtra->Cs.lpszClass = CbtCreateWnd->lpcs->lpszClass;
// if Atom
-
- if (Ansi)
- {
- if (asWindowName.Buffer)
- RtlCopyMemory(Extra, asWindowName.Buffer, asWindowName.Length);
- CbtCreatewndExtra->Cs.lpszName = (LPCWSTR) (Extra - (PCHAR)
CbtCreatewndExtra);
- Extra += asWindowName.Length;
-
- *((CHAR *) Extra) = '\0';
- Extra += sizeof(CHAR);
- }
- else
- {
- if (WindowName.Buffer)
- RtlCopyMemory(Extra, WindowName.Buffer, WindowName.Length);
- CbtCreatewndExtra->Cs.lpszName = (LPCWSTR) (Extra - (PCHAR)
CbtCreatewndExtra);
- Extra += WindowName.Length;
-
- *((WCHAR *) Extra) = L'\0';
- Extra += sizeof(WCHAR);
- }
-
- if (!IS_ATOM(CbtCreateWnd->lpcs->lpszClass))
- {
- if (Ansi)
- {
- if (asClassName.Buffer)
- RtlCopyMemory(Extra, asClassName.Buffer, asClassName.Length);
- CbtCreatewndExtra->Cs.lpszClass =
- (LPCWSTR)(ULONG_PTR) MAKELONG(Extra - (PCHAR) CbtCreatewndExtra,
1);
- Extra += asClassName.Length;
-
- *((CHAR *) Extra) = '\0';
- Extra += sizeof(CHAR);
- }
- else
- {
- if (ClassName.Buffer)
- RtlCopyMemory(Extra, ClassName.Buffer, ClassName.Length);
- CbtCreatewndExtra->Cs.lpszClass =
- (LPCWSTR)(ULONG_PTR) MAKELONG(Extra - (PCHAR) CbtCreatewndExtra,
1);
- Extra += ClassName.Length;
-
- *((WCHAR *) Extra) = L'\0';
- Extra += sizeof(WCHAR);
- }
- }
break;
case HCBT_CLICKSKIPPED:
RtlCopyMemory(Extra, (PVOID) lParam, sizeof(MOUSEHOOKSTRUCT));
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/hook.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] Tue Oct 26 06:24:50
2010
@@ -987,11 +987,14 @@
ObReferenceObject(ptiHook->pEThread);
if (ptiHook != pti )
{
- DPRINT("\nGlobal Hook posting to another Thread! %d\n",HookId );
+ if (HookId == WH_KEYBOARD_LL){
+ DPRINT1("\nGlobal Hook posting to another Thread! %d\n",HookId
);}
Result = IntCallLowLevelHook(Hook, Code, wParam, lParam);
}
else
{ /* Make the direct call. */
+ if (HookId == WH_KEYBOARD_LL){
+ DPRINT1("\nLocal Hook calling to Thread! %d\n",HookId );}
Result = co_IntCallHookProc( HookId,
Code,
wParam,
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] Tue Oct 26 06:24:50
2010
@@ -1347,7 +1347,7 @@
KbdHookData.dwExtraInfo = ki->dwExtraInfo;
if (co_HOOK_CallHooks(WH_KEYBOARD_LL, HC_ACTION, Msg.message, (LPARAM)
&KbdHookData))
{
- DPRINT("Kbd msg %d wParam %d lParam 0x%08x dropped by WH_KEYBOARD_LL
hook\n",
+ DPRINT1("Kbd msg %d wParam %d lParam 0x%08x dropped by WH_KEYBOARD_LL
hook\n",
Msg.message, vk_hook, Msg.lParam);
if (Entered) UserLeave();
return FALSE;