mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
- 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:
parent
3df7c8cf6a
commit
4419fee70a
2 changed files with 36 additions and 22 deletions
|
@ -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
|
||||||
|
|
|
@ -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:
|
||||||
|
@ -1819,23 +1819,30 @@ SendMessageW(HWND Wnd,
|
||||||
UMMsg.wParam = wParam;
|
UMMsg.wParam = wParam;
|
||||||
UMMsg.lParam = lParam;
|
UMMsg.lParam = lParam;
|
||||||
if (! MsgiUMToKMMessage(&UMMsg, &KMMsg, FALSE))
|
if (! MsgiUMToKMMessage(&UMMsg, &KMMsg, FALSE))
|
||||||
{
|
{
|
||||||
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))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result;
|
return 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;
|
||||||
|
|
Loading…
Reference in a new issue