mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 05:15:41 +00:00
Implement SendNotifyMessage. Needs more testing.
svn path=/trunk/; revision=23557
This commit is contained in:
parent
635b9fb393
commit
8d995ea23d
2 changed files with 137 additions and 13 deletions
|
@ -1901,8 +1901,30 @@ SendNotifyMessageA(
|
|||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
MSG AnsiMsg, UcMsg;
|
||||
MSG KMMsg;
|
||||
LRESULT Result;
|
||||
|
||||
AnsiMsg.hwnd = hWnd;
|
||||
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 = NtUserSendNotifyMessage(KMMsg.hwnd, KMMsg.message,
|
||||
KMMsg.wParam, KMMsg.lParam);
|
||||
MsgiUMToKMCleanup(&UcMsg, &KMMsg);
|
||||
MsgiAnsiToUnicodeCleanup(&UcMsg, &AnsiMsg);
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1917,8 +1939,22 @@ SendNotifyMessageW(
|
|||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
MSG UMMsg, KMMsg;
|
||||
LRESULT Result;
|
||||
|
||||
UMMsg.hwnd = hWnd;
|
||||
UMMsg.message = Msg;
|
||||
UMMsg.wParam = wParam;
|
||||
UMMsg.lParam = lParam;
|
||||
if (! MsgiUMToKMMessage(&UMMsg, &KMMsg, TRUE))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
Result = NtUserSendNotifyMessage(KMMsg.hwnd, KMMsg.message,
|
||||
KMMsg.wParam, KMMsg.lParam);
|
||||
MsgiUMToKMCleanup(&UMMsg, &KMMsg);
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1103,13 +1103,19 @@ CopyMsgToKernelMem(MSG *KernelModeMsg, MSG *UserModeMsg, PMSGMEMORY MsgMemoryEnt
|
|||
/* Copy data if required */
|
||||
if (0 != (MsgMemoryEntry->Flags & MMS_FLAG_READ))
|
||||
{
|
||||
Status = MmCopyFromCaller(KernelMem, (PVOID) UserModeMsg->lParam, Size);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Failed to copy message to kernel: invalid usermode buffer\n");
|
||||
ExFreePool(KernelMem);
|
||||
return Status;
|
||||
}
|
||||
|
||||
DPRINT1("Copy message to kernel from the User! %x from %x\n", KernelMem, UserModeMsg->lParam);
|
||||
RtlCopyMemory(KernelMem, (PVOID) UserModeMsg->lParam, Size);
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
|
||||
// Status = MmCopyFromCaller(KernelMem, (PVOID) UserModeMsg->lParam, Size);
|
||||
// if (! NT_SUCCESS(Status))
|
||||
// {
|
||||
// DPRINT1("Failed to copy message to kernel: invalid usermode buffer\n");
|
||||
// ExFreePool(KernelMem);
|
||||
// return Status;
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1700,17 +1706,99 @@ NtUserSendMessageCallback(HWND hWnd,
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
BOOL FASTCALL
|
||||
UserSendNotifyMessage(HWND hWnd,
|
||||
UINT Msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
BOOL Result = TRUE;
|
||||
// Basicly the same as IntPostOrSendMessage
|
||||
if (hWnd == HWND_BROADCAST) //Handle Broadcast
|
||||
{
|
||||
HWND *List;
|
||||
PWINDOW_OBJECT DesktopWindow;
|
||||
ULONG i;
|
||||
|
||||
DesktopWindow = UserGetWindowObject(IntGetDesktopWindow());
|
||||
List = IntWinListChildren(DesktopWindow);
|
||||
|
||||
if (List != NULL)
|
||||
{
|
||||
for (i = 0; List[i]; i++)
|
||||
{
|
||||
UserSendNotifyMessage(List[i], Msg, wParam, lParam);
|
||||
}
|
||||
ExFreePool(List);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ULONG_PTR PResult;
|
||||
PWINDOW_OBJECT Window;
|
||||
NTSTATUS Status;
|
||||
MSG UserModeMsg;
|
||||
MSG KernelModeMsg;
|
||||
PMSGMEMORY MsgMemoryEntry;
|
||||
|
||||
if(!(Window = UserGetWindowObject(hWnd))) return FALSE;
|
||||
|
||||
if(Window->MessageQueue != PsGetCurrentThreadWin32Thread()->MessageQueue)
|
||||
{ // Send message w/o waiting for it.
|
||||
Result = UserPostMessage(hWnd, Msg, wParam, lParam);
|
||||
}
|
||||
else
|
||||
{ // Handle message and callback.
|
||||
UserModeMsg.hwnd = hWnd;
|
||||
UserModeMsg.message = Msg;
|
||||
UserModeMsg.wParam = wParam;
|
||||
UserModeMsg.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);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
BOOL STDCALL
|
||||
NtUserSendNotifyMessage(HWND hWnd,
|
||||
UINT Msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
DECLARE_RETURN(BOOL);
|
||||
|
||||
DPRINT("EnterNtUserSendNotifyMessage\n");
|
||||
UserEnterExclusive();
|
||||
|
||||
RETURN(UserSendNotifyMessage(hWnd, Msg, wParam, lParam));
|
||||
|
||||
CLEANUP:
|
||||
DPRINT("Leave NtUserSendNotifyMessage, ret=%i\n",_ret_);
|
||||
UserLeave();
|
||||
END_CLEANUP;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
BOOL STDCALL
|
||||
NtUserWaitMessage(VOID)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue