ReactOS 0.4.15-dev-7136-g77ab709
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 3047 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 3048 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 1947 of file message.c.

1952{
1955 PWND Window = NULL;
1956 MSG UserModeMsg, KernelModeMsg;
1957 PMSGMEMORY MsgMemoryEntry;
1958 PTHREADINFO ptiSendTo;
1959
1960 if (hWnd != HWND_BROADCAST && hWnd != HWND_TOPMOST)
1961 {
1963 if ( !Window )
1964 {
1965 return 0;
1966 }
1967 }
1968
1969 /* Check for an exiting window. */
1970 if (Window && Window->state & WNDS_DESTROYED)
1971 {
1972 ERR("co_IntDoSendMessage Window Exiting!\n");
1973 }
1974
1975 /* See if the current thread can handle this message */
1976 ptiSendTo = IntSendTo(Window, gptiCurrent, Msg);
1977
1978 // If broadcasting or sending to another thread, save the users data.
1979 if (!Window || ptiSendTo )
1980 {
1981 UserModeMsg.hwnd = hWnd;
1982 UserModeMsg.message = Msg;
1983 UserModeMsg.wParam = wParam;
1984 UserModeMsg.lParam = lParam;
1985 MsgMemoryEntry = FindMsgMemory(UserModeMsg.message);
1986 Status = CopyMsgToKernelMem(&KernelModeMsg, &UserModeMsg, MsgMemoryEntry);
1987 if (!NT_SUCCESS(Status))
1988 {
1990 return (dsm ? 0 : -1);
1991 }
1992 }
1993 else
1994 {
1995 KernelModeMsg.hwnd = hWnd;
1996 KernelModeMsg.message = Msg;
1997 KernelModeMsg.wParam = wParam;
1998 KernelModeMsg.lParam = lParam;
1999 }
2000
2001 if (!dsm)
2002 {
2003 Result = co_IntSendMessage( KernelModeMsg.hwnd,
2004 KernelModeMsg.message,
2005 KernelModeMsg.wParam,
2006 KernelModeMsg.lParam );
2007 }
2008 else
2009 {
2010 Result = co_IntSendMessageTimeout( KernelModeMsg.hwnd,
2011 KernelModeMsg.message,
2012 KernelModeMsg.wParam,
2013 KernelModeMsg.lParam,
2014 dsm->uFlags,
2015 dsm->uTimeout,
2016 &dsm->Result );
2017 }
2018
2019 if (!Window || ptiSendTo )
2020 {
2021 Status = CopyMsgToUserMem(&UserModeMsg, &KernelModeMsg);
2022 if (!NT_SUCCESS(Status))
2023 {
2025 return(dsm ? 0 : -1);
2026 }
2027 }
2028
2029 return (LRESULT)Result;
2030}
HWND hWnd
Definition: settings.c:17
LONG NTSTATUS
Definition: precomp.h:26
#define ERR(fmt,...)
Definition: debug.h:110
struct @1619 Msg[]
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#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:635
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
Definition: window.c:28
Definition: ntuser.h:693
ULONG_PTR Result
Definition: ntuser.h:2677
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:1653
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:28
LONG_PTR LRESULT
Definition: windef.h:209
#define HWND_TOPMOST
Definition: winuser.h:1207
#define HWND_BROADCAST
Definition: winuser.h:1203
_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:282
#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:2101
__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:3114
DWORD time
Definition: winuser.h:3117
WPARAM wParam
Definition: winuser.h:3115
POINT pt
Definition: winuser.h:3118
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:1619
#define WM_QUIT
Definition: winuser.h:1622
#define HC_ACTION
Definition: winuser.h:48
#define WM_DEVICECHANGE
Definition: winuser.h:1810
#define PM_NOYIELD
Definition: winuser.h:1196
#define PM_REMOVE
Definition: winuser.h:1195
#define WH_GETMESSAGE
Definition: winuser.h:33
#define HWND_BOTTOM
Definition: winuser.h:1204

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:2044
#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:877
#define QS_ALLPOSTMESSAGE
Definition: winuser.h:881
#define QS_ALLINPUT
Definition: winuser.h:902
#define QS_HOTKEY
Definition: winuser.h:880
#define QS_INPUT
Definition: winuser.h:898
#define QS_POSTMESSAGE
Definition: winuser.h:876
#define QS_PAINT
Definition: winuser.h:878

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:1224

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 1709 of file message.c.

1713{
1714 ULONG_PTR Result = 0;
1716 Msg,
1717 wParam,
1718 lParam,
1719 NULL,
1720 0,
1721 &Result);
1722}
LRESULT FASTCALL co_IntSendMessageWithCallBack(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, SENDASYNCPROC CompletionCallback, ULONG_PTR CompletionCallbackContext, ULONG_PTR *uResult)
Definition: message.c:1731

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 1653 of file message.c.

1660{
1662 HWND *Children;
1663 HWND *Child;
1664
1665 if (hWnd != HWND_BROADCAST && hWnd != HWND_TOPMOST)
1666 {
1667 return co_IntSendMessageTimeoutSingle(hWnd, Msg, wParam, lParam, uFlags, uTimeout, uResult);
1668 }
1669
1670 if (!is_message_broadcastable(Msg)) return TRUE;
1671
1673 if (NULL == DesktopWindow)
1674 {
1676 return 0;
1677 }
1678
1679 if (hWnd != HWND_TOPMOST)
1680 {
1681 /* Send message to the desktop window too! */
1682 co_IntSendMessageTimeoutSingle(DesktopWindow->head.h, Msg, wParam, lParam, uFlags, uTimeout, uResult);
1683 }
1684
1686 if (NULL == Children)
1687 {
1688 return 0;
1689 }
1690
1691 for (Child = Children; NULL != *Child; Child++)
1692 {
1694 if (!pwnd) continue;
1695
1696 if ( pwnd->fnid == FNID_MENU ||
1698 continue;
1699
1701 }
1702
1704
1705 return (LRESULT) TRUE;
1706}
UINT uFlags
Definition: api.c:59
PSERVERINFO gpsi
Definition: imm.c:18
#define ICLS_SWITCH
Definition: ntuser.h:931
#define FNID_MENU
Definition: ntuser.h:860
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
Implementation of the Explorer desktop window.
Definition: desktop.h:52
RTL_ATOM atomClassName
Definition: ntuser.h:567
PCLS pcls
Definition: ntuser.h:719
DWORD fnid
Definition: ntuser.h:708
ATOM atomSysClass[ICLS_NOTUSED+1]
Definition: ntuser.h:1059
_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 = NULL;
1470 PMSGMEMORY MsgMemoryEntry;
1471 INT lParamBufferSize;
1472 LPARAM lParamPacked;
1473 PTHREADINFO Win32Thread, ptiSendTo = NULL;
1474 ULONG_PTR Result = 0;
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 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 RETURN( FALSE);
1506 }
1507
1508 if (Msg & 0x80000000)
1509 {
1510 TRACE("SMTS: Internal Message!\n");
1512 if (uResult) *uResult = Result;
1513 RETURN( TRUE);
1514 }
1515
1516 // Only happens when calling the client!
1518
1519 if ( Window->state & WNDS_SERVERSIDEWINDOWPROC )
1520 {
1521 TRACE("SMT: Server Side Window Procedure\n");
1522 // Handle it here. Safeguard against excessive recursions.
1523 if (IoGetRemainingStackSize() < PAGE_SIZE)
1524 {
1525 ERR("Server Callback Exceeded Stack!\n");
1526 RETURN( FALSE);
1527 }
1528 /* Return after server side call, IntCallWndProcRet will not be called. */
1529 switch(Window->fnid)
1530 {
1531 case FNID_DESKTOP:
1532 DoCallBack = !DesktopWindowProc(Window, Msg, wParam, lParam,(LRESULT*)&Result);
1533 break;
1534 case FNID_MESSAGEWND:
1536 break;
1537 case FNID_MENU:
1538 DoCallBack = !PopupMenuWndProc( Window, Msg, wParam, lParam,(LRESULT*)&Result);
1539 break;
1540 }
1541 if (!DoCallBack)
1542 {
1543 if (uResult) *uResult = Result;
1544 RETURN( TRUE);
1545 }
1546 }
1547 /* See if this message type is present in the table */
1548 MsgMemoryEntry = FindMsgMemory(Msg);
1549 if (NULL == MsgMemoryEntry)
1550 {
1551 lParamBufferSize = -1;
1552 }
1553 else
1554 {
1555 lParamBufferSize = MsgMemorySize(MsgMemoryEntry, wParam, lParam);
1556 // If zero, do not allow callback on client side to allocate a buffer!!!!! See CORE-7695.
1557 if (!lParamBufferSize) lParamBufferSize = -1;
1558 }
1559
1560 if (! NT_SUCCESS(PackParam(&lParamPacked, Msg, wParam, lParam, FALSE)))
1561 {
1562 ERR("Failed to pack message parameters\n");
1563 RETURN( FALSE);
1564 }
1565
1567 !Window->Unicode,
1568 hWnd,
1569 Msg,
1570 wParam,
1571 lParamPacked,
1572 lParamBufferSize );
1573 if (uResult)
1574 {
1575 *uResult = Result;
1576 }
1577
1578 if (! NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam, FALSE)))
1579 {
1580 ERR("Failed to unpack message parameters\n");
1581 RETURN( TRUE);
1582 }
1583
1584 // Only happens when calling the client!
1586
1587 RETURN( TRUE);
1588 }
1589
1590 if (Window->state & WNDS_DESTROYED)
1591 {
1592 /* FIXME: Last error? */
1593 ERR("Attempted to send message to window %p that is being destroyed!\n", hWnd);
1594 RETURN( FALSE);
1595 }
1596
1597 if ((uFlags & SMTO_ABORTIFHUNG) && MsqIsHung(ptiSendTo, 4 * MSQ_HUNG))
1598 {
1599 // FIXME: Set window hung and add to a list.
1600 /* FIXME: Set a LastError? */
1601 ERR("Window %p (%p) (pti %p) is hung!\n", hWnd, Window, ptiSendTo);
1602 RETURN( FALSE);
1603 }
1604
1605 do
1606 {
1607 Status = co_MsqSendMessage( ptiSendTo,
1608 hWnd,
1609 Msg,
1610 wParam,
1611 lParam,
1612 uTimeout,
1613 (uFlags & SMTO_BLOCK),
1614 MSQ_NORMAL,
1615 uResult );
1616 }
1617 while ((Status == STATUS_TIMEOUT) &&
1618 (uFlags & SMTO_NOTIMEOUTIFNOTHUNG) &&
1619 !MsqIsHung(ptiSendTo, MSQ_HUNG)); // FIXME: Set window hung and add to a list.
1620
1621 if (Status == STATUS_TIMEOUT)
1622 {
1623 if (0 && MsqIsHung(ptiSendTo, MSQ_HUNG))
1624 {
1625 TRACE("Let's go Ghost!\n");
1627 }
1628/*
1629 * MSDN says:
1630 * Microsoft Windows 2000: If GetLastError returns zero, then the function
1631 * timed out.
1632 * XP+ : If the function fails or times out, the return value is zero.
1633 * To get extended error information, call GetLastError. If GetLastError
1634 * returns ERROR_TIMEOUT, then the function timed out.
1635 */
1637 RETURN( FALSE);
1638 }
1639 else if (!NT_SUCCESS(Status))
1640 {
1642 RETURN( FALSE);
1643 }
1644
1645 RETURN( TRUE);
1646
1647CLEANUP:
1650}
#define RETURN(x)
#define ULONG_PTR
Definition: config.h:101
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define TIF_INCLEANUP
Definition: ntuser.h:262
#define FNID_DESKTOP
Definition: ntuser.h:861
#define WNDS_SERVERSIDEWINDOWPROC
Definition: ntuser.h:622
#define FNID_MESSAGEWND
Definition: ntuser.h:863
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:2131
#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
#define CLEANUP
Definition: ntuser.h:5
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
#define END_CLEANUP
Definition: ntuser.h:6
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:37
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:1223
#define SMTO_ABORTIFHUNG
Definition: winuser.h:1222

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 1731 of file message.c.

