ReactOS 0.4.15-dev-7788-g1ad9096
message.c File Reference
#include <win32k.h>
#include <dde.h>
Include dependency graph for message.c:

Go to the source code of this file.

Classes

struct  tagMSGMEMORY
 

Macros

#define PM_BADMSGFLAGS   ~((QS_RAWINPUT << 16)|PM_QS_SENDMESSAGE|PM_QS_PAINT|PM_QS_POSTMESSAGE|PM_QS_INPUT|PM_NOYIELD|PM_REMOVE)
 
#define SET(msg)   (1 << ((msg) & 31))
 
#define MMS_SIZE_WPARAM   -1
 
#define MMS_SIZE_WPARAMWCHAR   -2
 
#define MMS_SIZE_LPARAMSZ   -3
 
#define MMS_SIZE_SPECIAL   -4
 
#define MMS_FLAG_READ   0x01
 
#define MMS_FLAG_WRITE   0x02
 
#define MMS_FLAG_READWRITE   (MMS_FLAG_READ | MMS_FLAG_WRITE)
 
#define INFINITE   0xFFFFFFFF
 
#define WAIT_FAILED   ((DWORD)0xFFFFFFFF)
 

Typedefs

typedef struct tagMSGMEMORY MSGMEMORY
 
typedef struct tagMSGMEMORYPMSGMEMORY
 

Functions

 DBG_DEFAULT_CHANNEL (UserMsg)
 
NTSTATUS FASTCALL IntInitMessageImpl (VOID)
 
NTSTATUS FASTCALL IntCleanupMessageImpl (VOID)
 
static int is_pointer_message (UINT message, WPARAM wparam)
 
static PMSGMEMORY FASTCALL FindMsgMemory (UINT Msg)
 
static UINT FASTCALL MsgMemorySize (PMSGMEMORY MsgMemoryEntry, WPARAM wParam, LPARAM lParam)
 
UINT lParamMemorySize (UINT Msg, WPARAM wParam, LPARAM lParam)
 
static NTSTATUS PackParam (LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL NonPagedPoolNeeded)
 
static NTSTATUS UnpackParam (LPARAM lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL NonPagedPoolUsed)
 
static NTSTATUS FASTCALL CopyMsgToKernelMem (MSG *KernelModeMsg, MSG *UserModeMsg, PMSGMEMORY MsgMemoryEntry)
 
static NTSTATUS FASTCALL CopyMsgToUserMem (MSG *UserModeMsg, MSG *KernelModeMsg)
 
VOID FASTCALL IdlePing (VOID)
 
VOID FASTCALL IdlePong (VOID)
 
static BOOL is_message_broadcastable (UINT msg)
 
UINT FASTCALL GetWakeMask (UINT first, UINT last)
 
BOOL FASTCALL IntMsgCreateStructW (PWND Window, CREATESTRUCTW *pCsw, CREATESTRUCTW *Cs, PVOID *ppszClass, PVOID *ppszName)
 
static VOID FASTCALL IntCallWndProc (PWND Window, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
static VOID FASTCALL IntCallWndProcRet (PWND Window, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *uResult)
 
static LRESULT handle_internal_message (PWND pWnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT handle_internal_events (PTHREADINFO pti, PWND pWnd, DWORD dwQEvent, LONG_PTR ExtraInfo, PMSG pMsg)
 
LRESULT FASTCALL IntDispatchMessage (PMSG pMsg)
 
BOOL APIENTRY co_IntPeekMessage (PMSG Msg, PWND Window, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg, LONG_PTR *ExtraInfo, BOOL bGMSG)
 
BOOL FASTCALL co_IntWaitMessage (PWND Window, UINT MsgFilterMin, UINT MsgFilterMax)
 
BOOL APIENTRY co_IntGetPeekMessage (PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg, BOOL bGMSG)
 
BOOL FASTCALL UserPostThreadMessage (PTHREADINFO pti, UINT Msg, WPARAM wParam, LPARAM lParam)
 
PTHREADINFO FASTCALL IntSendTo (PWND Window, PTHREADINFO ptiCur, UINT Msg)
 
BOOL FASTCALL UserPostMessage (HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
LRESULT FASTCALL co_IntSendMessage (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT FASTCALL co_IntSendMessageTimeoutSingle (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT uFlags, UINT uTimeout, ULONG_PTR *uResult)
 
LRESULT FASTCALL co_IntSendMessageTimeout (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT uFlags, UINT uTimeout, ULONG_PTR *uResult)
 
LRESULT FASTCALL co_IntSendMessageNoWait (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
LRESULT FASTCALL co_IntSendMessageWithCallBack (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, SENDASYNCPROC CompletionCallback, ULONG_PTR CompletionCallbackContext, ULONG_PTR *uResult)
 
static LRESULT FASTCALL co_IntDoSendMessage (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, PDOSENDMESSAGE dsm)
 
BOOL FASTCALL UserSendNotifyMessage (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
DWORD APIENTRY IntGetQueueStatus (DWORD Changes)
 
BOOL APIENTRY IntInitMessagePumpHook (VOID)
 
BOOL APIENTRY IntUninitMessagePumpHook (VOID)
 
BOOL FASTCALL IntCallMsgFilter (LPMSG lpmsg, INT code)
 
BOOL APIENTRY NtUserDragDetect (HWND hWnd, POINT pt)
 
BOOL APIENTRY NtUserPostMessage (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
BOOL APIENTRY NtUserPostThreadMessage (DWORD idThread, UINT Msg, WPARAM wParam, LPARAM lParam)
 
BOOL APIENTRY NtUserWaitMessage (VOID)
 
BOOL APIENTRY NtUserGetMessage (PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax)
 
BOOL APIENTRY NtUserPeekMessage (PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg)
 
BOOL APIENTRY NtUserCallMsgFilter (LPMSG lpmsg, INT code)
 
LRESULT APIENTRY NtUserDispatchMessage (PMSG UnsafeMsgInfo)
 
BOOL APIENTRY NtUserTranslateMessage (LPMSG lpMsg, UINT flags)
 
LRESULT APIENTRY ScrollBarWndProc (HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
BOOL APIENTRY NtUserMessageCall (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR ResultInfo, DWORD dwType, BOOL Ansi)
 
DWORD APIENTRY NtUserWaitForInputIdle (IN HANDLE hProcess, IN DWORD dwMilliseconds, IN BOOL bSharedWow)
 

Variables

static const unsigned int message_pointer_flags []
 
static MSGMEMORY g_MsgMemory []
 

Macro Definition Documentation

◆ INFINITE

#define INFINITE   0xFFFFFFFF

Definition at line 3055 of file message.c.

◆ MMS_FLAG_READ

#define MMS_FLAG_READ   0x01

Definition at line 110 of file message.c.

◆ MMS_FLAG_READWRITE

#define MMS_FLAG_READWRITE   (MMS_FLAG_READ | MMS_FLAG_WRITE)

Definition at line 112 of file message.c.

◆ MMS_FLAG_WRITE

#define MMS_FLAG_WRITE   0x02

Definition at line 111 of file message.c.

◆ MMS_SIZE_LPARAMSZ

#define MMS_SIZE_LPARAMSZ   -3

Definition at line 108 of file message.c.

◆ MMS_SIZE_SPECIAL

#define MMS_SIZE_SPECIAL   -4

Definition at line 109 of file message.c.

◆ MMS_SIZE_WPARAM

#define MMS_SIZE_WPARAM   -1

Definition at line 106 of file message.c.

◆ MMS_SIZE_WPARAMWCHAR

#define MMS_SIZE_WPARAMWCHAR   -2

Definition at line 107 of file message.c.

◆ PM_BADMSGFLAGS

#define PM_BADMSGFLAGS   ~((QS_RAWINPUT << 16)|PM_QS_SENDMESSAGE|PM_QS_PAINT|PM_QS_POSTMESSAGE|PM_QS_INPUT|PM_NOYIELD|PM_REMOVE)

Definition at line 14 of file message.c.

◆ SET

#define SET (   msg)    (1 << ((msg) & 31))

Definition at line 34 of file message.c.

◆ WAIT_FAILED

#define WAIT_FAILED   ((DWORD)0xFFFFFFFF)

Definition at line 3056 of file message.c.

Typedef Documentation

◆ MSGMEMORY

◆ PMSGMEMORY

Function Documentation

◆ co_IntDoSendMessage()

static LRESULT FASTCALL co_IntDoSendMessage ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
PDOSENDMESSAGE  dsm 
)
static

Definition at line 1954 of file message.c.

1959{
1962 PWND Window = NULL;
1963 MSG UserModeMsg, KernelModeMsg;
1964 PMSGMEMORY MsgMemoryEntry;
1965 PTHREADINFO ptiSendTo;
1966
1967 if (hWnd != HWND_BROADCAST && hWnd != HWND_TOPMOST)
1968 {
1970 if ( !Window )
1971 {
1972 return 0;
1973 }
1974 }
1975
1976 /* Check for an exiting window. */
1977 if (Window && Window->state & WNDS_DESTROYED)
1978 {
1979 ERR("co_IntDoSendMessage Window Exiting!\n");
1980 }
1981
1982 /* See if the current thread can handle this message */
1983 ptiSendTo = IntSendTo(Window, gptiCurrent, Msg);
1984
1985 // If broadcasting or sending to another thread, save the users data.
1986 if (!Window || ptiSendTo )
1987 {
1988 UserModeMsg.hwnd = hWnd;
1989 UserModeMsg.message = Msg;
1990 UserModeMsg.wParam = wParam;
1991 UserModeMsg.lParam = lParam;
1992 MsgMemoryEntry = FindMsgMemory(UserModeMsg.message);
1993 Status = CopyMsgToKernelMem(&KernelModeMsg, &UserModeMsg, MsgMemoryEntry);
1994 if (!NT_SUCCESS(Status))
1995 {
1997 return (dsm ? 0 : -1);
1998 }
1999 }
2000 else
2001 {
2002 KernelModeMsg.hwnd = hWnd;
2003 KernelModeMsg.message = Msg;
2004 KernelModeMsg.wParam = wParam;
2005 KernelModeMsg.lParam = lParam;
2006 }
2007
2008 if (!dsm)
2009 {
2010 Result = co_IntSendMessage( KernelModeMsg.hwnd,
2011 KernelModeMsg.message,
2012 KernelModeMsg.wParam,
2013 KernelModeMsg.lParam );
2014 }
2015 else
2016 {
2017 Result = co_IntSendMessageTimeout( KernelModeMsg.hwnd,
2018 KernelModeMsg.message,
2019 KernelModeMsg.wParam,
2020 KernelModeMsg.lParam,
2021 dsm->uFlags,
2022 dsm->uTimeout,
2023 &dsm->Result );
2024 }
2025
2026 if (!Window || ptiSendTo )
2027 {
2028 Status = CopyMsgToUserMem(&UserModeMsg, &KernelModeMsg);
2029 if (!NT_SUCCESS(Status))
2030 {
2032 return(dsm ? 0 : -1);
2033 }
2034 }
2035
2036 return (LRESULT)Result;
2037}
HWND hWnd
Definition: settings.c:17
LONG NTSTATUS
Definition: precomp.h:26
#define ERR(fmt,...)
Definition: debug.h:110
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
struct @1627 Msg[]
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
Status
Definition: gdiplustypes.h:25
#define WNDS_DESTROYED
Definition: ntuser.h:636
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
Definition: window.c:28
Definition: ntuser.h:694
ULONG_PTR Result
Definition: ntuser.h:2650
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:122
static NTSTATUS FASTCALL CopyMsgToKernelMem(MSG *KernelModeMsg, MSG *UserModeMsg, PMSGMEMORY MsgMemoryEntry)
Definition: message.c:429
PTHREADINFO FASTCALL IntSendTo(PWND Window, PTHREADINFO ptiCur, UINT Msg)
Definition: message.c:1331
LRESULT FASTCALL co_IntSendMessageTimeout(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT uFlags, UINT uTimeout, ULONG_PTR *uResult)
Definition: message.c:1657
static PMSGMEMORY FASTCALL FindMsgMemory(UINT Msg)
Definition: message.c:146
static NTSTATUS FASTCALL CopyMsgToUserMem(MSG *UserModeMsg, MSG *KernelModeMsg)
Definition: message.c:486
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1445
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22
LONG_PTR LRESULT
Definition: windef.h:209
#define HWND_TOPMOST
Definition: winuser.h:1208
#define HWND_BROADCAST
Definition: winuser.h:1204
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by NtUserMessageCall().

◆ co_IntGetPeekMessage()

BOOL APIENTRY co_IntGetPeekMessage ( PMSG  pMsg,
HWND  hWnd,
UINT  MsgFilterMin,
UINT  MsgFilterMax,
UINT  RemoveMsg,
BOOL  bGMSG 
)

Definition at line 1176 of file message.c.

1182{
1183 PWND Window;
1184 PTHREADINFO pti;
1185 BOOL Present = FALSE;
1187 LONG_PTR ExtraInfo = 0;
1188
1189 if ( hWnd == HWND_TOPMOST || hWnd == HWND_BROADCAST )
1190 hWnd = HWND_BOTTOM;
1191
1192 /* Validate input */
1193 if (hWnd && hWnd != HWND_BOTTOM)
1194 {
1196 {
1197 if (bGMSG)
1198 return -1;
1199 else
1200 return FALSE;
1201 }
1202 }
1203 else
1204 {
1205 Window = (PWND)hWnd;
1206 }
1207
1208 if (MsgFilterMax < MsgFilterMin)
1209 {
1210 MsgFilterMin = 0;
1211 MsgFilterMax = 0;
1212 }
1213
1214 if (bGMSG)
1215 {
1216 RemoveMsg |= ((GetWakeMask( MsgFilterMin, MsgFilterMax ))<< 16);
1217 }
1218
1220 pti->pClientInfo->cSpins++; // Bump up the spin count.
1221
1222 do
1223 {
1224 Present = co_IntPeekMessage( pMsg,
1225 Window,
1226 MsgFilterMin,
1227 MsgFilterMax,
1228 RemoveMsg,
1229 &ExtraInfo,
1230 bGMSG );
1231 if (Present)
1232 {
1233 if ( pMsg->message != WM_DEVICECHANGE || (pMsg->wParam & 0x8000) )
1234 {
1235 /* GetMessage or PostMessage must never get messages that contain pointers */
1236 ASSERT(FindMsgMemory(pMsg->message) == NULL);
1237 }
1238
1239 if ( pMsg->message >= WM_DDE_FIRST && pMsg->message <= WM_DDE_LAST )
1240 {
1241 if (!IntDdeGetMessageHook(pMsg, ExtraInfo))
1242 {
1243 TRACE("DDE Get return ERROR\n");
1244 continue;
1245 }
1246 }
1247
1248 if (pMsg->message != WM_PAINT && pMsg->message != WM_QUIT)
1249 {
1250 if (!RtlEqualMemory(&pti->ptLast, &pMsg->pt, sizeof(POINT)))
1251 {
1253 }
1254 pti->timeLast = pMsg->time;
1255 pti->ptLast = pMsg->pt;
1256 }
1257
1258 // The WH_GETMESSAGE hook enables an application to monitor messages about to
1259 // be returned by the GetMessage or PeekMessage function.
1260
1262
1263 if ( bGMSG || pMsg->message == WM_PAINT) break;
1264 }
1265
1266 if ( bGMSG )
1267 {
1269 Window,
1270 MsgFilterMin,
1271 MsgFilterMax);
1272 if ( !NT_SUCCESS(Status) ||
1275 {
1276 Present = -1;
1277 break;
1278 }
1279 }
1280 else
1281 {
1282 if (!(RemoveMsg & PM_NOYIELD))
1283 {
1284 IdlePing();
1285 // Yield this thread!
1286 UserLeave();
1289 // Fall through to exit.
1290 IdlePong();
1291 }
1292 break;
1293 }
1294 }
1295 while( bGMSG && !Present );
1296
1297 // Been spinning, time to swap vinyl...
1298 if (pti->pClientInfo->cSpins >= 100)
1299 {
1300 // Clear the spin cycle to fix the mix.
1301 pti->pClientInfo->cSpins = 0;
1302 //if (!(pti->TIF_flags & TIF_SPINNING)) // FIXME: Need to swap vinyl...
1303 }
1304 return Present;
1305}
#define WM_DDE_FIRST
Definition: dde.h:47
#define WM_DDE_LAST
Definition: dde.h:46
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
struct _WND * PWND
#define TIF_MSGPOSCHANGED
Definition: ntuser.h:283
#define RtlEqualMemory(a, b, c)
Definition: kdvm.h:18
#define ASSERT(a)
Definition: mode.c:44
NTSTATUS FASTCALL co_MsqWaitForNewMessages(PTHREADINFO pti, PWND WndFilter, UINT MsgFilterMin, UINT MsgFilterMax)
Definition: msgqueue.c:2107
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
NTSYSAPI NTSTATUS NTAPI ZwYieldExecution(VOID)
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define STATUS_TIMEOUT
Definition: ntstatus.h:81
#define STATUS_USER_APC
Definition: ntstatus.h:78
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
Definition: hook.c:1102
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:251
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:242
#define TRACE(s)
Definition: solgame.cpp:4
POINT ptLast
Definition: win32.h:129
struct _CLIENTINFO * pClientInfo
Definition: win32.h:94
LONG timeLast
Definition: win32.h:102
FLONG TIF_flags
Definition: win32.h:95
UINT message
Definition: winuser.h:3115
DWORD time
Definition: winuser.h:3118
WPARAM wParam
Definition: winuser.h:3116
POINT pt
Definition: winuser.h:3119
BOOL APIENTRY IntDdeGetMessageHook(PMSG pMsg, LONG_PTR ExtraInfo)
Definition: dde.c:326
UINT FASTCALL GetWakeMask(UINT first, UINT last)
Definition: message.c:573
VOID FASTCALL IdlePing(VOID)
Definition: message.c:526
VOID FASTCALL IdlePong(VOID)
Definition: message.c:556
BOOL APIENTRY co_IntPeekMessage(PMSG Msg, PWND Window, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg, LONG_PTR *ExtraInfo, BOOL bGMSG)
Definition: message.c:964
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_PAINT
Definition: winuser.h:1620
#define WM_QUIT
Definition: winuser.h:1623
#define HC_ACTION
Definition: winuser.h:48
#define WM_DEVICECHANGE
Definition: winuser.h:1811
#define PM_NOYIELD
Definition: winuser.h:1197
#define PM_REMOVE
Definition: winuser.h:1196
#define WH_GETMESSAGE
Definition: winuser.h:33
#define HWND_BOTTOM
Definition: winuser.h:1205

Referenced by DefWndDoSizeMove(), DefWndStartSizeMove(), DesktopThreadMain(), MENU_SuspendPopup(), MENU_TrackMenu(), NC_DoButton(), NC_HandleNCRButtonDown(), NtUserDragDetect(), NtUserGetMessage(), NtUserPeekMessage(), and NtUserWaitForInputIdle().

◆ co_IntPeekMessage()

BOOL APIENTRY co_IntPeekMessage ( PMSG  Msg,
PWND  Window,
UINT  MsgFilterMin,
UINT  MsgFilterMax,
UINT  RemoveMsg,
LONG_PTR ExtraInfo,
BOOL  bGMSG 
)

Definition at line 964 of file message.c.

971{
972 PTHREADINFO pti;
973 BOOL RemoveMessages;
974 UINT ProcessMask;
975 BOOL Hit = FALSE;
976
978
979 RemoveMessages = RemoveMsg & PM_REMOVE;
980 ProcessMask = HIWORD(RemoveMsg);
981
982 /* Hint, "If wMsgFilterMin and wMsgFilterMax are both zero, PeekMessage returns
983 all available messages (that is, no range filtering is performed)". */
984 if (!ProcessMask) ProcessMask = (QS_ALLPOSTMESSAGE|QS_ALLINPUT);
985
986 IdlePong();
987
988 do
989 {
990 /* Update the last message-queue access time */
991 pti->pcti->timeLastRead = EngGetTickCount32();
992
993 // Post mouse moves while looping through peek messages.
994 if (pti->MessageQueue->QF_flags & QF_MOUSEMOVED)
995 {
997 }
998
999 /* Dispatch sent messages here. */
1000 while ( co_MsqDispatchOneSentMessage(pti) )
1001 {
1002 /* if some PM_QS* flags were specified, only handle sent messages from now on */
1003 if (HIWORD(RemoveMsg) && !bGMSG) Hit = TRUE; // wine does this; ProcessMask = QS_SENDMESSAGE;
1004 }
1005 if (Hit) return FALSE;
1006
1007 /* Clear changed bits so we can wait on them if we don't find a message */
1008 if (ProcessMask & QS_POSTMESSAGE)
1009 {
1010 pti->pcti->fsChangeBits &= ~(QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER);
1011 if (MsgFilterMin == 0 && MsgFilterMax == 0) // Wine hack does this; ~0U)
1012 {
1013 pti->pcti->fsChangeBits &= ~QS_ALLPOSTMESSAGE;
1014 }
1015 }
1016
1017 if (ProcessMask & QS_INPUT)
1018 {
1019 pti->pcti->fsChangeBits &= ~QS_INPUT;
1020 }
1021
1022 /* Now check for normal messages. */
1023 if (( (ProcessMask & QS_POSTMESSAGE) ||
1024 (ProcessMask & QS_HOTKEY) ) &&
1025 MsqPeekMessage( pti,
1026 RemoveMessages,
1027 Window,
1028 MsgFilterMin,
1029 MsgFilterMax,
1030 ProcessMask,
1031 ExtraInfo,
1032 0,
1033 Msg ))
1034 {
1035 goto GotMessage;
1036 }
1037
1038 /* Only check for quit messages if not posted messages pending. */
1039 if (ProcessMask & QS_POSTMESSAGE && pti->QuitPosted)
1040 {
1041 /* According to the PSDK, WM_QUIT messages are always returned, regardless
1042 of the filter specified */
1043 Msg->hwnd = NULL;
1044 Msg->message = WM_QUIT;
1045 Msg->wParam = pti->exitCode;
1046 Msg->lParam = 0;
1047 if (RemoveMessages)
1048 {
1049 pti->QuitPosted = FALSE;
1051 pti->pcti->fsWakeBits &= ~QS_ALLPOSTMESSAGE;
1052 pti->pcti->fsChangeBits &= ~QS_ALLPOSTMESSAGE;
1053 }
1054 goto GotMessage;
1055 }
1056
1057 /* Check for hardware events. */
1058 if ((ProcessMask & QS_INPUT) &&
1060 RemoveMessages,
1061 Window,
1062 MsgFilterMin,
1063 MsgFilterMax,
1064 ProcessMask,
1065 Msg))
1066 {
1067 goto GotMessage;
1068 }
1069
1070 /* Now check for System Event messages. */
1071 {
1072 LONG_PTR eExtraInfo;
1073 MSG eMsg;
1074 DWORD dwQEvent;
1075 if (MsqPeekMessage( pti,
1076 TRUE,
1077 Window,
1078 0,
1079 0,
1080 QS_EVENT,
1081 &eExtraInfo,
1082 &dwQEvent,
1083 &eMsg ))
1084 {
1085 handle_internal_events( pti, Window, dwQEvent, eExtraInfo, &eMsg);
1086 continue;
1087 }
1088 }
1089
1090 /* Check for sent messages again. */
1091 while ( co_MsqDispatchOneSentMessage(pti) )
1092 {
1093 if (HIWORD(RemoveMsg) && !bGMSG) Hit = TRUE;
1094 }
1095 if (Hit) return FALSE;
1096
1097 /* Check for paint messages. */
1098 if ((ProcessMask & QS_PAINT) &&
1099 pti->cPaintsReady &&
1101 MsgFilterMin,
1102 MsgFilterMax,
1103 pti,
1104 Msg,
1105 RemoveMessages))
1106 {
1107 goto GotMessage;
1108 }
1109
1110 /* This is correct, check for the current threads timers waiting to be
1111 posted to this threads message queue. If any we loop again.
1112 */
1113 if ((ProcessMask & QS_TIMER) &&
1115 {
1116 continue;
1117 }
1118
1119 return FALSE;
1120 }
1121 while (TRUE);
1122
1123GotMessage:
1124 /* Update the last message-queue access time */
1125 pti->pcti->timeLastRead = EngGetTickCount32();
1126 return TRUE;
1127}
#define EngGetTickCount32()
Definition: eng.h:43
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID FASTCALL ClearMsgBitsMask(PTHREADINFO pti, UINT MessageBits)
Definition: msgqueue.c:445
BOOLEAN FASTCALL co_MsqDispatchOneSentMessage(_In_ PTHREADINFO pti)
Definition: msgqueue.c:873
BOOL APIENTRY co_MsqPeekHardwareMessage(IN PTHREADINFO pti, IN BOOL Remove, IN PWND Window, IN UINT MsgFilterLow, IN UINT MsgFilterHigh, IN UINT QSflags, OUT MSG *pMsg)
Definition: msgqueue.c:1933
VOID FASTCALL IntCoalesceMouseMove(PTHREADINFO pti)
Definition: msgqueue.c:551
BOOLEAN APIENTRY MsqPeekMessage(IN PTHREADINFO pti, IN BOOLEAN Remove, IN PWND Window, IN UINT MsgFilterLow, IN UINT MsgFilterHigh, IN UINT QSflags, OUT LONG_PTR *ExtraInfo, OUT DWORD *dwQEvent, OUT PMSG Message)
Definition: msgqueue.c:2050
#define QF_MOUSEMOVED
Definition: msgqueue.h:99
unsigned int UINT
Definition: ndis.h:50
INT exitCode
Definition: win32.h:107
BOOLEAN QuitPosted
Definition: win32.h:105
struct _CLIENTTHREADINFO * pcti
Definition: win32.h:91
UINT cPaintsReady
Definition: win32.h:109
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:89
#define HIWORD(l)
Definition: typedefs.h:247
#define QS_EVENT
Definition: undocuser.h:97
BOOL FASTCALL IntGetPaintMessage(PWND Window, UINT MsgFilterMin, UINT MsgFilterMax, PTHREADINFO Thread, MSG *Message, BOOL Remove)
Definition: painting.c:1184
static LRESULT handle_internal_events(PTHREADINFO pti, PWND pWnd, DWORD dwQEvent, LONG_PTR ExtraInfo, PMSG pMsg)
Definition: message.c:812
BOOL FASTCALL PostTimerMessages(PWND Window)
Definition: timer.c:395
#define QS_TIMER
Definition: winuser.h:878
#define QS_ALLPOSTMESSAGE
Definition: winuser.h:882
#define QS_ALLINPUT
Definition: winuser.h:903
#define QS_HOTKEY
Definition: winuser.h:881
#define QS_INPUT
Definition: winuser.h:899
#define QS_POSTMESSAGE
Definition: winuser.h:877
#define QS_PAINT
Definition: winuser.h:879

Referenced by co_IntGetPeekMessage(), and co_IntWaitMessage().

◆ co_IntSendMessage()

LRESULT FASTCALL co_IntSendMessage ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1445 of file message.c.

1449{
1450 ULONG_PTR Result = 0;
1451
1453 {
1454 return (LRESULT)Result;
1455 }
1456 return 0;
1457}
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define SMTO_NORMAL
Definition: winuser.h:1225

Referenced by co_IntDoSendMessage(), co_IntPaintWindows(), co_IntProcessKeyboardMessage(), co_IntProcessMouseMessage(), co_IntSendActivateMessages(), co_IntSendDeactivateMessages(), co_IntSetForegroundMessageQueue(), co_IntSetWindowLongPtr(), co_IntTranslateAccelerator(), co_IntUpdateWindows(), co_MsqDispatchOneSentMessage(), co_UserActivateKbl(), co_UserActivateKeyboardLayout(), co_UserCreateWindowEx(), co_UserFreeWindow(), co_UserSetCapture(), co_WinPosDoNCCALCSize(), co_WinPosDoWinPosChanging(), co_WinPosGetMinMaxInfo(), co_WinPosSearchChildren(), co_WinPosShowWindow(), DefWndDoSizeMove(), DefWndHandleSysCommand(), DefWndHandleWindowPosChanged(), DefWndPrint(), DefWndStartSizeMove(), ForceNCPaintErase(), GetControlColor(), IntActivateWindow(), IntBeginPaint(), IntCheckImeShowStatus(), IntClientShutdown(), IntDeactivateWindow(), IntDefWindowProc(), IntEnableWindow(), IntFlashWindowEx(), IntFocusSetInputContext(), IntImeWindowPosChanged(), IntImmActivateLayout(), IntScrollWindowEx(), IntSendDestroyMsg(), IntSendFocusMessages(), IntSendMessageToUI(), IntSendNCPaint(), IntSendOpenStatusNotify(), IntSendParentNotify(), IntShowOwnedPopups(), IntTrackPopupMenuEx(), MENU_CalcItemSize(), MENU_DoNextMenu(), MENU_DrawBitmapItem(), MENU_DrawMenuItem(), MENU_ExitTracking(), MENU_FindItemByKey(), MENU_GetBitmapItemSize(), MENU_HideSubPopups(), MENU_InitTracking(), MENU_SelectItem(), MENU_ShowSubPopup(), MENU_TrackMenu(), MsqSendParentNotify(), NC_DoButton(), NC_DoNCPaint(), NC_HandleNCLButtonDblClk(), NC_HandleNCLButtonDown(), NC_HandleNCRButtonDown(), NtUserChangeClipboardChain(), NtUserGetClipboardData(), NtUserGetComboBoxInfo(), NtUserGetListBoxInfo(), NtUserGetMenuBarInfo(), UserClipboardRelease(), UserEmptyClipboard(), and UserPaintCaption().

◆ co_IntSendMessageNoWait()

LRESULT FASTCALL co_IntSendMessageNoWait ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1713 of file message.c.

1717{
1718 ULONG_PTR Result = 0;
1720 Msg,
1721 wParam,
1722 lParam,
1723 NULL,
1724 0,
1725 &Result);
1726}
LRESULT FASTCALL co_IntSendMessageWithCallBack(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, SENDASYNCPROC CompletionCallback, ULONG_PTR CompletionCallbackContext, ULONG_PTR *uResult)
Definition: message.c:1735

Referenced by co_WinPosGetNonClientSize(), co_WinPosMinMaximize(), co_WinPosSendSizeMove(), co_WinPosSetWindowPos(), co_WinPosShowWindow(), IntEndDeferWindowPosEx(), IntSendSyncPaint(), IntSetWindowPlacement(), NtUserSetClipboardViewer(), NtUserShowWindowAsync(), UserClipboardRelease(), UserCloseClipboard(), and UserSendNotifyMessage().

◆ co_IntSendMessageTimeout()

LRESULT FASTCALL co_IntSendMessageTimeout ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
UINT  uFlags,
UINT  uTimeout,
ULONG_PTR uResult 
)

Definition at line 1657 of file message.c.

1664{
1666 HWND *Children;
1667 HWND *Child;
1668
1669 if (hWnd != HWND_BROADCAST && hWnd != HWND_TOPMOST)
1670 {
1671 return co_IntSendMessageTimeoutSingle(hWnd, Msg, wParam, lParam, uFlags, uTimeout, uResult);
1672 }
1673
1674 if (!is_message_broadcastable(Msg)) return TRUE;
1675
1677 if (NULL == DesktopWindow)
1678 {
1680 return 0;
1681 }
1682
1683 if (hWnd != HWND_TOPMOST)
1684 {
1685 /* Send message to the desktop window too! */
1687 }
1688
1690 if (NULL == Children)
1691 {
1692 return 0;
1693 }
1694
1695 for (Child = Children; NULL != *Child; Child++)
1696 {
1698 if (!pwnd) continue;
1699
1700 if ( pwnd->fnid == FNID_MENU ||
1702 continue;
1703
1705 }
1706
1708
1709 return (LRESULT) TRUE;
1710}
UINT uFlags
Definition: api.c:59
PSERVERINFO gpsi
Definition: imm.c:18
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define ICLS_SWITCH
Definition: ntuser.h:932
#define FNID_MENU
Definition: ntuser.h:861
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
Implementation of the Explorer desktop window.
Definition: desktop.h:52
RTL_ATOM atomClassName
Definition: ntuser.h:568
PCLS pcls
Definition: ntuser.h:720
DWORD fnid
Definition: ntuser.h:709
ATOM atomSysClass[ICLS_NOTUSED+1]
Definition: ntuser.h:1060
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1386
static LRESULT FASTCALL co_IntSendMessageTimeoutSingle(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT uFlags, UINT uTimeout, ULONG_PTR *uResult)
Definition: message.c:1460
static BOOL is_message_broadcastable(UINT msg)
Definition: message.c:567
#define USERTAG_WINDOWLIST
Definition: tags.h:298
HWND *FASTCALL IntWinListChildren(PWND Window)
Definition: window.c:274
#define ERROR_INTERNAL_ERROR
Definition: winerror.h:840

Referenced by co_IntDoSendMessage(), co_IntSendMessage(), NtUserMessageCall(), UserChangeDisplaySettings(), and UserSystemParametersInfo().

◆ co_IntSendMessageTimeoutSingle()

static LRESULT FASTCALL co_IntSendMessageTimeoutSingle ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
UINT  uFlags,
UINT  uTimeout,
ULONG_PTR uResult 
)
static

Definition at line 1460 of file message.c.

1467{
1469 PWND Window;
1470 PMSGMEMORY MsgMemoryEntry;
1471 INT lParamBufferSize;
1472 LPARAM lParamPacked;
1473 PTHREADINFO Win32Thread, ptiSendTo = NULL;
1474 ULONG_PTR Result = 0;
1475 LRESULT Ret = FALSE;
1477 BOOL DoCallBack = TRUE;
1478
1480 {
1481 TRACE("SendMessageTimeoutSingle: Invalid handle 0x%p!\n",hWnd);
1482 return FALSE;
1483 }
1484
1485 UserRefObjectCo(Window, &Ref);
1486
1487 Win32Thread = PsGetCurrentThreadWin32Thread();
1488
1489 ptiSendTo = IntSendTo(Window, Win32Thread, Msg);
1490
1491 if ( Msg >= WM_DDE_FIRST && Msg <= WM_DDE_LAST )
1492 {
1494 {
1495 ERR("Sending Exit DDE 0x%x\n",Msg);
1496 goto Cleanup; // Return FALSE
1497 }
1498 }
1499
1500 if ( !ptiSendTo )
1501 {
1502 if (Win32Thread->TIF_flags & TIF_INCLEANUP)
1503 {
1504 /* Never send messages to exiting threads */
1505 goto Cleanup; // Return FALSE
1506 }
1507
1508 if (Msg & 0x80000000)
1509 {
1510 TRACE("SMTS: Internal Message!\n");
1512 if (uResult) *uResult = Result;
1513 Ret = TRUE;
1514 goto Cleanup;
1515 }
1516
1517 // Only happens when calling the client!
1519
1520 if ( Window->state & WNDS_SERVERSIDEWINDOWPROC )
1521 {
1522 TRACE("SMT: Server Side Window Procedure\n");
1523 // Handle it here. Safeguard against excessive recursions.
1524 if (IoGetRemainingStackSize() < PAGE_SIZE)
1525 {
1526 ERR("Server Callback Exceeded Stack!\n");
1527 goto Cleanup; // Return FALSE
1528 }
1529 /* Return after server side call, IntCallWndProcRet will not be called. */
1530 switch(Window->fnid)
1531 {
1532 case FNID_DESKTOP:
1533 DoCallBack = !DesktopWindowProc(Window, Msg, wParam, lParam,(LRESULT*)&Result);
1534 break;
1535 case FNID_MESSAGEWND:
1537 break;
1538 case FNID_MENU:
1539 DoCallBack = !PopupMenuWndProc( Window, Msg, wParam, lParam,(LRESULT*)&Result);
1540 break;
1541 }
1542 if (!DoCallBack)
1543 {
1544 if (uResult) *uResult = Result;
1545 Ret = TRUE;
1546 goto Cleanup;
1547 }
1548 }
1549 /* See if this message type is present in the table */
1550 MsgMemoryEntry = FindMsgMemory(Msg);
1551 if (NULL == MsgMemoryEntry)
1552 {
1553 lParamBufferSize = -1;
1554 }
1555 else
1556 {
1557 lParamBufferSize = MsgMemorySize(MsgMemoryEntry, wParam, lParam);
1558 // If zero, do not allow callback on client side to allocate a buffer!!!!! See CORE-7695.
1559 if (!lParamBufferSize) lParamBufferSize = -1;
1560 }
1561
1562 if (! NT_SUCCESS(PackParam(&lParamPacked, Msg, wParam, lParam, FALSE)))
1563 {
1564 ERR("Failed to pack message parameters\n");
1565 goto Cleanup; // Return FALSE
1566 }
1567
1569 !Window->Unicode,
1570 hWnd,
1571 Msg,
1572 wParam,
1573 lParamPacked,
1574 lParamBufferSize );
1575 if (uResult)
1576 {
1577 *uResult = Result;
1578 }
1579
1580 if (! NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam, FALSE)))
1581 {
1582 ERR("Failed to unpack message parameters\n");
1583 Ret = TRUE;
1584 goto Cleanup;
1585 }
1586
1587 // Only happens when calling the client!
1589
1590 Ret = TRUE;
1591 goto Cleanup;
1592 }
1593
1594 if (Window->state & WNDS_DESTROYED)
1595 {
1596 /* FIXME: Last error? */
1597 ERR("Attempted to send message to window %p that is being destroyed!\n", hWnd);
1598 goto Cleanup; // Return FALSE
1599 }
1600
1601 if ((uFlags & SMTO_ABORTIFHUNG) && MsqIsHung(ptiSendTo, 4 * MSQ_HUNG))
1602 {
1603 // FIXME: Set window hung and add to a list.
1604 /* FIXME: Set a LastError? */
1605 ERR("Window %p (%p) (pti %p) is hung!\n", hWnd, Window, ptiSendTo);
1606 goto Cleanup; // Return FALSE
1607 }
1608
1609 do
1610 {
1611 Status = co_MsqSendMessage( ptiSendTo,
1612 hWnd,
1613 Msg,
1614 wParam,
1615 lParam,
1616 uTimeout,
1617 (uFlags & SMTO_BLOCK),
1618 MSQ_NORMAL,
1619 uResult );
1620 }
1621 while ((Status == STATUS_TIMEOUT) &&
1622 (uFlags & SMTO_NOTIMEOUTIFNOTHUNG) &&
1623 !MsqIsHung(ptiSendTo, MSQ_HUNG)); // FIXME: Set window hung and add to a list.
1624
1625 if (Status == STATUS_TIMEOUT)
1626 {
1627 if (0 && MsqIsHung(ptiSendTo, MSQ_HUNG))
1628 {
1629 TRACE("Let's go Ghost!\n");
1631 }
1632/*
1633 * MSDN says:
1634 * Microsoft Windows 2000: If GetLastError returns zero, then the function
1635 * timed out.
1636 * XP+ : If the function fails or times out, the return value is zero.
1637 * To get extended error information, call GetLastError. If GetLastError
1638 * returns ERROR_TIMEOUT, then the function timed out.
1639 */
1641 goto Cleanup; // Return FALSE
1642 }
1643 else if (!NT_SUCCESS(Status))
1644 {
1646 goto Cleanup; // Return FALSE
1647 }
1648
1649 Ret = TRUE;
1650
1651Cleanup:
1653 return Ret;
1654}
static const WCHAR Cleanup[]
Definition: register.c:80
#define ULONG_PTR
Definition: config.h:101
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define TIF_INCLEANUP
Definition: ntuser.h:263
#define FNID_DESKTOP
Definition: ntuser.h:862
#define WNDS_SERVERSIDEWINDOWPROC
Definition: ntuser.h:623
#define FNID_MESSAGEWND
Definition: ntuser.h:864
NTSTATUS FASTCALL co_MsqSendMessage(PTHREADINFO ptirec, HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT uTimeout, BOOL Block, INT HookMessage, ULONG_PTR *uResult)
Definition: msgqueue.c:1056
BOOL FASTCALL MsqIsHung(PTHREADINFO pti, DWORD TimeOut)
Definition: msgqueue.c:2137
#define MSQ_NORMAL
Definition: msgqueue.h:4
#define MSQ_HUNG
Definition: msgqueue.h:3
BOOL FASTCALL IntMakeHungWindowGhosted(HWND hwndHung)
Definition: ghost.c:156
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: object.h:4
int32_t INT
Definition: typedefs.h:58
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:31
LRESULT APIENTRY co_IntCallWindowProc(WNDPROC Proc, BOOLEAN IsAnsiProc, HWND Wnd, UINT Message, WPARAM wParam, LPARAM lParam, INT lParamBufferSize)
Definition: callback.c:282
BOOL FASTCALL IntDdeSendMessageHook(PWND pWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: dde.c:386
BOOL FASTCALL DesktopWindowProc(PWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
Definition: desktop.c:1439
BOOL FASTCALL UserMessageWindowProc(PWND pwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
Definition: desktop.c:1525
BOOL WINAPI PopupMenuWndProc(PWND Wnd, UINT Message, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
Definition: menu.c:4619
static VOID FASTCALL IntCallWndProcRet(PWND Window, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *uResult)
Definition: message.c:740
static UINT FASTCALL MsgMemorySize(PMSGMEMORY MsgMemoryEntry, WPARAM wParam, LPARAM lParam)
Definition: message.c:165
static NTSTATUS PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL NonPagedPoolNeeded)
Definition: message.c:262
static VOID FASTCALL IntCallWndProc(PWND Window, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:706
static LRESULT handle_internal_message(PWND pWnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: message.c:771
static NTSTATUS UnpackParam(LPARAM lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL NonPagedPoolUsed)
Definition: message.c:380
#define ERROR_TIMEOUT
Definition: winerror.h:941
#define SMTO_BLOCK
Definition: winuser.h:1224
#define SMTO_ABORTIFHUNG
Definition: winuser.h:1223

Referenced by co_IntSendMessageTimeout().

◆ co_IntSendMessageWithCallBack()

LRESULT FASTCALL co_IntSendMessageWithCallBack ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
SENDASYNCPROC  CompletionCallback,
ULONG_PTR  CompletionCallbackContext,
ULONG_PTR uResult 
)

Definition at line 1735 of file message.c.

1742{
1744 PWND Window;
1745 PMSGMEMORY MsgMemoryEntry;
1746 INT lParamBufferSize;
1747 LPARAM lParamPacked;
1748 PTHREADINFO Win32Thread, ptiSendTo = NULL;
1749 LRESULT Ret = FALSE;
1752 BOOL DoCallBack = TRUE;
1753
1755 {
1756 TRACE("SendMessageWithCallBack: Invalid handle 0x%p\n",hWnd);
1757 return FALSE;
1758 }
1759
1760 UserRefObjectCo(Window, &Ref);
1761
1762 if (Window->state & WNDS_DESTROYED)
1763 {
1764 /* FIXME: last error? */
1765 ERR("Attempted to send message to window %p that is being destroyed\n", hWnd);
1766 goto Cleanup; // Return FALSE
1767 }
1768
1769 Win32Thread = PsGetCurrentThreadWin32Thread();
1770
1771 if (Win32Thread == NULL || Win32Thread->TIF_flags & TIF_INCLEANUP)
1772 goto Cleanup; // Return FALSE
1773
1774 ptiSendTo = IntSendTo(Window, Win32Thread, Msg);
1775
1776 if (Msg & 0x80000000 &&
1777 !ptiSendTo)
1778 {
1779 if (Win32Thread->TIF_flags & TIF_INCLEANUP)
1780 goto Cleanup; // Return FALSE
1781
1782 TRACE("SMWCB: Internal Message\n");
1784 if (uResult) *uResult = Result;
1785 Ret = TRUE;
1786 goto Cleanup;
1787 }
1788
1789 /* See if this message type is present in the table */
1790 MsgMemoryEntry = FindMsgMemory(Msg);
1791 if (NULL == MsgMemoryEntry)
1792 {
1793 lParamBufferSize = -1;
1794 }
1795 else
1796 {
1797 lParamBufferSize = MsgMemorySize(MsgMemoryEntry, wParam, lParam);
1798 if (!lParamBufferSize) lParamBufferSize = -1;
1799 }
1800
1801 if (!NT_SUCCESS(PackParam(&lParamPacked, Msg, wParam, lParam, !!ptiSendTo)))
1802 {
1803 ERR("Failed to pack message parameters\n");
1804 goto Cleanup; // Return FALSE
1805 }
1806
1807 /* If it can be sent now, then send it. */
1808 if (!ptiSendTo)
1809 {
1810 if (Win32Thread->TIF_flags & TIF_INCLEANUP)
1811 {
1812 UnpackParam(lParamPacked, Msg, wParam, lParam, FALSE);
1813 /* Never send messages to exiting threads */
1814 goto Cleanup; // Return FALSE
1815 }
1816
1818
1819 if (Window->state & WNDS_SERVERSIDEWINDOWPROC)
1820 {
1821 TRACE("SMWCB: Server Side Window Procedure\n");
1822 switch(Window->fnid)
1823 {
1824 case FNID_DESKTOP:
1825 DoCallBack = !DesktopWindowProc(Window, Msg, wParam, lParamPacked, (LRESULT*)&Result);
1826 break;
1827 case FNID_MESSAGEWND:
1829 break;
1830 case FNID_MENU:
1831 DoCallBack = !PopupMenuWndProc(Window, Msg, wParam, lParam, (LRESULT*)&Result);
1832 break;
1833 }
1834 }
1835
1836 if (DoCallBack)
1838 !Window->Unicode,
1839 hWnd,
1840 Msg,
1841 wParam,
1842 lParamPacked,
1843 lParamBufferSize);
1844 if(uResult)
1845 {
1846 *uResult = Result;
1847 }
1848
1850
1852 {
1854 hWnd,
1855 Msg,
1856 CompletionCallbackContext,
1857 Result);
1858 }
1859 }
1860
1861 if (!ptiSendTo)
1862 {
1863 if (!NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam, FALSE)))
1864 {
1865 ERR("Failed to unpack message parameters\n");
1866 }
1867 Ret = TRUE;
1868 goto Cleanup;
1869 }
1870
1872 {
1873 ERR("Failed to allocate message\n");
1874 goto Cleanup; // Return FALSE
1875 }
1876
1877 Message->Msg.hwnd = hWnd;
1878 Message->Msg.message = Msg;
1879 Message->Msg.wParam = wParam;
1880 Message->Msg.lParam = lParamPacked;
1881 Message->pkCompletionEvent = NULL; // No event needed.
1882 Message->lResult = 0;
1883 Message->QS_Flags = 0;
1884 Message->ptiReceiver = ptiSendTo;
1885 Message->ptiSender = NULL;
1886 Message->ptiCallBackSender = Win32Thread;
1887 Message->CompletionCallback = CompletionCallback;
1888 Message->CompletionCallbackContext = CompletionCallbackContext;
1889 Message->HookMessage = MSQ_NORMAL;
1890 Message->HasPackedLParam = (lParamBufferSize > 0);
1891 Message->QS_Flags = QS_SENDMESSAGE;
1892 Message->flags = SMF_RECEIVERFREE;
1893
1894 if (Msg & 0x80000000) // Higher priority event message!
1895 InsertHeadList(&ptiSendTo->SentMessagesListHead, &Message->ListEntry);
1896 else
1897 InsertTailList(&ptiSendTo->SentMessagesListHead, &Message->ListEntry);
1898 MsqWakeQueue(ptiSendTo, QS_SENDMESSAGE, TRUE);
1899
1900 Ret = TRUE;
1901
1902Cleanup:
1904 return Ret;
1905}
const TCHAR * CompletionCallback(unsigned __int64 &rnIndex, const BOOL *pblnForward, const TCHAR *pszContext, const TCHAR *pszBegin)
Definition: Completion.cpp:439
static const WCHAR Message[]
Definition: register.c:74
#define InsertTailList(ListHead, Entry)
#define InsertHeadList(ListHead, Entry)
VOID FASTCALL MsqWakeQueue(PTHREADINFO pti, DWORD MessageBits, BOOL KeyEvent)
Definition: msgqueue.c:412
PUSER_SENT_MESSAGE FASTCALL AllocateUserMessage(BOOL KEvent)
Definition: msgqueue.c:763
#define SMF_RECEIVERFREE
Definition: msgqueue.h:40
LIST_ENTRY SentMessagesListHead
Definition: win32.h:100
VOID APIENTRY co_IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback, HWND hWnd, UINT Msg, ULONG_PTR CompletionCallbackContext, LRESULT Result)
Definition: callback.c:238
#define QS_SENDMESSAGE
Definition: winuser.h:880

Referenced by co_IntSendMessageNoWait(), IntFocusSetInputContext(), and NtUserMessageCall().

◆ co_IntWaitMessage()

BOOL FASTCALL co_IntWaitMessage ( PWND  Window,
UINT  MsgFilterMin,
UINT  MsgFilterMax 
)

Definition at line 1130 of file message.c.

1133{
1134 PTHREADINFO pti;
1136 MSG Msg;
1137 LONG_PTR ExtraInfo = 0;
1138
1140
1141 do
1142 {
1143 if ( co_IntPeekMessage( &Msg, // Dont reenter!
1144 Window,
1145 MsgFilterMin,
1146 MsgFilterMax,
1147 MAKELONG( PM_NOREMOVE, GetWakeMask( MsgFilterMin, MsgFilterMax)),
1148 &ExtraInfo,
1149 TRUE ) ) // act like GetMessage.
1150 {
1151 return TRUE;
1152 }
1153
1154 /* Nothing found. Wait for new messages. */
1156 Window,
1157 MsgFilterMin,
1158 MsgFilterMax);
1159 if (!NT_SUCCESS(Status))
1160 {
1162 ERR("Exit co_IntWaitMessage on error!\n");
1163 return FALSE;
1164 }
1166 {
1167 return FALSE;
1168 }
1169 }
1170 while ( TRUE );
1171
1172 return FALSE;
1173}
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define PM_NOREMOVE
Definition: winuser.h:1195

Referenced by MENU_TrackMenu(), NtUserDragDetect(), and NtUserWaitMessage().

◆ CopyMsgToKernelMem()

static NTSTATUS FASTCALL CopyMsgToKernelMem ( MSG KernelModeMsg,
MSG UserModeMsg,
PMSGMEMORY  MsgMemoryEntry 
)
static

Definition at line 429 of file message.c.

430{
432
433 PVOID KernelMem;
434 UINT Size;
435
436 *KernelModeMsg = *UserModeMsg;
437
438 /* See if this message type is present in the table */
439 if (NULL == MsgMemoryEntry)
440 {
441 /* Not present, no copying needed */
442 return STATUS_SUCCESS;
443 }
444
445 /* Determine required size */
446 Size = MsgMemorySize(MsgMemoryEntry, UserModeMsg->wParam, UserModeMsg->lParam);
447
448 if (0 != Size)
449 {
450 /* Allocate kernel mem */
452 if (NULL == KernelMem)
453 {
454 ERR("Not enough memory to copy message to kernel mem\n");
455 return STATUS_NO_MEMORY;
456 }
457 KernelModeMsg->lParam = (LPARAM) KernelMem;
458
459 /* Copy data if required */
460 if (0 != (MsgMemoryEntry->Flags & MMS_FLAG_READ))
461 {
462 TRACE("Copy Message %u from usermode buffer\n", KernelModeMsg->message);
463 Status = MmCopyFromCaller(KernelMem, (PVOID) UserModeMsg->lParam, Size);
464 if (! NT_SUCCESS(Status))
465 {
466 ERR("Failed to copy message to kernel: invalid usermode lParam buffer\n");
467 ExFreePoolWithTag(KernelMem, TAG_MSG);
468 return Status;
469 }
470 }
471 else
472 {
473 /* Make sure we don't pass any secrets to usermode */
474 RtlZeroMemory(KernelMem, Size);
475 }
476 }
477 else
478 {
479 KernelModeMsg->lParam = 0;
480 }
481
482 return STATUS_SUCCESS;
483}
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define MmCopyFromCaller
Definition: polytest.cpp:29
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
#define MMS_FLAG_READ
Definition: message.c:110
#define TAG_MSG
Definition: tags.h:7

