- Discontinue the use of thread information for the hook check and use client information.

- Moved code around to make it readable.

svn path=/trunk/; revision=41777
This commit is contained in:
James Tabor 2009-07-05 04:00:59 +00:00
parent 3df7c8cf6a
commit 4419fee70a
2 changed files with 36 additions and 22 deletions

View file

@ -90,9 +90,9 @@ SharedPtrToKernel(PVOID Ptr)
} }
static __inline BOOL static __inline BOOL
IsThreadHooked(PW32THREADINFO ti) IsThreadHooked(PCLIENTINFO pci)
{ {
return ti->fsHooks != 0; return pci->fsHooks != 0;
} }
static __inline PDESKTOPINFO static __inline PDESKTOPINFO

View file

@ -1801,7 +1801,7 @@ SendMessageW(HWND Wnd,
PW32THREADINFO ti = GetW32ThreadInfo(); PW32THREADINFO ti = GetW32ThreadInfo();
Window = ValidateHwnd(Wnd); Window = ValidateHwnd(Wnd);
if (Window != NULL && SharedPtrToUser(Window->ti) == ti && !IsThreadHooked(ti)) if (Window != NULL && SharedPtrToUser(Window->ti) == ti && !IsThreadHooked(GetWin32ClientInfo()))
{ {
/* NOTE: We can directly send messages to the window procedure /* NOTE: We can directly send messages to the window procedure
if *all* the following conditions are met: if *all* the following conditions are met:
@ -1823,14 +1823,21 @@ SendMessageW(HWND Wnd,
return FALSE; return FALSE;
} }
Info.Ansi = FALSE; Info.Ansi = FALSE;
Result = NtUserSendMessage(KMMsg.hwnd, KMMsg.message, Result = NtUserSendMessage( KMMsg.hwnd,
KMMsg.wParam, KMMsg.lParam, &Info); KMMsg.message,
KMMsg.wParam,
KMMsg.lParam,
&Info);
if (! Info.HandledByKernel) if (! Info.HandledByKernel)
{ {
MsgiUMToKMCleanup(&UMMsg, &KMMsg); MsgiUMToKMCleanup(&UMMsg, &KMMsg);
/* We need to send the message ourselves */ /* We need to send the message ourselves */
Result = IntCallWindowProcW(Info.Ansi, Info.Proc, UMMsg.hwnd, UMMsg.message, Result = IntCallWindowProcW( Info.Ansi,
UMMsg.wParam, UMMsg.lParam); Info.Proc,
UMMsg.hwnd,
UMMsg.message,
UMMsg.wParam,
UMMsg.lParam);
} }
else if (! MsgiUMToKMReply(&UMMsg, &KMMsg, &Result)) else if (! MsgiUMToKMReply(&UMMsg, &KMMsg, &Result))
{ {
@ -1858,7 +1865,7 @@ SendMessageA(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
PW32THREADINFO ti = GetW32ThreadInfo(); PW32THREADINFO ti = GetW32ThreadInfo();
Window = ValidateHwnd(Wnd); Window = ValidateHwnd(Wnd);
if (Window != NULL && SharedPtrToUser(Window->ti) == ti && !IsThreadHooked(ti)) if (Window != NULL && SharedPtrToUser(Window->ti) == ti && !IsThreadHooked(GetWin32ClientInfo()))
{ {
/* NOTE: We can directly send messages to the window procedure /* NOTE: We can directly send messages to the window procedure
if *all* the following conditions are met: if *all* the following conditions are met:
@ -1886,8 +1893,11 @@ SendMessageA(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
return FALSE; return FALSE;
} }
Info.Ansi = TRUE; Info.Ansi = TRUE;
Result = NtUserSendMessage(KMMsg.hwnd, KMMsg.message, Result = NtUserSendMessage( KMMsg.hwnd,
KMMsg.wParam, KMMsg.lParam, &Info); KMMsg.message,
KMMsg.wParam,
KMMsg.lParam,
&Info);
if (! Info.HandledByKernel) if (! Info.HandledByKernel)
{ {
/* We need to send the message ourselves */ /* We need to send the message ourselves */
@ -1904,8 +1914,12 @@ SendMessageA(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
/* Unicode winproc. Although we started out with an Ansi message we /* Unicode winproc. Although we started out with an Ansi message we
already converted it to Unicode for the kernel call. Reuse that already converted it to Unicode for the kernel call. Reuse that
message to avoid another conversion */ message to avoid another conversion */
Result = IntCallWindowProcW(Info.Ansi, Info.Proc, UcMsg.hwnd, Result = IntCallWindowProcW( Info.Ansi,
UcMsg.message, UcMsg.wParam, UcMsg.lParam); Info.Proc,
UcMsg.hwnd,
UcMsg.message,
UcMsg.wParam,
UcMsg.lParam);
if (! MsgiAnsiToUnicodeReply(&UcMsg, &AnsiMsg, &Result)) if (! MsgiAnsiToUnicodeReply(&UcMsg, &AnsiMsg, &Result))
{ {
return FALSE; return FALSE;