1738{
1740 PWND Window = NULL;
1741 PMSGMEMORY MsgMemoryEntry;
1742 INT lParamBufferSize;
1743 LPARAM lParamPacked;
1744 PTHREADINFO Win32Thread, ptiSendTo = NULL;
1748 BOOL DoCallBack = TRUE;
1749
1751 {
1752 TRACE("SendMessageWithCallBack: Invalid handle 0x%p\n",hWnd);
1753 RETURN(FALSE);
1754 }
1755
1756 UserRefObjectCo(Window, &Ref);
1757
1758 if (Window->state & WNDS_DESTROYED)
1759 {
1760 /* FIXME: last error? */
1761 ERR("Attempted to send message to window %p that is being destroyed\n", hWnd);
1762 RETURN(FALSE);
1763 }
1764
1765 Win32Thread = PsGetCurrentThreadWin32Thread();
1766
1767 if (Win32Thread == NULL || Win32Thread->TIF_flags & TIF_INCLEANUP)
1768 RETURN(FALSE);
1769
1770 ptiSendTo = IntSendTo(Window, Win32Thread, Msg);
1771
1772 if (Msg & 0x80000000 &&
1773 !ptiSendTo)
1774 {
1775 if (Win32Thread->TIF_flags & TIF_INCLEANUP) RETURN(FALSE);
1776
1777 TRACE("SMWCB: Internal Message\n");
1779 if (uResult) *uResult = Result;
1780 RETURN(TRUE);
1781 }
1782
1783 /* See if this message type is present in the table */
1784 MsgMemoryEntry = FindMsgMemory(Msg);
1785 if (NULL == MsgMemoryEntry)
1786 {
1787 lParamBufferSize = -1;
1788 }
1789 else
1790 {
1791 lParamBufferSize = MsgMemorySize(MsgMemoryEntry, wParam, lParam);
1792 if (!lParamBufferSize) lParamBufferSize = -1;
1793 }
1794
1795 if (!NT_SUCCESS(PackParam(&lParamPacked, Msg, wParam, lParam, !!ptiSendTo)))
1796 {
1797 ERR("Failed to pack message parameters\n");
1798 RETURN(FALSE);
1799 }
1800
1801 /* If it can be sent now, then send it. */
1802 if (!ptiSendTo)
1803 {
1804 if (Win32Thread->TIF_flags & TIF_INCLEANUP)
1805 {
1806 UnpackParam(lParamPacked, Msg, wParam, lParam, FALSE);
1807 /* Never send messages to exiting threads */
1808 RETURN(FALSE);
1809 }
1810
1812
1813 if (Window->state & WNDS_SERVERSIDEWINDOWPROC)
1814 {
1815 TRACE("SMWCB: Server Side Window Procedure\n");
1816 switch(Window->fnid)
1817 {
1818 case FNID_DESKTOP:
1819 DoCallBack = !DesktopWindowProc(Window, Msg, wParam, lParamPacked, (LRESULT*)&Result);
1820 break;
1821 case FNID_MESSAGEWND:
1823 break;
1824 case FNID_MENU:
1825 DoCallBack = !PopupMenuWndProc(Window, Msg, wParam, lParam, (LRESULT*)&Result);
1826 break;
1827 }
1828 }
1829
1830 if (DoCallBack)
1832 !Window->Unicode,
1833 hWnd,
1834 Msg,
1835 wParam,
1836 lParamPacked,
1837 lParamBufferSize);
1838 if(uResult)
1839 {
1840 *uResult = Result;
1841 }
1842
1844
1846 {
1848 hWnd,
1849 Msg,
1850 CompletionCallbackContext,
1851 Result);
1852 }
1853 }
1854
1855 if (!ptiSendTo)
1856 {
1857 if (!NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam, FALSE)))
1858 {
1859 ERR("Failed to unpack message parameters\n");
1860 }
1861 RETURN(TRUE);
1862 }
1863
1865 {
1866 ERR("Failed to allocate message\n");
1867 RETURN(FALSE);
1868 }
1869
1870 Message->Msg.hwnd = hWnd;
1871 Message->Msg.message = Msg;
1872 Message->Msg.wParam = wParam;
1873 Message->Msg.lParam = lParamPacked;
1874 Message->pkCompletionEvent = NULL; // No event needed.
1875 Message->lResult = 0;
1876 Message->QS_Flags = 0;
1877 Message->ptiReceiver = ptiSendTo;
1878 Message->ptiSender = NULL;
1879 Message->ptiCallBackSender = Win32Thread;
1880 Message->CompletionCallback = CompletionCallback;
1881 Message->CompletionCallbackContext = CompletionCallbackContext;
1882 Message->HookMessage = MSQ_NORMAL;
1883 Message->HasPackedLParam = (lParamBufferSize > 0);
1884 Message->QS_Flags = QS_SENDMESSAGE;
1885 Message->flags = SMF_RECEIVERFREE;
1886
1887 if (Msg & 0x80000000) // Higher priority event message!
1888 InsertHeadList(&ptiSendTo->SentMessagesListHead, &Message->ListEntry);
1889 else
1890 InsertTailList(&ptiSendTo->SentMessagesListHead, &Message->ListEntry);
1891 MsqWakeQueue(ptiSendTo, QS_SENDMESSAGE, TRUE);
1892
1893 RETURN(TRUE);
1894
1895CLEANUP:
1898}
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:879

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:1194

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:873
#define WM_MOUSEFIRST
Definition: winuser.h:1773
#define WM_MOUSELAST
Definition: winuser.h:1800
#define WM_KEYFIRST
Definition: winuser.h:1713
#define WM_TIMER
Definition: winuser.h:1741
#define QS_MOUSE
Definition: winuser.h:891
#define WM_KEYLAST
Definition: winuser.h:1727

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:3113
LPARAM lParam
Definition: winuser.h:3116
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, pWnd->head.h);
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:3593
HWND hwndInsertAfter
Definition: winuser.h:3588
THRDESKHEAD head
Definition: ntuser.h:694
DWORD style
Definition: ntuser.h:705
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 2133 of file message.c.

2134{
2135 BOOL Ret = FALSE;
2136
2137 if ( co_HOOK_CallHooks( WH_SYSMSGFILTER, code, 0, (LPARAM)lpmsg))
2138 {
2139 Ret = TRUE;
2140 }
2141 else
2142 {
2143 Ret = co_HOOK_CallHooks( WH_MSGFILTER, code, 0, (LPARAM)lpmsg);
2144 }
2145 return Ret;
2146}
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:3024
WPARAM wParam
Definition: winuser.h:3025
UINT message
Definition: winuser.h:3026
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:1607
#define WM_NCCREATE
Definition: winuser.h:1682
#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:3018
LRESULT lResult
Definition: winuser.h:3016
LPARAM lParam
Definition: winuser.h:3017
#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:616
#define WNDS_PAINTNOTPROCESSED
Definition: ntuser.h:626
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:2905

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

◆ IntGetQueueStatus()

DWORD APIENTRY IntGetQueueStatus ( DWORD  Changes)

Definition at line 2082 of file message.c.

2083{
2084 PTHREADINFO pti;
2085 DWORD Result;
2086
2088// wine:
2090
2091 /* High word, types of messages currently in the queue.
2092 Low word, types of messages that have been added to the queue and that
2093 are still in the queue
2094 */
2095 Result = MAKELONG(pti->pcti->fsChangeBits & Changes, pti->pcti->fsWakeBits & Changes);
2096
2097 pti->pcti->fsChangeBits &= ~Changes;
2098
2099 return Result;
2100}
#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 2103 of file message.c.

2104{
2106
2107 if (pti->pcti)
2108 {
2109 pti->pcti->dwcPumpHook++;
2110 return TRUE;
2111 }
2112 return FALSE;
2113}

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:633
#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:2964
LPCWSTR lpszName
Definition: winuser.h:2963
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 2116 of file message.c.

2117{
2119
2120 if (pti->pcti)
2121 {
2122 if (pti->pcti->dwcPumpHook <= 0)
2123 {
2124 return FALSE;
2125 }
2126 pti->pcti->dwcPumpHook--;
2127 return TRUE;
2128 }
2129 return FALSE;
2130}

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:1663
#define WM_NCCALCSIZE
Definition: winuser.h:1684
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 2375 of file message.c.

2376{
2377 BOOL Ret = FALSE;
2378 MSG Msg;
2379
2380 _SEH2_TRY
2381 {
2382 ProbeForRead(lpmsg, sizeof(MSG), 1);
2383 RtlCopyMemory( &Msg, lpmsg, sizeof(MSG));
2384 }
2386 {
2387 _SEH2_YIELD(return FALSE);
2388 }
2389 _SEH2_END;
2390
2392
2394 {
2395 Ret = TRUE;
2396 }
2397 else
2398 {
2400 }
2401
2402 UserLeave();
2403
2404 _SEH2_TRY
2405 {
2406 ProbeForWrite(lpmsg, sizeof(MSG), 1);
2407 RtlCopyMemory(lpmsg, &Msg, sizeof(MSG));
2408 }
2410 {
2411 Ret = FALSE;
2412 }
2413 _SEH2_END;
2414
2415 return Ret;
2416}
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 2419 of file message.c.

2420{
2421 LRESULT Res = 0;
2422 MSG SafeMsg;
2423
2424 _SEH2_TRY
2425 {
2426 ProbeForRead(UnsafeMsgInfo, sizeof(MSG), 1);
2427 RtlCopyMemory(&SafeMsg, UnsafeMsgInfo, sizeof(MSG));
2428 }
2430 {
2432 _SEH2_YIELD(return FALSE);
2433 }
2434 _SEH2_END;
2435
2437
2438 Res = IntDispatchMessage(&SafeMsg);
2439
2440 UserLeave();
2441 return Res;
2442}
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 2152 of file message.c.

2155{
2156 MSG msg;
2157 RECT rect;
2158 ULONG wDragWidth, wDragHeight;
2160
2161 TRACE("Enter NtUserDragDetect(%p)\n", hWnd);
2163
2164 wDragWidth = UserGetSystemMetrics(SM_CXDRAG);
2165 wDragHeight= UserGetSystemMetrics(SM_CYDRAG);
2166
2167 rect.left = pt.x - wDragWidth;
2168 rect.right = pt.x + wDragWidth;
2169
2170 rect.top = pt.y - wDragHeight;
2171 rect.bottom = pt.y + wDragHeight;
2172
2174
2175 for (;;)
2176 {
2180 {
2181 if ( msg.message == WM_LBUTTONUP )
2182 {
2184 RETURN( FALSE);
2185 }
2186 if ( msg.message == WM_MOUSEMOVE )
2187 {
2188 POINT tmp;
2189 tmp.x = (short)LOWORD(msg.lParam);
2190 tmp.y = (short)HIWORD(msg.lParam);
2191 if( !RECTL_bPointInRect( &rect, tmp.x, tmp.y ) )
2192 {
2194 RETURN( TRUE);
2195 }
2196 }
2197 if ( msg.message == WM_KEYDOWN )
2198 {
2199 if ( msg.wParam == VK_ESCAPE )
2200 {
2202 RETURN( TRUE);
2203 }
2204 }
2205 if ( msg.message == WM_QUEUESYNC )
2206 {
2208 }
2209 }
2210 co_IntWaitMessage(NULL, 0, 0);
2211 }
2212 RETURN( FALSE);
2213
2214CLEANUP:
2215 TRACE("Leave NtUserDragDetect, ret=%i\n",_ret_);
2216 UserLeave();
2218}
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:1458
#define LOWORD(l)
Definition: pedump.c:82
& 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:208
#define SM_CXDRAG
Definition: winuser.h:1027
#define WM_MOUSEMOVE
Definition: winuser.h:1774
#define WH_CBT
Definition: winuser.h:35
#define WM_QUEUESYNC
Definition: winuser.h:1638
#define HCBT_QS
Definition: winuser.h:57
#define WM_LBUTTONUP
Definition: winuser.h:1776
#define WM_KEYDOWN
Definition: winuser.h:1714
#define SM_CYDRAG
Definition: winuser.h:1028
#define VK_ESCAPE
Definition: winuser.h:2213

Referenced by DragDetect().

◆ NtUserGetMessage()

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

Definition at line 2289 of file message.c.

2293{
2294 MSG Msg;
2295 BOOL Ret;
2296
2297 if ( (MsgFilterMin|MsgFilterMax) & ~WM_MAXIMUM )
2298 {
2300 return FALSE;
2301 }
2302
2304
2305 RtlZeroMemory(&Msg, sizeof(MSG));
2306
2307 Ret = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, PM_REMOVE, TRUE);
2308
2309 UserLeave();
2310
2311 if (Ret)
2312 {
2313 _SEH2_TRY
2314 {
2315 ProbeForWrite(pMsg, sizeof(MSG), 1);
2316 RtlCopyMemory(pMsg, &Msg, sizeof(MSG));
2317 }
2319 {
2321 Ret = FALSE;
2322 }
2323 _SEH2_END;
2324 }
2325
2326 if ((INT)Ret != -1)
2327 Ret = Ret ? (WM_QUIT != pMsg->message) : FALSE;
2328
2329 return Ret;
2330}
#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 2482 of file message.c.

2489{
2490 LRESULT lResult = 0;
2491 BOOL Ret = FALSE;
2492 PWND Window = NULL;
2494
2496
2497 switch(dwType)
2498 {
2499 case FNID_SCROLLBAR:
2500 {
2501 lResult = ScrollBarWndProc(hWnd, Msg, wParam, lParam);
2502 break;
2503 }
2504 case FNID_DESKTOP:
2505 {
2507 if (Window)
2508 {
2509 //ERR("FNID_DESKTOP IN\n");
2510 Ret = DesktopWindowProc(Window, Msg, wParam, lParam, &lResult);
2511 //ERR("FNID_DESKTOP OUT\n");
2512 }
2513 break;
2514 }
2515 case FNID_MENU:
2516 {
2518 if (Window)
2519 {
2520 Ret = PopupMenuWndProc( Window, Msg, wParam, lParam, &lResult);
2521 }
2522 break;
2523 }
2524 case FNID_MESSAGEWND:
2525 {
2527 if (Window)
2528 {
2529 Ret = !UserMessageWindowProc(Window, Msg, wParam, lParam, &lResult);
2530 }
2531 break;
2532 }
2533 case FNID_DEFWINDOWPROC:
2534 /* Validate input */
2535 if (hWnd)
2536 {
2538 if (!Window)
2539 {
2540 UserLeave();
2541 return FALSE;
2542 }
2543 UserRefObjectCo(Window, &Ref);
2544 }
2545 lResult = IntDefWindowProc(Window, Msg, wParam, lParam, Ansi);
2546 Ret = TRUE;
2547 if (hWnd)
2549 break;
2552 break;
2554 {
2555 BROADCASTPARM parm, *retparam;
2556 DWORD_PTR RetVal = 0;
2557
2558 if (ResultInfo)
2559 {
2560 _SEH2_TRY
2561 {
2562 ProbeForWrite((PVOID)ResultInfo, sizeof(BROADCASTPARM), 1);
2563 RtlCopyMemory(&parm, (PVOID)ResultInfo, sizeof(BROADCASTPARM));
2564 }
2566 {
2567 _SEH2_YIELD(break);
2568 }
2569 _SEH2_END;
2570 }
2571 else
2572 break;
2573
2574 if ( parm.recipients & BSM_ALLDESKTOPS ||
2576 {
2577 PLIST_ENTRY DesktopEntry;
2578 PDESKTOP rpdesk;
2579 HWND *List, hwndDenied = NULL;
2580 HDESK hDesk = NULL;
2581 PWND pwnd, pwndDesk;
2582 ULONG i;
2583 UINT fuFlags;
2584
2585 for (DesktopEntry = InputWindowStation->DesktopListHead.Flink;
2586 DesktopEntry != &InputWindowStation->DesktopListHead;
2587 DesktopEntry = DesktopEntry->Flink)
2588 {
2589 rpdesk = CONTAINING_RECORD(DesktopEntry, DESKTOP, ListEntry);
2590 pwndDesk = rpdesk->pDeskInfo->spwnd;
2591 List = IntWinListChildren(pwndDesk);
2592
2593 if (parm.flags & BSF_QUERY)
2594 {
2595 if (List != NULL)
2596 {
2597 if (parm.flags & BSF_FORCEIFHUNG || parm.flags & BSF_NOHANG)
2598 {
2599 fuFlags = SMTO_ABORTIFHUNG;
2600 }
2601 else if (parm.flags & BSF_NOTIMEOUTIFNOTHUNG)
2602 {
2603 fuFlags = SMTO_NOTIMEOUTIFNOTHUNG;
2604 }
2605 else
2606 {
2607 fuFlags = SMTO_NORMAL;
2608 }
2610 Msg,
2611 wParam,
2612 lParam,
2613 fuFlags,
2614 2000,
2615 &RetVal);
2616 Ret = TRUE;
2617 for (i = 0; List[i]; i++)
2618 {
2619 pwnd = UserGetWindowObject(List[i]);
2620 if (!pwnd) continue;
2621
2622 if ( pwnd->fnid == FNID_MENU ||
2624 continue;
2625
2626 if ( parm.flags & BSF_IGNORECURRENTTASK )
2627 {
2628 if ( pwnd->head.pti == gptiCurrent )
2629 continue;
2630 }
2632 Msg,
2633 wParam,
2634 lParam,
2635 fuFlags,
2636 2000,
2637 &RetVal);
2638
2639 if (!RetVal && EngGetLastError() == ERROR_TIMEOUT)
2640 {
2641 if (!(parm.flags & BSF_FORCEIFHUNG))
2642 Ret = FALSE;
2643 }
2644 if (RetVal == BROADCAST_QUERY_DENY)
2645 {
2646 hwndDenied = List[i];
2647 hDesk = UserHMGetHandle(pwndDesk);
2648 Ret = FALSE;
2649 }
2650 }
2652 _SEH2_TRY
2653 {
2654 retparam = (PBROADCASTPARM) ResultInfo;
2655 retparam->hDesk = hDesk;
2656 retparam->hWnd = hwndDenied;
2657 }
2659 {
2660 _SEH2_YIELD(break);
2661 }
2662 _SEH2_END;
2663 if (!Ret) break; // Have a hit! Let everyone know!
2664 }
2665 }
2666 else if (parm.flags & BSF_POSTMESSAGE)
2667 {
2668 if (List != NULL)
2669 {
2671
2672 for (i = 0; List[i]; i++)
2673 {
2674 pwnd = UserGetWindowObject(List[i]);
2675 if (!pwnd) continue;
2676
2677 if ( pwnd->fnid == FNID_MENU ||
2679 continue;
2680
2681 if ( parm.flags & BSF_IGNORECURRENTTASK )
2682 {
2683 if ( pwnd->head.pti == gptiCurrent )
2684 continue;
2685 }
2687 }
2689 }
2690 Ret = TRUE;
2691 }
2692 else
2693 {
2694 if (List != NULL)
2695 {
2697
2698 for (i = 0; List[i]; i++)
2699 {
2700 pwnd = UserGetWindowObject(List[i]);
2701 if (!pwnd) continue;
2702
2703 if ( pwnd->fnid == FNID_MENU ||
2705 continue;
2706
2707 if ( parm.flags & BSF_IGNORECURRENTTASK )
2708 {
2709 if ( pwnd->head.pti == gptiCurrent )
2710 continue;
2711 }
2713 }
2715 }
2716 Ret = TRUE;
2717 }
2718 }
2719 }
2720 else if (parm.recipients & BSM_APPLICATIONS)
2721 {
2722 HWND *List, hwndDenied = NULL;
2723 HDESK hDesk = NULL;
2724 PWND pwnd, pwndDesk;
2725 ULONG i;
2726 UINT fuFlags;
2727
2728 pwndDesk = UserGetDesktopWindow();
2729 List = IntWinListChildren(pwndDesk);
2730
2731 if (parm.flags & BSF_QUERY)
2732 {
2733 if (List != NULL)
2734 {
2735 if (parm.flags & BSF_FORCEIFHUNG || parm.flags & BSF_NOHANG)
2736 {
2737 fuFlags = SMTO_ABORTIFHUNG;
2738 }
2739 else if (parm.flags & BSF_NOTIMEOUTIFNOTHUNG)
2740 {
2741 fuFlags = SMTO_NOTIMEOUTIFNOTHUNG;
2742 }
2743 else
2744 {
2745 fuFlags = SMTO_NORMAL;
2746 }
2748 Msg,
2749 wParam,
2750 lParam,
2751 fuFlags,
2752 2000,
2753 &RetVal);
2754 Ret = TRUE;
2755 for (i = 0; List[i]; i++)
2756 {
2757 pwnd = UserGetWindowObject(List[i]);
2758 if (!pwnd) continue;
2759
2760 if ( pwnd->fnid == FNID_MENU ||
2762 continue;
2763
2764 if ( parm.flags & BSF_IGNORECURRENTTASK )
2765 {
2766 if ( pwnd->head.pti == gptiCurrent )
2767 continue;
2768 }
2770 Msg,
2771 wParam,
2772 lParam,
2773 fuFlags,
2774 2000,
2775 &RetVal);
2776
2777 if (!RetVal && EngGetLastError() == ERROR_TIMEOUT)
2778 {
2779 if (!(parm.flags & BSF_FORCEIFHUNG))
2780 Ret = FALSE;
2781 }
2782 if (RetVal == BROADCAST_QUERY_DENY)
2783 {
2784 hwndDenied = List[i];
2785 hDesk = UserHMGetHandle(pwndDesk);
2786 Ret = FALSE;
2787 }
2788 }
2790 _SEH2_TRY
2791 {
2792 retparam = (PBROADCASTPARM) ResultInfo;
2793 retparam->hDesk = hDesk;
2794 retparam->hWnd = hwndDenied;
2795 }
2797 {
2798 _SEH2_YIELD(break);
2799 }
2800 _SEH2_END;
2801 }
2802 }
2803 else if (parm.flags & BSF_POSTMESSAGE)
2804 {
2805 if (List != NULL)
2806 {
2808
2809 for (i = 0; List[i]; i++)
2810 {
2811 pwnd = UserGetWindowObject(List[i]);
2812 if (!pwnd) continue;
2813
2814 if ( pwnd->fnid == FNID_MENU ||
2816 continue;
2817
2818 if ( parm.flags & BSF_IGNORECURRENTTASK )
2819 {
2820 if ( pwnd->head.pti == gptiCurrent )
2821 continue;
2822 }
2824 }
2826 }
2827 Ret = TRUE;
2828 }
2829 else
2830 {
2831 if (List != NULL)
2832 {
2834
2835 for (i = 0; List[i]; i++)
2836 {
2837 pwnd = UserGetWindowObject(List[i]);
2838 if (!pwnd) continue;
2839
2840 if ( pwnd->fnid == FNID_MENU ||
2842 continue;
2843
2844 if ( parm.flags & BSF_IGNORECURRENTTASK )
2845 {
2846 if ( pwnd->head.pti == gptiCurrent )
2847 continue;
2848 }
2850 }
2852 }
2853 Ret = TRUE;
2854 }
2855 }
2856 }
2857 break;
2859 {
2860 CALL_BACK_INFO CallBackInfo;
2861 ULONG_PTR uResult;
2862
2863 _SEH2_TRY
2864 {
2865 ProbeForRead((PVOID)ResultInfo, sizeof(CALL_BACK_INFO), 1);
2866 RtlCopyMemory(&CallBackInfo, (PVOID)ResultInfo, sizeof(CALL_BACK_INFO));
2867 }
2869 {
2870 _SEH2_YIELD(break);
2871 }
2872 _SEH2_END;
2873
2875 {
2877 break;
2878 }
2879
2881 CallBackInfo.CallBack, CallBackInfo.Context, &uResult)))
2882 {
2883 ERR("Callback failure!\n");
2884 }
2885 }
2886 break;
2887 case FNID_SENDMESSAGE:
2888 {
2889 lResult = co_IntDoSendMessage(hWnd, Msg, wParam, lParam, 0);
2890 Ret = TRUE;
2891
2892 if (ResultInfo)
2893 {
2894 _SEH2_TRY
2895 {
2896 ProbeForWrite((PVOID)ResultInfo, sizeof(ULONG_PTR), 1);
2897 RtlCopyMemory((PVOID)ResultInfo, &lResult, sizeof(ULONG_PTR));
2898 }
2900 {
2901 Ret = FALSE;
2902 _SEH2_YIELD(break);
2903 }
2904 _SEH2_END;
2905 }
2906 break;
2907 }
2908 case FNID_SENDMESSAGEFF:
2910 {
2911 DOSENDMESSAGE dsm, *pdsm = (PDOSENDMESSAGE)ResultInfo;
2912 if (ResultInfo)
2913 {
2914 _SEH2_TRY
2915 {
2916 ProbeForRead(pdsm, sizeof(DOSENDMESSAGE), 1);
2917 RtlCopyMemory(&dsm, pdsm, sizeof(DOSENDMESSAGE));
2918 }
2920 {
2921 _SEH2_YIELD(break);
2922 }
2923 _SEH2_END;
2924 }
2925
2926 Ret = co_IntDoSendMessage( hWnd, Msg, wParam, lParam, pdsm ? &dsm : NULL );
2927
2928 if (pdsm)
2929 {
2930 _SEH2_TRY
2931 {
2932 ProbeForWrite(pdsm, sizeof(DOSENDMESSAGE), 1);
2933 RtlCopyMemory(pdsm, &dsm, sizeof(DOSENDMESSAGE));
2934 }
2936 {
2937 Ret = FALSE;
2938 _SEH2_YIELD(break);
2939 }
2940 _SEH2_END;
2941 }
2942 break;
2943 }
2944 // CallNextHook bypass.
2945 case FNID_CALLWNDPROC:
2947 {
2948 PTHREADINFO pti;
2950 PHOOK NextObj, Hook;
2951
2952 pti = GetW32ThreadInfo();
2953
2954 Hook = pti->sphkCurrent;
2955
2956 if (!Hook) break;
2957
2958 NextObj = Hook->phkNext;
2959 ClientInfo = pti->pClientInfo;
2960 _SEH2_TRY
2961 {
2962 ClientInfo->phkCurrent = NextObj;
2963 }
2965 {
2966 ClientInfo = NULL;
2967 }
2968 _SEH2_END;
2969
2970 if (!ClientInfo || !NextObj) break;
2971
2972 NextObj->phkNext = IntGetNextHook(NextObj);
2973
2974 if ( Hook->HookId == WH_CALLWNDPROC)
2975 {
2976 CWPSTRUCT CWP;
2977 CWP.hwnd = hWnd;
2978 CWP.message = Msg;
2979 CWP.wParam = wParam;
2980 CWP.lParam = lParam;
2981 TRACE("WH_CALLWNDPROC: Hook %p NextHook %p\n", Hook, NextObj);
2982
2983 lResult = co_IntCallHookProc( Hook->HookId,
2984 HC_ACTION,
2985 ((ClientInfo->CI_flags & CI_CURTHPRHOOK) ? 1 : 0),
2986 (LPARAM)&CWP,
2987 Hook->Proc,
2988 Hook->ihmod,
2989 Hook->offPfn,
2990 Hook->Ansi,
2991 &Hook->ModuleName);
2992 }
2993 else
2994 {
2995 CWPRETSTRUCT CWPR;
2996 CWPR.hwnd = hWnd;
2997 CWPR.message = Msg;
2998 CWPR.wParam = wParam;
2999 CWPR.lParam = lParam;
3000 CWPR.lResult = ClientInfo->dwHookData;
3001
3002 lResult = co_IntCallHookProc( Hook->HookId,
3003 HC_ACTION,
3004 ((ClientInfo->CI_flags & CI_CURTHPRHOOK) ? 1 : 0),
3005 (LPARAM)&CWPR,
3006 Hook->Proc,
3007 Hook->ihmod,
3008 Hook->offPfn,
3009 Hook->Ansi,
3010 &Hook->ModuleName);
3011 }
3012 }
3013 break;
3014 }
3015
3016 switch(dwType)
3017 {
3018 case FNID_DEFWINDOWPROC:
3019 case FNID_CALLWNDPROC:
3021 case FNID_SCROLLBAR:
3022 case FNID_DESKTOP:
3023 case FNID_MENU:
3024 if (ResultInfo)
3025 {
3026 _SEH2_TRY
3027 {
3028 ProbeForWrite((PVOID)ResultInfo, sizeof(LRESULT), 1);
3029 RtlCopyMemory((PVOID)ResultInfo, &lResult, sizeof(LRESULT));
3030 }
3032 {
3033 Ret = FALSE;
3034 }
3035 _SEH2_END;
3036 }
3037 break;
3038 default:
3039 break;
3040 }
3041
3042 UserLeave();
3043
3044 return Ret;
3045}
#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:882
#define FNID_SCROLLBAR
Definition: ntuser.h:858
#define FNID_DEFWINDOWPROC
Definition: ntuser.h:862
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define FNID_SENDMESSAGECALLBACK
Definition: ntuser.h:889
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:809
#define FNID_SENDMESSAGEWTOOPTION
Definition: ntuser.h:884
#define FNID_CALLWNDPROCRET
Definition: ntuser.h:876
#define FNID_CALLWNDPROC
Definition: ntuser.h:875
#define CI_CURTHPRHOOK
Definition: ntuser.h:303
struct tagDOSENDMESSAGE * PDOSENDMESSAGE
#define FNID_SENDMESSAGE
Definition: ntuser.h:881
struct _BROADCASTPARM * PBROADCASTPARM
#define FNID_BROADCASTSYSTEMMESSAGE
Definition: ntuser.h:886
#define FNID_SENDNOTIFYMESSAGE
Definition: ntuser.h:888
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:1108
DWORD flags
Definition: ntuser.h:1107
HDESK hDesk
Definition: ntuser.h:1109
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
INT_PTR ihmod
Definition: ntuser.h:244
struct tagHOOK * phkNext
Definition: ntuser.h:240
HOOKPROC Proc
Definition: ntuser.h:249
ULONG_PTR offPfn
Definition: ntuser.h:242
int HookId
Definition: ntuser.h:241
BOOLEAN Ansi
Definition: ntuser.h:250
UNICODE_STRING ModuleName
Definition: ntuser.h:251
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:1947
BOOL FASTCALL UserSendNotifyMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:2033
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:12
#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 2333 of file message.c.

2338{
2339 MSG Msg;
2340 BOOL Ret;
2341
2342 if ( RemoveMsg & PM_BADMSGFLAGS )
2343 {
2345 return FALSE;
2346 }
2347
2349
2350 RtlZeroMemory(&Msg, sizeof(MSG));
2351
2352 Ret = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, RemoveMsg, FALSE);
2353
2354 UserLeave();
2355
2356 if (Ret)
2357 {
2358 _SEH2_TRY
2359 {
2360 ProbeForWrite(pMsg, sizeof(MSG), 1);
2361 RtlCopyMemory(pMsg, &Msg, sizeof(MSG));
2362 }
2364 {
2366 Ret = FALSE;
2367 }
2368 _SEH2_END;
2369 }
2370
2371 return Ret;
2372}
#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 2221 of file message.c.

2225{
2226 BOOL ret;
2227
2229
2231
2232 UserLeave();
2233
2234 return ret;
2235}
int ret

Referenced by PostMessageA(), and PostMessageW().

◆ NtUserPostThreadMessage()

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

Definition at line 2238 of file message.c.

2242{
2243 BOOL ret = FALSE;
2244 PETHREAD peThread;
2245 PTHREADINFO pThread;
2247
2249
2250 Status = PsLookupThreadByThreadId(UlongToHandle(idThread), &peThread);
2251
2252 if ( Status == STATUS_SUCCESS )
2253 {
2254 pThread = (PTHREADINFO)peThread->Tcb.Win32Thread;
2255 if( !pThread ||
2256 !pThread->MessageQueue ||
2257 (pThread->TIF_flags & TIF_INCLEANUP))
2258 {
2259 ObDereferenceObject( peThread );
2260 goto exit;
2261 }
2262 ret = UserPostThreadMessage( pThread, Msg, wParam, lParam);
2263 ObDereferenceObject( peThread );
2264 }
2265 else
2266 {
2268 }
2269exit:
2270 UserLeave();
2271 return ret;
2272}
#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:1773
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 2445 of file message.c.

2446{
2447 MSG SafeMsg;
2448 BOOL Ret;
2449 PWND pWnd;
2450
2451 _SEH2_TRY
2452 {
2453 ProbeForRead(lpMsg, sizeof(MSG), 1);
2454 RtlCopyMemory(&SafeMsg, lpMsg, sizeof(MSG));
2455 }
2457 {
2459 _SEH2_YIELD(return FALSE);
2460 }
2461 _SEH2_END;
2462
2464 pWnd = UserGetWindowObject(SafeMsg.hwnd);
2465 if (pWnd) // Must have a window!
2466 {
2467 Ret = IntTranslateKbdMessage(&SafeMsg, flags);
2468 }
2469 else
2470 {
2471 TRACE("No Window for Translate. hwnd 0x%p Msg %u\n", SafeMsg.hwnd, SafeMsg.message);
2472 Ret = FALSE;
2473 }
2474 UserLeave();
2475
2476 return Ret;
2477}
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 3052 of file message.c.

3055{
3057 PPROCESSINFO W32Process;
3058 PTHREADINFO pti;
3060 HANDLE Handles[3];
3063
3065
3069 UserMode,
3070 (PVOID*)&Process,
3071 NULL);
3072
3073 if (!NT_SUCCESS(Status))
3074 {
3075 UserLeave();
3077 return WAIT_FAILED;
3078 }
3079
3081
3082 W32Process = (PPROCESSINFO)Process->Win32Process;
3083
3085 !W32Process ||
3086 pti->ppi == W32Process)
3087 {
3089 UserLeave();
3091 return WAIT_FAILED;
3092 }
3093
3094 Handles[0] = Process;
3095 Handles[1] = W32Process->InputIdleEvent;
3096 Handles[2] = pti->pEventQueueServer; // IntMsqSetWakeMask returns hEventQueueClient
3097
3098 if (!Handles[1])
3099 {
3101 UserLeave();
3102 return STATUS_SUCCESS; /* no event to wait on */
3103 }
3104
3105 if (dwMilliseconds != INFINITE)
3106 Timeout.QuadPart = (LONGLONG) dwMilliseconds * (LONGLONG) -10000;
3107
3109 W32Process->W32PF_flags |= W32PF_WAITFORINPUTIDLE;
3110 for (pti = W32Process->ptiList; pti; pti = pti->ptiSibling)
3111 {
3113 pti->pClientInfo->dwTIFlags = pti->TIF_flags;
3114 }
3116
3117 TRACE("WFII: ppi %p\n", W32Process);
3118 TRACE("WFII: waiting for %p\n", Handles[1] );
3119
3120 /*
3121 * We must add a refcount to our current PROCESSINFO,
3122 * because anything could happen (including process death) we're leaving win32k
3123 */
3124 IntReferenceProcessInfo(W32Process);
3125
3126 do
3127 {
3128 UserLeave();
3130 Handles,
3131 WaitAny,
3133 UserMode,
3134 FALSE,
3135 dwMilliseconds == INFINITE ? NULL : &Timeout,
3136 NULL);
3138
3139 if (!NT_SUCCESS(Status))
3140 {
3143 goto WaitExit;
3144 }
3145
3146 switch (Status)
3147 {
3148 case STATUS_WAIT_0:
3149 goto WaitExit;
3150
3151 case STATUS_WAIT_2:
3152 {
3153 MSG Msg;
3154 co_IntGetPeekMessage( &Msg, 0, 0, 0, PM_REMOVE | PM_QS_SENDMESSAGE, FALSE);
3155 ERR("WFII: WAIT 2\n");
3156 }
3157 break;
3158
3159 case STATUS_TIMEOUT:
3160 ERR("WFII: timeout\n");
3161 case WAIT_FAILED:
3162 goto WaitExit;
3163
3164 default:
3165 ERR("WFII: finished\n");
3167 goto WaitExit;
3168 }
3169 }
3170 while (TRUE);
3171
3172WaitExit:
3174 for (pti = W32Process->ptiList; pti; pti = pti->ptiSibling)
3175 {
3176 pti->TIF_flags &= ~TIF_WAITFORINPUTIDLE;
3177 pti->pClientInfo->dwTIFlags = pti->TIF_flags;
3178 }
3179 W32Process->W32PF_flags &= ~W32PF_WAITFORINPUTIDLE;
3181
3182 IntDereferenceProcessInfo(W32Process);
3184 UserLeave();
3185 return Status;
3186}
_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:276
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:3047
#define WAIT_FAILED
Definition: message.c:3048
@ UserRequest
Definition: ketypes.h:421
KAPC_STATE
Definition: ketypes.h:1297

Referenced by WaitForInputIdle().

◆ NtUserWaitMessage()

BOOL APIENTRY NtUserWaitMessage ( VOID  )

Definition at line 2275 of file message.c.

2276{
2277 BOOL ret;
2278
2280 TRACE("NtUserWaitMessage Enter\n");
2281 ret = co_IntWaitMessage(NULL, 0, 0);
2282 TRACE("NtUserWaitMessage Leave\n");
2283 UserLeave();
2284
2285 return ret;
2286}

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:3598
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:725
INT WSBflags
Definition: ntuser.h:512
#define WM_ENABLE
Definition: winuser.h:1614
#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 2033 of file message.c.

2037{
2038 BOOL Ret = TRUE;
2039
2041 {
2043 return FALSE;
2044 }
2045
2046 // Basicly the same as IntPostOrSendMessage
2047 if (hWnd == HWND_BROADCAST) // Handle Broadcast
2048 {
2049 HWND *List;
2051 ULONG i;
2052
2055
2056 if (List != NULL)
2057 {
2059 for (i = 0; List[i]; i++)
2060 {
2061 PWND pwnd = UserGetWindowObject(List[i]);
2062 if (!pwnd) continue;
2063
2064 if ( pwnd->fnid == FNID_MENU ||
2066 continue;
2067
2069 }
2071 }
2072 }
2073 else
2074 {
2076 }
2077 return Ret;
2078}
LRESULT FASTCALL co_IntSendMessageNoWait(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1709

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:1805
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1660
#define WM_GETTEXT
Definition: winuser.h:1617
struct tagMEASUREITEMSTRUCT MEASUREITEMSTRUCT
struct _WINDOWPOS WINDOWPOS
struct tagDRAWITEMSTRUCT DRAWITEMSTRUCT
#define WM_DRAWITEM
Definition: winuser.h:1644
struct tagMINMAXINFO MINMAXINFO
#define WM_SETTINGCHANGE
Definition: winuser.h:1628
#define WM_SETTEXT
Definition: winuser.h:1616
#define WM_GETMINMAXINFO
Definition: winuser.h:1639
struct tagSTYLESTRUCT STYLESTRUCT
struct tagHELPINFO HELPINFO
#define WM_MEASUREITEM
Definition: winuser.h:1645
#define WM_SIZING
Definition: winuser.h:1806
#define WM_MOVING
Definition: winuser.h:1808
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1661

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().