{
/* generate double click messages, if necessary */
if ((((*HitTest) != HTCLIENT) ||
- (Window->Wnd->Class->Style & CS_DBLCLKS)) &&
+ (Window->Wnd->pcls->style & CS_DBLCLKS)) &&
MsqIsDblClk(Msg, Remove))
{
Msg->message += WM_LBUTTONDBLCLK - WM_LBUTTONDOWN;
{
/* NOTE: Msg->pt should remain in screen coordinates. -- FiN */
Msg->lParam = MAKELONG(
- Msg->pt.x - (WORD)Window->Wnd->ClientRect.left,
- Msg->pt.y - (WORD)Window->Wnd->ClientRect.top);
+ Msg->pt.x - (WORD)Window->Wnd->rcClient.left,
+ Msg->pt.y - (WORD)Window->Wnd->rcClient.top);
}
}
PWINDOW_OBJECT Window;
PMSGMEMORY MsgMemoryEntry;
PVOID UserMem;
- UINT Size;
+ SIZE_T Size;
USER_MESSAGE Msg;
DECLARE_RETURN(BOOL);
Info.LParamSize = Size;
UserMem = NULL;
Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &UserMem, 0,
- &Info.LParamSize, MEM_COMMIT, PAGE_READWRITE);
+ &Size, MEM_COMMIT, PAGE_READWRITE);
if (! NT_SUCCESS(Status))
{
SetLastNtError(Status);
RETURN( (BOOL) -1);
}
/* Transfer lParam data to user-mode mem */
- Status = MmCopyToCaller(UserMem, (PVOID) Info.Msg.lParam, Size);
+ Status = MmCopyToCaller(UserMem, (PVOID) Info.Msg.lParam, Info.LParamSize);
if (! NT_SUCCESS(Status))
{
ZwFreeVirtualMemory(NtCurrentProcess(), (PVOID *) &UserMem,
- &Info.LParamSize, MEM_RELEASE);
+ &Size, MEM_RELEASE);
SetLastNtError(Status);
RETURN( (BOOL) -1);
}
PWINDOW_OBJECT Window = NULL;
PMSGMEMORY MsgMemoryEntry;
PVOID UserMem;
- UINT Size;
+ SIZE_T Size;
USER_MESSAGE Msg;
DECLARE_RETURN(BOOL);
// USER_REFERENCE_ENTRY Ref;
Info.LParamSize = Size;
UserMem = NULL;
Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &UserMem, 0,
- &Info.LParamSize, MEM_COMMIT, PAGE_READWRITE);
+ &Size, MEM_COMMIT, PAGE_READWRITE);
if (! NT_SUCCESS(Status))
{
RETURN( (BOOL) -1);
}
/* Transfer lParam data to user-mode mem */
- Status = MmCopyToCaller(UserMem, (PVOID) Info.Msg.lParam, Size);
+ Status = MmCopyToCaller(UserMem, (PVOID) Info.Msg.lParam, Info.LParamSize);
if (! NT_SUCCESS(Status))
{
ZwFreeVirtualMemory(NtCurrentProcess(), (PVOID *) &UserMem,
- &Info.LParamSize, MEM_DECOMMIT);
+ &Size, MEM_DECOMMIT);
SetLastNtError(Status);
RETURN( (BOOL) -1);
}
return STATUS_SUCCESS;
}
+BOOL FASTCALL
+UserPostThreadMessage( DWORD idThread,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ MSG Message;
+ PETHREAD peThread;
+ PTHREADINFO pThread;
+ LARGE_INTEGER LargeTickCount;
+ NTSTATUS Status;
+
+ DPRINT1("UserPostThreadMessage wParam 0x%x lParam 0x%x\n", wParam,lParam);
+
+ if (FindMsgMemory(Msg) != 0)
+ {
+ SetLastWin32Error(ERROR_MESSAGE_SYNC_ONLY );
+ return FALSE;
+ }
+
+ Status = PsLookupThreadByThreadId((HANDLE)idThread,&peThread);
+
+ if( Status == STATUS_SUCCESS )
+ {
+ pThread = (PTHREADINFO)peThread->Tcb.Win32Thread;
+ if( !pThread || !pThread->MessageQueue )
+ {
+ ObDereferenceObject( peThread );
+ return FALSE;
+ }
+
+ Message.hwnd = NULL;
+ Message.message = Msg;
+ Message.wParam = wParam;
+ Message.lParam = lParam;
+ IntGetCursorLocation(pThread->Desktop->WindowStation, &Message.pt);
+ KeQueryTickCount(&LargeTickCount);
+ pThread->timeLast = Message.time = MsqCalculateMessageTime(&LargeTickCount);
+ MsqPostMessage(pThread->MessageQueue, &Message, FALSE, QS_POSTMESSAGE);
+ ObDereferenceObject( peThread );
+ return TRUE;
+ }
+ else
+ {
+ SetLastNtError( Status );
+ }
+ return FALSE;
+}
+
BOOL FASTCALL
UserPostMessage(HWND Wnd,
UINT Msg,
MSG Message;
LARGE_INTEGER LargeTickCount;
- if (FindMsgMemory(Msg) != 0)
- {
- SetLastWin32Error(ERROR_MESSAGE_SYNC_ONLY );
- return FALSE;
- }
+ if (FindMsgMemory(Msg) != 0)
+ {
+ SetLastWin32Error(ERROR_MESSAGE_SYNC_ONLY );
+ return FALSE;
+ }
+
+ if (!Wnd)
+ return UserPostThreadMessage( PtrToInt(PsGetCurrentThreadId()),
+ Msg,
+ wParam,
+ lParam);
pti = PsGetCurrentThreadWin32Thread();
if (Wnd == HWND_BROADCAST)
MsqPostMessage(Window->MessageQueue, &Message, FALSE, QS_POSTMESSAGE);
}
}
-
return TRUE;
}
DPRINT("Enter NtUserPostMessage\n");
UserEnterExclusive();
- RETURN(UserPostMessage(hWnd, Msg, wParam, lParam));
+ RETURN( UserPostMessage(hWnd, Msg, wParam, lParam));
CLEANUP:
DPRINT("Leave NtUserPostMessage, ret=%i\n",_ret_);
WPARAM wParam,
LPARAM lParam)
{
- MSG Message;
- PETHREAD peThread;
- PTHREADINFO pThread;
- NTSTATUS Status;
DECLARE_RETURN(BOOL);
DPRINT("Enter NtUserPostThreadMessage\n");
-
- if (FindMsgMemory(Msg) != 0)
- {
- SetLastWin32Error(ERROR_MESSAGE_SYNC_ONLY );
- return FALSE;
- }
-
UserEnterExclusive();
- Status = PsLookupThreadByThreadId((HANDLE)idThread,&peThread);
-
- if( Status == STATUS_SUCCESS )
- {
- pThread = (PTHREADINFO)peThread->Tcb.Win32Thread;
- if( !pThread || !pThread->MessageQueue )
- {
- ObDereferenceObject( peThread );
- RETURN( FALSE);
- }
-
- Message.hwnd = NULL;
- Message.message = Msg;
- Message.wParam = wParam;
- Message.lParam = lParam;
- MsqPostMessage(pThread->MessageQueue, &Message, FALSE, QS_POSTMESSAGE);
- ObDereferenceObject( peThread );
- RETURN( TRUE);
- }
- else
- {
- SetLastNtError( Status );
- RETURN( FALSE);
- }
+ RETURN( UserPostThreadMessage( idThread,
+ Msg,
+ wParam,
+ lParam));
CLEANUP:
DPRINT("Leave NtUserPostThreadMessage, ret=%i\n",_ret_);
RETURN( FALSE);
}
- Result = (ULONG_PTR)co_IntCallWindowProc(Window->Wnd->WndProc, !Window->Wnd->Unicode, hWnd, Msg, wParam,
+ Result = (ULONG_PTR)co_IntCallWindowProc(Window->Wnd->lpfnWndProc, !Window->Wnd->Unicode, hWnd, Msg, wParam,
lParamPacked,lParamBufferSize);
if(uResult)
if (Window->Wnd->IsSystem)
{
- Info.Proc = (!Info.Ansi ? Window->Wnd->WndProc : Window->Wnd->WndProcExtra);
+ Info.Proc = (!Info.Ansi ? Window->Wnd->lpfnWndProc : Window->Wnd->WndProcExtra);
}
else
{
Info.Ansi = !Window->Wnd->Unicode;
- Info.Proc = Window->Wnd->WndProc;
+ Info.Proc = Window->Wnd->lpfnWndProc;
}
IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, &Result);
{
BOOL Result = TRUE;
- if (FindMsgMemory(Msg) != 0)
- {
- SetLastWin32Error(ERROR_MESSAGE_SYNC_ONLY );
- return FALSE;
- }
+ if (FindMsgMemory(Msg) != 0)
+ {
+ SetLastWin32Error(ERROR_MESSAGE_SYNC_ONLY );
+ return FALSE;
+ }
// Basicly the same as IntPostOrSendMessage
if (hWnd == HWND_BROADCAST) //Handle Broadcast
break;
case FNID_BROADCASTSYSTEMMESSAGE:
{
- PBROADCASTPARM parm;
+ BROADCASTPARM parm;
DWORD_PTR RetVal = 0;
if (ResultInfo)
ProbeForWrite((PVOID)ResultInfo,
sizeof(BROADCASTPARM),
1);
- parm = (PBROADCASTPARM)ResultInfo;
+ RtlCopyMemory(&parm, (PVOID)ResultInfo, sizeof(BROADCASTPARM));
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
else
break;
- if ( parm->recipients & BSM_ALLDESKTOPS ||
- parm->recipients == BSM_ALLCOMPONENTS )
+ if ( parm.recipients & BSM_ALLDESKTOPS ||
+ parm.recipients == BSM_ALLCOMPONENTS )
{
}
- else if (parm->recipients & BSM_APPLICATIONS)
+ else if (parm.recipients & BSM_APPLICATIONS)
{
- if (parm->flags & BSF_QUERY)
+ if (parm.flags & BSF_QUERY)
{
- if (parm->flags & BSF_FORCEIFHUNG || parm->flags & BSF_NOHANG)
+ if (parm.flags & BSF_FORCEIFHUNG || parm.flags & BSF_NOHANG)
{
co_IntSendMessageTimeout( HWND_BROADCAST,
Msg,
2000,
&RetVal);
}
- else if (parm->flags & BSF_NOTIMEOUTIFNOTHUNG)
+ else if (parm.flags & BSF_NOTIMEOUTIFNOTHUNG)
{
co_IntSendMessageTimeout( HWND_BROADCAST,
Msg,
&RetVal);
}
}
- else if (parm->flags & BSF_POSTMESSAGE)
+ else if (parm.flags & BSF_POSTMESSAGE)
{
Ret = UserPostMessage(HWND_BROADCAST, Msg, wParam, lParam);
}
- else if ( parm->flags & BSF_SENDNOTIFYMESSAGE)
+ else if ( parm.flags & BSF_SENDNOTIFYMESSAGE)
{
Ret = UserSendNotifyMessage(HWND_BROADCAST, Msg, wParam, lParam);
}
IN BOOL Unknown2)
{
PEPROCESS Process;
- PW32PROCESS W32Process;
+ PPROCESSINFO W32Process;
NTSTATUS Status;
HANDLE Handles[2];
LARGE_INTEGER Timeout;
return WAIT_FAILED;
}
- W32Process = (PW32PROCESS)Process->Win32Process;
+ W32Process = (PPROCESSINFO)Process->Win32Process;
if (!W32Process)
{
ObDereferenceObject(Process);