Referenced by co_IntDoSendMessage().

◆ CopyMsgToUserMem()

static NTSTATUS FASTCALL CopyMsgToUserMem ( MSG UserModeMsg,
MSG KernelModeMsg 
)
static

Definition at line 486 of file message.c.

487{
489 PMSGMEMORY MsgMemoryEntry;
490 UINT Size;
491
492 /* See if this message type is present in the table */
493 MsgMemoryEntry = FindMsgMemory(UserModeMsg->message);
494 if (NULL == MsgMemoryEntry)
495 {
496 /* Not present, no copying needed */
497 return STATUS_SUCCESS;
498 }
499
500 /* Determine required size */
501 Size = MsgMemorySize(MsgMemoryEntry, UserModeMsg->wParam, UserModeMsg->lParam);
502
503 if (0 != Size)
504 {
505 /* Copy data if required */
506 if (0 != (MsgMemoryEntry->Flags & MMS_FLAG_WRITE))
507 {
508 Status = MmCopyToCaller((PVOID) UserModeMsg->lParam, (PVOID) KernelModeMsg->lParam, Size);
509 if (! NT_SUCCESS(Status))
510 {
511 ERR("Failed to copy message from kernel: invalid usermode lParam buffer\n");
512 ExFreePool((PVOID) KernelModeMsg->lParam);
513 return Status;
514 }
515 }
516 ExFreePool((PVOID) KernelModeMsg->lParam);
517 }
518
519 return STATUS_SUCCESS;
520}
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
#define MMS_FLAG_WRITE
Definition: message.c:111

Referenced by co_IntDoSendMessage().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UserMsg  )

◆ FindMsgMemory()

static PMSGMEMORY FASTCALL FindMsgMemory ( UINT  Msg)
static

Definition at line 146 of file message.c.

147{
148 PMSGMEMORY MsgMemoryEntry;
149
150 /* See if this message type is present in the table */
151 for (MsgMemoryEntry = g_MsgMemory;
152 MsgMemoryEntry < g_MsgMemory + sizeof(g_MsgMemory) / sizeof(MSGMEMORY);
153 MsgMemoryEntry++)
154 {
155 if (Msg == MsgMemoryEntry->Message)
156 {
157 return MsgMemoryEntry;
158 }
159 }
160
161 return NULL;
162}
UINT Message
Definition: message.c:115
static MSGMEMORY g_MsgMemory[]
Definition: message.c:121

Referenced by co_IntDoSendMessage(), co_IntGetPeekMessage(), co_IntSendMessageTimeoutSingle(), co_IntSendMessageWithCallBack(), CopyMsgToUserMem(), lParamMemorySize(), PackParam(), and UnpackParam().

◆ GetWakeMask()

UINT FASTCALL GetWakeMask ( UINT  first,
UINT  last 
)

Definition at line 573 of file message.c.

574{
575 UINT mask = QS_POSTMESSAGE | QS_SENDMESSAGE; /* Always selected */
576
577 if (first || last)
578 {
579 if ((first <= WM_KEYLAST) && (last >= WM_KEYFIRST)) mask |= QS_KEY;
580 if ( ((first <= WM_MOUSELAST) && (last >= WM_MOUSEFIRST)) ||
582 if ((first <= WM_TIMER) && (last >= WM_TIMER)) mask |= QS_TIMER;
583 if ((first <= WM_SYSTIMER) && (last >= WM_SYSTIMER)) mask |= QS_TIMER;
584 if ((first <= WM_PAINT) && (last >= WM_PAINT)) mask |= QS_PAINT;
585 }
586 else mask = QS_ALLINPUT;
587
588 return mask;
589}
#define WM_SYSTIMER
Definition: comctl32.h:119
GLenum GLint GLuint mask
Definition: glext.h:6028
const GLint * first
Definition: glext.h:5794
static UINT UINT last
Definition: font.c:45
#define WM_NCMOUSEFIRST
Definition: msgqueue.h:239
#define WM_NCMOUSELAST
Definition: msgqueue.h:240
#define QS_KEY
Definition: winuser.h:874
#define WM_MOUSEFIRST
Definition: winuser.h:1774
#define WM_MOUSELAST
Definition: winuser.h:1801
#define WM_KEYFIRST
Definition: winuser.h:1714
#define WM_TIMER
Definition: winuser.h:1742
#define QS_MOUSE
Definition: winuser.h:892
#define WM_KEYLAST
Definition: winuser.h:1728

Referenced by co_IntGetPeekMessage(), and co_IntWaitMessage().

◆ handle_internal_events()

static LRESULT handle_internal_events ( PTHREADINFO  pti,
PWND  pWnd,
DWORD  dwQEvent,
LONG_PTR  ExtraInfo,
PMSG  pMsg 
)
static

Definition at line 812 of file message.c.

813{
814 LRESULT Result = 0;
815
816 switch(dwQEvent)
817 {
818 case POSTEVENT_NWE:
819 {
820 co_EVENT_CallEvents( pMsg->message, pMsg->hwnd, pMsg->wParam, ExtraInfo);
821 }
822 break;
823 case POSTEVENT_SAW:
824 {
825 //ERR("HIE : SAW : pti 0x%p hWnd 0x%p\n",pti,pMsg->hwnd);
826 IntActivateWindow((PWND)pMsg->wParam, pti, (HANDLE)pMsg->lParam, (DWORD)ExtraInfo);
827 }
828 break;
829 case POSTEVENT_DAW:
830 {
831 //ERR("HIE : DAW : pti 0x%p tid 0x%p hWndPrev 0x%p\n",pti,ExtraInfo,pMsg->hwnd);
832 IntDeactivateWindow(pti, (HANDLE)ExtraInfo);
833 }
834 break;
835 }
836 return Result;
837}
BOOL FASTCALL IntDeactivateWindow(PTHREADINFO pti, HANDLE tid)
Definition: focus.c:191
VOID FASTCALL IntActivateWindow(PWND Wnd, PTHREADINFO pti, HANDLE tid, DWORD Type)
Definition: focus.c:357
#define POSTEVENT_NWE
Definition: msgqueue.h:125
#define POSTEVENT_SAW
Definition: msgqueue.h:124
#define POSTEVENT_DAW
Definition: msgqueue.h:123
HWND hwnd
Definition: winuser.h:3114
LPARAM lParam
Definition: winuser.h:3117
LRESULT APIENTRY co_EVENT_CallEvents(DWORD event, HWND hwnd, UINT_PTR idObject, LONG_PTR idChild)
Definition: event.c:150

Referenced by co_IntPeekMessage().

◆ handle_internal_message()

static LRESULT handle_internal_message ( PWND  pWnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 771 of file message.c.

772{
773 LRESULT lRes;
774// USER_REFERENCE_ENTRY Ref;
775// PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
776
777 if (!pWnd || UserIsDesktopWindow(pWnd) || UserIsMessageWindow(pWnd))
778 return 0;
779
780 TRACE("Internal Event Msg 0x%x hWnd 0x%p\n", msg, UserHMGetHandle(pWnd));
781
782 switch(msg)
783 {
785 return co_WinPosShowWindow( pWnd, wparam );
787 {
788 PWINDOWPOS winpos = (PWINDOWPOS)lparam;
789 if (!winpos) return 0;
790 lRes = co_WinPosSetWindowPos( pWnd,
791 winpos->hwndInsertAfter,
792 winpos->x,
793 winpos->y,
794 winpos->cx,
795 winpos->cy,
796 winpos->flags);
798 return lRes;
799 }
801 {
802 TRACE("WM_ASYNC_DESTROYWINDOW\n");
803 if (pWnd->style & WS_CHILD)
805 else
807 }
808 }
809 return 0;
810}
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define msg(x)
Definition: auth_time.c:54
@ WM_ASYNC_SHOWWINDOW
Definition: msgqueue.h:117
@ WM_ASYNC_SETWINDOWPOS
Definition: msgqueue.h:118
@ WM_ASYNC_DESTROYWINDOW
Definition: msgqueue.h:120
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1786
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2566
#define WS_CHILD
Definition: pedump.c:617
UINT flags
Definition: winuser.h:3594
HWND hwndInsertAfter
Definition: winuser.h:3589
DWORD style
Definition: ntuser.h:706
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2853
#define UserIsMessageWindow(pWnd)
Definition: desktop.h:197
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
#define USERTAG_SWP
Definition: tags.h:281
LRESULT co_UserFreeWindow(PWND Window, PPROCESSINFO ProcessData, PTHREADINFO ThreadData, BOOLEAN SendMessages)
Definition: window.c:574
struct _WINDOWPOS * PWINDOWPOS

Referenced by co_IntSendMessageTimeoutSingle(), and co_IntSendMessageWithCallBack().

◆ IdlePing()

VOID FASTCALL IdlePing ( VOID  )

Definition at line 526 of file message.c.

527{
529 PTHREADINFO pti;
530
532
533 if ( pti )
534 {
535 pti->pClientInfo->cSpins = 0; // Reset spins.
536
537 if ( pti->pDeskInfo && pti == gptiForeground )
538 {
541 {
543 }
544 }
545 }
546
547 TRACE("IdlePing ppi %p\n", ppi);
548 if ( ppi && ppi->InputIdleEvent )
549 {
550 TRACE("InputIdleEvent\n");
551 KeSetEvent( ppi->InputIdleEvent, IO_NO_INCREMENT, FALSE);
552 }
553}
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define HOOKID_TO_FLAG(HookId)
Definition: hook.h:5
struct _DESKTOPINFO * pDeskInfo
Definition: win32.h:93
ULONG fsHooks
Definition: win32.h:117
PTHREADINFO gptiForeground
Definition: focus.c:15
#define WH_FOREGROUNDIDLE
Definition: winuser.h:41
#define IO_NO_INCREMENT
Definition: iotypes.h:598

Referenced by co_IntGetPeekMessage(), and IntMsqSetWakeMask().

◆ IdlePong()

VOID FASTCALL IdlePong ( VOID  )

Definition at line 556 of file message.c.

557{
559
560 TRACE("IdlePong ppi %p\n", ppi);
561 if ( ppi && ppi->InputIdleEvent )
562 {
563 KeClearEvent(ppi->InputIdleEvent);
564 }
565}
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22

Referenced by co_IntGetPeekMessage(), co_IntPeekMessage(), and IntMsqClearWakeMask().

◆ IntCallMsgFilter()

BOOL FASTCALL IntCallMsgFilter ( LPMSG  lpmsg,
INT  code 
)

Definition at line 2140 of file message.c.

2141{
2142 BOOL Ret = FALSE;
2143
2144 if ( co_HOOK_CallHooks( WH_SYSMSGFILTER, code, 0, (LPARAM)lpmsg))
2145 {
2146 Ret = TRUE;
2147 }
2148 else
2149 {
2150 Ret = co_HOOK_CallHooks( WH_MSGFILTER, code, 0, (LPARAM)lpmsg);
2151 }
2152 return Ret;
2153}
Definition: inflate.c:139
#define WH_MSGFILTER
Definition: winuser.h:29
#define WH_SYSMSGFILTER
Definition: winuser.h:36

Referenced by DefWndDoSizeMove(), DefWndStartSizeMove(), MENU_TrackMenu(), NC_DoButton(), and NC_HandleNCRButtonDown().

◆ IntCallWndProc()

static VOID FASTCALL IntCallWndProc ( PWND  Window,
HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 706 of file message.c.

707{
708 BOOL SameThread = FALSE;
709 CWPSTRUCT CWP;
710 PVOID pszClass = NULL, pszName = NULL;
711 CREATESTRUCTW Csw;
712
714 if ( !ISITHOOKED(WH_CALLWNDPROC) && !(Window->head.rpdesk->pDeskInfo->fsHooks & HOOKID_TO_FLAG(WH_CALLWNDPROC)) )
715 return;
716
718 SameThread = TRUE;
719
720 if ( Msg == WM_CREATE || Msg == WM_NCCREATE )
721 { //
722 // String pointers are in user heap space, like WH_CBT HCBT_CREATEWND.
723 //
724 if (!IntMsgCreateStructW( Window, &Csw, (CREATESTRUCTW *)lParam, &pszClass, &pszName ))
725 return;
726 lParam = (LPARAM)&Csw;
727 }
728
729 CWP.hwnd = hWnd;
730 CWP.message = Msg;
731 CWP.wParam = wParam;
732 CWP.lParam = lParam;
733 co_HOOK_CallHooks( WH_CALLWNDPROC, HC_ACTION, SameThread, (LPARAM)&CWP );
734
735 if (pszName) UserHeapFree(pszName);
736 if (pszClass) UserHeapFree(pszClass);
737}
#define ISITHOOKED(HookId)
Definition: hook.h:6
LPARAM lParam
Definition: winuser.h:3025
WPARAM wParam
Definition: winuser.h:3026
UINT message
Definition: winuser.h:3027
static __inline BOOL UserHeapFree(PVOID lpMem)
Definition: usrheap.h:44
BOOL FASTCALL IntMsgCreateStructW(PWND Window, CREATESTRUCTW *pCsw, CREATESTRUCTW *Cs, PVOID *ppszClass, PVOID *ppszName)
Definition: message.c:596
#define WM_CREATE
Definition: winuser.h:1608
#define WM_NCCREATE
Definition: winuser.h:1683
#define WH_CALLWNDPROC
Definition: winuser.h:34

Referenced by co_IntSendMessageTimeoutSingle(), and co_IntSendMessageWithCallBack().

◆ IntCallWndProcRet()

static VOID FASTCALL IntCallWndProcRet ( PWND  Window,
HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT uResult 
)
static

Definition at line 740 of file message.c.

741{
742 BOOL SameThread = FALSE;
743 CWPRETSTRUCT CWPR;
744 PVOID pszClass = NULL, pszName = NULL;
745 CREATESTRUCTW Csw;
746
747 if ( !ISITHOOKED(WH_CALLWNDPROCRET) && !(Window->head.rpdesk->pDeskInfo->fsHooks & HOOKID_TO_FLAG(WH_CALLWNDPROCRET)) )
748 return;
749
751 SameThread = TRUE;
752
753 if ( Msg == WM_CREATE || Msg == WM_NCCREATE )
754 {
755 if (!IntMsgCreateStructW( Window, &Csw, (CREATESTRUCTW *)lParam, &pszClass, &pszName ))
756 return;
757 lParam = (LPARAM)&Csw;
758 }
759
760 CWPR.hwnd = hWnd;
761 CWPR.message = Msg;
762 CWPR.wParam = wParam;
763 CWPR.lParam = lParam;
764 CWPR.lResult = uResult ? (*uResult) : 0;
765 co_HOOK_CallHooks( WH_CALLWNDPROCRET, HC_ACTION, SameThread, (LPARAM)&CWPR );
766
767 if (pszName) UserHeapFree(pszName);
768 if (pszClass) UserHeapFree(pszClass);
769}
WPARAM wParam
Definition: winuser.h:3019
LRESULT lResult
Definition: winuser.h:3017
LPARAM lParam
Definition: winuser.h:3018
#define WH_CALLWNDPROCRET
Definition: winuser.h:42

Referenced by co_IntSendMessageTimeoutSingle(), and co_IntSendMessageWithCallBack().

◆ IntCleanupMessageImpl()

NTSTATUS FASTCALL IntCleanupMessageImpl ( VOID  )

Definition at line 25 of file message.c.

26{
27 return STATUS_SUCCESS;
28}

◆ IntDispatchMessage()

LRESULT FASTCALL IntDispatchMessage ( PMSG  pMsg)

Definition at line 840 of file message.c.

841{
842 LONG Time;
843 LRESULT retval = 0;
844 PTHREADINFO pti;
845 PWND Window = NULL;
846 BOOL DoCallBack = TRUE;
847
848 if (pMsg->hwnd)
849 {
851 if (!Window) return 0;
852 }
853
855
856 if ( Window && Window->head.pti != pti)
857 {
859 return 0;
860 }
861
862 if (((pMsg->message == WM_SYSTIMER) ||
863 (pMsg->message == WM_TIMER)) &&
864 (pMsg->lParam) )
865 {
866 if (pMsg->message == WM_TIMER)
867 {
868 if (ValidateTimerCallback(pti,pMsg->lParam))
869 {
871 retval = co_IntCallWindowProc((WNDPROC)pMsg->lParam,
872 TRUE,
873 pMsg->hwnd,
874 WM_TIMER,
875 pMsg->wParam,
876 (LPARAM)Time,
877 -1);
878 }
879 return retval;
880 }
881 else
882 {
883 PTIMER pTimer = FindSystemTimer(pMsg);
884 if (pTimer && pTimer->pfn)
885 {
887 pTimer->pfn(pMsg->hwnd, WM_SYSTIMER, (UINT)pMsg->wParam, Time);
888 }
889 return 0;
890 }
891 }
892 // Need a window!
893 if ( !Window ) return 0;
894
895 if (pMsg->message == WM_PAINT) Window->state |= WNDS_PAINTNOTPROCESSED;
896
897 if ( Window->state & WNDS_SERVERSIDEWINDOWPROC )
898 {
899 TRACE("Dispatch: Server Side Window Procedure\n");
900 switch(Window->fnid)
901 {
902 case FNID_DESKTOP:
903 DoCallBack = !DesktopWindowProc( Window,
904 pMsg->message,
905 pMsg->wParam,
906 pMsg->lParam,
907 &retval);
908 break;
909 case FNID_MESSAGEWND:
910 DoCallBack = !UserMessageWindowProc( Window,
911 pMsg->message,
912 pMsg->wParam,
913 pMsg->lParam,
914 &retval);
915 break;
916 case FNID_MENU:
917 DoCallBack = !PopupMenuWndProc( Window,
918 pMsg->message,
919 pMsg->wParam,
920 pMsg->lParam,
921 &retval);
922 break;
923 }
924 }
925
926 /* Since we are doing a callback on the same thread right away, there is
927 no need to copy the lparam to kernel mode and then back to usermode.
928 We just pretend it isn't a pointer */
929
930 if (DoCallBack)
931 retval = co_IntCallWindowProc( Window->lpfnWndProc,
932 !Window->Unicode,
933 pMsg->hwnd,
934 pMsg->message,
935 pMsg->wParam,
936 pMsg->lParam,
937 -1);
938
939 if ( pMsg->message == WM_PAINT &&
940 VerifyWnd(Window) &&
941 Window->state & WNDS_PAINTNOTPROCESSED ) // <--- Cleared, paint was already processed!
942 {
943 Window->state2 &= ~WNDS2_WMPAINTSENT;
944 /* send a WM_ERASEBKGND if the non-client area is still invalid */
945 ERR("Message WM_PAINT count %d Internal Paint Set? %s\n",Window->head.pti->cPaintsReady, Window->state & WNDS_INTERNALPAINT ? "TRUE" : "FALSE");
947 }
948
949 return retval;
950}
#define WNDS_INTERNALPAINT
Definition: ntuser.h:617
#define WNDS_PAINTNOTPROCESSED
Definition: ntuser.h:627
static PLARGE_INTEGER Time
Definition: time.c:105
long LONG
Definition: pedump.c:60
Definition: timer.h:4
TIMERPROC pfn
Definition: timer.h:13
VOID FASTCALL IntPaintWindow(PWND Window)
Definition: painting.c:1177
BOOL FASTCALL ValidateTimerCallback(PTHREADINFO pti, LPARAM lParam)
Definition: timer.c:150
PTIMER FASTCALL FindSystemTimer(PMSG pMsg)
Definition: timer.c:126
PWND FASTCALL VerifyWnd(PWND pWnd)
Definition: window.c:86
#define ERROR_MESSAGE_SYNC_ONLY
Definition: winerror.h:681
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906

Referenced by DefWndDoSizeMove(), DefWndStartSizeMove(), DesktopThreadMain(), MENU_TrackMenu(), and NtUserDispatchMessage().

◆ IntGetQueueStatus()

DWORD APIENTRY IntGetQueueStatus ( DWORD  Changes)

Definition at line 2089 of file message.c.

2090{
2091 PTHREADINFO pti;
2092 DWORD Result;
2093
2095// wine:
2097
2098 /* High word, types of messages currently in the queue.
2099 Low word, types of messages that have been added to the queue and that
2100 are still in the queue
2101 */
2102 Result = MAKELONG(pti->pcti->fsChangeBits & Changes, pti->pcti->fsWakeBits & Changes);
2103
2104 pti->pcti->fsChangeBits &= ~Changes;
2105
2106 return Result;
2107}
#define QS_SMRESULT
Definition: undocuser.h:95

Referenced by NtUserCallOneParam(), and NtUserGetThreadState().

◆ IntInitMessageImpl()

NTSTATUS FASTCALL IntInitMessageImpl ( VOID  )

Definition at line 19 of file message.c.

20{
21 return STATUS_SUCCESS;
22}

◆ IntInitMessagePumpHook()

BOOL APIENTRY IntInitMessagePumpHook ( VOID  )

Definition at line 2110 of file message.c.

2111{
2113
2114 if (pti->pcti)
2115 {
2116 pti->pcti->dwcPumpHook++;
2117 return TRUE;
2118 }
2119 return FALSE;
2120}

Referenced by NtUserCallNoParam().

◆ IntMsgCreateStructW()

BOOL FASTCALL IntMsgCreateStructW ( PWND  Window,
CREATESTRUCTW pCsw,
CREATESTRUCTW Cs,
PVOID ppszClass,
PVOID ppszName 
)

Definition at line 596 of file message.c.

602{
603 PLARGE_STRING WindowName;
604 PUNICODE_STRING ClassName;
605 PVOID pszClass = NULL, pszName = NULL;
606
607 /* Fill the new CREATESTRUCTW */
608 RtlCopyMemory(pCsw, Cs, sizeof(CREATESTRUCTW));
609 pCsw->style = Window->style; /* HCBT_CREATEWND needs the real window style */
610
611 WindowName = (PLARGE_STRING) Cs->lpszName;
612 ClassName = (PUNICODE_STRING) Cs->lpszClass;
613
614 // Based on the assumption this is from "unicode source" user32, ReactOS, answer is yes.
615 if (!IS_ATOM(ClassName->Buffer))
616 {
617 if (ClassName->Length)
618 {
619 if (Window->state & WNDS_ANSICREATOR)
620 {
622 AnsiString.MaximumLength = (USHORT)RtlUnicodeStringToAnsiSize(ClassName)+sizeof(CHAR);
623 pszClass = UserHeapAlloc(AnsiString.MaximumLength);
624 if (!pszClass)
625 {
626 ERR("UserHeapAlloc() failed!\n");
627 return FALSE;
628 }
629 RtlZeroMemory(pszClass, AnsiString.MaximumLength);
630 AnsiString.Buffer = (PCHAR)pszClass;
632 }
633 else
634 {
636 UnicodeString.MaximumLength = ClassName->Length + sizeof(UNICODE_NULL);
637 pszClass = UserHeapAlloc(UnicodeString.MaximumLength);
638 if (!pszClass)
639 {
640 ERR("UserHeapAlloc() failed!\n");
641 return FALSE;
642 }
643 RtlZeroMemory(pszClass, UnicodeString.MaximumLength);
644 UnicodeString.Buffer = (PWSTR)pszClass;
646 }
647 *ppszClass = pszClass;
648 pCsw->lpszClass = UserHeapAddressToUser(pszClass);
649 }
650 else
651 {
652 pCsw->lpszClass = NULL;
653 }
654 }
655 else
656 {
657 pCsw->lpszClass = ClassName->Buffer;
658 }
659 if (WindowName->Length)
660 {
662 Name.Buffer = WindowName->Buffer;
663 Name.Length = (USHORT)min(WindowName->Length, MAXUSHORT); // FIXME: LARGE_STRING truncated
664 Name.MaximumLength = (USHORT)min(WindowName->MaximumLength, MAXUSHORT);
665
666 if (Window->state & WNDS_ANSICREATOR)
667 {
669 AnsiString.MaximumLength = (USHORT)RtlUnicodeStringToAnsiSize(&Name) + sizeof(CHAR);
670 pszName = UserHeapAlloc(AnsiString.MaximumLength);
671 if (!pszName)
672 {
673 ERR("UserHeapAlloc() failed!\n");
674 return FALSE;
675 }
676 RtlZeroMemory(pszName, AnsiString.MaximumLength);
677 AnsiString.Buffer = (PCHAR)pszName;
679 }
680 else
681 {
683 UnicodeString.MaximumLength = Name.Length + sizeof(UNICODE_NULL);
684 pszName = UserHeapAlloc(UnicodeString.MaximumLength);
685 if (!pszName)
686 {
687 ERR("UserHeapAlloc() failed!\n");
688 return FALSE;
689 }
690 RtlZeroMemory(pszName, UnicodeString.MaximumLength);
691 UnicodeString.Buffer = (PWSTR)pszName;
693 }
694 *ppszName = pszName;
695 pCsw->lpszName = UserHeapAddressToUser(pszName);
696 }
697 else
698 {
699 pCsw->lpszName = NULL;
700 }
701
702 return TRUE;
703}
struct NameRec_ * Name
Definition: cdprocs.h:460
#define CHAR(Char)
#define IS_ATOM(x)
Definition: class.h:3
@ AnsiString
Definition: dnslib.h:19
struct _LARGE_STRING * PLARGE_STRING
#define WNDS_ANSICREATOR
Definition: ntuser.h:634
#define PCHAR
Definition: match.c:90
#define min(a, b)
Definition: monoChain.cc:55
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
#define UNICODE_NULL
unsigned short USHORT
Definition: pedump.c:61
SIGDN PWSTR * ppszName
Definition: shobjidl.idl:595
ULONG Length
Definition: ntuser.h:91
ULONG MaximumLength
Definition: ntuser.h:92
PVOID Buffer
Definition: ntuser.h:94
LPCWSTR lpszClass
Definition: winuser.h:2965
LPCWSTR lpszName
Definition: winuser.h:2964
uint16_t * PWSTR
Definition: typedefs.h:56
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define MAXUSHORT
Definition: typedefs.h:83
static __inline PVOID UserHeapAlloc(SIZE_T Bytes)
Definition: usrheap.h:34
static __inline PVOID UserHeapAddressToUser(PVOID lpMem)
Definition: usrheap.h:99
#define RtlUnicodeStringToAnsiSize(String)
Definition: rtlfuncs.h:1005

Referenced by co_UserCreateWindowEx(), IntCallWndProc(), and IntCallWndProcRet().

◆ IntSendTo()

PTHREADINFO FASTCALL IntSendTo ( PWND  Window,
PTHREADINFO  ptiCur,
UINT  Msg 
)

Definition at line 1331 of file message.c.

1332{
1333 if ( ptiCur )
1334 {
1335 if (!Window ||
1336 Window->head.pti == ptiCur )
1337 {
1338 return NULL;
1339 }
1340 }
1341 return Window ? Window->head.pti : NULL;
1342}

Referenced by co_IntDoSendMessage(), co_IntSendMessageTimeoutSingle(), and co_IntSendMessageWithCallBack().

◆ IntUninitMessagePumpHook()

BOOL APIENTRY IntUninitMessagePumpHook ( VOID  )

Definition at line 2123 of file message.c.

2124{
2126
2127 if (pti->pcti)
2128 {
2129 if (pti->pcti->dwcPumpHook <= 0)
2130 {
2131 return FALSE;
2132 }
2133 pti->pcti->dwcPumpHook--;
2134 return TRUE;
2135 }
2136 return FALSE;
2137}

Referenced by NtUserCallNoParam().

◆ is_message_broadcastable()

static BOOL is_message_broadcastable ( UINT  msg)
static

Definition at line 567 of file message.c.

568{
569 return msg < WM_USER || msg >= 0xc000;
570}

Referenced by co_IntSendMessageTimeout(), and UserPostMessage().

◆ is_pointer_message()

static int is_pointer_message ( UINT  message,
WPARAM  wparam 
)
inlinestatic

Definition at line 98 of file message.c.

99{
100 if (message >= 8*sizeof(message_pointer_flags)) return FALSE;
101 if (message == WM_DEVICECHANGE && !(wparam & 0x8000)) return FALSE;
102 return (message_pointer_flags[message / 32] & SET(message)) != 0;
103}
Definition: tftpd.h:60
static const unsigned int message_pointer_flags[]
Definition: message.c:36
#define SET(msg)
Definition: message.c:34

Referenced by DispatchMessageA(), DispatchMessageW(), NtUserMessageCall(), SendMessageCallbackA(), SendMessageCallbackW(), SendNotifyMessageA(), SendNotifyMessageW(), UserPostMessage(), UserPostThreadMessage(), and UserSendNotifyMessage().

◆ lParamMemorySize()

UINT lParamMemorySize ( UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 254 of file message.c.

255{
256 PMSGMEMORY MsgMemoryEntry = FindMsgMemory(Msg);
257 if(MsgMemoryEntry == NULL) return 0;
258 return MsgMemorySize(MsgMemoryEntry, wParam, lParam);
259}

Referenced by co_IntCallHookProc().

◆ MsgMemorySize()

static UINT FASTCALL MsgMemorySize ( PMSGMEMORY  MsgMemoryEntry,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 165 of file message.c.

166{
167 CREATESTRUCTW *Cs;
168 PLARGE_STRING WindowName;
169 PUNICODE_STRING ClassName;
170 UINT Size = 0;
171
173 {
174 if (MMS_SIZE_WPARAM == MsgMemoryEntry->Size)
175 {
176 Size = (UINT)wParam;
177 }
178 else if (MMS_SIZE_WPARAMWCHAR == MsgMemoryEntry->Size)
179 {
180 Size = (UINT) (wParam * sizeof(WCHAR));
181 }
182 else if (MMS_SIZE_LPARAMSZ == MsgMemoryEntry->Size)
183 {
184 // WM_SETTEXT and WM_SETTINGCHANGE can be null!
185 if (!lParam)
186 {
187 TRACE("lParam is NULL!\n");
188 Size = 0;
189 }
190 else
191 Size = (UINT) ((wcslen((PWSTR) lParam) + 1) * sizeof(WCHAR));
192 }
193 else if (MMS_SIZE_SPECIAL == MsgMemoryEntry->Size)
194 {
195 switch(MsgMemoryEntry->Message)
196 {
197 case WM_CREATE:
198 case WM_NCCREATE:
199 Cs = (CREATESTRUCTW *) lParam;
200 WindowName = (PLARGE_STRING) Cs->lpszName;
201 ClassName = (PUNICODE_STRING) Cs->lpszClass;
202 Size = sizeof(CREATESTRUCTW) + WindowName->Length + sizeof(WCHAR);
203 if (IS_ATOM(ClassName->Buffer))
204 {
205 Size += sizeof(WCHAR) + sizeof(ATOM);
206 }
207 else
208 {
209 Size += sizeof(WCHAR) + ClassName->Length + sizeof(WCHAR);
210 }
211 break;
212
213 case WM_NCCALCSIZE:
214 Size = wParam ? sizeof(NCCALCSIZE_PARAMS) + sizeof(WINDOWPOS) : sizeof(RECT);
215 break;
216
217 case WM_COPYDATA:
218 {
220 Size = sizeof(COPYDATASTRUCT) + cds->cbData;
221 }
222 break;
223
224 case WM_DEVICECHANGE:
225 {
226 if ( lParam && (wParam & 0x8000) )
227 {
229 Size = header->dbch_size;
230 }
231 }
232 break;
233
234 default:
235 ASSERT(FALSE);
236 Size = 0;
237 break;
238 }
239 }
240 else
241 {
242 Size = MsgMemoryEntry->Size;
243 }
244 }
246 {
247 ERR("Exception caught in MsgMemorySize()! Status: 0x%x\n", _SEH2_GetExceptionCode());
248 Size = 0;
249 }
250 _SEH2_END;
251 return Size;
252}
WORD ATOM
Definition: dimm.idl:113
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
UINT Size
Definition: message.c:116
#define MMS_SIZE_LPARAMSZ
Definition: message.c:108
#define MMS_SIZE_WPARAMWCHAR
Definition: message.c:107
#define MMS_SIZE_SPECIAL
Definition: message.c:109
#define MMS_SIZE_WPARAM
Definition: message.c:106
struct tagNCCALCSIZE_PARAMS NCCALCSIZE_PARAMS
struct tagCREATESTRUCTW CREATESTRUCTW
struct tagCOPYDATASTRUCT COPYDATASTRUCT
#define WM_COPYDATA
Definition: winuser.h:1664
#define WM_NCCALCSIZE
Definition: winuser.h:1685
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by co_IntSendMessageTimeoutSingle(), co_IntSendMessageWithCallBack(), CopyMsgToKernelMem(), CopyMsgToUserMem(), lParamMemorySize(), and PackParam().

◆ NtUserCallMsgFilter()

BOOL APIENTRY NtUserCallMsgFilter ( LPMSG  lpmsg,
INT  code 
)

Definition at line 2383 of file message.c.

2384{
2385 BOOL Ret = FALSE;
2386 MSG Msg;
2387
2388 _SEH2_TRY
2389 {
2390 ProbeForRead(lpmsg, sizeof(MSG), 1);
2391 RtlCopyMemory( &Msg, lpmsg, sizeof(MSG));
2392 }
2394 {
2395 _SEH2_YIELD(return FALSE);
2396 }
2397 _SEH2_END;
2398
2400
2402 {
2403 Ret = TRUE;
2404 }
2405 else
2406 {
2408 }
2409
2410 UserLeave();
2411
2412 _SEH2_TRY
2413 {
2414 ProbeForWrite(lpmsg, sizeof(MSG), 1);
2415 RtlCopyMemory(lpmsg, &Msg, sizeof(MSG));
2416 }
2418 {
2419 Ret = FALSE;
2420 }
2421 _SEH2_END;
2422
2423 return Ret;
2424}
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:162

Referenced by CallMsgFilterA(), and CallMsgFilterW().

◆ NtUserDispatchMessage()

LRESULT APIENTRY NtUserDispatchMessage ( PMSG  UnsafeMsgInfo)

Definition at line 2427 of file message.c.

2428{
2429 LRESULT Res = 0;
2430 MSG SafeMsg;
2431
2432 _SEH2_TRY
2433 {
2434 ProbeForRead(UnsafeMsgInfo, sizeof(MSG), 1);
2435 RtlCopyMemory(&SafeMsg, UnsafeMsgInfo, sizeof(MSG));
2436 }
2438 {
2440 _SEH2_YIELD(return FALSE);
2441 }
2442 _SEH2_END;
2443
2445
2446 Res = IntDispatchMessage(&SafeMsg);
2447
2448 UserLeave();
2449 return Res;
2450}
LRESULT FASTCALL IntDispatchMessage(PMSG pMsg)
Definition: message.c:840

Referenced by DispatchMessageA(), and DispatchMessageW().

◆ NtUserDragDetect()

BOOL APIENTRY NtUserDragDetect ( HWND  hWnd,
POINT  pt 
)

Functions

Definition at line 2159 of file message.c.

2162{
2163 MSG msg;
2164 RECT rect;
2165 ULONG wDragWidth, wDragHeight;
2166 BOOL Ret = FALSE;
2167
2168 TRACE("Enter NtUserDragDetect(%p)\n", hWnd);
2170
2171 wDragWidth = UserGetSystemMetrics(SM_CXDRAG);
2172 wDragHeight= UserGetSystemMetrics(SM_CYDRAG);
2173
2174 rect.left = pt.x - wDragWidth;
2175 rect.right = pt.x + wDragWidth;
2176
2177 rect.top = pt.y - wDragHeight;
2178 rect.bottom = pt.y + wDragHeight;
2179
2181
2182 for (;;)
2183 {
2187 {
2188 if ( msg.message == WM_LBUTTONUP )
2189 {
2191 goto Exit; // Return FALSE
2192 }
2193 if ( msg.message == WM_MOUSEMOVE )
2194 {
2195 POINT tmp;
2196 tmp.x = (short)LOWORD(msg.lParam);
2197 tmp.y = (short)HIWORD(msg.lParam);
2198 if( !RECTL_bPointInRect( &rect, tmp.x, tmp.y ) )
2199 {
2201 Ret = TRUE;
2202 goto Exit;
2203 }
2204 }
2205 if ( msg.message == WM_KEYDOWN )
2206 {
2207 if ( msg.wParam == VK_ESCAPE )
2208 {
2210 Ret = TRUE;
2211 goto Exit;
2212 }
2213 }
2214 if ( msg.message == WM_QUEUESYNC )
2215 {
2217 }
2218 }
2219 co_IntWaitMessage(NULL, 0, 0);
2220 }
2221
2222Exit:
2223 TRACE("Leave NtUserDragDetect, ret=%i\n", Ret);
2224 UserLeave();
2225 return Ret;
2226}
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define pt(x, y)
Definition: drawing.c:79
HWND FASTCALL co_UserSetCapture(HWND hWnd)
Definition: focus.c:1457
#define LOWORD(l)
Definition: pedump.c:82
static void Exit(void)
Definition: sock.c:1330
& rect
Definition: startmenu.cpp:1413
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
uint32_t ULONG
Definition: typedefs.h:59
FORCEINLINE BOOL RECTL_bPointInRect(_In_ const RECTL *prcl, _In_ INT x, _In_ INT y)
Definition: rect.h:52
BOOL FASTCALL co_IntWaitMessage(PWND Window, UINT MsgFilterMin, UINT MsgFilterMax)
Definition: message.c:1130
BOOL APIENTRY co_IntGetPeekMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg, BOOL bGMSG)
Definition: message.c:1176
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:213
#define SM_CXDRAG
Definition: winuser.h:1028
#define WM_MOUSEMOVE
Definition: winuser.h:1775
#define WH_CBT
Definition: winuser.h:35
#define WM_QUEUESYNC
Definition: winuser.h:1639
#define HCBT_QS
Definition: winuser.h:57
#define WM_LBUTTONUP
Definition: winuser.h:1777
#define WM_KEYDOWN
Definition: winuser.h:1715
#define SM_CYDRAG
Definition: winuser.h:1029
#define VK_ESCAPE
Definition: winuser.h:2214

Referenced by DragDetect().

◆ NtUserGetMessage()

BOOL APIENTRY NtUserGetMessage ( PMSG  pMsg,
HWND  hWnd,
UINT  MsgFilterMin,
UINT  MsgFilterMax 
)

Definition at line 2297 of file message.c.

2301{
2302 MSG Msg;
2303 BOOL Ret;
2304
2305 if ( (MsgFilterMin|MsgFilterMax) & ~WM_MAXIMUM )
2306 {
2308 return FALSE;
2309 }
2310
2312
2313 RtlZeroMemory(&Msg, sizeof(MSG));
2314
2315 Ret = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, PM_REMOVE, TRUE);
2316
2317 UserLeave();
2318
2319 if (Ret)
2320 {
2321 _SEH2_TRY
2322 {
2323 ProbeForWrite(pMsg, sizeof(MSG), 1);
2324 RtlCopyMemory(pMsg, &Msg, sizeof(MSG));
2325 }
2327 {
2329 Ret = FALSE;
2330 }
2331 _SEH2_END;
2332 }
2333
2334 if ((INT)Ret != -1)
2335 Ret = Ret ? (WM_QUIT != pMsg->message) : FALSE;
2336
2337 return Ret;
2338}
#define WM_MAXIMUM
Definition: undocuser.h:64

Referenced by GetMessageA(), and GetMessageW().

◆ NtUserMessageCall()

BOOL APIENTRY NtUserMessageCall ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
ULONG_PTR  ResultInfo,
DWORD  dwType,
BOOL  Ansi 
)

Definition at line 2490 of file message.c.

2497{
2498 LRESULT lResult = 0;
2499 BOOL Ret = FALSE;
2500 PWND Window = NULL;
2502
2504
2505 switch(dwType)
2506 {
2507 case FNID_SCROLLBAR:
2508 {
2509 lResult = ScrollBarWndProc(hWnd, Msg, wParam, lParam);
2510 break;
2511 }
2512 case FNID_DESKTOP:
2513 {
2515 if (Window)
2516 {
2517 //ERR("FNID_DESKTOP IN\n");
2518 Ret = DesktopWindowProc(Window, Msg, wParam, lParam, &lResult);
2519 //ERR("FNID_DESKTOP OUT\n");
2520 }
2521 break;
2522 }
2523 case FNID_MENU:
2524 {
2526 if (Window)
2527 {
2528 Ret = PopupMenuWndProc( Window, Msg, wParam, lParam, &lResult);
2529 }
2530 break;
2531 }
2532 case FNID_MESSAGEWND:
2533 {
2535 if (Window)
2536 {
2537 Ret = !UserMessageWindowProc(Window, Msg, wParam, lParam, &lResult);
2538 }
2539 break;
2540 }
2541 case FNID_DEFWINDOWPROC:
2542 /* Validate input */
2543 if (hWnd)
2544 {
2546 if (!Window)
2547 {
2548 UserLeave();
2549 return FALSE;
2550 }
2551 UserRefObjectCo(Window, &Ref);
2552 }
2553 lResult = IntDefWindowProc(Window, Msg, wParam, lParam, Ansi);
2554 Ret = TRUE;
2555 if (hWnd)
2557 break;
2560 break;
2562 {
2563 BROADCASTPARM parm, *retparam;
2564 DWORD_PTR RetVal = 0;
2565
2566 if (ResultInfo)
2567 {
2568 _SEH2_TRY
2569 {
2570 ProbeForWrite((PVOID)ResultInfo, sizeof(BROADCASTPARM), 1);
2571 RtlCopyMemory(&parm, (PVOID)ResultInfo, sizeof(BROADCASTPARM));
2572 }
2574 {
2575 _SEH2_YIELD(break);
2576 }
2577 _SEH2_END;
2578 }
2579 else
2580 break;
2581
2582 if ( parm.recipients & BSM_ALLDESKTOPS ||
2584 {
2585 PLIST_ENTRY DesktopEntry;
2586 PDESKTOP rpdesk;
2587 HWND *List, hwndDenied = NULL;
2588 HDESK hDesk = NULL;
2589 PWND pwnd, pwndDesk;
2590 ULONG i;
2591 UINT fuFlags;
2592
2593 for (DesktopEntry = InputWindowStation->DesktopListHead.Flink;
2594 DesktopEntry != &InputWindowStation->DesktopListHead;
2595 DesktopEntry = DesktopEntry->Flink)
2596 {
2597 rpdesk = CONTAINING_RECORD(DesktopEntry, DESKTOP, ListEntry);
2598 pwndDesk = rpdesk->pDeskInfo->spwnd;
2599 List = IntWinListChildren(pwndDesk);
2600
2601 if (parm.flags & BSF_QUERY)
2602 {
2603 if (List != NULL)
2604 {
2605 if (parm.flags & BSF_FORCEIFHUNG || parm.flags & BSF_NOHANG)
2606 {
2607 fuFlags = SMTO_ABORTIFHUNG;
2608 }
2609 else if (parm.flags & BSF_NOTIMEOUTIFNOTHUNG)
2610 {
2611 fuFlags = SMTO_NOTIMEOUTIFNOTHUNG;
2612 }
2613 else
2614 {
2615 fuFlags = SMTO_NORMAL;
2616 }
2618 Msg,
2619 wParam,
2620 lParam,
2621 fuFlags,
2622 2000,
2623 &RetVal);
2624 Ret = TRUE;
2625 for (i = 0; List[i]; i++)
2626 {
2627 pwnd = UserGetWindowObject(List[i]);
2628 if (!pwnd) continue;
2629
2630 if ( pwnd->fnid == FNID_MENU ||
2632 continue;
2633
2634 if ( parm.flags & BSF_IGNORECURRENTTASK )
2635 {
2636 if ( pwnd->head.pti == gptiCurrent )
2637 continue;
2638 }
2640 Msg,
2641 wParam,
2642 lParam,
2643 fuFlags,
2644 2000,
2645 &RetVal);
2646
2647 if (!RetVal && EngGetLastError() == ERROR_TIMEOUT)
2648 {
2649 if (!(parm.flags & BSF_FORCEIFHUNG))
2650 Ret = FALSE;
2651 }
2652 if (RetVal == BROADCAST_QUERY_DENY)
2653 {
2654 hwndDenied = List[i];
2655 hDesk = UserHMGetHandle(pwndDesk);
2656 Ret = FALSE;
2657 }
2658 }
2660 _SEH2_TRY
2661 {
2662 retparam = (PBROADCASTPARM) ResultInfo;
2663 retparam->hDesk = hDesk;
2664 retparam->hWnd = hwndDenied;
2665 }
2667 {
2668 _SEH2_YIELD(break);
2669 }
2670 _SEH2_END;
2671 if (!Ret) break; // Have a hit! Let everyone know!
2672 }
2673 }
2674 else if (parm.flags & BSF_POSTMESSAGE)
2675 {
2676 if (List != NULL)
2677 {
2679
2680 for (i = 0; List[i]; i++)
2681 {
2682 pwnd = UserGetWindowObject(List[i]);
2683 if (!pwnd) continue;
2684
2685 if ( pwnd->fnid == FNID_MENU ||
2687 continue;
2688
2689 if ( parm.flags & BSF_IGNORECURRENTTASK )
2690 {
2691 if ( pwnd->head.pti == gptiCurrent )
2692 continue;
2693 }
2695 }
2697 }
2698 Ret = TRUE;
2699 }
2700 else
2701 {
2702 if (List != NULL)
2703 {
2705
2706 for (i = 0; List[i]; i++)
2707 {
2708 pwnd = UserGetWindowObject(List[i]);
2709 if (!pwnd) continue;
2710
2711 if ( pwnd->fnid == FNID_MENU ||
2713 continue;
2714
2715 if ( parm.flags & BSF_IGNORECURRENTTASK )
2716 {
2717 if ( pwnd->head.pti == gptiCurrent )
2718 continue;
2719 }
2721 }
2723 }
2724 Ret = TRUE;
2725 }
2726 }
2727 }
2728 else if (parm.recipients & BSM_APPLICATIONS)
2729 {
2730 HWND *List, hwndDenied = NULL;
2731 HDESK hDesk = NULL;
2732 PWND pwnd, pwndDesk;
2733 ULONG i;
2734 UINT fuFlags;
2735
2736 pwndDesk = UserGetDesktopWindow();
2737 List = IntWinListChildren(pwndDesk);
2738
2739 if (parm.flags & BSF_QUERY)
2740 {
2741 if (List != NULL)
2742 {
2743 if (parm.flags & BSF_FORCEIFHUNG || parm.flags & BSF_NOHANG)
2744 {
2745 fuFlags = SMTO_ABORTIFHUNG;
2746 }
2747 else if (parm.flags & BSF_NOTIMEOUTIFNOTHUNG)
2748 {
2749 fuFlags = SMTO_NOTIMEOUTIFNOTHUNG;
2750 }
2751 else
2752 {
2753 fuFlags = SMTO_NORMAL;
2754 }
2756 Msg,
2757 wParam,
2758 lParam,
2759 fuFlags,
2760 2000,
2761 &RetVal);
2762 Ret = TRUE;
2763 for (i = 0; List[i]; i++)
2764 {
2765 pwnd = UserGetWindowObject(List[i]);
2766 if (!pwnd) continue;
2767
2768 if ( pwnd->fnid == FNID_MENU ||
2770 continue;
2771
2772 if ( parm.flags & BSF_IGNORECURRENTTASK )
2773 {
2774 if ( pwnd->head.pti == gptiCurrent )
2775 continue;
2776 }
2778 Msg,
2779 wParam,
2780 lParam,
2781 fuFlags,
2782 2000,
2783 &RetVal);
2784
2785 if (!RetVal && EngGetLastError() == ERROR_TIMEOUT)
2786 {
2787 if (!(parm.flags & BSF_FORCEIFHUNG))
2788 Ret = FALSE;
2789 }
2790 if (RetVal == BROADCAST_QUERY_DENY)
2791 {
2792 hwndDenied = List[i];
2793 hDesk = UserHMGetHandle(pwndDesk);
2794 Ret = FALSE;
2795 }
2796 }
2798 _SEH2_TRY
2799 {
2800 retparam = (PBROADCASTPARM) ResultInfo;
2801 retparam->hDesk = hDesk;
2802 retparam->hWnd = hwndDenied;
2803 }
2805 {
2806 _SEH2_YIELD(break);
2807 }
2808 _SEH2_END;
2809 }
2810 }
2811 else if (parm.flags & BSF_POSTMESSAGE)
2812 {
2813 if (List != NULL)
2814 {
2816
2817 for (i = 0; List[i]; i++)
2818 {
2819 pwnd = UserGetWindowObject(List[i]);
2820 if (!pwnd) continue;
2821
2822 if ( pwnd->fnid == FNID_MENU ||
2824 continue;
2825
2826 if ( parm.flags & BSF_IGNORECURRENTTASK )
2827 {
2828 if ( pwnd->head.pti == gptiCurrent )
2829 continue;
2830 }
2832 }
2834 }
2835 Ret = TRUE;
2836 }
2837 else
2838 {
2839 if (List != NULL)
2840 {
2842
2843 for (i = 0; List[i]; i++)
2844 {
2845 pwnd = UserGetWindowObject(List[i]);
2846 if (!pwnd) continue;
2847
2848 if ( pwnd->fnid == FNID_MENU ||
2850 continue;
2851
2852 if ( parm.flags & BSF_IGNORECURRENTTASK )
2853 {
2854 if ( pwnd->head.pti == gptiCurrent )
2855 continue;
2856 }
2858 }
2860 }
2861 Ret = TRUE;
2862 }
2863 }
2864 }
2865 break;
2867 {
2868 CALL_BACK_INFO CallBackInfo;
2869 ULONG_PTR uResult;
2870
2871 _SEH2_TRY
2872 {
2873 ProbeForRead((PVOID)ResultInfo, sizeof(CALL_BACK_INFO), 1);
2874 RtlCopyMemory(&CallBackInfo, (PVOID)ResultInfo, sizeof(CALL_BACK_INFO));
2875 }
2877 {
2878 _SEH2_YIELD(break);
2879 }
2880 _SEH2_END;
2881
2883 {
2885 break;
2886 }
2887
2889 CallBackInfo.CallBack, CallBackInfo.Context, &uResult)))
2890 {
2891 ERR("Callback failure!\n");
2892 }
2893 }
2894 break;
2895 case FNID_SENDMESSAGE:
2896 {
2897 lResult = co_IntDoSendMessage(hWnd, Msg, wParam, lParam, 0);
2898 Ret = TRUE;
2899
2900 if (ResultInfo)
2901 {
2902 _SEH2_TRY
2903 {
2904 ProbeForWrite((PVOID)ResultInfo, sizeof(ULONG_PTR), 1);
2905 RtlCopyMemory((PVOID)ResultInfo, &lResult, sizeof(ULONG_PTR));
2906 }
2908 {
2909 Ret = FALSE;
2910 _SEH2_YIELD(break);
2911 }
2912 _SEH2_END;
2913 }
2914 break;
2915 }
2916 case FNID_SENDMESSAGEFF:
2918 {
2919 DOSENDMESSAGE dsm, *pdsm = (PDOSENDMESSAGE)ResultInfo;
2920 if (ResultInfo)
2921 {
2922 _SEH2_TRY
2923 {
2924 ProbeForRead(pdsm, sizeof(DOSENDMESSAGE), 1);
2925 RtlCopyMemory(&dsm, pdsm, sizeof(DOSENDMESSAGE));
2926 }
2928 {
2929 _SEH2_YIELD(break);
2930 }
2931 _SEH2_END;
2932 }
2933
2934 Ret = co_IntDoSendMessage( hWnd, Msg, wParam, lParam, pdsm ? &dsm : NULL );
2935
2936 if (pdsm)
2937 {
2938 _SEH2_TRY
2939 {
2940 ProbeForWrite(pdsm, sizeof(DOSENDMESSAGE), 1);
2941 RtlCopyMemory(pdsm, &dsm, sizeof(DOSENDMESSAGE));
2942 }
2944 {
2945 Ret = FALSE;
2946 _SEH2_YIELD(break);
2947 }
2948 _SEH2_END;
2949 }
2950 break;
2951 }
2952 // CallNextHook bypass.
2953 case FNID_CALLWNDPROC:
2955 {
2956 PTHREADINFO pti;
2958 PHOOK NextObj, Hook;
2959
2960 pti = GetW32ThreadInfo();
2961
2962 Hook = pti->sphkCurrent;
2963
2964 if (!Hook) break;
2965
2966 NextObj = Hook->phkNext;
2967 ClientInfo = pti->pClientInfo;
2968 _SEH2_TRY
2969 {
2970 ClientInfo->phkCurrent = NextObj;
2971 }
2973 {
2974 ClientInfo = NULL;
2975 }
2976 _SEH2_END;
2977
2978 if (!ClientInfo || !NextObj) break;
2979
2980 NextObj->phkNext = IntGetNextHook(NextObj);
2981
2982 if ( Hook->HookId == WH_CALLWNDPROC)
2983 {
2984 CWPSTRUCT CWP;
2985 CWP.hwnd = hWnd;
2986 CWP.message = Msg;
2987 CWP.wParam = wParam;
2988 CWP.lParam = lParam;
2989 TRACE("WH_CALLWNDPROC: Hook %p NextHook %p\n", Hook, NextObj);
2990
2991 lResult = co_IntCallHookProc( Hook->HookId,
2992 HC_ACTION,
2993 ((ClientInfo->CI_flags & CI_CURTHPRHOOK) ? 1 : 0),
2994 (LPARAM)&CWP,
2995 Hook->Proc,
2996 Hook->ihmod,
2997 Hook->offPfn,
2998 Hook->Ansi,
2999 &Hook->ModuleName);
3000 }
3001 else
3002 {
3003 CWPRETSTRUCT CWPR;
3004 CWPR.hwnd = hWnd;
3005 CWPR.message = Msg;
3006 CWPR.wParam = wParam;
3007 CWPR.lParam = lParam;
3008 CWPR.lResult = ClientInfo->dwHookData;
3009
3010 lResult = co_IntCallHookProc( Hook->HookId,
3011 HC_ACTION,
3012 ((ClientInfo->CI_flags & CI_CURTHPRHOOK) ? 1 : 0),
3013 (LPARAM)&CWPR,
3014 Hook->Proc,
3015 Hook->ihmod,
3016 Hook->offPfn,
3017 Hook->Ansi,
3018 &Hook->ModuleName);
3019 }
3020 }
3021 break;
3022 }
3023
3024 switch(dwType)
3025 {
3026 case FNID_DEFWINDOWPROC:
3027 case FNID_CALLWNDPROC:
3029 case FNID_SCROLLBAR:
3030 case FNID_DESKTOP:
3031 case FNID_MENU:
3032 if (ResultInfo)
3033 {
3034 _SEH2_TRY
3035 {
3036 ProbeForWrite((PVOID)ResultInfo, sizeof(LRESULT), 1);
3037 RtlCopyMemory((PVOID)ResultInfo, &lResult, sizeof(LRESULT));
3038 }
3040 {
3041 Ret = FALSE;
3042 }
3043 _SEH2_END;
3044 }
3045 break;
3046 default:
3047 break;
3048 }
3049
3050 UserLeave();
3051
3052 return Ret;
3053}
#define BSF_POSTMESSAGE
Definition: dbt.h:58
#define BSF_NOTIMEOUTIFNOTHUNG
Definition: dbt.h:57
#define BSF_NOHANG
Definition: dbt.h:56
#define BSF_IGNORECURRENTTASK
Definition: dbt.h:55
#define BSF_QUERY
Definition: dbt.h:59
#define BSM_APPLICATIONS
Definition: dbt.h:48
#define BSF_FORCEIFHUNG
Definition: dbt.h:54
#define BSM_ALLDESKTOPS
Definition: dbt.h:49
#define BSM_ALLCOMPONENTS
Definition: dbt.h:47
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FNID_SENDMESSAGEFF
Definition: ntuser.h:883
#define FNID_SCROLLBAR
Definition: ntuser.h:859
#define FNID_DEFWINDOWPROC
Definition: ntuser.h:863
#define FNID_SENDMESSAGECALLBACK
Definition: ntuser.h:890
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:805
#define FNID_SENDMESSAGEWTOOPTION
Definition: ntuser.h:885
#define FNID_CALLWNDPROCRET
Definition: ntuser.h:877
#define FNID_CALLWNDPROC
Definition: ntuser.h:876
#define CI_CURTHPRHOOK
Definition: ntuser.h:304
struct tagDOSENDMESSAGE * PDOSENDMESSAGE
#define FNID_SENDMESSAGE
Definition: ntuser.h:882
struct _BROADCASTPARM * PBROADCASTPARM
#define FNID_BROADCASTSYSTEMMESSAGE
Definition: ntuser.h:887
#define FNID_SENDNOTIFYMESSAGE
Definition: ntuser.h:889
CLIENT_DATA ClientInfo
LRESULT FASTCALL IntDefWindowProc(PWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi)
Definition: defwnd.c:535
PHOOK FASTCALL IntGetNextHook(PHOOK Hook)
Definition: hook.c:995
PWINSTATION_OBJECT InputWindowStation
Definition: winsta.c:21
DWORD recipients
Definition: ntuser.h:1109
DWORD flags
Definition: ntuser.h:1108
HDESK hDesk
Definition: ntuser.h:1110
SENDASYNCPROC CallBack
Definition: callback.h:50
ULONG_PTR Context
Definition: callback.h:51
struct _WND * spwnd
Definition: ntuser.h:137
PDESKTOPINFO pDeskInfo
Definition: desktop.h:8
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
struct tagHOOK * sphkCurrent
Definition: win32.h:118
LIST_ENTRY DesktopListHead
Definition: winsta.h:19
THRDESKHEAD head
Definition: ntuser.h:695
INT_PTR ihmod
Definition: ntuser.h:245
struct tagHOOK * phkNext
Definition: ntuser.h:241
HOOKPROC Proc
Definition: ntuser.h:250
ULONG_PTR offPfn
Definition: ntuser.h:243
int HookId
Definition: ntuser.h:242
BOOLEAN Ansi
Definition: ntuser.h:251
UNICODE_STRING ModuleName
Definition: ntuser.h:252
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
LRESULT APIENTRY co_IntCallHookProc(INT HookId, INT Code, WPARAM wParam, LPARAM lParam, HOOKPROC Proc, INT Mod, ULONG_PTR offPfn, BOOLEAN Ansi, PUNICODE_STRING ModuleName)
Definition: callback.c:508
static int is_pointer_message(UINT message, WPARAM wparam)
Definition: message.c:98
static LRESULT FASTCALL co_IntDoSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, PDOSENDMESSAGE dsm)
Definition: message.c:1954
BOOL FASTCALL UserSendNotifyMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:2040
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1345
LRESULT APIENTRY ScrollBarWndProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: scrollbar.c:1123
ENGAPI ULONG APIENTRY EngGetLastError(VOID)
Definition: error.c:9
#define BROADCAST_QUERY_DENY
Definition: winuser.h:178

Referenced by CallNextHookEx(), DefWndHandleSysCommand(), DesktopWndProcW(), IntBroadcastSystemMessage(), IntScrollCreateScrollBar(), MenuWindowProcA(), MenuWindowProcW(), PopupMenuWndProcW(), SendMessageA(), SendMessageCallbackA(), SendMessageCallbackW(), SendMessageTimeoutA(), SendMessageTimeoutW(), SendMessageW(), SendNotifyMessageW(), and User32DefWindowProc().

◆ NtUserPeekMessage()

BOOL APIENTRY NtUserPeekMessage ( PMSG  pMsg,
HWND  hWnd,
UINT  MsgFilterMin,
UINT  MsgFilterMax,
UINT  RemoveMsg 
)

Definition at line 2341 of file message.c.

2346{
2347 MSG Msg;
2348 BOOL Ret;
2349
2350 if ( RemoveMsg & PM_BADMSGFLAGS )
2351 {
2353 return FALSE;
2354 }
2355
2357
2358 RtlZeroMemory(&Msg, sizeof(MSG));
2359
2360 Ret = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, RemoveMsg, FALSE);
2361
2362 UserLeave();
2363
2364 if (Ret)
2365 {
2366 _SEH2_TRY
2367 {
2368 ProbeForWrite(pMsg, sizeof(MSG), 1);
2369 RtlCopyMemory(pMsg, &Msg, sizeof(MSG));
2370 }
2372 {
2374 Ret = FALSE;
2375 }
2376 _SEH2_END;
2377 }
2378
2379 return Ret;
2380}
#define PM_BADMSGFLAGS
Definition: message.c:14
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583

Referenced by PeekMessageWorker().

◆ NtUserPostMessage()

BOOL APIENTRY NtUserPostMessage ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 2229 of file message.c.

2233{
2234 BOOL ret;
2235
2237
2239
2240 UserLeave();
2241
2242 return ret;
2243}
int ret

Referenced by PostMessageA(), and PostMessageW().

◆ NtUserPostThreadMessage()

BOOL APIENTRY NtUserPostThreadMessage ( DWORD  idThread,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 2246 of file message.c.

2250{
2251 BOOL ret = FALSE;
2252 PETHREAD peThread;
2253 PTHREADINFO pThread;
2255
2257
2258 Status = PsLookupThreadByThreadId(UlongToHandle(idThread), &peThread);
2259
2260 if ( Status == STATUS_SUCCESS )
2261 {
2262 pThread = (PTHREADINFO)peThread->Tcb.Win32Thread;
2263 if( !pThread ||
2264 !pThread->MessageQueue ||
2265 (pThread->TIF_flags & TIF_INCLEANUP))
2266 {
2267 ObDereferenceObject( peThread );
2268 goto exit;
2269 }
2270 ret = UserPostThreadMessage( pThread, Msg, wParam, lParam);
2271 ObDereferenceObject( peThread );
2272 }
2273 else
2274 {
2276 }
2277exit:
2278 UserLeave();
2279 return ret;
2280}
#define UlongToHandle(ul)
Definition: basetsd.h:97
NTSTATUS NTAPI PsLookupThreadByThreadId(IN HANDLE ThreadId, OUT PETHREAD *Thread)
Definition: thread.c:643
struct _THREADINFO * PTHREADINFO
Definition: ntwin32.h:6
#define exit(n)
Definition: config.h:202
KTHREAD Tcb
Definition: pstypes.h:1103
PVOID Win32Thread
Definition: ketypes.h:1866
BOOL FASTCALL UserPostThreadMessage(PTHREADINFO pti, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1308
#define ObDereferenceObject
Definition: obfuncs.h:203

Referenced by PostThreadMessageA(), and PostThreadMessageW().

◆ NtUserTranslateMessage()

BOOL APIENTRY NtUserTranslateMessage ( LPMSG  lpMsg,
UINT  flags 
)

Definition at line 2453 of file message.c.

2454{
2455 MSG SafeMsg;
2456 BOOL Ret;
2457 PWND pWnd;
2458
2459 _SEH2_TRY
2460 {
2461 ProbeForRead(lpMsg, sizeof(MSG), 1);
2462 RtlCopyMemory(&SafeMsg, lpMsg, sizeof(MSG));
2463 }
2465 {
2467 _SEH2_YIELD(return FALSE);
2468 }
2469 _SEH2_END;
2470
2472 pWnd = UserGetWindowObject(SafeMsg.hwnd);
2473 if (pWnd) // Must have a window!
2474 {
2475 Ret = IntTranslateKbdMessage(&SafeMsg, flags);
2476 }
2477 else
2478 {
2479 TRACE("No Window for Translate. hwnd 0x%p Msg %u\n", SafeMsg.hwnd, SafeMsg.message);
2480 Ret = FALSE;
2481 }
2482 UserLeave();
2483
2484 return Ret;
2485}
GLbitfield flags
Definition: glext.h:7161
BOOL FASTCALL IntTranslateKbdMessage(LPMSG lpMsg, UINT flags)
Definition: keyboard.c:1276

Referenced by TranslateMessageEx().

◆ NtUserWaitForInputIdle()

DWORD APIENTRY NtUserWaitForInputIdle ( IN HANDLE  hProcess,
IN DWORD  dwMilliseconds,
IN BOOL  bSharedWow 
)

Definition at line 3060 of file message.c.

3063{
3065 PPROCESSINFO W32Process;
3066 PTHREADINFO pti;
3068 HANDLE Handles[3];
3071
3073
3077 UserMode,
3078 (PVOID*)&Process,
3079 NULL);
3080
3081 if (!NT_SUCCESS(Status))
3082 {
3083 UserLeave();
3085 return WAIT_FAILED;
3086 }
3087
3089
3090 W32Process = (PPROCESSINFO)Process->Win32Process;
3091
3093 !W32Process ||
3094 pti->ppi == W32Process)
3095 {
3097 UserLeave();
3099 return WAIT_FAILED;
3100 }
3101
3102 Handles[0] = Process;
3103 Handles[1] = W32Process->InputIdleEvent;
3104 Handles[2] = pti->pEventQueueServer; // IntMsqSetWakeMask returns hEventQueueClient
3105
3106 if (!Handles[1])
3107 {
3109 UserLeave();
3110 return STATUS_SUCCESS; /* no event to wait on */
3111 }
3112
3113 if (dwMilliseconds != INFINITE)
3114 Timeout.QuadPart = (LONGLONG) dwMilliseconds * (LONGLONG) -10000;
3115
3117 W32Process->W32PF_flags |= W32PF_WAITFORINPUTIDLE;
3118 for (pti = W32Process->ptiList; pti; pti = pti->ptiSibling)
3119 {
3121 pti->pClientInfo->dwTIFlags = pti->TIF_flags;
3122 }
3124
3125 TRACE("WFII: ppi %p\n", W32Process);
3126 TRACE("WFII: waiting for %p\n", Handles[1] );
3127
3128 /*
3129 * We must add a refcount to our current PROCESSINFO,
3130 * because anything could happen (including process death) we're leaving win32k
3131 */
3132 IntReferenceProcessInfo(W32Process);
3133
3134 do
3135 {
3136 UserLeave();
3138 Handles,
3139 WaitAny,
3141 UserMode,
3142 FALSE,
3143 dwMilliseconds == INFINITE ? NULL : &Timeout,
3144 NULL);
3146
3147 if (!NT_SUCCESS(Status))
3148 {
3151 goto WaitExit;
3152 }
3153
3154 switch (Status)
3155 {
3156 case STATUS_WAIT_0:
3157 goto WaitExit;
3158
3159 case STATUS_WAIT_2:
3160 {
3161 MSG Msg;
3162 co_IntGetPeekMessage( &Msg, 0, 0, 0, PM_REMOVE | PM_QS_SENDMESSAGE, FALSE);
3163 ERR("WFII: WAIT 2\n");
3164 }
3165 break;
3166
3167 case STATUS_TIMEOUT:
3168 ERR("WFII: timeout\n");
3169 case WAIT_FAILED:
3170 goto WaitExit;
3171
3172 default:
3173 ERR("WFII: finished\n");
3175 goto WaitExit;
3176 }
3177 }
3178 while (TRUE);
3179
3180WaitExit:
3182 for (pti = W32Process->ptiList; pti; pti = pti->ptiSibling)
3183 {
3184 pti->TIF_flags &= ~TIF_WAITFORINPUTIDLE;
3185 pti->pClientInfo->dwTIFlags = pti->TIF_flags;
3186 }
3187 W32Process->W32PF_flags &= ~W32PF_WAITFORINPUTIDLE;
3189
3190 IntDereferenceProcessInfo(W32Process);
3192 UserLeave();
3193 return Status;
3194}
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:166
#define TIF_WAITFORINPUTIDLE
Definition: ntuser.h:277
if(dx< 0)
Definition: linetemp.h:194
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:71
#define UserMode
Definition: asm.h:35
@ WaitAny
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1765
NTSTATUS NTAPI KeWaitForMultipleObjects(IN ULONG Count, IN PVOID Object[], IN WAIT_TYPE WaitType, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL, OUT PKWAIT_BLOCK WaitBlockArray OPTIONAL)
Definition: wait.c:586
BOOLEAN NTAPI PsGetProcessExitProcessCalled(PEPROCESS Process)
Definition: process.c:1043
POBJECT_TYPE PsProcessType
Definition: process.c:20
#define STATUS_WAIT_0
Definition: ntstatus.h:237
#define STATUS_WAIT_2
Definition: ntstatus.h:72
struct _PROCESSINFO * PPROCESSINFO
Definition: ntwin32.h:5
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:494
static ULONG Timeout
Definition: ping.c:61
VOID NTAPI KeStackAttachProcess(IN PKPROCESS Process, OUT PRKAPC_STATE ApcState)
Definition: procobj.c:704
VOID NTAPI KeUnstackDetachProcess(IN PRKAPC_STATE ApcState)
Definition: procobj.c:756
PTHREADINFO ptiList
Definition: win32.h:256
PPROCESSINFO ppi
Definition: win32.h:88
PTHREADINFO ptiSibling
Definition: win32.h:116
PKEVENT pEventQueueServer
Definition: win32.h:125
int64_t LONGLONG
Definition: typedefs.h:68
#define IntReferenceProcessInfo(ppi)
Definition: win32.h:181
#define W32PF_WAITFORINPUTIDLE
Definition: win32.h:22
#define IntDereferenceProcessInfo(ppi)
Definition: win32.h:186
#define INFINITE
Definition: message.c:3055
#define WAIT_FAILED
Definition: message.c:3056
@ UserRequest
Definition: ketypes.h:421
KAPC_STATE
Definition: ketypes.h:1409

Referenced by WaitForInputIdle().

◆ NtUserWaitMessage()

BOOL APIENTRY NtUserWaitMessage ( VOID  )

Definition at line 2283 of file message.c.

2284{
2285 BOOL ret;
2286
2288 TRACE("NtUserWaitMessage Enter\n");
2289 ret = co_IntWaitMessage(NULL, 0, 0);
2290 TRACE("NtUserWaitMessage Leave\n");
2291 UserLeave();
2292
2293 return ret;
2294}

Referenced by WaitMessage().

◆ PackParam()

static NTSTATUS PackParam ( LPARAM lParamPacked,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
BOOL  NonPagedPoolNeeded 
)
static

Definition at line 262 of file message.c.

263{
264 NCCALCSIZE_PARAMS *UnpackedNcCalcsize;
265 NCCALCSIZE_PARAMS *PackedNcCalcsize;
266 CREATESTRUCTW *UnpackedCs;
267 CREATESTRUCTW *PackedCs;
268 PLARGE_STRING WindowName;
269 PUNICODE_STRING ClassName;
271 UINT Size;
272 PCHAR CsData;
273
274 *lParamPacked = lParam;
275
276 if (NonPagedPoolNeeded)
278 else
280
281 if (WM_NCCALCSIZE == Msg && wParam)
282 {
283
284 UnpackedNcCalcsize = (NCCALCSIZE_PARAMS *) lParam;
285 PackedNcCalcsize = ExAllocatePoolWithTag(PoolType,
286 sizeof(NCCALCSIZE_PARAMS) + sizeof(WINDOWPOS),
287 TAG_MSG);
288
289 if (NULL == PackedNcCalcsize)
290 {
291 ERR("Not enough memory to pack lParam\n");
292 return STATUS_NO_MEMORY;
293 }
294 RtlCopyMemory(PackedNcCalcsize, UnpackedNcCalcsize, sizeof(NCCALCSIZE_PARAMS));
295 PackedNcCalcsize->lppos = (PWINDOWPOS) (PackedNcCalcsize + 1);
296 RtlCopyMemory(PackedNcCalcsize->lppos, UnpackedNcCalcsize->lppos, sizeof(WINDOWPOS));
297 *lParamPacked = (LPARAM) PackedNcCalcsize;
298 }
299 else if (WM_CREATE == Msg || WM_NCCREATE == Msg)
300 {
301 UnpackedCs = (CREATESTRUCTW *) lParam;
302 WindowName = (PLARGE_STRING) UnpackedCs->lpszName;
303 ClassName = (PUNICODE_STRING) UnpackedCs->lpszClass;
304 Size = sizeof(CREATESTRUCTW) + WindowName->Length + sizeof(WCHAR);
305 if (IS_ATOM(ClassName->Buffer))
306 {
307 Size += sizeof(WCHAR) + sizeof(ATOM);
308 }
309 else
310 {
311 Size += sizeof(WCHAR) + ClassName->Length + sizeof(WCHAR);
312 }
314 if (NULL == PackedCs)
315 {
316 ERR("Not enough memory to pack lParam\n");
317 return STATUS_NO_MEMORY;
318 }
319 RtlCopyMemory(PackedCs, UnpackedCs, sizeof(CREATESTRUCTW));
320 CsData = (PCHAR) (PackedCs + 1);
321 PackedCs->lpszName = (LPCWSTR) (CsData - (PCHAR) PackedCs);
322 RtlCopyMemory(CsData, WindowName->Buffer, WindowName->Length);
323 CsData += WindowName->Length;
324 *((WCHAR *) CsData) = L'\0';
325 CsData += sizeof(WCHAR);
326 PackedCs->lpszClass = (LPCWSTR) (CsData - (PCHAR) PackedCs);
327 if (IS_ATOM(ClassName->Buffer))
328 {
329 *((WCHAR *) CsData) = L'A';
330 CsData += sizeof(WCHAR);
331 *((ATOM *) CsData) = (ATOM)(DWORD_PTR) ClassName->Buffer;
332 CsData += sizeof(ATOM);
333 }
334 else
335 {
336 NT_ASSERT(ClassName->Buffer != NULL);
337 *((WCHAR *) CsData) = L'S';
338 CsData += sizeof(WCHAR);
339 RtlCopyMemory(CsData, ClassName->Buffer, ClassName->Length);
340 CsData += ClassName->Length;
341 *((WCHAR *) CsData) = L'\0';
342 CsData += sizeof(WCHAR);
343 }
344 ASSERT(CsData == (PCHAR) PackedCs + Size);
345 *lParamPacked = (LPARAM) PackedCs;
346 }
347 else if (PoolType == NonPagedPool)
348 {
349 PMSGMEMORY MsgMemoryEntry;
350 PVOID PackedData;
351 SIZE_T size;
352
353 MsgMemoryEntry = FindMsgMemory(Msg);
354
355 if (!MsgMemoryEntry)
356 {
357 /* Keep previous behavior */
358 return STATUS_SUCCESS;
359 }
360 size = MsgMemorySize(MsgMemoryEntry, wParam, lParam);
361 if (!size)
362 {
363 ERR("No size for lParamPacked\n");
364 return STATUS_SUCCESS;
365 }
367 if (PackedData == NULL)
368 {
369 ERR("Not enough memory to pack lParam\n");
370 return STATUS_NO_MEMORY;
371 }
372 RtlCopyMemory(PackedData, (PVOID)lParam, MsgMemorySize(MsgMemoryEntry, wParam, lParam));
373 *lParamPacked = (LPARAM)PackedData;
374 }
375
376 return STATUS_SUCCESS;
377}
#define NonPagedPool
Definition: env_spec_w32.h:307
GLsizeiptr size
Definition: glext.h:5919
#define L(x)
Definition: ntvdm.h:50
PWINDOWPOS lppos
Definition: winuser.h:3599
INT POOL_TYPE
Definition: typedefs.h:78
ULONG_PTR SIZE_T
Definition: typedefs.h:80
char * PCHAR
Definition: typedefs.h:51
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815
#define NT_ASSERT
Definition: rtlfuncs.h:3310
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by co_IntSendMessageTimeoutSingle(), and co_IntSendMessageWithCallBack().

◆ ScrollBarWndProc()

LRESULT APIENTRY ScrollBarWndProc ( HWND  Wnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1123 of file scrollbar.c.

1124{
1125 LRESULT lResult = 0;
1126 PWND pWnd;
1127 pWnd = UserGetWindowObject(hWnd);
1128 if (!pWnd) return 0;
1129
1130 switch(Msg)
1131 {
1132 case WM_ENABLE:
1133 if (pWnd->pSBInfo)
1135 break;
1136 }
1137 return lResult;
1138}
PSBINFO pSBInfo
Definition: ntuser.h:726
INT WSBflags
Definition: ntuser.h:513
#define WM_ENABLE
Definition: winuser.h:1615
#define ESB_DISABLE_BOTH
Definition: winuser.h:556
#define ESB_ENABLE_BOTH
Definition: winuser.h:563

Referenced by NtUserMessageCall().

◆ UnpackParam()

static NTSTATUS UnpackParam ( LPARAM  lParamPacked,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
BOOL  NonPagedPoolUsed 
)
static

Definition at line 380 of file message.c.

381{
382 NCCALCSIZE_PARAMS *UnpackedParams;
383 NCCALCSIZE_PARAMS *PackedParams;
384 PWINDOWPOS UnpackedWindowPos;
385
386 if (lParamPacked == lParam)
387 {
388 return STATUS_SUCCESS;
389 }
390
391 if (WM_NCCALCSIZE == Msg && wParam)
392 {
393 PackedParams = (NCCALCSIZE_PARAMS *) lParamPacked;
394 UnpackedParams = (NCCALCSIZE_PARAMS *) lParam;
395 UnpackedWindowPos = UnpackedParams->lppos;
396 RtlCopyMemory(UnpackedParams, PackedParams, sizeof(NCCALCSIZE_PARAMS));
397 UnpackedParams->lppos = UnpackedWindowPos;
398 RtlCopyMemory(UnpackedWindowPos, PackedParams + 1, sizeof(WINDOWPOS));
399 ExFreePool((PVOID) lParamPacked);
400
401 return STATUS_SUCCESS;
402 }
403 else if (WM_CREATE == Msg || WM_NCCREATE == Msg)
404 {
405 ExFreePool((PVOID) lParamPacked);
406
407 return STATUS_SUCCESS;
408 }
409 else if (NonPagedPoolUsed)
410 {
411 PMSGMEMORY MsgMemoryEntry;
412 MsgMemoryEntry = FindMsgMemory(Msg);
413 ASSERT(MsgMemoryEntry);
414
415 if (MsgMemoryEntry->Flags == MMS_FLAG_READWRITE)
416 {
417 //RtlCopyMemory((PVOID)lParam, (PVOID)lParamPacked, MsgMemoryEntry->Size);
418 }
419 ExFreePool((PVOID) lParamPacked);
420 return STATUS_SUCCESS;
421 }
422
423 ASSERT(FALSE);
424
426}
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define MMS_FLAG_READWRITE
Definition: message.c:112

Referenced by co_IntSendMessageTimeoutSingle(), and co_IntSendMessageWithCallBack().

◆ UserPostMessage()

BOOL FASTCALL UserPostMessage ( HWND  Wnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1345 of file message.c.

1349{
1350 PTHREADINFO pti;
1351 MSG Message;
1352 LONG_PTR ExtraInfo = 0;
1353
1354 Message.hwnd = Wnd;
1355 Message.message = Msg;
1356 Message.wParam = wParam;
1357 Message.lParam = lParam;
1358 Message.pt = gpsi->ptCursor;
1359 Message.time = EngGetTickCount32();
1360
1361 if (is_pointer_message(Message.message, Message.wParam))
1362 {
1364 return FALSE;
1365 }
1366
1367 if (Wnd == HWND_BROADCAST || Wnd == HWND_TOPMOST)
1368 {
1369 HWND *List;
1371 ULONG i;
1372
1373 if (!is_message_broadcastable(Msg)) return TRUE;
1374
1377
1378 if (List != NULL)
1379 {
1381 for (i = 0; List[i]; i++)
1382 {
1383 PWND pwnd = UserGetWindowObject(List[i]);
1384 if (!pwnd) continue;
1385
1386 if ( pwnd->fnid == FNID_MENU || // Also need pwnd->pcls->atomClassName == gaOleMainThreadWndClass
1388 continue;
1389
1391 }
1393 }
1394 }
1395 else
1396 {
1397 PWND Window;
1398
1399 if (!Wnd)
1400 {
1402 Msg,
1403 wParam,
1404 lParam);
1405 }
1406
1408 if ( !Window )
1409 {
1410 ERR("UserPostMessage: Invalid handle 0x%p Msg 0x%x!\n", Wnd, Msg);
1411 return FALSE;
1412 }
1413
1414 pti = Window->head.pti;
1415
1416 if ( pti->TIF_flags & TIF_INCLEANUP )
1417 {
1418 ERR("Attempted to post message to window %p when the thread is in cleanup!\n", Wnd);
1419 return FALSE;
1420 }
1421
1422 if ( Window->state & WNDS_DESTROYED )
1423 {
1424 ERR("Attempted to post message to window %p that is being destroyed!\n", Wnd);
1426 return FALSE;
1427 }
1428
1429 if ( Msg >= WM_DDE_FIRST && Msg <= WM_DDE_LAST )
1430 {
1431 if (!IntDdePostMessageHook(Window, Msg, wParam, &lParam, &ExtraInfo))
1432 {
1433 TRACE("Posting Exit DDE 0x%x\n",Msg);
1434 return FALSE;
1435 }
1436 Message.lParam = lParam;
1437 }
1438
1439 MsqPostMessage(pti, &Message, FALSE, QS_POSTMESSAGE, 0, ExtraInfo);
1440 }
1441 return TRUE;
1442}
VOID FASTCALL MsqPostMessage(PTHREADINFO pti, MSG *Msg, BOOLEAN HardwareMessage, DWORD MessageBits, DWORD dwQEvent, LONG_PTR ExtraInfo)
Definition: msgqueue.c:1337
BOOL APIENTRY IntDdePostMessageHook(IN PWND pWnd, IN UINT Msg, IN WPARAM wParam, IN OUT LPARAM *lParam, IN OUT LONG_PTR *ExtraInfo)
Definition: dde.c:172
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881

Referenced by co_IntProcessKeyboardMessage(), co_IntShellHookNotify(), co_UserProcessHotKeys(), DefWndHandleSetCursor(), DefWndHandleSysCommand(), DoTheScreenSaver(), ExitThreadCallback(), IntDefWindowProc(), IntImmProcessKey(), IntLanguageToggle(), IntRemoveTrackMouseEvent(), IntTrackMouseEvent(), IntTrackMouseMove(), MENU_EndMenu(), MENU_ExecFocusedItem(), MENU_TrackKbdMenuBar(), MENU_TrackMenu(), NotifyLogon(), NtUserCallOneParam(), NtUserEndMenu(), NtUserLockWorkStation(), NtUserMessageCall(), NtUserPostMessage(), SystemTimerProc(), and UserPostMessage().

◆ UserPostThreadMessage()

BOOL FASTCALL UserPostThreadMessage ( PTHREADINFO  pti,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1308 of file message.c.

1312{
1313 MSG Message;
1314
1316 {
1318 return FALSE;
1319 }
1320 Message.hwnd = NULL;
1321 Message.message = Msg;
1322 Message.wParam = wParam;
1323 Message.lParam = lParam;
1324 Message.pt = gpsi->ptCursor;
1325 Message.time = EngGetTickCount32();
1327 return TRUE;
1328}

Referenced by co_UserProcessHotKeys(), NtUserPostThreadMessage(), and UserPostMessage().

◆ UserSendNotifyMessage()

BOOL FASTCALL UserSendNotifyMessage ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 2040 of file message.c.

2044{
2045 BOOL Ret = TRUE;
2046
2048 {
2050 return FALSE;
2051 }
2052
2053 // Basicly the same as IntPostOrSendMessage
2054 if (hWnd == HWND_BROADCAST) // Handle Broadcast
2055 {
2056 HWND *List;
2058 ULONG i;
2059
2062
2063 if (List != NULL)
2064 {
2066 for (i = 0; List[i]; i++)
2067 {
2068 PWND pwnd = UserGetWindowObject(List[i]);
2069 if (!pwnd) continue;
2070
2071 if ( pwnd->fnid == FNID_MENU ||
2073 continue;
2074
2076 }
2078 }
2079 }
2080 else
2081 {
2083 }
2084 return Ret;
2085}
LRESULT FASTCALL co_IntSendMessageNoWait(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1713

Referenced by co_IntSendActivateMessages(), NtUserMessageCall(), NtUserSetSysColors(), UserChangeDisplaySettings(), UserRealizePalette(), and UserSendNotifyMessage().

Variable Documentation

◆ g_MsgMemory

MSGMEMORY g_MsgMemory[]
static
Initial value:
=
{
{ WM_STYLECHANGED, sizeof(STYLESTRUCT), MMS_FLAG_READ },
{ WM_STYLECHANGING, sizeof(STYLESTRUCT), MMS_FLAG_READWRITE },
{ WM_HELP, sizeof(HELPINFO), MMS_FLAG_READWRITE },
}
#define WM_COPYGLOBALDATA
Definition: undocuser.h:36
#define RECT
Definition: precomp.h:26
struct tagMDINEXTMENU MDINEXTMENU
#define WM_NEXTMENU
Definition: winuser.h:1806
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1661
#define WM_GETTEXT
Definition: winuser.h:1618
struct tagMEASUREITEMSTRUCT MEASUREITEMSTRUCT
struct _WINDOWPOS WINDOWPOS
struct tagDRAWITEMSTRUCT DRAWITEMSTRUCT
#define WM_DRAWITEM
Definition: winuser.h:1645
struct tagMINMAXINFO MINMAXINFO
#define WM_SETTINGCHANGE
Definition: winuser.h:1629
#define WM_SETTEXT
Definition: winuser.h:1617
#define WM_GETMINMAXINFO
Definition: winuser.h:1640
struct tagSTYLESTRUCT STYLESTRUCT
struct tagHELPINFO HELPINFO
#define WM_MEASUREITEM
Definition: winuser.h:1646
#define WM_SIZING
Definition: winuser.h:1807
#define WM_MOVING
Definition: winuser.h:1809
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1662

Definition at line 121 of file message.c.

Referenced by FindMsgMemory().

◆ message_pointer_flags

const unsigned int message_pointer_flags[]
static

Definition at line 36 of file message.c.

Referenced by is_pointer_message().