mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 11:51:58 +00:00
- Updates and changes to, with one add on and removal: MenuWindowProc (Not supported in kernel space), PopupMenuWndProcA, PostMessage, SendNotifyMessage and win32k hook debugs.
- Patch by Smiley <johnyadams@hotmail.com>: Wrong PostMessage and SendNotifyMessage behavior, see Bug 4646. - Reference: Related to TranslateMessage: http://msdn.microsoft.com/en-us/library/aa912145.aspx , Related to PopupMenuWndProcA: Registration of Atom classes, Unicode only: http://www.reactos.org/archives/public/ros-dev/2007-October/009976.html svn path=/trunk/; revision=41772
This commit is contained in:
parent
43005003c0
commit
0aeef70968
7 changed files with 239 additions and 260 deletions
|
@ -483,8 +483,8 @@
|
||||||
@ stdcall MapVirtualKeyW(long long)
|
@ stdcall MapVirtualKeyW(long long)
|
||||||
@ stdcall MapWindowPoints(long long ptr long)
|
@ stdcall MapWindowPoints(long long ptr long)
|
||||||
@ stdcall MenuItemFromPoint(long long double) ; Direct call NtUserMenuItemFromPoint
|
@ stdcall MenuItemFromPoint(long long double) ; Direct call NtUserMenuItemFromPoint
|
||||||
@ stdcall MenuWindowProcA (long long long long)
|
@ stdcall MenuWindowProcA (long ptr long long long)
|
||||||
@ stdcall MenuWindowProcW (long long long long)
|
@ stdcall MenuWindowProcW (long ptr long long long)
|
||||||
@ stdcall MessageBeep(long)
|
@ stdcall MessageBeep(long)
|
||||||
@ stdcall MessageBoxA(long str str long)
|
@ stdcall MessageBoxA(long str str long)
|
||||||
@ stdcall MessageBoxExA(long str str long long)
|
@ stdcall MessageBoxExA(long str str long long)
|
||||||
|
|
|
@ -72,6 +72,7 @@ typedef struct
|
||||||
POINT Pt;
|
POINT Pt;
|
||||||
} MTRACKER;
|
} MTRACKER;
|
||||||
|
|
||||||
|
static LRESULT WINAPI PopupMenuWndProcA(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam);
|
||||||
static LRESULT WINAPI PopupMenuWndProcW(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
|
static LRESULT WINAPI PopupMenuWndProcW(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
@ -971,6 +972,70 @@ MenuDrawPopupMenu(HWND Wnd, HDC Dc, HMENU Menu)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LRESULT WINAPI
|
||||||
|
PopupMenuWndProcA(HWND Wnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
TRACE("YES! hwnd=%x msg=0x%04x wp=0x%04lx lp=0x%08lx\n", Wnd, Message, wParam, lParam);
|
||||||
|
|
||||||
|
switch(Message)
|
||||||
|
{
|
||||||
|
case WM_CREATE:
|
||||||
|
{
|
||||||
|
CREATESTRUCTA *cs = (CREATESTRUCTA *) lParam;
|
||||||
|
SetWindowLongPtrA(Wnd, 0, (LONG) cs->lpCreateParams);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_MOUSEACTIVATE: /* We don't want to be activated */
|
||||||
|
return MA_NOACTIVATE;
|
||||||
|
|
||||||
|
case WM_PAINT:
|
||||||
|
{
|
||||||
|
PAINTSTRUCT ps;
|
||||||
|
BeginPaint(Wnd, &ps);
|
||||||
|
MenuDrawPopupMenu(Wnd, ps.hdc, (HMENU)GetWindowLongPtrA(Wnd, 0));
|
||||||
|
EndPaint(Wnd, &ps);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_ERASEBKGND:
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
case WM_DESTROY:
|
||||||
|
/* zero out global pointer in case resident popup window was destroyed. */
|
||||||
|
if (Wnd == TopPopup)
|
||||||
|
{
|
||||||
|
TopPopup = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_SHOWWINDOW:
|
||||||
|
if (0 != wParam)
|
||||||
|
{
|
||||||
|
if (0 == GetWindowLongPtrA(Wnd, 0))
|
||||||
|
{
|
||||||
|
OutputDebugStringA("no menu to display\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetWindowLongPtrA(Wnd, 0, 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MM_SETMENUHANDLE:
|
||||||
|
SetWindowLongPtrA(Wnd, 0, wParam);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MM_GETMENUHANDLE:
|
||||||
|
return GetWindowLongPtrA(Wnd, 0);
|
||||||
|
|
||||||
|
default:
|
||||||
|
return DefWindowProcA(Wnd, Message, wParam, lParam);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static LRESULT WINAPI
|
static LRESULT WINAPI
|
||||||
PopupMenuWndProcW(HWND Wnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
PopupMenuWndProcW(HWND Wnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -5161,33 +5226,56 @@ GetMenuContextHelpId(HMENU hmenu)
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
LRESULT
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
MenuWindowProcA(
|
MenuWindowProcA(
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
|
ULONG_PTR Result,
|
||||||
UINT Msg,
|
UINT Msg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam
|
LPARAM lParam
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
if ( Msg < WM_USER)
|
||||||
|
{
|
||||||
|
LRESULT lResult;
|
||||||
|
lResult = PopupMenuWndProcA(hWnd, Msg, wParam, lParam );
|
||||||
|
if (Result)
|
||||||
|
{
|
||||||
|
Result = (ULONG_PTR)lResult;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
return NtUserMessageCall(hWnd, Msg, wParam, lParam, Result, FNID_MENU, TRUE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
LRESULT
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
MenuWindowProcW(
|
MenuWindowProcW(
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
|
ULONG_PTR Result,
|
||||||
UINT Msg,
|
UINT Msg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam
|
LPARAM lParam
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
if ( Msg < WM_USER)
|
||||||
|
{
|
||||||
|
LRESULT lResult;
|
||||||
|
lResult = PopupMenuWndProcW(hWnd, Msg, wParam, lParam );
|
||||||
|
if (Result)
|
||||||
|
{
|
||||||
|
Result = (ULONG_PTR)lResult;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
return NtUserMessageCall(hWnd, Msg, wParam, lParam, Result, FNID_MENU, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1632,51 +1632,12 @@ PeekMessageW(
|
||||||
return Res;
|
return Res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
/*
|
// Worker function for post message.
|
||||||
* @implemented
|
//
|
||||||
*/
|
|
||||||
BOOL
|
BOOL
|
||||||
WINAPI
|
FASTCALL
|
||||||
PostMessageA(
|
PostMessageWorker(
|
||||||
HWND Wnd,
|
|
||||||
UINT Msg,
|
|
||||||
WPARAM wParam,
|
|
||||||
LPARAM lParam)
|
|
||||||
{
|
|
||||||
MSG AnsiMsg, UcMsg;
|
|
||||||
MSG KMMsg;
|
|
||||||
LRESULT Result;
|
|
||||||
|
|
||||||
AnsiMsg.hwnd = Wnd;
|
|
||||||
AnsiMsg.message = Msg;
|
|
||||||
AnsiMsg.wParam = wParam;
|
|
||||||
AnsiMsg.lParam = lParam;
|
|
||||||
if (! MsgiAnsiToUnicodeMessage(&UcMsg, &AnsiMsg))
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! MsgiUMToKMMessage(&UcMsg, &KMMsg, TRUE))
|
|
||||||
{
|
|
||||||
MsgiAnsiToUnicodeCleanup(&UcMsg, &AnsiMsg);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
Result = NtUserPostMessage(KMMsg.hwnd, KMMsg.message,
|
|
||||||
KMMsg.wParam, KMMsg.lParam);
|
|
||||||
MsgiUMToKMCleanup(&UcMsg, &KMMsg);
|
|
||||||
MsgiAnsiToUnicodeCleanup(&UcMsg, &AnsiMsg);
|
|
||||||
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
BOOL
|
|
||||||
WINAPI
|
|
||||||
PostMessageW(
|
|
||||||
HWND Wnd,
|
HWND Wnd,
|
||||||
UINT Msg,
|
UINT Msg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
|
@ -1693,57 +1654,22 @@ PostMessageW(
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
Result = NtUserPostMessage(KMMsg.hwnd, KMMsg.message,
|
Result = NtUserPostMessage( KMMsg.hwnd,
|
||||||
KMMsg.wParam, KMMsg.lParam);
|
KMMsg.message,
|
||||||
|
KMMsg.wParam,
|
||||||
|
KMMsg.lParam);
|
||||||
|
|
||||||
MsgiUMToKMCleanup(&UMMsg, &KMMsg);
|
MsgiUMToKMCleanup(&UMMsg, &KMMsg);
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
/*
|
||||||
WINAPI
|
* @implemented
|
||||||
PostMessageWX(
|
|
||||||
HWND hWnd,
|
|
||||||
UINT Msg,
|
|
||||||
WPARAM wParam,
|
|
||||||
LPARAM lParam)
|
|
||||||
{
|
|
||||||
LRESULT Ret;
|
|
||||||
|
|
||||||
/* Check for combo box or a list box to send names. */
|
|
||||||
if (Msg == CB_DIR || Msg == LB_DIR)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Set DDL_POSTMSGS, so use the PostMessage function to send messages to the
|
|
||||||
combo/list box. Forces a call like DlgDirListComboBox.
|
|
||||||
*/
|
*/
|
||||||
wParam |= DDL_POSTMSGS;
|
|
||||||
return NtUserPostMessage(hWnd, Msg, wParam, lParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* No drop files or current Process, just post message. */
|
|
||||||
if ( (Msg != WM_DROPFILES) ||
|
|
||||||
( NtUserQueryWindow( hWnd, QUERY_WINDOW_UNIQUE_PROCESS_ID) ==
|
|
||||||
PtrToUint(NtCurrentTeb()->ClientId.UniqueProcess) ) )
|
|
||||||
{
|
|
||||||
return NtUserPostMessage(hWnd, Msg, wParam, lParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We have drop files or this is not the same process for this window. */
|
|
||||||
|
|
||||||
/* Just incase, check wParam for Global memory handle and send size. */
|
|
||||||
Ret = SendMessageW( hWnd,
|
|
||||||
WM_COPYGLOBALDATA,
|
|
||||||
(WPARAM)GlobalSize((HGLOBAL)wParam), // Zero if not a handle.
|
|
||||||
(LPARAM)wParam); // Send wParam as lParam.
|
|
||||||
|
|
||||||
if ( Ret ) return NtUserPostMessage(hWnd, Msg, (WPARAM)Ret, lParam);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
BOOL
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
PostMessageAX(
|
PostMessageA(
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
UINT Msg,
|
UINT Msg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
|
@ -1762,13 +1688,58 @@ PostMessageAX(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = PostMessageWX( hWnd, UcMsg.message, UcMsg.wParam, UcMsg.lParam);
|
Ret = PostMessageW( hWnd, UcMsg.message, UcMsg.wParam, UcMsg.lParam);
|
||||||
|
|
||||||
MsgiAnsiToUnicodeCleanup(&UcMsg, &AnsiMsg);
|
MsgiAnsiToUnicodeCleanup(&UcMsg, &AnsiMsg);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
|
PostMessageW(
|
||||||
|
HWND hWnd,
|
||||||
|
UINT Msg,
|
||||||
|
WPARAM wParam,
|
||||||
|
LPARAM lParam)
|
||||||
|
{
|
||||||
|
LRESULT Ret;
|
||||||
|
|
||||||
|
/* Check for combo box or a list box to send names. */
|
||||||
|
if (Msg == CB_DIR || Msg == LB_DIR)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Set DDL_POSTMSGS, so use the PostMessage function to send messages to the
|
||||||
|
combo/list box. Forces a call like DlgDirListComboBox.
|
||||||
|
*/
|
||||||
|
wParam |= DDL_POSTMSGS;
|
||||||
|
return PostMessageWorker(hWnd, Msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* No drop files or current Process, just post message. */
|
||||||
|
if ( (Msg != WM_DROPFILES) ||
|
||||||
|
( NtUserQueryWindow( hWnd, QUERY_WINDOW_UNIQUE_PROCESS_ID) ==
|
||||||
|
PtrToUint(NtCurrentTeb()->ClientId.UniqueProcess) ) )
|
||||||
|
{
|
||||||
|
return PostMessageWorker(hWnd, Msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We have drop files and this is not the same process for this window. */
|
||||||
|
|
||||||
|
/* Just incase, check wParam for Global memory handle and send size. */
|
||||||
|
Ret = SendMessageW( hWnd,
|
||||||
|
WM_COPYGLOBALDATA,
|
||||||
|
(WPARAM)GlobalSize((HGLOBAL)wParam), // Zero if not a handle.
|
||||||
|
(LPARAM)wParam); // Send wParam as lParam.
|
||||||
|
|
||||||
|
if ( Ret ) return PostMessageWorker(hWnd, Msg, (WPARAM)Ret, lParam);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
@ -2113,9 +2084,8 @@ SendMessageTimeoutW(
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
BOOL
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
|
@ -2125,9 +2095,8 @@ SendNotifyMessageA(
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
BOOL Ret;
|
||||||
MSG AnsiMsg, UcMsg;
|
MSG AnsiMsg, UcMsg;
|
||||||
MSG KMMsg;
|
|
||||||
LRESULT Result;
|
|
||||||
|
|
||||||
AnsiMsg.hwnd = hWnd;
|
AnsiMsg.hwnd = hWnd;
|
||||||
AnsiMsg.message = Msg;
|
AnsiMsg.message = Msg;
|
||||||
|
@ -2137,23 +2106,15 @@ SendNotifyMessageA(
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
Ret = SendNotifyMessageW(hWnd, UcMsg.message, UcMsg.wParam, UcMsg.lParam);
|
||||||
|
|
||||||
if (! MsgiUMToKMMessage(&UcMsg, &KMMsg, TRUE))
|
|
||||||
{
|
|
||||||
MsgiAnsiToUnicodeCleanup(&UcMsg, &AnsiMsg);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
Result = NtUserSendNotifyMessage(KMMsg.hwnd, KMMsg.message,
|
|
||||||
KMMsg.wParam, KMMsg.lParam);
|
|
||||||
MsgiUMToKMCleanup(&UcMsg, &KMMsg);
|
|
||||||
MsgiAnsiToUnicodeCleanup(&UcMsg, &AnsiMsg);
|
MsgiAnsiToUnicodeCleanup(&UcMsg, &AnsiMsg);
|
||||||
|
|
||||||
return Result;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
BOOL
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
|
@ -2174,51 +2135,19 @@ SendNotifyMessageW(
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
Result = NtUserSendNotifyMessage(KMMsg.hwnd, KMMsg.message,
|
Result = NtUserMessageCall( hWnd,
|
||||||
KMMsg.wParam, KMMsg.lParam);
|
KMMsg.message,
|
||||||
|
KMMsg.wParam,
|
||||||
|
KMMsg.lParam,
|
||||||
|
0,
|
||||||
|
FNID_SENDNOTIFYMESSAGE,
|
||||||
|
FALSE);
|
||||||
|
|
||||||
MsgiUMToKMCleanup(&UMMsg, &KMMsg);
|
MsgiUMToKMCleanup(&UMMsg, &KMMsg);
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
|
||||||
WINAPI
|
|
||||||
SendNotifyMessageAX(
|
|
||||||
HWND hWnd,
|
|
||||||
UINT Msg,
|
|
||||||
WPARAM wParam,
|
|
||||||
LPARAM lParam)
|
|
||||||
{
|
|
||||||
BOOL Ret;
|
|
||||||
MSG AnsiMsg, UcMsg;
|
|
||||||
|
|
||||||
AnsiMsg.hwnd = hWnd;
|
|
||||||
AnsiMsg.message = Msg;
|
|
||||||
AnsiMsg.wParam = wParam;
|
|
||||||
AnsiMsg.lParam = lParam;
|
|
||||||
if (! MsgiAnsiToUnicodeMessage(&UcMsg, &AnsiMsg))
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
/* ATM, ReactOS does not support Ansi in win32k. */
|
|
||||||
Ret = NtUserMessageCall(hWnd, UcMsg.message, UcMsg.wParam, UcMsg.lParam, 0, FNID_SENDNOTIFYMESSAGE, FALSE);
|
|
||||||
|
|
||||||
MsgiAnsiToUnicodeCleanup(&UcMsg, &AnsiMsg);
|
|
||||||
|
|
||||||
return Ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL
|
|
||||||
WINAPI
|
|
||||||
SendNotifyMessageWX(
|
|
||||||
HWND hWnd,
|
|
||||||
UINT Msg,
|
|
||||||
WPARAM wParam,
|
|
||||||
LPARAM lParam)
|
|
||||||
{
|
|
||||||
return NtUserMessageCall(hWnd, Msg, wParam, lParam, 0, FNID_SENDNOTIFYMESSAGE, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
@ -2234,6 +2163,8 @@ TranslateMessageEx(CONST MSG *lpMsg, DWORD unk)
|
||||||
return(NtUserTranslateMessage((LPMSG)lpMsg, (HKL)unk));
|
return(NtUserTranslateMessage((LPMSG)lpMsg, (HKL)unk));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if ( lpMsg->message & ~WM_MAXIMUM )
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2245,7 +2176,20 @@ TranslateMessageEx(CONST MSG *lpMsg, DWORD unk)
|
||||||
BOOL WINAPI
|
BOOL WINAPI
|
||||||
TranslateMessage(CONST MSG *lpMsg)
|
TranslateMessage(CONST MSG *lpMsg)
|
||||||
{
|
{
|
||||||
return(TranslateMessageEx((LPMSG)lpMsg, 0));
|
BOOL Ret = FALSE;
|
||||||
|
|
||||||
|
// Ref: msdn ImmGetVirtualKey:
|
||||||
|
// http://msdn.microsoft.com/en-us/library/aa912145.aspx
|
||||||
|
/*
|
||||||
|
if ( (LOWORD(lpMsg->wParam) != VK_PROCESSKEY) ||
|
||||||
|
!(Ret = IMM_ImmTranslateMessage( lpMsg->hwnd,
|
||||||
|
lpMsg->message,
|
||||||
|
lpMsg->wParam,
|
||||||
|
lpMsg->lParam)) )*/
|
||||||
|
{
|
||||||
|
Ret = TranslateMessageEx((LPMSG)lpMsg, 0);
|
||||||
|
}
|
||||||
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -566,6 +566,7 @@ typedef struct _USERCONNECT
|
||||||
#define WM_SYSTIMER 280
|
#define WM_SYSTIMER 280
|
||||||
#define WM_POPUPSYSTEMMENU 787
|
#define WM_POPUPSYSTEMMENU 787
|
||||||
#define WM_CBT 1023 // ReactOS only.
|
#define WM_CBT 1023 // ReactOS only.
|
||||||
|
#define WM_MAXIMUM 0x0001FFFF
|
||||||
|
|
||||||
//
|
//
|
||||||
// Non SDK DCE types.
|
// Non SDK DCE types.
|
||||||
|
@ -3078,16 +3079,6 @@ NtUserSendMessageTimeout(HWND hWnd,
|
||||||
ULONG_PTR *uResult,
|
ULONG_PTR *uResult,
|
||||||
PNTUSERSENDMESSAGEINFO Info);
|
PNTUSERSENDMESSAGEINFO Info);
|
||||||
|
|
||||||
/* use NtUserMessageCall */
|
|
||||||
BOOL
|
|
||||||
NTAPI
|
|
||||||
NtUserSendNotifyMessage(
|
|
||||||
HWND hWnd,
|
|
||||||
UINT Msg,
|
|
||||||
WPARAM wParam,
|
|
||||||
LPARAM lParam);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _SETSCROLLBARINFO
|
typedef struct _SETSCROLLBARINFO
|
||||||
{
|
{
|
||||||
int nTrackPos;
|
int nTrackPos;
|
||||||
|
|
|
@ -785,14 +785,14 @@ UserCallNextHookEx(PHOOK Hook,
|
||||||
}
|
}
|
||||||
|
|
||||||
case WH_CBT:
|
case WH_CBT:
|
||||||
DPRINT1("HOOK WH_CBT!\n");
|
DPRINT("HOOK WH_CBT!\n");
|
||||||
switch (Code)
|
switch (Code)
|
||||||
{
|
{
|
||||||
case HCBT_CREATEWND:
|
case HCBT_CREATEWND:
|
||||||
{
|
{
|
||||||
LPCBT_CREATEWNDW pcbtcww = (LPCBT_CREATEWNDW)lParam;
|
LPCBT_CREATEWNDW pcbtcww = (LPCBT_CREATEWNDW)lParam;
|
||||||
|
|
||||||
DPRINT1("HOOK HCBT_CREATEWND\n");
|
DPRINT("HOOK HCBT_CREATEWND\n");
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
if (Ansi)
|
if (Ansi)
|
||||||
|
@ -856,7 +856,7 @@ UserCallNextHookEx(PHOOK Hook,
|
||||||
{
|
{
|
||||||
RECTL rt;
|
RECTL rt;
|
||||||
|
|
||||||
DPRINT1("HOOK HCBT_MOVESIZE\n");
|
DPRINT("HOOK HCBT_MOVESIZE\n");
|
||||||
|
|
||||||
if (lParam)
|
if (lParam)
|
||||||
{
|
{
|
||||||
|
@ -893,7 +893,7 @@ UserCallNextHookEx(PHOOK Hook,
|
||||||
{
|
{
|
||||||
CBTACTIVATESTRUCT CbAs;
|
CBTACTIVATESTRUCT CbAs;
|
||||||
|
|
||||||
DPRINT1("HOOK HCBT_ACTIVATE\n");
|
DPRINT("HOOK HCBT_ACTIVATE\n");
|
||||||
if (lParam)
|
if (lParam)
|
||||||
{
|
{
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
|
@ -927,7 +927,7 @@ UserCallNextHookEx(PHOOK Hook,
|
||||||
|
|
||||||
/* The rest just use default. */
|
/* The rest just use default. */
|
||||||
default:
|
default:
|
||||||
DPRINT1("HOOK HCBT_ %d\n",Code);
|
DPRINT("HOOK HCBT_ %d\n",Code);
|
||||||
lResult = co_HOOK_CallHookNext(Hook, Code, wParam, lParam);
|
lResult = co_HOOK_CallHookNext(Hook, Code, wParam, lParam);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1314,10 +1314,14 @@ UserPostMessage(HWND Wnd,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
PTHREADINFO pti;
|
PTHREADINFO pti;
|
||||||
MSG UserModeMsg, KernelModeMsg;
|
MSG Message;
|
||||||
LARGE_INTEGER LargeTickCount;
|
LARGE_INTEGER LargeTickCount;
|
||||||
NTSTATUS Status;
|
|
||||||
PMSGMEMORY MsgMemoryEntry;
|
if (FindMsgMemory(Msg) != 0)
|
||||||
|
{
|
||||||
|
SetLastWin32Error(ERROR_MESSAGE_SYNC_ONLY );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
pti = PsGetCurrentThreadWin32Thread();
|
pti = PsGetCurrentThreadWin32Thread();
|
||||||
if (Wnd == HWND_BROADCAST)
|
if (Wnd == HWND_BROADCAST)
|
||||||
|
@ -1358,24 +1362,14 @@ UserPostMessage(HWND Wnd,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UserModeMsg.hwnd = Wnd;
|
Message.hwnd = Wnd;
|
||||||
UserModeMsg.message = Msg;
|
Message.message = Msg;
|
||||||
UserModeMsg.wParam = wParam;
|
Message.wParam = wParam;
|
||||||
UserModeMsg.lParam = lParam;
|
Message.lParam = lParam;
|
||||||
MsgMemoryEntry = FindMsgMemory(UserModeMsg.message);
|
IntGetCursorLocation(pti->Desktop->WindowStation, &Message.pt);
|
||||||
Status = CopyMsgToKernelMem(&KernelModeMsg, &UserModeMsg, MsgMemoryEntry);
|
|
||||||
if (! NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
IntGetCursorLocation(pti->Desktop->WindowStation,
|
|
||||||
&KernelModeMsg.pt);
|
|
||||||
KeQueryTickCount(&LargeTickCount);
|
KeQueryTickCount(&LargeTickCount);
|
||||||
pti->timeLast = KernelModeMsg.time = MsqCalculateMessageTime(&LargeTickCount);
|
pti->timeLast = Message.time = MsqCalculateMessageTime(&LargeTickCount);
|
||||||
MsqPostMessage(Window->MessageQueue, &KernelModeMsg,
|
MsqPostMessage(Window->MessageQueue, &Message, FALSE, QS_POSTMESSAGE);
|
||||||
NULL != MsgMemoryEntry && 0 != KernelModeMsg.lParam,
|
|
||||||
QS_POSTMESSAGE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1410,14 +1404,20 @@ NtUserPostThreadMessage(DWORD idThread,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
MSG UserModeMsg, KernelModeMsg;
|
MSG Message;
|
||||||
PETHREAD peThread;
|
PETHREAD peThread;
|
||||||
PTHREADINFO pThread;
|
PTHREADINFO pThread;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PMSGMEMORY MsgMemoryEntry;
|
|
||||||
DECLARE_RETURN(BOOL);
|
DECLARE_RETURN(BOOL);
|
||||||
|
|
||||||
DPRINT("Enter NtUserPostThreadMessage\n");
|
DPRINT("Enter NtUserPostThreadMessage\n");
|
||||||
|
|
||||||
|
if (FindMsgMemory(Msg) != 0)
|
||||||
|
{
|
||||||
|
SetLastWin32Error(ERROR_MESSAGE_SYNC_ONLY );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
Status = PsLookupThreadByThreadId((HANDLE)idThread,&peThread);
|
Status = PsLookupThreadByThreadId((HANDLE)idThread,&peThread);
|
||||||
|
@ -1431,21 +1431,11 @@ NtUserPostThreadMessage(DWORD idThread,
|
||||||
RETURN( FALSE);
|
RETURN( FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
UserModeMsg.hwnd = NULL;
|
Message.hwnd = NULL;
|
||||||
UserModeMsg.message = Msg;
|
Message.message = Msg;
|
||||||
UserModeMsg.wParam = wParam;
|
Message.wParam = wParam;
|
||||||
UserModeMsg.lParam = lParam;
|
Message.lParam = lParam;
|
||||||
MsgMemoryEntry = FindMsgMemory(UserModeMsg.message);
|
MsqPostMessage(pThread->MessageQueue, &Message, FALSE, QS_POSTMESSAGE);
|
||||||
Status = CopyMsgToKernelMem(&KernelModeMsg, &UserModeMsg, MsgMemoryEntry);
|
|
||||||
if (! NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
ObDereferenceObject( peThread );
|
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
||||||
RETURN( FALSE);
|
|
||||||
}
|
|
||||||
MsqPostMessage(pThread->MessageQueue, &KernelModeMsg,
|
|
||||||
NULL != MsgMemoryEntry && 0 != KernelModeMsg.lParam,
|
|
||||||
QS_POSTMESSAGE);
|
|
||||||
ObDereferenceObject( peThread );
|
ObDereferenceObject( peThread );
|
||||||
RETURN( TRUE);
|
RETURN( TRUE);
|
||||||
}
|
}
|
||||||
|
@ -1682,7 +1672,7 @@ co_IntPostOrSendMessage(HWND hWnd,
|
||||||
}
|
}
|
||||||
|
|
||||||
pti = PsGetCurrentThreadWin32Thread();
|
pti = PsGetCurrentThreadWin32Thread();
|
||||||
if(Window->MessageQueue != pti->MessageQueue)
|
if(Window->MessageQueue != pti->MessageQueue && FindMsgMemory(Msg) ==0)
|
||||||
{
|
{
|
||||||
Result = UserPostMessage(hWnd, Msg, wParam, lParam);
|
Result = UserPostMessage(hWnd, Msg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
@ -1878,6 +1868,13 @@ UserSendNotifyMessage(HWND hWnd,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
BOOL Result = TRUE;
|
BOOL Result = TRUE;
|
||||||
|
|
||||||
|
if (FindMsgMemory(Msg) != 0)
|
||||||
|
{
|
||||||
|
SetLastWin32Error(ERROR_MESSAGE_SYNC_ONLY );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
// Basicly the same as IntPostOrSendMessage
|
// Basicly the same as IntPostOrSendMessage
|
||||||
if (hWnd == HWND_BROADCAST) //Handle Broadcast
|
if (hWnd == HWND_BROADCAST) //Handle Broadcast
|
||||||
{
|
{
|
||||||
|
@ -1902,10 +1899,7 @@ UserSendNotifyMessage(HWND hWnd,
|
||||||
ULONG_PTR PResult;
|
ULONG_PTR PResult;
|
||||||
PTHREADINFO pti;
|
PTHREADINFO pti;
|
||||||
PWINDOW_OBJECT Window;
|
PWINDOW_OBJECT Window;
|
||||||
NTSTATUS Status;
|
MSG Message;
|
||||||
MSG UserModeMsg;
|
|
||||||
MSG KernelModeMsg;
|
|
||||||
PMSGMEMORY MsgMemoryEntry;
|
|
||||||
|
|
||||||
if(!(Window = UserGetWindowObject(hWnd))) return FALSE;
|
if(!(Window = UserGetWindowObject(hWnd))) return FALSE;
|
||||||
|
|
||||||
|
@ -1916,55 +1910,18 @@ UserSendNotifyMessage(HWND hWnd,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Handle message and callback.
|
{ // Handle message and callback.
|
||||||
UserModeMsg.hwnd = hWnd;
|
Message.hwnd = hWnd;
|
||||||
UserModeMsg.message = Msg;
|
Message.message = Msg;
|
||||||
UserModeMsg.wParam = wParam;
|
Message.wParam = wParam;
|
||||||
UserModeMsg.lParam = lParam;
|
Message.lParam = lParam;
|
||||||
MsgMemoryEntry = FindMsgMemory(UserModeMsg.message);
|
|
||||||
Status = CopyMsgToKernelMem(&KernelModeMsg, &UserModeMsg, MsgMemoryEntry);
|
|
||||||
if (! NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
Result = co_IntSendMessageTimeoutSingle(
|
|
||||||
KernelModeMsg.hwnd, KernelModeMsg.message,
|
|
||||||
KernelModeMsg.wParam, KernelModeMsg.lParam,
|
|
||||||
SMTO_NORMAL, 0, &PResult);
|
|
||||||
|
|
||||||
Status = CopyMsgToUserMem(&UserModeMsg, &KernelModeMsg);
|
Result = co_IntSendMessageTimeoutSingle( hWnd, Msg, wParam, lParam, SMTO_NORMAL, 0, &PResult);
|
||||||
if (! NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL APIENTRY
|
|
||||||
NtUserSendNotifyMessage(HWND hWnd,
|
|
||||||
UINT Msg,
|
|
||||||
WPARAM wParam,
|
|
||||||
LPARAM lParam)
|
|
||||||
{
|
|
||||||
DECLARE_RETURN(BOOL);
|
|
||||||
|
|
||||||
DPRINT("EnterNtUserSendNotifyMessage\n");
|
|
||||||
UserEnterExclusive();
|
|
||||||
|
|
||||||
RETURN(UserSendNotifyMessage(hWnd, Msg, wParam, lParam));
|
|
||||||
|
|
||||||
CLEANUP:
|
|
||||||
DPRINT("Leave NtUserSendNotifyMessage, ret=%i\n",_ret_);
|
|
||||||
UserLeave();
|
|
||||||
END_CLEANUP;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BOOL APIENTRY
|
BOOL APIENTRY
|
||||||
NtUserWaitMessage(VOID)
|
NtUserWaitMessage(VOID)
|
||||||
{
|
{
|
||||||
|
|
|
@ -699,5 +699,4 @@ NtUserRegisterClassEx 6
|
||||||
NtUserMonitorFromWindow 2
|
NtUserMonitorFromWindow 2
|
||||||
NtUserSendMessage 5
|
NtUserSendMessage 5
|
||||||
NtUserSendMessageTimeout 8
|
NtUserSendMessageTimeout 8
|
||||||
NtUserSendNotifyMessage 4
|
|
||||||
NtUserSetScrollBarInfo 3
|
NtUserSetScrollBarInfo 3
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue