ReactOS  0.4.14-dev-337-gf981a68
message.c File Reference
#include <user32.h>
Include dependency graph for message.c:

Go to the source code of this file.

Classes

struct  tagDDEPAIR
 
struct  _USER_MESSAGE_PUMP_ADDRESSES
 

Macros

#define CALL_EXTERN_WNDPROC(proc, h, m, w, l)   proc(h, m, w, l)
 
#define SET(msg)   (1 << ((msg) & 31))
 
#define GROWBY   4
 
#define QS_TEMPALLINPUT   255
 

Typedefs

typedef struct tagDDEPAIR DDEPAIR
 
typedef struct tagDDEPAIRPDDEPAIR
 
typedef DWORD(WINAPIRealGetQueueStatusProc) (UINT flags)
 
typedef DWORD(WINAPIRealMsgWaitForMultipleObjectsExProc) (DWORD nCount, CONST HANDLE *lpHandles, DWORD dwMilliseconds, DWORD dwWakeMask, DWORD dwFlags)
 
typedef BOOL(WINAPIRealInternalGetMessageProc) (LPMSG, HWND, UINT, UINT, UINT, BOOL)
 
typedef BOOL(WINAPIRealWaitMessageExProc) (DWORD, UINT)
 
typedef struct _USER_MESSAGE_PUMP_ADDRESSES USER_MESSAGE_PUMP_ADDRESSES
 
typedef struct _USER_MESSAGE_PUMP_ADDRESSESPUSER_MESSAGE_PUMP_ADDRESSES
 
typedef BOOL(WINAPIMESSAGEPUMPHOOKPROC) (BOOL Unregistering, PUSER_MESSAGE_PUMP_ADDRESSES MessagePumpAddresses)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (user32)
 
static int is_pointer_message (UINT message)
 
static BOOL FASTCALL combobox_has_strings (HWND hwnd)
 
static BOOL FASTCALL listbox_has_strings (HWND hwnd)
 
BOOL FASTCALL DdeAddPair (HGLOBAL ClientMem, HGLOBAL ServerMem)
 
HGLOBAL FASTCALL DdeGetPair (HGLOBAL ServerMem)
 
DWORD FASTCALL get_input_codepage (void)
 
static WPARAM FASTCALL map_wparam_char_WtoA (WPARAM wParam, DWORD len)
 
static WPARAM FASTCALL map_wparam_AtoW (UINT message, WPARAM wparam)
 
static BOOL FASTCALL MsgiUMToKMMessage (PMSG UMMsg, PMSG KMMsg, BOOL Posted)
 
static VOID FASTCALL MsgiUMToKMCleanup (PMSG UMMsg, PMSG KMMsg)
 
static BOOL FASTCALL MsgiKMToUMMessage (PMSG KMMsg, PMSG UMMsg)
 
static VOID FASTCALL MsgiKMToUMCleanup (PMSG KMMsg, PMSG UMMsg)
 
static BOOL FASTCALL MsgiKMToUMReply (PMSG KMMsg, PMSG UMMsg, LRESULT *Result)
 
static BOOL FASTCALL MsgiAnsiToUnicodeMessage (HWND hwnd, LPMSG UnicodeMsg, LPMSG AnsiMsg)
 
static BOOL FASTCALL MsgiAnsiToUnicodeCleanup (LPMSG UnicodeMsg, LPMSG AnsiMsg)
 
static BOOL FASTCALL MsgiAnsiToUnicodeReply (LPMSG UnicodeMsg, LPMSG AnsiMsg, LRESULT *Result)
 
static BOOL FASTCALL MsgiUnicodeToAnsiMessage (HWND hwnd, LPMSG AnsiMsg, LPMSG UnicodeMsg)
 
static BOOL FASTCALL MsgiUnicodeToAnsiCleanup (LPMSG AnsiMsg, LPMSG UnicodeMsg)
 
static BOOL FASTCALL MsgiUnicodeToAnsiReply (LPMSG AnsiMsg, LPMSG UnicodeMsg, LRESULT *Result)
 
LRESULT WINAPI DesktopWndProcA (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
LPARAM WINAPI GetMessageExtraInfo (VOID)
 
DWORD WINAPI GetMessagePos (VOID)
 
LONG WINAPI GetMessageTime (VOID)
 
BOOL WINAPI InSendMessage (VOID)
 
DWORD WINAPI InSendMessageEx (LPVOID lpReserved)
 
BOOL WINAPI ReplyMessage (LRESULT lResult)
 
LPARAM WINAPI SetMessageExtraInfo (LPARAM lParam)
 
LRESULT FASTCALL IntCallWindowProcW (BOOL IsAnsiProc, WNDPROC WndProc, PWND pWnd, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT FASTCALL IntCallWindowProcA (BOOL IsAnsiProc, WNDPROC WndProc, PWND pWnd, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT WINAPI IntCallMessageProc (IN PWND Wnd, IN HWND hWnd, IN UINT Msg, IN WPARAM wParam, IN LPARAM lParam, IN BOOL Ansi)
 
LRESULT WINAPI CallWindowProcA (WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI CallWindowProcW (WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageA (CONST MSG *lpmsg)
 
LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageW (CONST MSG *lpmsg)
 
static VOID IntConvertMsgToAnsi (LPMSG lpMsg)
 
BOOL WINAPI DECLSPEC_HOTPATCH GetMessageA (LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
 
BOOL WINAPI DECLSPEC_HOTPATCH GetMessageW (LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
 
BOOL WINAPI PeekMessageWorker (PMSG pMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)
 
BOOL WINAPI DECLSPEC_HOTPATCH PeekMessageA (LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)
 
BOOL WINAPI DECLSPEC_HOTPATCH PeekMessageW (LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)
 
BOOL WINAPI PostMessageA (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
BOOL WINAPI PostMessageW (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
VOID WINAPI PostQuitMessage (int nExitCode)
 
BOOL WINAPI PostThreadMessageA (DWORD idThread, UINT Msg, WPARAM wParam, LPARAM lParam)
 
BOOL WINAPI PostThreadMessageW (DWORD idThread, UINT Msg, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI SendMessageW (HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI SendMessageA (HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
BOOL WINAPI SendMessageCallbackA (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, SENDASYNCPROC lpCallBack, ULONG_PTR dwData)
 
BOOL WINAPI SendMessageCallbackW (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, SENDASYNCPROC lpCallBack, ULONG_PTR dwData)
 
LRESULT WINAPI SendMessageTimeoutA (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT fuFlags, UINT uTimeout, PDWORD_PTR lpdwResult)
 
LRESULT WINAPI SendMessageTimeoutW (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT fuFlags, UINT uTimeout, PDWORD_PTR lpdwResult)
 
BOOL WINAPI SendNotifyMessageA (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
BOOL WINAPI SendNotifyMessageW (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
BOOL WINAPI TranslateMessageEx (CONST MSG *lpMsg, UINT Flags)
 
BOOL WINAPI TranslateMessage (CONST MSG *lpMsg)
 
UINT WINAPI RegisterWindowMessageA (LPCSTR lpString)
 
UINT WINAPI RegisterWindowMessageW (LPCWSTR lpString)
 
HWND WINAPI GetCapture (VOID)
 
BOOL WINAPI ReleaseCapture (VOID)
 
DWORD WINAPI RealGetQueueStatus (UINT flags)
 
BOOL WINAPI GetInputState (VOID)
 
NTSTATUS WINAPI User32CallWindowProcFromKernel (PVOID Arguments, ULONG ArgumentLength)
 
BOOL WINAPI SetMessageQueue (int cMessagesMax)
 
DWORD WINAPI RealMsgWaitForMultipleObjectsEx (DWORD nCount, CONST HANDLE *pHandles, DWORD dwMilliseconds, DWORD dwWakeMask, DWORD dwFlags)
 
BOOL WINAPI IsInsideMessagePumpHook ()
 
void WINAPI ResetMessagePumpHook (PUSER_MESSAGE_PUMP_ADDRESSES Addresses)
 
BOOL WINAPI RegisterMessagePumpHook (MESSAGEPUMPHOOKPROC Hook)
 
BOOL WINAPI UnregisterMessagePumpHook (VOID)
 
DWORD WINAPI GetQueueStatus (UINT flags)
 
RealMsgWaitForMultipleObjectsEx

Wait either for either message arrival or for one of the passed events to be signalled.

Parameters
nCountNumber of handles in the pHandles array.
pHandlesHandles of events to wait for.
dwMillisecondsTimeout interval.
dwWakeMaskMask specifying on which message events we should wakeup.
dwFlagsWait type (see MWMO_* constants).

@implemented

DWORD WINAPI RealMsgWaitForMultipleObjectsEx (DWORD nCount, const HANDLE *pHandles, DWORD dwMilliseconds, DWORD dwWakeMask, DWORD dwFlags)
 
DWORD WINAPI MsgWaitForMultipleObjectsEx (DWORD nCount, CONST HANDLE *lpHandles, DWORD dwMilliseconds, DWORD dwWakeMask, DWORD dwFlags)
 
DWORD WINAPI MsgWaitForMultipleObjects (DWORD nCount, CONST HANDLE *lpHandles, BOOL fWaitAll, DWORD dwMilliseconds, DWORD dwWakeMask)
 
BOOL FASTCALL MessageInit (VOID)
 
VOID FASTCALL MessageCleanup (VOID)
 
BOOL WINAPI IsDialogMessageA (HWND hwndDlg, LPMSG pmsg)
 
LONG WINAPI IntBroadcastSystemMessage (DWORD dwflags, LPDWORD lpdwRecipients, UINT uiMessage, WPARAM wParam, LPARAM lParam, PBSMINFO pBSMInfo, BOOL Ansi)
 
LONG WINAPI BroadcastSystemMessageA (DWORD dwFlags, LPDWORD lpdwRecipients, UINT uiMessage, WPARAM wParam, LPARAM lParam)
 
LONG WINAPI BroadcastSystemMessageW (DWORD dwFlags, LPDWORD lpdwRecipients, UINT uiMessage, WPARAM wParam, LPARAM lParam)
 
LONG WINAPI BroadcastSystemMessageExA (DWORD dwflags, LPDWORD lpdwRecipients, UINT uiMessage, WPARAM wParam, LPARAM lParam, PBSMINFO pBSMInfo)
 
LONG WINAPI BroadcastSystemMessageExW (DWORD dwflags, LPDWORD lpdwRecipients, UINT uiMessage, WPARAM wParam, LPARAM lParam, PBSMINFO pBSMInfo)
 

Variables

static const unsigned int message_pointer_flags []
 
static PDDEPAIR DdePairs = NULL
 
static unsigned DdeNumAlloc = 0
 
static unsigned DdeNumUsed = 0
 
static CRITICAL_SECTION DdeCrst
 
CRITICAL_SECTION gcsMPH
 
MESSAGEPUMPHOOKPROC gpfnInitMPH
 
DWORD gcLoadMPH = 0
 
USER_MESSAGE_PUMP_ADDRESSES gmph
 
DWORD gfMessagePumpHook = 0
 

Macro Definition Documentation

◆ CALL_EXTERN_WNDPROC

#define CALL_EXTERN_WNDPROC (   proc,
  h,
  m,
  w,
  l 
)    proc(h, m, w, l)

Definition at line 27 of file message.c.

◆ GROWBY

#define GROWBY   4

◆ QS_TEMPALLINPUT

#define QS_TEMPALLINPUT   255

◆ SET

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

Definition at line 34 of file message.c.

Typedef Documentation

◆ DDEPAIR

◆ MESSAGEPUMPHOOKPROC

typedef BOOL(WINAPI * MESSAGEPUMPHOOKPROC) (BOOL Unregistering, PUSER_MESSAGE_PUMP_ADDRESSES MessagePumpAddresses)

Definition at line 3063 of file message.c.

◆ PDDEPAIR

◆ PUSER_MESSAGE_PUMP_ADDRESSES

◆ RealGetQueueStatusProc

typedef DWORD(WINAPI * RealGetQueueStatusProc) (UINT flags)

Definition at line 3041 of file message.c.

◆ RealInternalGetMessageProc

typedef BOOL(WINAPI * RealInternalGetMessageProc) (LPMSG, HWND, UINT, UINT, UINT, BOOL)

Definition at line 3043 of file message.c.

◆ RealMsgWaitForMultipleObjectsExProc

typedef DWORD(WINAPI * RealMsgWaitForMultipleObjectsExProc) (DWORD nCount, CONST HANDLE *lpHandles, DWORD dwMilliseconds, DWORD dwWakeMask, DWORD dwFlags)

Definition at line 3042 of file message.c.

◆ RealWaitMessageExProc

typedef BOOL(WINAPI * RealWaitMessageExProc) (DWORD, UINT)

Definition at line 3044 of file message.c.

◆ USER_MESSAGE_PUMP_ADDRESSES

Function Documentation

◆ BroadcastSystemMessageA()

LONG WINAPI BroadcastSystemMessageA ( DWORD  dwFlags,
LPDWORD  lpdwRecipients,
UINT  uiMessage,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 3382 of file message.c.

3388 {
3389  return IntBroadcastSystemMessage( dwFlags, lpdwRecipients, uiMessage, wParam, lParam, NULL, TRUE );
3390 }
#define TRUE
Definition: types.h:120
WPARAM wParam
Definition: combotst.c:138
LONG WINAPI IntBroadcastSystemMessage(DWORD dwflags, LPDWORD lpdwRecipients, UINT uiMessage, WPARAM wParam, LPARAM lParam, PBSMINFO pBSMInfo, BOOL Ansi)
Definition: message.c:3300
smooth NULL
Definition: ftsmooth.c:416
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LPARAM lParam
Definition: combotst.c:139

Referenced by START_TEST().

◆ BroadcastSystemMessageExA()

LONG WINAPI BroadcastSystemMessageExA ( DWORD  dwflags,
LPDWORD  lpdwRecipients,
UINT  uiMessage,
WPARAM  wParam,
LPARAM  lParam,
PBSMINFO  pBSMInfo 
)

Definition at line 3412 of file message.c.

3419 {
3420  return IntBroadcastSystemMessage( dwflags, lpdwRecipients, uiMessage, wParam, lParam , pBSMInfo, TRUE );
3421 }
#define TRUE
Definition: types.h:120
WPARAM wParam
Definition: combotst.c:138
LONG WINAPI IntBroadcastSystemMessage(DWORD dwflags, LPDWORD lpdwRecipients, UINT uiMessage, WPARAM wParam, LPARAM lParam, PBSMINFO pBSMInfo, BOOL Ansi)
Definition: message.c:3300
static _In_ DWORD dwflags
Definition: dispmode.c:64
LPARAM lParam
Definition: combotst.c:139

Referenced by START_TEST().

◆ BroadcastSystemMessageExW()

LONG WINAPI BroadcastSystemMessageExW ( DWORD  dwflags,
LPDWORD  lpdwRecipients,
UINT  uiMessage,
WPARAM  wParam,
LPARAM  lParam,
PBSMINFO  pBSMInfo 
)

Definition at line 3428 of file message.c.

3435 {
3436  return IntBroadcastSystemMessage( dwflags, lpdwRecipients, uiMessage, wParam, lParam , pBSMInfo, FALSE );
3437 }
WPARAM wParam
Definition: combotst.c:138
LONG WINAPI IntBroadcastSystemMessage(DWORD dwflags, LPDWORD lpdwRecipients, UINT uiMessage, WPARAM wParam, LPARAM lParam, PBSMINFO pBSMInfo, BOOL Ansi)
Definition: message.c:3300
static _In_ DWORD dwflags
Definition: dispmode.c:64
LPARAM lParam
Definition: combotst.c:139

Referenced by START_TEST(), and test_noprivileges().

◆ BroadcastSystemMessageW()

LONG WINAPI BroadcastSystemMessageW ( DWORD  dwFlags,
LPDWORD  lpdwRecipients,
UINT  uiMessage,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 3397 of file message.c.

3403 {
3404  return IntBroadcastSystemMessage( dwFlags, lpdwRecipients, uiMessage, wParam, lParam, NULL, FALSE );
3405 }
WPARAM wParam
Definition: combotst.c:138
LONG WINAPI IntBroadcastSystemMessage(DWORD dwflags, LPDWORD lpdwRecipients, UINT uiMessage, WPARAM wParam, LPARAM lParam, PBSMINFO pBSMInfo, BOOL Ansi)
Definition: message.c:3300
smooth NULL
Definition: ftsmooth.c:416
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LPARAM lParam
Definition: combotst.c:139

Referenced by InputList_Process(), and START_TEST().

◆ CallWindowProcA()

LRESULT WINAPI CallWindowProcA ( WNDPROC  lpPrevWndFunc,
HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1807 of file message.c.

1812 {
1813  PWND pWnd;
1814  PCALLPROCDATA CallProc;
1815 
1816  if (lpPrevWndFunc == NULL)
1817  {
1818  WARN("CallWindowProcA: lpPrevWndFunc == NULL!\n");
1819  return 0;
1820  }
1821 
1822  pWnd = ValidateHwnd(hWnd);
1823 
1824  if (!IsCallProcHandle(lpPrevWndFunc))
1825  return IntCallWindowProcA(TRUE, lpPrevWndFunc, pWnd, hWnd, Msg, wParam, lParam);
1826  else
1827  {
1828  CallProc = ValidateCallProc((HANDLE)lpPrevWndFunc);
1829  if (CallProc != NULL)
1830  {
1831  return IntCallWindowProcA(!(CallProc->wType & UserGetCPDA2U),
1832  CallProc->pfnClientPrevious,
1833  pWnd,
1834  hWnd,
1835  Msg,
1836  wParam,
1837  lParam);
1838  }
1839  else
1840  {
1841  WARN("CallWindowProcA: can not dereference WndProcHandle\n");
1842  return 0;
1843  }
1844  }
1845 }
static LRESULT FASTCALL IntCallWindowProcA(BOOL IsAnsiProc, WNDPROC WndProc, PWND pWnd, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1583
#define TRUE
Definition: types.h:120
WNDPROC pfnClientPrevious
Definition: ntuser.h:520
PCALLPROCDATA FASTCALL ValidateCallProc(HANDLE hCallProc)
Definition: misc.c:349
#define WARN(fmt,...)
Definition: debug.h:111
struct @1591 Msg[]
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
GETCPD wType
Definition: ntuser.h:521
smooth NULL
Definition: ftsmooth.c:416
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657
static __inline BOOL IsCallProcHandle(IN WNDPROC lpWndProc)
Definition: class.h:13
LPARAM lParam
Definition: combotst.c:139

◆ CallWindowProcW()

LRESULT WINAPI CallWindowProcW ( WNDPROC  lpPrevWndFunc,
HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1852 of file message.c.

1857 {
1858  PWND pWnd;
1859  PCALLPROCDATA CallProc;
1860 
1861  /* FIXME - can the first parameter be NULL? */
1862  if (lpPrevWndFunc == NULL)
1863  {
1864  WARN("CallWindowProcA: lpPrevWndFunc == NULL!\n");
1865  return 0;
1866  }
1867 
1868  pWnd = ValidateHwnd(hWnd);
1869 
1870  if (!IsCallProcHandle(lpPrevWndFunc))
1871  return IntCallWindowProcW(FALSE, lpPrevWndFunc, pWnd, hWnd, Msg, wParam, lParam);
1872  else
1873  {
1874  CallProc = ValidateCallProc((HANDLE)lpPrevWndFunc);
1875  if (CallProc != NULL)
1876  {
1877  return IntCallWindowProcW(!(CallProc->wType & UserGetCPDA2U),
1878  CallProc->pfnClientPrevious,
1879  pWnd,
1880  hWnd,
1881  Msg,
1882  wParam,
1883  lParam);
1884  }
1885  else
1886  {
1887  WARN("CallWindowProcW: can not dereference WndProcHandle\n");
1888  return 0;
1889  }
1890  }
1891 }
WNDPROC pfnClientPrevious
Definition: ntuser.h:520
PCALLPROCDATA FASTCALL ValidateCallProc(HANDLE hCallProc)
Definition: misc.c:349
#define WARN(fmt,...)
Definition: debug.h:111
struct @1591 Msg[]
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
GETCPD wType
Definition: ntuser.h:521
LRESULT FASTCALL IntCallWindowProcW(BOOL IsAnsiProc, WNDPROC WndProc, PWND pWnd, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1424
smooth NULL
Definition: ftsmooth.c:416
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657
static __inline BOOL IsCallProcHandle(IN WNDPROC lpWndProc)
Definition: class.h:13
LPARAM lParam
Definition: combotst.c:139

◆ combobox_has_strings()

static BOOL FASTCALL combobox_has_strings ( HWND  hwnd)
static

Definition at line 107 of file message.c.

108 {
111 }
#define CBS_OWNERDRAWFIXED
Definition: winuser.h:289
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define CBS_OWNERDRAWVARIABLE
Definition: winuser.h:290
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define CBS_HASSTRINGS
Definition: winuser.h:285
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GWL_STYLE
Definition: winuser.h:846
Arabic default style
Definition: afstyles.h:93

Referenced by MsgiAnsiToUnicodeCleanup(), MsgiAnsiToUnicodeMessage(), MsgiAnsiToUnicodeReply(), MsgiUnicodeToAnsiCleanup(), MsgiUnicodeToAnsiMessage(), and MsgiUnicodeToAnsiReply().

◆ DdeAddPair()

BOOL FASTCALL DdeAddPair ( HGLOBAL  ClientMem,
HGLOBAL  ServerMem 
)

Definition at line 180 of file message.c.

181 {
182  unsigned i;
183 
185 
186  /* now remember the pair of hMem on both sides */
187  if (DdeNumUsed == DdeNumAlloc)
188  {
189 #define GROWBY 4
190  PDDEPAIR New;
191  if (NULL != DdePairs)
192  {
194  (DdeNumAlloc + GROWBY) * sizeof(DDEPAIR));
195  }
196  else
197  {
199  (DdeNumAlloc + GROWBY) * sizeof(DDEPAIR));
200  }
201 
202  if (NULL == New)
203  {
205  return FALSE;
206  }
207  DdePairs = New;
208  /* zero out newly allocated part */
209  memset(&DdePairs[DdeNumAlloc], 0, GROWBY * sizeof(DDEPAIR));
210  DdeNumAlloc += GROWBY;
211 #undef GROWBY
212  }
213 
214  for (i = 0; i < DdeNumAlloc; i++)
215  {
216  if (NULL == DdePairs[i].ServerMem)
217  {
218  DdePairs[i].ClientMem = ClientMem;
219  DdePairs[i].ServerMem = ServerMem;
220  DdeNumUsed++;
221  break;
222  }
223  }
225 
226  return TRUE;
227 }
#define TRUE
Definition: types.h:120
HGLOBAL ServerMem
Definition: message.c:171
#define GROWBY
#define New(t)
Definition: rtf.h:1086
static unsigned DdeNumUsed
Definition: message.c:176
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
HGLOBAL ClientMem
Definition: message.c:170
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
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static unsigned DdeNumAlloc
Definition: message.c:175
static PDDEPAIR DdePairs
Definition: message.c:174
#define HeapReAlloc
Definition: compat.h:401
static CRITICAL_SECTION DdeCrst
Definition: message.c:177
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define memset(x, y, z)
Definition: compat.h:39

Referenced by unpack_dde_message().

◆ DdeGetPair()

HGLOBAL FASTCALL DdeGetPair ( HGLOBAL  ServerMem)

Definition at line 230 of file message.c.

231 {
232  unsigned i;
233  HGLOBAL Ret = NULL;
234 
236  for (i = 0; i < DdeNumAlloc; i++)
237  {
238  if (DdePairs[i].ServerMem == ServerMem)
239  {
240  /* free this pair */
241  DdePairs[i].ServerMem = 0;
242  DdeNumUsed--;
243  Ret = DdePairs[i].ClientMem;
244  break;
245  }
246  }
248 
249  return Ret;
250 }
HGLOBAL ServerMem
Definition: message.c:171
static unsigned DdeNumUsed
Definition: message.c:176
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
HGLOBAL ClientMem
Definition: message.c:170
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
smooth NULL
Definition: ftsmooth.c:416
static unsigned DdeNumAlloc
Definition: message.c:175
static PDDEPAIR DdePairs
Definition: message.c:174
static CRITICAL_SECTION DdeCrst
Definition: message.c:177
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by post_dde_message().

◆ DesktopWndProcA()

LRESULT WINAPI DesktopWndProcA ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1306 of file message.c.

1307 {
1308  LRESULT Result;
1309  MSG AnsiMsg, UcMsg;
1310 
1311  TRACE("Desktop A Class Atom! hWnd 0x%x, Msg %d\n", hwnd, message);
1312 
1313  AnsiMsg.hwnd = hwnd;
1314  AnsiMsg.message = message;
1315  AnsiMsg.wParam = wParam;
1316  AnsiMsg.lParam = lParam;
1317  AnsiMsg.time = 0;
1318  AnsiMsg.pt.x = 0;
1319  AnsiMsg.pt.y = 0;
1320 
1321  // Desktop is always Unicode so convert Ansi here.
1322  if (!MsgiAnsiToUnicodeMessage(hwnd, &UcMsg, &AnsiMsg))
1323  {
1324  return FALSE;
1325  }
1326 
1327  Result = DesktopWndProcW(hwnd, message, UcMsg.wParam, UcMsg.lParam);
1328 
1329  MsgiAnsiToUnicodeCleanup(&UcMsg, &AnsiMsg);
1330 
1331  return Result;
1332  }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT WINAPI DesktopWndProcW(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:33
Definition: tftpd.h:59
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:5579
WPARAM wParam
Definition: combotst.c:138
static BOOL FASTCALL MsgiAnsiToUnicodeMessage(HWND hwnd, LPMSG UnicodeMsg, LPMSG AnsiMsg)
Definition: message.c:516
_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:426
static BOOL FASTCALL MsgiAnsiToUnicodeCleanup(LPMSG UnicodeMsg, LPMSG AnsiMsg)
Definition: message.c:708
#define TRACE(s)
Definition: solgame.cpp:4
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139

Referenced by RegisterClientPFN().

◆ DispatchMessageA()

LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageA ( CONST MSG lpmsg)

Definition at line 1900 of file message.c.

1901 {
1902  LRESULT Ret = 0;
1903  MSG UnicodeMsg;
1904  PWND Wnd;
1905 
1906  if ( lpmsg->message & ~WM_MAXIMUM )
1907  {
1909  return 0;
1910  }
1911 
1912  if (lpmsg->hwnd != NULL)
1913  {
1914  Wnd = ValidateHwnd(lpmsg->hwnd);
1915  if (!Wnd) return 0;
1916  }
1917  else
1918  Wnd = NULL;
1919 
1920  if (is_pointer_message(lpmsg->message))
1921  {
1923  return 0;
1924  }
1925 
1926  if ((lpmsg->message == WM_TIMER || lpmsg->message == WM_SYSTIMER) && lpmsg->lParam != 0)
1927  {
1928  WNDPROC WndProc = (WNDPROC)lpmsg->lParam;
1929 
1930  if ( lpmsg->message == WM_SYSTIMER )
1931  return NtUserDispatchMessage( (PMSG)lpmsg );
1932 
1933  if (!NtUserValidateTimerCallback(lpmsg->lParam))
1934  {
1935  WARN("Validating Timer Callback failed!\n");
1936  return 0;
1937  }
1938 
1939  _SEH2_TRY // wine does this. Hint: Prevents call to another thread....
1940  {
1941  Ret = WndProc(lpmsg->hwnd,
1942  lpmsg->message,
1943  lpmsg->wParam,
1944  GetTickCount());
1945  }
1947  {
1948  ERR("Exception in Timer Callback!\n");
1949  }
1950  _SEH2_END;
1951  }
1952  else if (Wnd != NULL)
1953  {
1954  if ( (lpmsg->message != WM_PAINT) && !(Wnd->state & WNDS_SERVERSIDEWINDOWPROC) )
1955  {
1956  Ret = IntCallMessageProc(Wnd,
1957  lpmsg->hwnd,
1958  lpmsg->message,
1959  lpmsg->wParam,
1960  lpmsg->lParam,
1961  TRUE);
1962  }
1963  else
1964  {
1965  if (!MsgiAnsiToUnicodeMessage(lpmsg->hwnd, &UnicodeMsg, (LPMSG)lpmsg))
1966  {
1967  return FALSE;
1968  }
1969 
1970  Ret = NtUserDispatchMessage(&UnicodeMsg);
1971 
1972  if (!MsgiAnsiToUnicodeReply(&UnicodeMsg, (LPMSG)lpmsg, &Ret))
1973  {
1974  return FALSE;
1975  }
1976  }
1977  }
1978 
1979  return Ret;
1980 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
#define WM_SYSTIMER
Definition: comctl32.h:112
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define WARN(fmt,...)
Definition: debug.h:111
static int is_pointer_message(UINT message)
Definition: message.c:98
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
static LRESULT WINAPI IntCallMessageProc(IN PWND Wnd, IN HWND hWnd, IN UINT Msg, IN WPARAM wParam, IN LPARAM lParam, IN BOOL Ansi)
Definition: message.c:1746
static BOOL FASTCALL MsgiAnsiToUnicodeReply(LPMSG UnicodeMsg, LPMSG AnsiMsg, LRESULT *Result)
Definition: message.c:820
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
static BOOL FASTCALL MsgiAnsiToUnicodeMessage(HWND hwnd, LPMSG UnicodeMsg, LPMSG AnsiMsg)
Definition: message.c:516
smooth NULL
Definition: ftsmooth.c:416
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define WM_TIMER
Definition: winuser.h:1724
#define SetLastError(x)
Definition: compat.h:417
#define WM_PAINT
Definition: winuser.h:1602
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
#define WM_MAXIMUM
Definition: undocuser.h:62
LRESULT APIENTRY NtUserDispatchMessage(PMSG UnsafeMsgInfo)
Definition: message.c:2260
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: solitaire.cpp:598
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2880
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
_SEH2_END
Definition: create.c:4424
BOOL APIENTRY NtUserValidateTimerCallback(LPARAM lParam)
Definition: timer.c:700
#define ERROR_MESSAGE_SYNC_ONLY
Definition: winerror.h:681
DWORD state
Definition: ntuser.h:665
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
LONG_PTR LRESULT
Definition: windef.h:209
#define WNDS_SERVERSIDEWINDOWPROC
Definition: ntuser.h:591

◆ DispatchMessageW()

LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageW ( CONST MSG lpmsg)

Definition at line 1989 of file message.c.

1990 {
1991  LRESULT Ret = 0;
1992  PWND Wnd;
1993  BOOL Hit = FALSE;
1994 
1995  if ( lpmsg->message & ~WM_MAXIMUM )
1996  {
1998  return 0;
1999  }
2000 
2001  if (lpmsg->hwnd != NULL)
2002  {
2003  Wnd = ValidateHwnd(lpmsg->hwnd);
2004  if (!Wnd) return 0;
2005  }
2006  else
2007  Wnd = NULL;
2008 
2009  if (is_pointer_message(lpmsg->message))
2010  {
2012  return 0;
2013  }
2014 
2015  if ((lpmsg->message == WM_TIMER || lpmsg->message == WM_SYSTIMER) && lpmsg->lParam != 0)
2016  {
2017  WNDPROC WndProc = (WNDPROC)lpmsg->lParam;
2018 
2019  if ( lpmsg->message == WM_SYSTIMER )
2020  return NtUserDispatchMessage( (PMSG) lpmsg );
2021 
2022  if (!NtUserValidateTimerCallback(lpmsg->lParam))
2023  {
2024  WARN("Validating Timer Callback failed!\n");
2025  return 0;
2026  }
2027 
2028  _SEH2_TRY
2029  {
2030  Ret = WndProc(lpmsg->hwnd,
2031  lpmsg->message,
2032  lpmsg->wParam,
2033  GetTickCount());
2034  }
2036  {
2037  Hit = TRUE;
2038  }
2039  _SEH2_END;
2040  }
2041  else if (Wnd != NULL)
2042  {
2043  if ( (lpmsg->message != WM_PAINT) && !(Wnd->state & WNDS_SERVERSIDEWINDOWPROC) )
2044  {
2045  Ret = IntCallMessageProc(Wnd,
2046  lpmsg->hwnd,
2047  lpmsg->message,
2048  lpmsg->wParam,
2049  lpmsg->lParam,
2050  FALSE);
2051  }
2052  else
2053  Ret = NtUserDispatchMessage( (PMSG) lpmsg );
2054  }
2055 
2056  if (Hit)
2057  {
2058  WARN("Exception in Timer Callback WndProcW!\n");
2059  }
2060  return Ret;
2061 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
#define WM_SYSTIMER
Definition: comctl32.h:112
#define WARN(fmt,...)
Definition: debug.h:111
static int is_pointer_message(UINT message)
Definition: message.c:98
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
static LRESULT WINAPI IntCallMessageProc(IN PWND Wnd, IN HWND hWnd, IN UINT Msg, IN WPARAM wParam, IN LPARAM lParam, IN BOOL Ansi)
Definition: message.c:1746
_SEH2_TRY
Definition: create.c:4250
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define WM_TIMER
Definition: winuser.h:1724
#define SetLastError(x)
Definition: compat.h:417
#define WM_PAINT
Definition: winuser.h:1602
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
#define WM_MAXIMUM
Definition: undocuser.h:62
LRESULT APIENTRY NtUserDispatchMessage(PMSG UnsafeMsgInfo)
Definition: message.c:2260
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: solitaire.cpp:598
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2880
Definition: ntuser.h:657
_SEH2_END
Definition: create.c:4424
BOOL APIENTRY NtUserValidateTimerCallback(LPARAM lParam)
Definition: timer.c:700
#define ERROR_MESSAGE_SYNC_ONLY
Definition: winerror.h:681
DWORD state
Definition: ntuser.h:665
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
LONG_PTR LRESULT
Definition: windef.h:209
#define WNDS_SERVERSIDEWINDOWPROC
Definition: ntuser.h:591

◆ get_input_codepage()

DWORD FASTCALL get_input_codepage ( void  )

Definition at line 252 of file message.c.

253 {
254  DWORD cp;
255  int ret;
256  HKL hkl = GetKeyboardLayout( 0 );
257  ret = GetLocaleInfoW( LOWORD(hkl), LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, (WCHAR *)&cp, sizeof(cp) / sizeof(WCHAR) );
258  if (!ret) cp = CP_ACP;
259  return cp;
260 }
#define LOCALE_IDEFAULTANSICODEPAGE
Definition: winnls.h:38
#define CP_ACP
Definition: compat.h:99
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
UINT_PTR HKL
Definition: msctf.idl:101
HKL hkl
Definition: msctf.idl:611
PKEYBOARD_LAYOUT GetKeyboardLayout()
Definition: utils.c:194
POINT cp
Definition: magnifier.c:59
#define LOWORD(l)
Definition: pedump.c:82

Referenced by map_wparam_char_WtoA(), and MsgiUnicodeToAnsiMessage().

◆ GetCapture()

HWND WINAPI GetCapture ( VOID  )

◆ GetInputState()

BOOL WINAPI GetInputState ( VOID  )

Definition at line 2914 of file message.c.

2915 {
2916  PCLIENTTHREADINFO pcti = GetWin32ClientInfo()->pClientThreadInfo;
2917 
2918  if ((!pcti) || (pcti->fsChangeBits & (QS_KEY|QS_MOUSEBUTTON)))
2920 
2921  return FALSE;
2922 }
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:231
#define GetWin32ClientInfo()
Definition: ntuser.h:320
unsigned int BOOL
Definition: ntddk_ex.h:94
WORD fsChangeBits
Definition: ntuser.h:166
#define QS_MOUSEBUTTON
Definition: winuser.h:885
#define QS_KEY
Definition: winuser.h:883

◆ GetMessageA()

BOOL WINAPI DECLSPEC_HOTPATCH GetMessageA ( LPMSG  lpMsg,
HWND  hWnd,
UINT  wMsgFilterMin,
UINT  wMsgFilterMax 
)

Definition at line 2091 of file message.c.

2095 {
2096  BOOL Res;
2097 
2098  if ( (wMsgFilterMin|wMsgFilterMax) & ~WM_MAXIMUM )
2099  {
2101  return FALSE;
2102  }
2103 
2104  Res = NtUserGetMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
2105  if (-1 == (int) Res)
2106  {
2107  return Res;
2108  }
2109 
2110  IntConvertMsgToAnsi(lpMsg);
2111 
2112  return Res;
2113 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
HWND hWnd
Definition: settings.c:17
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL APIENTRY NtUserGetMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax)
Definition: message.c:2130
static VOID IntConvertMsgToAnsi(LPMSG lpMsg)
Definition: message.c:2064
#define SetLastError(x)
Definition: compat.h:417
#define WM_MAXIMUM
Definition: undocuser.h:62

◆ GetMessageExtraInfo()

LPARAM WINAPI GetMessageExtraInfo ( VOID  )

Definition at line 1339 of file message.c.

1340 {
1341  return NtUserxGetMessageExtraInfo();
1342 }
EXTINLINE LPARAM NtUserxGetMessageExtraInfo(VOID)
Definition: ntwrapper.h:796

Referenced by OSK_DlgCommand(), and OSK_ReleaseKey().

◆ GetMessagePos()

◆ GetMessageTime()

LONG WINAPI GetMessageTime ( VOID  )

Definition at line 1360 of file message.c.

1361 {
1363 }
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:231

Referenced by ME_CalculateClickCount(), mstsc_WndProc(), STATUSBAR_Relay2Tip(), TAB_RelayEvent(), TOOLBAR_RelayEvent(), and WindowProc().

◆ GetMessageW()

BOOL WINAPI DECLSPEC_HOTPATCH GetMessageW ( LPMSG  lpMsg,
HWND  hWnd,
UINT  wMsgFilterMin,
UINT  wMsgFilterMax 
)

Definition at line 2121 of file message.c.

2125 {
2126  BOOL Res;
2127 
2128  if ( (wMsgFilterMin|wMsgFilterMax) & ~WM_MAXIMUM )
2129  {
2131  return FALSE;
2132  }
2133 
2134  Res = NtUserGetMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
2135  if (-1 == (int) Res)
2136  {
2137  return Res;
2138  }
2139 
2140  return Res;
2141 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
HWND hWnd
Definition: settings.c:17
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL APIENTRY NtUserGetMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax)
Definition: message.c:2130
#define SetLastError(x)
Definition: compat.h:417
#define WM_MAXIMUM
Definition: undocuser.h:62

◆ GetQueueStatus()

DWORD WINAPI GetQueueStatus ( UINT  flags)

Definition at line 3146 of file message.c.

3147 {
3149 }
RealGetQueueStatusProc RealGetQueueStatus
Definition: message.c:3050
DWORD WINAPI RealGetQueueStatus(UINT flags)
Definition: message.c:2899
GLbitfield flags
Definition: glext.h:7161
BOOL WINAPI IsInsideMessagePumpHook()
Definition: message.c:3077
USER_MESSAGE_PUMP_ADDRESSES gmph
Definition: message.c:3068

◆ InSendMessage()

BOOL WINAPI InSendMessage ( VOID  )

Definition at line 1371 of file message.c.

1372 {
1373  PCLIENTTHREADINFO pcti = GetWin32ClientInfo()->pClientThreadInfo;
1374  if ( pcti )
1375  {
1376  if (pcti->CTI_flags & CTI_INSENDMESSAGE)
1377  {
1378  return TRUE;
1379  }
1380  }
1381  return(NtUserGetThreadState(THREADSTATE_INSENDMESSAGE) != ISMEX_NOSEND);
1382 }
#define TRUE
Definition: types.h:120
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:231
#define GetWin32ClientInfo()
Definition: ntuser.h:320
DWORD CTI_flags
Definition: ntuser.h:165
#define CTI_INSENDMESSAGE
Definition: ntuser.h:161

Referenced by ClientRpcChannelBuffer_SendReceive(), co_IntCallWindowProc(), DoMessage(), and insendmessage_wnd_proc().

◆ InSendMessageEx()

DWORD WINAPI InSendMessageEx ( LPVOID  lpReserved)

Definition at line 1390 of file message.c.

1392 {
1393  PCLIENTTHREADINFO pcti = GetWin32ClientInfo()->pClientThreadInfo;
1394  if (pcti && !(pcti->CTI_flags & CTI_INSENDMESSAGE))
1395  return ISMEX_NOSEND;
1396  else
1398 }
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:231
#define GetWin32ClientInfo()
Definition: ntuser.h:320
DWORD CTI_flags
Definition: ntuser.h:165
#define CTI_INSENDMESSAGE
Definition: ntuser.h:161

Referenced by clipboard_wnd_proc(), DoBuildPrefix(), DoMessage(), DumpInSMEX(), insendmessage_wnd_proc(), and winproc_wrapper().

◆ IntBroadcastSystemMessage()

LONG WINAPI IntBroadcastSystemMessage ( DWORD  dwflags,
LPDWORD  lpdwRecipients,
UINT  uiMessage,
WPARAM  wParam,
LPARAM  lParam,
PBSMINFO  pBSMInfo,
BOOL  Ansi 
)

Definition at line 3300 of file message.c.

3308 {
3309  BROADCASTPARM parm;
3310  DWORD recips = BSM_ALLCOMPONENTS;
3311  BOOL ret = -1; // Set to return fail
3312  static const DWORD all_flags = ( BSF_QUERY | BSF_IGNORECURRENTTASK | BSF_FLUSHDISK | BSF_NOHANG
3314  | BSF_ALLOWSFW | BSF_SENDNOTIFYMESSAGE | BSF_RETURNHDESK | BSF_LUID );
3315 
3316  if ((dwflags & ~all_flags) ||
3317  (!pBSMInfo && (dwflags & (BSF_RETURNHDESK|BSF_LUID))) )
3318  {
3320  return 0;
3321  }
3322 
3323  if(uiMessage >= WM_USER && uiMessage < 0xC000)
3324  {
3326  return 0;
3327  }
3328 
3330 
3331  if (dwflags & BSF_QUERY) dwflags &= ~BSF_SENDNOTIFYMESSAGE|BSF_POSTMESSAGE;
3332 
3333  if (!lpdwRecipients)
3334  lpdwRecipients = &recips;
3335 
3337  {
3339  return 0;
3340  }
3341 
3342  if ( pBSMInfo && (dwflags & BSF_QUERY) )
3343  {
3344  if (pBSMInfo->cbSize != sizeof(BSMINFO))
3345  {
3347  return 0;
3348  }
3349  }
3350 
3351  parm.hDesk = NULL;
3352  parm.hWnd = NULL;
3353  parm.flags = dwflags;
3354  parm.recipients = *lpdwRecipients;
3355 
3356  if (dwflags & BSF_LUID) parm.luid = pBSMInfo->luid;
3357 
3359  uiMessage,
3360  wParam,
3361  lParam,
3362  (ULONG_PTR)&parm,
3364  Ansi);
3365 
3366  if (!ret)
3367  {
3368  if ( pBSMInfo && (dwflags & BSF_QUERY) )
3369  {
3370  pBSMInfo->hdesk = parm.hDesk;
3371  pBSMInfo->hwnd = parm.hWnd;
3372  }
3373  }
3374  return ret;
3375 }
#define BSM_ALLCOMPONENTS
Definition: dbt.h:47
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define BSF_FORCEIFHUNG
Definition: dbt.h:54
#define BSF_IGNORECURRENTTASK
Definition: dbt.h:55
HDESK hDesk
Definition: ntuser.h:1063
DWORD recipients
Definition: ntuser.h:1062
#define BSF_NOTIMEOUTIFNOTHUNG
Definition: dbt.h:57
#define BSF_QUERY
Definition: dbt.h:59
#define BSF_NOHANG
Definition: dbt.h:56
#define BSF_POSTMESSAGE
Definition: dbt.h:58
WPARAM wParam
Definition: combotst.c:138
uint32_t ULONG_PTR
Definition: typedefs.h:63
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
BOOL APIENTRY NtUserMessageCall(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR ResultInfo, DWORD dwType, BOOL Ansi)
Definition: message.c:2323
#define BSM_NETDRIVER
Definition: dbt.h:51
unsigned long DWORD
Definition: ntddk_ex.h:95
#define BSF_FLUSHDISK
Definition: dbt.h:53
#define SetLastError(x)
Definition: compat.h:417
int ret
DWORD flags
Definition: ntuser.h:1061
static _In_ DWORD dwflags
Definition: dispmode.c:64
#define BSM_VXDS
Definition: dbt.h:52
#define WM_USER
Definition: winuser.h:1877
#define FNID_BROADCASTSYSTEMMESSAGE
Definition: ntuser.h:849
#define BSM_ALLDESKTOPS
Definition: dbt.h:49
#define BSM_INSTALLABLEDRIVERS
Definition: dbt.h:50
LPARAM lParam
Definition: combotst.c:139
#define BSM_APPLICATIONS
Definition: dbt.h:48

Referenced by BroadcastSystemMessageA(), BroadcastSystemMessageExA(), BroadcastSystemMessageExW(), and BroadcastSystemMessageW().

◆ IntCallMessageProc()

static LRESULT WINAPI IntCallMessageProc ( IN PWND  Wnd,
IN HWND  hWnd,
IN UINT  Msg,
IN WPARAM  wParam,
IN LPARAM  lParam,
IN BOOL  Ansi 
)
static

Definition at line 1746 of file message.c.

1747 {
1748  WNDPROC WndProc;
1749  BOOL IsAnsi;
1750  PCLS Class;
1751 
1752  Class = DesktopPtrToUser(Wnd->pcls);
1753  WndProc = NULL;
1754 
1755  if ( Wnd->head.pti != GetW32ThreadInfo())
1756  { // Must be inside the same thread!
1758  return 0;
1759  }
1760  /*
1761  This is the message exchange for user32. If there's a need to monitor messages,
1762  do it here!
1763  */
1764  TRACE("HWND %p, MSG %u, WPARAM %p, LPARAM %p, Ansi %d\n", hWnd, Msg, wParam, lParam, Ansi);
1765 // if (Class->fnid <= FNID_GHOST && Class->fnid >= FNID_BUTTON )
1766  if (Class->fnid <= FNID_GHOST && Class->fnid >= FNID_FIRST )
1767  {
1768  if (Ansi)
1769  {
1770  if (GETPFNCLIENTW(Class->fnid) == Wnd->lpfnWndProc)
1771  WndProc = GETPFNCLIENTA(Class->fnid);
1772  }
1773  else
1774  {
1775  if (GETPFNCLIENTA(Class->fnid) == Wnd->lpfnWndProc)
1776  WndProc = GETPFNCLIENTW(Class->fnid);
1777  }
1778 
1779  IsAnsi = Ansi;
1780 
1781  if (!WndProc)
1782  {
1783  IsAnsi = !Wnd->Unicode;
1784  WndProc = Wnd->lpfnWndProc;
1785  }
1786  }
1787  else
1788  {
1789  IsAnsi = !Wnd->Unicode;
1790  WndProc = Wnd->lpfnWndProc;
1791  }
1792 /*
1793  Message caller can be Ansi/Unicode and the receiver can be Unicode/Ansi or
1794  the same.
1795  */
1796  if (!Ansi)
1797  return IntCallWindowProcW(IsAnsi, WndProc, Wnd, hWnd, Msg, wParam, lParam);
1798  else
1799  return IntCallWindowProcA(IsAnsi, WndProc, Wnd, hWnd, Msg, wParam, lParam);
1800 }
static const WCHAR Class[]
Definition: cfgmgr.c:39
static LRESULT FASTCALL IntCallWindowProcA(BOOL IsAnsiProc, WNDPROC WndProc, PWND pWnd, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1583
#define GETPFNCLIENTW(fnid)
Definition: ntuser.h:867
struct @1591 Msg[]
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:781
static __inline PVOID DesktopPtrToUser(PVOID Ptr)
Definition: user_x.h:12
unsigned int BOOL
Definition: ntddk_ex.h:94
LRESULT FASTCALL IntCallWindowProcW(BOOL IsAnsiProc, WNDPROC WndProc, PWND pWnd, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1424
smooth NULL
Definition: ftsmooth.c:416
Definition: ntuser.h:533
#define TRACE(s)
Definition: solgame.cpp:4
#define SetLastError(x)
Definition: compat.h:417
#define GETPFNCLIENTA(fnid)
Definition: ntuser.h:865
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: solitaire.cpp:598
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2880
#define FNID_GHOST
Definition: ntuser.h:837
#define ERROR_MESSAGE_SYNC_ONLY
Definition: winerror.h:681
#define FNID_FIRST
Definition: ntuser.h:820
LPARAM lParam
Definition: combotst.c:139

Referenced by DispatchMessageA(), DispatchMessageW(), SendMessageA(), and SendMessageW().

◆ IntCallWindowProcA()

static LRESULT FASTCALL IntCallWindowProcA ( BOOL  IsAnsiProc,
WNDPROC  WndProc,
PWND  pWnd,
HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1583 of file message.c.

1590 {
1591  MSG AnsiMsg;
1592  MSG UnicodeMsg;
1593  BOOL Hook = FALSE, MsgOverride = FALSE, Dialog, DlgOverride = FALSE;
1594  LRESULT Result = 0, PreResult = 0;
1595  DWORD Data = 0;
1596 
1597  TRACE("IntCallWindowProcA: IsAnsiProc : %s, WndProc %p, pWnd %p, hWnd %p, Msg %u, wParam %Iu, lParam %Iu.\n",
1598  IsAnsiProc ? "TRUE" : "FALSE", WndProc, pWnd, hWnd, Msg, wParam, lParam);
1599 
1600  if (WndProc == NULL)
1601  {
1602  WARN("IntCallWindowsProcA() called with WndProc = NULL!\n");
1603  return FALSE;
1604  }
1605 
1606  if (pWnd)
1607  Dialog = (pWnd->fnid == FNID_DIALOG);
1608  else
1609  Dialog = FALSE;
1610 
1611  Hook = BeginIfHookedUserApiHook();
1612  if (Hook)
1613  {
1614  if (Dialog)
1615  DlgOverride = IsMsgOverride( Msg, &guah.DlgProcArray);
1616  MsgOverride = IsMsgOverride( Msg, &guah.WndProcArray);
1617  }
1618 
1619  if (IsAnsiProc)
1620  {
1621  if (Hook && (MsgOverride || DlgOverride))
1622  {
1623  _SEH2_TRY
1624  {
1625  if (!DlgOverride)
1626  PreResult = guah.PreWndProc(hWnd, Msg, wParam, lParam, (ULONG_PTR)&Result, &Data );
1627  else
1628  PreResult = guah.PreDefDlgProc(hWnd, Msg, wParam, lParam, (ULONG_PTR)&Result, &Data );
1629  }
1631  {
1632  ERR("Got exception in hooked PreWndProc, dlg:%d!\n", DlgOverride);
1633  }
1634  _SEH2_END;
1635  }
1636 
1637  if (PreResult) goto Exit;
1638 
1639  if (!Dialog)
1641  else
1642  {
1643  _SEH2_TRY
1644  {
1646  }
1648  {
1649  ERR("Exception Dialog Ansi %p Msg %d pti %p Wndpti %p\n",WndProc,Msg,GetW32ThreadInfo(),pWnd->head.pti);
1650  }
1651  _SEH2_END;
1652  }
1653 
1654  if (Hook && (MsgOverride || DlgOverride))
1655  {
1656  _SEH2_TRY
1657  {
1658  if (!DlgOverride)
1660  else
1662  }
1664  {
1665  ERR("Got exception in hooked PostWndProc, dlg:%d!\n", DlgOverride);
1666  }
1667  _SEH2_END;
1668  }
1669  }
1670  else
1671  {
1672  AnsiMsg.hwnd = hWnd;
1673  AnsiMsg.message = Msg;
1674  AnsiMsg.wParam = wParam;
1675  AnsiMsg.lParam = lParam;
1676  AnsiMsg.time = 0;
1677  AnsiMsg.pt.x = 0;
1678  AnsiMsg.pt.y = 0;
1679  if (! MsgiAnsiToUnicodeMessage(hWnd, &UnicodeMsg, &AnsiMsg))
1680  {
1681  goto Exit;
1682  }
1683 
1684  if (Hook && (MsgOverride || DlgOverride))
1685  {
1686  _SEH2_TRY
1687  {
1688  if (!DlgOverride)
1689  PreResult = guah.PreWndProc(UnicodeMsg.hwnd, UnicodeMsg.message, UnicodeMsg.wParam, UnicodeMsg.lParam, (ULONG_PTR)&Result, &Data );
1690  else
1691  PreResult = guah.PreDefDlgProc(UnicodeMsg.hwnd, UnicodeMsg.message, UnicodeMsg.wParam, UnicodeMsg.lParam, (ULONG_PTR)&Result, &Data );
1692  }
1694  {
1695  ERR("Got exception in hooked PreWndProc, dlg:%d!\n", DlgOverride);
1696  }
1697  _SEH2_END;
1698  }
1699 
1700  if (PreResult) goto Exit;
1701 
1702  if (!Dialog)
1703  Result = CALL_EXTERN_WNDPROC(WndProc, UnicodeMsg.hwnd, UnicodeMsg.message, UnicodeMsg.wParam, UnicodeMsg.lParam);
1704  else
1705  {
1706  _SEH2_TRY
1707  {
1708  Result = CALL_EXTERN_WNDPROC(WndProc, UnicodeMsg.hwnd, UnicodeMsg.message, UnicodeMsg.wParam, UnicodeMsg.lParam);
1709  }
1711  {
1712  ERR("Exception Dialog unicode %p Msg %d pti %p Wndpti %p\n",WndProc, Msg,GetW32ThreadInfo(),pWnd->head.pti);
1713  }
1714  _SEH2_END;
1715  }
1716 
1717  if (Hook && (MsgOverride || DlgOverride))
1718  {
1719  _SEH2_TRY
1720  {
1721  if (!DlgOverride)
1722  guah.PostWndProc(UnicodeMsg.hwnd, UnicodeMsg.message, UnicodeMsg.wParam, UnicodeMsg.lParam, (ULONG_PTR)&Result, &Data );
1723  else
1724  guah.PostDefDlgProc(UnicodeMsg.hwnd, UnicodeMsg.message, UnicodeMsg.wParam, UnicodeMsg.lParam, (ULONG_PTR)&Result, &Data );
1725  }
1727  {
1728  ERR("Got exception in hooked PostWndProc, dlg:%d!\n", DlgOverride);
1729  }
1730  _SEH2_END;
1731  }
1732 
1733  if (! MsgiAnsiToUnicodeReply(&UnicodeMsg, &AnsiMsg, &Result))
1734  {
1735  goto Exit;
1736  }
1737  }
1738 
1739 Exit:
1740  if (Hook) EndUserApiHook();
1741  return Result;
1742 }
#define CALL_EXTERN_WNDPROC(proc, h, m, w, l)
Definition: message.c:27
BOOL FASTCALL EndUserApiHook(VOID)
Definition: usrapihk.c:164
WNDPROC_OWP PostDefDlgProc
Definition: undocuser.h:343
UAHOWP DlgProcArray
Definition: undocuser.h:344
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define WARN(fmt,...)
Definition: debug.h:111
struct @1591 Msg[]
USERAPIHOOK guah
Definition: usrapihk.c:344
HWND hWnd
Definition: settings.c:17
static BOOL FASTCALL MsgiAnsiToUnicodeReply(LPMSG UnicodeMsg, LPMSG AnsiMsg, LRESULT *Result)
Definition: message.c:820
WPARAM wParam
Definition: combotst.c:138
_SEH2_TRY
Definition: create.c:4250
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:781
uint32_t ULONG_PTR
Definition: typedefs.h:63
BOOL FASTCALL IsMsgOverride(UINT, PUAHOWP)
Definition: usrapihk.c:63
WNDPROC_OWP PostWndProc
Definition: undocuser.h:340
DWORD fnid
Definition: ntuser.h:673
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FNID_DIALOG
Definition: ntuser.h:831
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
THRDESKHEAD head
Definition: ntuser.h:659
static BOOL FASTCALL MsgiAnsiToUnicodeMessage(HWND hwnd, LPMSG UnicodeMsg, LPMSG AnsiMsg)
Definition: message.c:516
smooth NULL
Definition: ftsmooth.c:416
_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:426
#define TRACE(s)
Definition: solgame.cpp:4
static void Exit(void)
Definition: sock.c:1331
unsigned long DWORD
Definition: ntddk_ex.h:95
WNDPROC_OWP PreDefDlgProc
Definition: undocuser.h:342
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: solitaire.cpp:598
#define ERR(fmt,...)
Definition: debug.h:109
_SEH2_END
Definition: create.c:4424
Definition: window.h:371
WNDPROC_OWP PreWndProc
Definition: undocuser.h:339
BOOL FASTCALL BeginIfHookedUserApiHook(VOID)
Definition: usrapihk.c:106
UAHOWP WndProcArray
Definition: undocuser.h:341
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139

Referenced by CallWindowProcA(), and IntCallMessageProc().

◆ IntCallWindowProcW()

LRESULT FASTCALL IntCallWindowProcW ( BOOL  IsAnsiProc,
WNDPROC  WndProc,
PWND  pWnd,
HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1424 of file message.c.

1431 {
1432  MSG AnsiMsg;
1433  MSG UnicodeMsg;
1434  BOOL Hook = FALSE, MsgOverride = FALSE, Dialog, DlgOverride = FALSE;
1435  LRESULT Result = 0, PreResult = 0;
1436  DWORD Data = 0;
1437 
1438  if (WndProc == NULL)
1439  {
1440  WARN("IntCallWindowsProcW() called with WndProc = NULL!\n");
1441  return FALSE;
1442  }
1443 
1444  if (pWnd)
1445  Dialog = (pWnd->fnid == FNID_DIALOG);
1446  else
1447  Dialog = FALSE;
1448 
1449  Hook = BeginIfHookedUserApiHook();
1450  if (Hook)
1451  {
1452  if (Dialog)
1453  DlgOverride = IsMsgOverride( Msg, &guah.DlgProcArray);
1454  MsgOverride = IsMsgOverride( Msg, &guah.WndProcArray);
1455  }
1456 
1457  if (IsAnsiProc)
1458  {
1459  UnicodeMsg.hwnd = hWnd;
1460  UnicodeMsg.message = Msg;
1461  UnicodeMsg.wParam = wParam;
1462  UnicodeMsg.lParam = lParam;
1463  UnicodeMsg.time = 0;
1464  UnicodeMsg.pt.x = 0;
1465  UnicodeMsg.pt.y = 0;
1466  if (! MsgiUnicodeToAnsiMessage(hWnd, &AnsiMsg, &UnicodeMsg))
1467  {
1468  goto Exit;
1469  }
1470 
1471  if (Hook && (MsgOverride || DlgOverride))
1472  {
1473  _SEH2_TRY
1474  {
1475  if (!DlgOverride)
1476  PreResult = guah.PreWndProc(AnsiMsg.hwnd, AnsiMsg.message, AnsiMsg.wParam, AnsiMsg.lParam, (ULONG_PTR)&Result, &Data );
1477  else
1478  PreResult = guah.PreDefDlgProc(AnsiMsg.hwnd, AnsiMsg.message, AnsiMsg.wParam, AnsiMsg.lParam, (ULONG_PTR)&Result, &Data );
1479  }
1481  {
1482  ERR("Got exception in hooked PreWndProc, dlg:%d!\n", DlgOverride);
1483  }
1484  _SEH2_END;
1485  }
1486 
1487  if (PreResult) goto Exit;
1488 
1489  if (!Dialog)
1490  Result = CALL_EXTERN_WNDPROC(WndProc, AnsiMsg.hwnd, AnsiMsg.message, AnsiMsg.wParam, AnsiMsg.lParam);
1491  else
1492  {
1493  _SEH2_TRY
1494  {
1495  Result = CALL_EXTERN_WNDPROC(WndProc, AnsiMsg.hwnd, AnsiMsg.message, AnsiMsg.wParam, AnsiMsg.lParam);
1496  }
1498  {
1499  ERR("Exception Dialog Ansi %p Msg %d pti %p Wndpti %p\n",WndProc,Msg,GetW32ThreadInfo(),pWnd->head.pti);
1500  }
1501  _SEH2_END;
1502  }
1503 
1504  if (Hook && (MsgOverride || DlgOverride))
1505  {
1506  _SEH2_TRY
1507  {
1508  if (!DlgOverride)
1509  guah.PostWndProc(AnsiMsg.hwnd, AnsiMsg.message, AnsiMsg.wParam, AnsiMsg.lParam, (ULONG_PTR)&Result, &Data );
1510  else
1511  guah.PostDefDlgProc(AnsiMsg.hwnd, AnsiMsg.message, AnsiMsg.wParam, AnsiMsg.lParam, (ULONG_PTR)&Result, &Data );
1512  }
1514  {
1515  ERR("Got exception in hooked PostWndProc, dlg:%d!\n", DlgOverride);
1516  }
1517  _SEH2_END;
1518  }
1519 
1520  if (! MsgiUnicodeToAnsiReply(&AnsiMsg, &UnicodeMsg, &Result))
1521  {
1522  goto Exit;
1523  }
1524  }
1525  else
1526  {
1527  if (Hook && (MsgOverride || DlgOverride))
1528  {
1529  _SEH2_TRY
1530  {
1531  if (!DlgOverride)
1532  PreResult = guah.PreWndProc(hWnd, Msg, wParam, lParam, (ULONG_PTR)&Result, &Data );
1533  else
1534  PreResult = guah.PreDefDlgProc(hWnd, Msg, wParam, lParam, (ULONG_PTR)&Result, &Data );
1535  }
1537  {
1538  ERR("Got exception in hooked PreWndProc, dlg:%d!\n", DlgOverride);
1539  }
1540  _SEH2_END;
1541  }
1542 
1543  if (PreResult) goto Exit;
1544 
1545  if (!Dialog)
1547  else
1548  {
1549  _SEH2_TRY
1550  {
1552  }
1554  {
1555  ERR("Exception Dialog unicode %p Msg %d pti %p Wndpti %p\n",WndProc, Msg,GetW32ThreadInfo(),pWnd->head.pti);
1556  }
1557  _SEH2_END;
1558  }
1559 
1560  if (Hook && (MsgOverride || DlgOverride))
1561  {
1562  _SEH2_TRY
1563  {
1564  if (!DlgOverride)
1566  else
1568  }
1570  {
1571  ERR("Got exception in hooked PostWndProc, dlg:%d!\n", DlgOverride);
1572  }
1573  _SEH2_END;
1574  }
1575  }
1576 
1577 Exit:
1578  if (Hook) EndUserApiHook();
1579  return Result;
1580 }
#define CALL_EXTERN_WNDPROC(proc, h, m, w, l)
Definition: message.c:27
BOOL FASTCALL EndUserApiHook(VOID)
Definition: usrapihk.c:164
WNDPROC_OWP PostDefDlgProc
Definition: undocuser.h:343
UAHOWP DlgProcArray
Definition: undocuser.h:344
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define WARN(fmt,...)
Definition: debug.h:111
struct @1591 Msg[]
USERAPIHOOK guah
Definition: usrapihk.c:344
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
_SEH2_TRY
Definition: create.c:4250
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:781
uint32_t ULONG_PTR
Definition: typedefs.h:63
BOOL FASTCALL IsMsgOverride(UINT, PUAHOWP)
Definition: usrapihk.c:63
WNDPROC_OWP PostWndProc
Definition: undocuser.h:340
DWORD fnid
Definition: ntuser.h:673
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL FASTCALL MsgiUnicodeToAnsiMessage(HWND hwnd, LPMSG AnsiMsg, LPMSG UnicodeMsg)
Definition: message.c:873
#define FNID_DIALOG
Definition: ntuser.h:831
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
THRDESKHEAD head
Definition: ntuser.h:659
smooth NULL
Definition: ftsmooth.c:416
_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:426
static void Exit(void)
Definition: sock.c:1331
unsigned long DWORD
Definition: ntddk_ex.h:95
WNDPROC_OWP PreDefDlgProc
Definition: undocuser.h:342
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: solitaire.cpp:598
#define ERR(fmt,...)
Definition: debug.h:109
_SEH2_END
Definition: create.c:4424
Definition: window.h:371
WNDPROC_OWP PreWndProc
Definition: undocuser.h:339
BOOL FASTCALL BeginIfHookedUserApiHook(VOID)
Definition: usrapihk.c:106
UAHOWP WndProcArray
Definition: undocuser.h:341
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
static BOOL FASTCALL MsgiUnicodeToAnsiReply(LPMSG AnsiMsg, LPMSG UnicodeMsg, LRESULT *Result)
Definition: message.c:1251
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139

Referenced by CallWindowProcW(), IntCallMessageProc(), and User32CallWindowProcFromKernel().

◆ IntConvertMsgToAnsi()

static VOID IntConvertMsgToAnsi ( LPMSG  lpMsg)
static

Definition at line 2064 of file message.c.

2065 {
2066  CHAR ch[2];
2067  WCHAR wch[2];
2068 
2069  switch (lpMsg->message)
2070  {
2071  case WM_CHAR:
2072  case WM_DEADCHAR:
2073  case WM_SYSCHAR:
2074  case WM_SYSDEADCHAR:
2075  case WM_MENUCHAR:
2076  wch[0] = LOWORD(lpMsg->wParam);
2077  wch[1] = HIWORD(lpMsg->wParam);
2078  ch[0] = ch[1] = 0;
2079  WideCharToMultiByte(CP_THREAD_ACP, 0, wch, 2, ch, 2, NULL, NULL);
2080  lpMsg->wParam = MAKEWPARAM(ch[0] | (ch[1] << 8), 0);
2081  break;
2082  }
2083 }
#define MAKEWPARAM(l, h)
Definition: winuser.h:3948
#define WM_CHAR
Definition: winuser.h:1699
#define WideCharToMultiByte
Definition: compat.h:101
#define WM_MENUCHAR
Definition: winuser.h:1730
char CHAR
Definition: xmlstorage.h:175
WPARAM wParam
Definition: winuser.h:3090
#define WM_SYSCHAR
Definition: winuser.h:1703
smooth NULL
Definition: ftsmooth.c:416
#define WM_DEADCHAR
Definition: winuser.h:1700
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_SYSDEADCHAR
Definition: winuser.h:1704
#define HIWORD(l)
Definition: typedefs.h:246
#define CP_THREAD_ACP
Definition: winnls.h:230
UINT message
Definition: winuser.h:3089
#define LOWORD(l)
Definition: pedump.c:82

Referenced by GetMessageA(), and PeekMessageA().

◆ is_pointer_message()

static int is_pointer_message ( UINT  message)
inlinestatic

Definition at line 98 of file message.c.

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

Referenced by DispatchMessageA(), DispatchMessageW(), SendMessageCallbackA(), SendMessageCallbackW(), SendNotifyMessageA(), and SendNotifyMessageW().

◆ IsDialogMessageA()

BOOL WINAPI IsDialogMessageA ( HWND  hwndDlg,
LPMSG  pmsg 
)

Definition at line 3291 of file message.c.

3292 {
3293  MSG msg = *pmsg;
3294  msg.wParam = map_wparam_AtoW( msg.message, msg.wParam );
3295  return IsDialogMessageW( hwndDlg, &msg );
3296 }
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
static WPARAM FASTCALL map_wparam_AtoW(UINT message, WPARAM wparam)
Definition: message.c:281
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI IsDialogMessageW(_In_ HWND, _In_ LPMSG)

◆ IsInsideMessagePumpHook()

BOOL WINAPI IsInsideMessagePumpHook ( )

Definition at line 3077 of file message.c.

3078 { // FF uses this and polls it when Min/Max
3079  PCLIENTTHREADINFO pcti = GetWin32ClientInfo()->pClientThreadInfo;
3080  return (gfMessagePumpHook && pcti && (pcti->dwcPumpHook > 0));
3081 }
#define GetWin32ClientInfo()
Definition: ntuser.h:320
DWORD gfMessagePumpHook
Definition: message.c:3075
DWORD dwcPumpHook
Definition: ntuser.h:171

Referenced by GetQueueStatus(), and MsgWaitForMultipleObjectsEx().

◆ listbox_has_strings()

static BOOL FASTCALL listbox_has_strings ( HWND  hwnd)
static

Definition at line 114 of file message.c.

115 {
118 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define LBS_HASSTRINGS
Definition: pedump.c:684
#define LBS_OWNERDRAWFIXED
Definition: pedump.c:682
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GWL_STYLE
Definition: winuser.h:846
#define LBS_OWNERDRAWVARIABLE
Definition: pedump.c:683
Arabic default style
Definition: afstyles.h:93

Referenced by MsgiAnsiToUnicodeCleanup(), MsgiAnsiToUnicodeMessage(), MsgiAnsiToUnicodeReply(), MsgiUnicodeToAnsiCleanup(), MsgiUnicodeToAnsiMessage(), and MsgiUnicodeToAnsiReply().

◆ map_wparam_AtoW()

static WPARAM FASTCALL map_wparam_AtoW ( UINT  message,
WPARAM  wparam 
)
static

Definition at line 281 of file message.c.

282 {
283  char ch[2];
284  WCHAR wch[2];
285 
286  wch[0] = wch[1] = 0;
287  switch(message)
288  {
289  case WM_CHAR:
290  /* WM_CHAR is magic: a DBCS char can be sent/posted as two consecutive WM_CHAR
291  * messages, in which case the first char is stored, and the conversion
292  * to Unicode only takes place once the second char is sent/posted.
293  */
294 #if 0
295  if (mapping != WMCHAR_MAP_NOMAPPING) // NlsMbCodePageTag
296  {
298 
299  struct wm_char_mapping_data *data = get_user_thread_info()->wmchar_data;
300 
301  BYTE low = LOBYTE(wparam);
302 
303  if (HIBYTE(wparam))
304  {
305  ch[0] = low;
306  ch[1] = HIBYTE(wparam);
307  RtlMultiByteToUnicodeN( wch, sizeof(wch), NULL, ch, 2 );
308  TRACE( "map %02x,%02x -> %04x mapping %u\n", (BYTE)ch[0], (BYTE)ch[1], wch[0], mapping );
309  if (data) data->lead_byte[mapping] = 0;
310  }
311  else if (data && data->lead_byte[mapping])
312  {
313  ch[0] = data->lead_byte[mapping];
314  ch[1] = low;
315  RtlMultiByteToUnicodeN( wch, sizeof(wch), NULL, ch, 2 );
316  TRACE( "map stored %02x,%02x -> %04x mapping %u\n", (BYTE)ch[0], (BYTE)ch[1], wch[0], mapping );
317  data->lead_byte[mapping] = 0;
318  }
319  else if (!IsDBCSLeadByte( low ))
320  {
321  ch[0] = low;
322  RtlMultiByteToUnicodeN( wch, sizeof(wch), NULL, ch, 1 );
323  TRACE( "map %02x -> %04x\n", (BYTE)ch[0], wch[0] );
324  if (data) data->lead_byte[mapping] = 0;
325  }
326  else /* store it and wait for trail byte */
327  {
328  if (!data)
329  {
330  if (!(data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data) )))
331  return FALSE;
332  get_user_thread_info()->wmchar_data = data;
333  }
334  TRACE( "storing lead byte %02x mapping %u\n", low, mapping );
335  data->lead_byte[mapping] = low;
336  return FALSE;
337  }
338  wparam = MAKEWPARAM(wch[0], wch[1]);
339  break;
340  }
341 #endif
342  /* else fall through */
343  case WM_CHARTOITEM:
344  case EM_SETPASSWORDCHAR:
345  case WM_DEADCHAR:
346  case WM_SYSCHAR:
347  case WM_SYSDEADCHAR:
348  case WM_MENUCHAR:
349  ch[0] = LOBYTE(wparam);
350  ch[1] = HIBYTE(wparam);
351  RtlMultiByteToUnicodeN( wch, sizeof(wch), NULL, ch, 2 );
352  wparam = MAKEWPARAM(wch[0], wch[1]);
353  break;
354  case WM_IME_CHAR:
355  ch[0] = HIBYTE(wparam);
356  ch[1] = LOBYTE(wparam);
357  if (ch[0]) RtlMultiByteToUnicodeN( wch, sizeof(wch[0]), NULL, ch, 2 );
358  else RtlMultiByteToUnicodeN( wch, sizeof(wch[0]), NULL, ch + 1, 1 );
359  wparam = MAKEWPARAM(wch[0], HIWORD(wparam));
360  break;
361  }
362  return wparam;
363 }
Definition: tftpd.h:59
#define MAKEWPARAM(l, h)
Definition: winuser.h:3948
#define WM_CHAR
Definition: winuser.h:1699
#define WM_IME_CHAR
Definition: winuser.h:1816
#define LOBYTE(W)
Definition: jmemdos.c:487
#define WM_MENUCHAR
Definition: winuser.h:1730
NTSYSAPI NTSTATUS WINAPI RtlMultiByteToUnicodeN(LPWSTR, DWORD, LPDWORD, LPCSTR, DWORD)
#define HIBYTE(W)
Definition: jmemdos.c:486
#define GetWin32ClientInfo()
Definition: ntuser.h:320
#define WM_CHARTOITEM
Definition: winuser.h:1631
#define WM_SYSCHAR
Definition: winuser.h:1703
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI IsDBCSLeadByte(BYTE TestByte)
Definition: nls.c:2237
#define WM_DEADCHAR
Definition: winuser.h:1700
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define EM_SETPASSWORDCHAR
Definition: winuser.h:1996
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
unsigned char BYTE
Definition: mem.h:68
#define WM_SYSDEADCHAR
Definition: winuser.h:1704
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define HIWORD(l)
Definition: typedefs.h:246
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by IsDialogMessageA(), and MsgiAnsiToUnicodeMessage().

◆ map_wparam_char_WtoA()

static WPARAM FASTCALL map_wparam_char_WtoA ( WPARAM  wParam,
DWORD  len 
)
static

Definition at line 262 of file message.c.

263 {
264  WCHAR wch = wParam;
265  BYTE ch[2];
267 
268  len = WideCharToMultiByte( cp, 0, &wch, 1, (LPSTR)ch, len, NULL, NULL );
269  if (len == 2)
270  return MAKEWPARAM( (ch[0] << 8) | ch[1], HIWORD(wParam) );
271  else
272  return MAKEWPARAM( ch[0], HIWORD(wParam) );
273 }
#define MAKEWPARAM(l, h)
Definition: winuser.h:3948
#define WideCharToMultiByte
Definition: compat.h:101
char * LPSTR
Definition: xmlstorage.h:182
WPARAM wParam
Definition: combotst.c:138
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
DWORD FASTCALL get_input_codepage(void)
Definition: message.c:252
POINT cp
Definition: magnifier.c:59
#define HIWORD(l)
Definition: typedefs.h:246

Referenced by MsgiUnicodeToAnsiMessage().

◆ MessageCleanup()

VOID FASTCALL MessageCleanup ( VOID  )

Definition at line 3281 of file message.c.

3282 {
3285 }
CRITICAL_SECTION gcsMPH
Definition: message.c:3065
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
static CRITICAL_SECTION DdeCrst
Definition: message.c:177

Referenced by Cleanup(), and ClientThreadSetupHelper().

◆ MessageInit()

BOOL FASTCALL MessageInit ( VOID  )

Definition at line 3273 of file message.c.

3274 {
3277 
3278  return TRUE;
3279 }
CRITICAL_SECTION gcsMPH
Definition: message.c:3065
#define TRUE
Definition: types.h:120
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
static CRITICAL_SECTION DdeCrst
Definition: message.c:177

Referenced by ClientThreadSetupHelper().

◆ MsgiAnsiToUnicodeCleanup()

static BOOL FASTCALL MsgiAnsiToUnicodeCleanup ( LPMSG  UnicodeMsg,
LPMSG  AnsiMsg 
)
static

Definition at line 708 of file message.c.

709 {
711 
712  switch (AnsiMsg->message)
713  {
714  case LB_GETTEXT:
715  if (!listbox_has_strings( UnicodeMsg->hwnd )) break;
716  case CB_GETLBTEXT:
717  if (UnicodeMsg->message == CB_GETLBTEXT && !combobox_has_strings( UnicodeMsg->hwnd )) break;
718  case WM_GETTEXT:
719  case WM_ASKCBFORMATNAME:
720  {
721  if (!UnicodeMsg->lParam) break;
722  RtlFreeHeap(GetProcessHeap(), 0, (PVOID) UnicodeMsg->lParam);
723  break;
724  }
725 
726  case WM_SETTEXT:
727  case WM_WININICHANGE:
728  case WM_DEVMODECHANGE:
729  case CB_DIR:
730  case LB_DIR:
731  case LB_ADDFILE:
732  case EM_REPLACESEL:
733  {
734  if (!UnicodeMsg->lParam) break;
737  break;
738  }
739 
740  case LB_ADDSTRING:
741  case LB_ADDSTRING_LOWER:
742  case LB_ADDSTRING_UPPER:
743  case LB_INSERTSTRING:
746  case LB_FINDSTRING:
747  case LB_FINDSTRINGEXACT:
748  case LB_SELECTSTRING:
749  {
750  if (UnicodeMsg->lParam && listbox_has_strings(AnsiMsg->hwnd))
751  {
754  }
755  break;
756  }
757 
758  case CB_ADDSTRING:
759  case CB_INSERTSTRING:
760  case CB_FINDSTRING:
761  case CB_FINDSTRINGEXACT:
762  case CB_SELECTSTRING:
763  {
764  if (UnicodeMsg->lParam && combobox_has_strings(AnsiMsg->hwnd))
765  {
768  }
769  break;
770  }
771 
772  case WM_NCCREATE:
773  case WM_CREATE:
774  {
775  struct s
776  {
777  CREATESTRUCTW cs; /* new structure */
778  MDICREATESTRUCTW mdi_cs; /* MDI info */
779  LPWSTR lpszName; /* allocated Name */
780  LPWSTR lpszClass; /* allocated Class */
781  };
782 
783  struct s *xs = (struct s *)UnicodeMsg->lParam;
784  if (xs->lpszName)
785  {
786  RtlInitUnicodeString(&UnicodeString, (PCWSTR)xs->lpszName);
788  }
789  if (xs->lpszClass)
790  {
791  RtlInitUnicodeString(&UnicodeString, (PCWSTR)xs->lpszClass);
793  }
794  HeapFree(GetProcessHeap(), 0, xs);
795  break;
796  }
797 
798  case WM_MDICREATE:
799  {
800  MDICREATESTRUCTW *cs = (MDICREATESTRUCTW *)UnicodeMsg->lParam;
803  if (!IS_ATOM(cs->szClass))
804  {
807  }
808  HeapFree(GetProcessHeap(), 0, cs);
809  break;
810  }
811  }
812 
813  return(TRUE);
814 }
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define LB_INSERTSTRING_LOWER
Definition: controls.h:87
#define TRUE
Definition: types.h:120
#define LB_DIR
Definition: winuser.h:2015
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1980
#define LB_FINDSTRINGEXACT
Definition: winuser.h:2017
#define LB_ADDFILE
Definition: winuser.h:2012
#define LB_ADDSTRING
Definition: winuser.h:2013
#define CB_GETLBTEXT
Definition: winuser.h:1934
#define WM_ASKCBFORMATNAME
Definition: winuser.h:1855
#define WM_GETTEXT
Definition: winuser.h:1600
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define WM_DEVMODECHANGE
Definition: winuser.h:1613
#define WM_NCCREATE
Definition: winuser.h:1665
#define LB_SELECTSTRING
Definition: winuser.h:2038
#define LB_ADDSTRING_UPPER
Definition: controls.h:88
uint32_t cs
Definition: isohybrid.c:75
static BOOL FASTCALL combobox_has_strings(HWND hwnd)
Definition: message.c:107
#define CB_ADDSTRING
Definition: winuser.h:1918
#define CB_INSERTSTRING
Definition: winuser.h:1939
#define WM_WININICHANGE
Definition: winuser.h:1612
LPARAM lParam
Definition: winuser.h:3091
#define WM_SETTEXT
Definition: winuser.h:1599
#define GetProcessHeap()
Definition: compat.h:403
if(!(yy_init))
Definition: macro.lex.yy.c:714
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
static BOOL FASTCALL listbox_has_strings(HWND hwnd)
Definition: message.c:114
#define LB_GETTEXT
Definition: winuser.h:2031
#define CB_SELECTSTRING
Definition: winuser.h:1942
GLdouble s
Definition: gl.h:2039
#define LB_INSERTSTRING_UPPER
Definition: controls.h:86
#define LB_FINDSTRING
Definition: winuser.h:2016
#define CB_DIR
Definition: winuser.h:1920
#define LB_ADDSTRING_LOWER
Definition: controls.h:89
HWND hwnd
Definition: winuser.h:3088
#define WM_MDICREATE
Definition: winuser.h:1794
#define WM_CREATE
Definition: winuser.h:1590
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define IS_ATOM(x)
Definition: class.h:3
WCHAR * LPWSTR
Definition: xmlstorage.h:184
UINT message
Definition: winuser.h:3089
#define CB_FINDSTRING
Definition: winuser.h:1921
#define LB_INSERTSTRING
Definition: winuser.h:2035
#define HeapFree(x, y, z)
Definition: compat.h:402
#define EM_REPLACESEL
Definition: winuser.h:1988
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1922

Referenced by DesktopWndProcA(), MsgiAnsiToUnicodeReply(), SendMessageA(), SendMessageCallbackA(), SendMessageTimeoutA(), and SendNotifyMessageA().

◆ MsgiAnsiToUnicodeMessage()

static BOOL FASTCALL MsgiAnsiToUnicodeMessage ( HWND  hwnd,
LPMSG  UnicodeMsg,
LPMSG  AnsiMsg 
)
static

Definition at line 516 of file message.c.

517 {
519 
520  *UnicodeMsg = *AnsiMsg;
521 
522  switch (AnsiMsg->message)
523  {
524  case WM_GETTEXT:
525  case WM_ASKCBFORMATNAME:
526  {
527  LPWSTR Buffer;
528  if (!AnsiMsg->lParam) break;
530  //ERR("WM_GETTEXT A2U Size %d\n",AnsiMsg->wParam);
531  if (!Buffer) return FALSE;
532  UnicodeMsg->lParam = (LPARAM)Buffer;
533  break;
534  }
535 
536  case LB_GETTEXT:
537  {
538  DWORD Size = 1024 * sizeof(WCHAR);
539  if (!AnsiMsg->lParam || !listbox_has_strings( AnsiMsg->hwnd )) break;
540  /*Size = SendMessageW( AnsiMsg->hwnd, LB_GETTEXTLEN, AnsiMsg->wParam, 0 );
541  if (Size == LB_ERR)
542  {
543  ERR("LB_GETTEXT LB_ERR\n");
544  Size = sizeof(ULONG_PTR);
545  }
546  Size = (Size + 1) * sizeof(WCHAR);*/
548  if (!UnicodeMsg->lParam) return FALSE;
549  break;
550  }
551 
552  case CB_GETLBTEXT:
553  {
554  DWORD Size = 1024 * sizeof(WCHAR);
555  if (!AnsiMsg->lParam || !combobox_has_strings( AnsiMsg->hwnd )) break;
556  /*Size = SendMessageW( AnsiMsg->hwnd, CB_GETLBTEXTLEN, AnsiMsg->wParam, 0 );
557  if (Size == LB_ERR)
558  {
559  ERR("CB_GETTEXT LB_ERR\n");
560  Size = sizeof(ULONG_PTR);
561  }
562  Size = (Size + 1) * sizeof(WCHAR);*/
564  if (!UnicodeMsg->lParam) return FALSE;
565  break;
566  }
567 
568  /* AnsiMsg->lParam is string (0-terminated) */
569  case WM_SETTEXT:
570  case WM_WININICHANGE:
571  case WM_DEVMODECHANGE:
572  case CB_DIR:
573  case LB_DIR:
574  case LB_ADDFILE:
575  case EM_REPLACESEL:
576  {
577  if (!AnsiMsg->lParam) break;
579  UnicodeMsg->lParam = (LPARAM)UnicodeString.Buffer;
580  break;
581  }
582 
583  case LB_ADDSTRING:
584  case LB_ADDSTRING_LOWER:
585  case LB_ADDSTRING_UPPER:
586  case LB_INSERTSTRING:
589  case LB_FINDSTRING:
590  case LB_FINDSTRINGEXACT:
591  case LB_SELECTSTRING:
592  {
593  if (AnsiMsg->lParam && listbox_has_strings(AnsiMsg->hwnd))
594  {
596  UnicodeMsg->lParam = (LPARAM)UnicodeString.Buffer;
597  }
598  break;
599  }
600 
601  case CB_ADDSTRING:
602  case CB_INSERTSTRING:
603  case CB_FINDSTRING:
604  case CB_FINDSTRINGEXACT:
605  case CB_SELECTSTRING:
606  {
607  if (AnsiMsg->lParam && combobox_has_strings(AnsiMsg->hwnd))
608  {
610  UnicodeMsg->lParam = (LPARAM)UnicodeString.Buffer;
611  }
612  break;
613  }
614 
615  case WM_NCCREATE:
616  case WM_CREATE:
617  {
618  struct s
619  {
620  CREATESTRUCTW cs; /* new structure */
621  MDICREATESTRUCTW mdi_cs; /* MDI info */
622  LPCWSTR lpszName; /* allocated Name */
623  LPCWSTR lpszClass; /* allocated Class */
624  };
625 
626  struct s *xs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct s));
627  if (!xs)
628  {
629  return FALSE;
630  }
631  xs->cs = *(CREATESTRUCTW *)AnsiMsg->lParam;
632  if (!IS_INTRESOURCE(xs->cs.lpszName))
633  {
635  xs->lpszName = xs->cs.lpszName = UnicodeString.Buffer;
636  }
637  if (!IS_ATOM(xs->cs.lpszClass))
638  {
640  xs->lpszClass = xs->cs.lpszClass = UnicodeString.Buffer;
641  }
642 
644  {
645  xs->mdi_cs = *(MDICREATESTRUCTW *)xs->cs.lpCreateParams;
646  xs->mdi_cs.szTitle = xs->cs.lpszName;
647  xs->mdi_cs.szClass = xs->cs.lpszClass;
648  xs->cs.lpCreateParams = &xs->mdi_cs;
649  }
650 
651  UnicodeMsg->lParam = (LPARAM)xs;
652  break;
653  }
654 
655  case WM_MDICREATE:
656  {
658  (MDICREATESTRUCTW *)HeapAlloc(GetProcessHeap(), 0, sizeof(*cs));
659 
660  if (!cs)
661  {
662  return FALSE;
663  }
664 
665  *cs = *(MDICREATESTRUCTW *)AnsiMsg->lParam;
666 
667  if (!IS_ATOM(cs->szClass))
668  {
670  cs->szClass = UnicodeString.Buffer;
671  }
672 
674  cs->szTitle = UnicodeString.Buffer;
675 
676  UnicodeMsg->lParam = (LPARAM)cs;
677  break;
678  }
679 
680  case WM_GETDLGCODE:
681  if (UnicodeMsg->lParam)
682  {
683  MSG newmsg = *(MSG *)UnicodeMsg->lParam;
684  newmsg.wParam = map_wparam_AtoW( newmsg.message, newmsg.wParam);
685  }
686  break;
687 
688  case WM_CHARTOITEM:
689  case WM_MENUCHAR:
690  case WM_CHAR:
691  case WM_DEADCHAR:
692  case WM_SYSCHAR:
693  case WM_SYSDEADCHAR:
694  case EM_SETPASSWORDCHAR:
695  case WM_IME_CHAR:
696  UnicodeMsg->wParam = map_wparam_AtoW( AnsiMsg->message, AnsiMsg->wParam );
697  break;
698  case EM_GETLINE:
699  ERR("FIXME EM_GETLINE A2U\n");
700  break;
701 
702  }
703 
704  return TRUE;
705 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define LB_INSERTSTRING_LOWER
Definition: controls.h:87
#define TRUE
Definition: types.h:120
#define LB_DIR
Definition: winuser.h:2015
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1980
#define LB_FINDSTRINGEXACT
Definition: winuser.h:2017
#define LB_ADDFILE
Definition: winuser.h:2012
#define WM_GETDLGCODE
Definition: winuser.h:1671
#define WM_CHAR
Definition: winuser.h:1699
#define WM_IME_CHAR
Definition: winuser.h:1816
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define LB_ADDSTRING
Definition: winuser.h:2013
#define WM_MENUCHAR
Definition: winuser.h:1730
#define CB_GETLBTEXT
Definition: winuser.h:1934
#define WM_ASKCBFORMATNAME
Definition: winuser.h:1855
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define WM_GETTEXT
Definition: winuser.h:1600
#define WM_DEVMODECHANGE
Definition: winuser.h:1613
#define GWL_EXSTYLE
Definition: winuser.h:845
WPARAM wParam
Definition: winuser.h:3090
char * LPSTR
Definition: xmlstorage.h:182
#define WM_NCCREATE
Definition: winuser.h:1665
#define LB_SELECTSTRING
Definition: winuser.h:2038
#define LB_ADDSTRING_UPPER
Definition: controls.h:88
static WPARAM FASTCALL map_wparam_AtoW(UINT message, WPARAM wparam)
Definition: message.c:281
uint32_t cs
Definition: isohybrid.c:75
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define WM_CHARTOITEM
Definition: winuser.h:1631
static BOOL FASTCALL combobox_has_strings(HWND hwnd)
Definition: message.c:107
#define WM_SYSCHAR
Definition: winuser.h:1703
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define CB_INSERTSTRING
Definition: winuser.h:1939
#define WM_WININICHANGE
Definition: winuser.h:1612
LPARAM lParam
Definition: winuser.h:3091
LONG_PTR LPARAM
Definition: windef.h:208
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
Definition: bufpool.h:45
#define WM_SETTEXT
Definition: winuser.h:1599
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
#define WM_DEADCHAR
Definition: winuser.h:1700
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
#define GetProcessHeap()
Definition: compat.h:403
#define EM_SETPASSWORDCHAR
Definition: winuser.h:1996
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
if(!(yy_init))
Definition: macro.lex.yy.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL FASTCALL listbox_has_strings(HWND hwnd)
Definition: message.c:114
#define LB_GETTEXT
Definition: winuser.h:2031
#define CB_SELECTSTRING
Definition: winuser.h:1942
GLdouble s
Definition: gl.h:2039
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define LB_INSERTSTRING_UPPER
Definition: controls.h:86
#define ERR(fmt,...)
Definition: debug.h:109
#define LB_FINDSTRING
Definition: winuser.h:2016
#define CB_DIR
Definition: winuser.h:1920
#define LB_ADDSTRING_LOWER
Definition: controls.h:89
#define WM_SYSDEADCHAR
Definition: winuser.h:1704
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
HWND hwnd
Definition: winuser.h:3088
#define WM_MDICREATE
Definition: winuser.h:1794
#define WM_CREATE
Definition: winuser.h:1590
#define EM_GETLINE
Definition: winuser.h:1973
#define IS_ATOM(x)
Definition: class.h:3
WCHAR * LPWSTR
Definition: xmlstorage.h:184
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
UINT message
Definition: winuser.h:3089
#define CB_FINDSTRING
Definition: winuser.h:1921
#define LB_INSERTSTRING
Definition: winuser.h:2035
#define EM_REPLACESEL
Definition: winuser.h:1988
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1922

Referenced by DesktopWndProcA(), DispatchMessageA(), IntCallWindowProcA(), SendMessageA(), SendMessageCallbackA(), SendMessageTimeoutA(), and SendNotifyMessageA().

◆ MsgiAnsiToUnicodeReply()

static BOOL FASTCALL MsgiAnsiToUnicodeReply ( LPMSG  UnicodeMsg,
LPMSG  AnsiMsg,
LRESULT Result 
)
static

Definition at line 820 of file message.c.

821 {
822  LPWSTR Buffer = (LPWSTR)UnicodeMsg->lParam;
823  LPSTR AnsiBuffer = (LPSTR)AnsiMsg->lParam;
824 
825  switch (AnsiMsg->message)
826  {
827  case WM_GETTEXT:
828  case WM_ASKCBFORMATNAME:
829  {
830  if (UnicodeMsg->wParam)
831  {
832  DWORD len = 0;
833  if (*Result) RtlUnicodeToMultiByteN( AnsiBuffer, UnicodeMsg->wParam - 1, &len, Buffer, strlenW(Buffer) * sizeof(WCHAR));
834  AnsiBuffer[len] = 0;
835  *Result = len;
836  //ERR("WM_GETTEXT U2A Result %d Size %d\n",*Result,AnsiMsg->wParam);
837  }
838  break;
839  }
840  case LB_GETTEXT:
841  {
842  if (!AnsiBuffer || !listbox_has_strings( UnicodeMsg->hwnd )) break;
843  if (*Result >= 0)
844  {
845  DWORD len;
846  RtlUnicodeToMultiByteN( AnsiBuffer, ~0u, &len, Buffer, (strlenW(Buffer) + 1) * sizeof(WCHAR) );
847  *Result = len - 1;
848  }
849  break;
850  }
851  case CB_GETLBTEXT:
852  {
853  if (!AnsiBuffer || !combobox_has_strings( UnicodeMsg->hwnd )) break;
854  if (*Result >= 0)
855  {
856  DWORD len;
857  RtlUnicodeToMultiByteN( AnsiBuffer, ~0u, &len, Buffer, (strlenW(Buffer) + 1) * sizeof(WCHAR) );
858  *Result = len - 1;
859  }
860  break;
861  }
862  }
863 
864  MsgiAnsiToUnicodeCleanup(UnicodeMsg, AnsiMsg);
865 
866  return TRUE;
867 }
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 * u
Definition: glfuncs.h:240
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define CB_GETLBTEXT
Definition: winuser.h:1934
#define WM_ASKCBFORMATNAME
Definition: winuser.h:1855
#define WM_GETTEXT
Definition: winuser.h:1600
WPARAM wParam
Definition: winuser.h:3090
char * LPSTR
Definition: xmlstorage.h:182
static BOOL FASTCALL combobox_has_strings(HWND hwnd)
Definition: message.c:107
_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:426
LPARAM lParam
Definition: winuser.h:3091
Definition: bufpool.h:45
static BOOL FASTCALL MsgiAnsiToUnicodeCleanup(LPMSG UnicodeMsg, LPMSG AnsiMsg)
Definition: message.c:708
__wchar_t WCHAR
Definition: xmlstorage.h:180
CHAR AnsiBuffer[1024]
Definition: debug.c:15
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL FASTCALL listbox_has_strings(HWND hwnd)
Definition: message.c:114
NTSYSAPI NTSTATUS NTAPI RtlUnicodeToMultiByteN(PCHAR MbString, ULONG MbSize, PULONG ResultSize, PCWCH UnicodeString, ULONG UnicodeSize)
#define LB_GETTEXT
Definition: winuser.h:2031
GLenum GLsizei len
Definition: glext.h:6722
HWND hwnd
Definition: winuser.h:3088
WCHAR * LPWSTR
Definition: xmlstorage.h:184
UINT message
Definition: winuser.h:3089

Referenced by DispatchMessageA(), IntCallWindowProcA(), SendMessageA(), and SendMessageTimeoutA().

◆ MsgiKMToUMCleanup()

static VOID FASTCALL MsgiKMToUMCleanup ( PMSG  KMMsg,
PMSG  UMMsg 
)
static

Definition at line 487 of file message.c.

488 {
489  switch (KMMsg->message)
490  {
491  case WM_DDE_EXECUTE:
492 #ifdef TODO // Kept as historic.
493  HeapFree(GetProcessHeap(), 0, (LPVOID) KMMsg->lParam);
494  GlobalUnlock((HGLOBAL) UMMsg->lParam);
495 #endif
496  break;
497  default:
498  break;
499  }
500 
501  return;
502 }
LPARAM lParam
Definition: winuser.h:3091
#define GetProcessHeap()
Definition: compat.h:403
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
UINT message
Definition: winuser.h:3089
#define WM_DDE_EXECUTE
Definition: dde.h:45
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by MsgiKMToUMReply().

◆ MsgiKMToUMMessage()

static BOOL FASTCALL MsgiKMToUMMessage ( PMSG  KMMsg,
PMSG  UMMsg 
)
static

Definition at line 431 of file message.c.

432 {
433  *UMMsg = *KMMsg;
434 
435  if (KMMsg->lParam == 0) return TRUE;
436 
437  switch (UMMsg->message)
438  {
439  case WM_CREATE:
440  case WM_NCCREATE:
441  {
442  CREATESTRUCTW *Cs = (CREATESTRUCTW *) KMMsg->lParam;
443  PCHAR Class;
444  Cs->lpszName = (LPCWSTR) ((PCHAR) Cs + (DWORD_PTR) Cs->lpszName);
445  Class = (PCHAR) Cs + (DWORD_PTR) Cs->lpszClass;
446  if (L'A' == *((WCHAR *) Class))
447  {
448  Class += sizeof(WCHAR);
449  Cs->lpszClass = (LPCWSTR)(DWORD_PTR) (*((ATOM *) Class));
450  }
451  else
452  {
453  ASSERT(L'S' == *((WCHAR *) Class));
454  Class += sizeof(WCHAR);
455  Cs->lpszClass = (LPCWSTR) Class;
456  }
457  }
458  break;
459 
460  case WM_COPYDATA:
461  {
462  PCOPYDATASTRUCT pKMCopyData = (PCOPYDATASTRUCT)KMMsg->lParam;
463  pKMCopyData->lpData = pKMCopyData + 1;
464  }
465  break;
466 
467  case WM_COPYGLOBALDATA:
468  {
469  PVOID Data;
470  HGLOBAL hGlobal = GlobalAlloc(GHND | GMEM_SHARE, KMMsg->wParam);
471  Data = GlobalLock(hGlobal);
472  if (Data) RtlCopyMemory(Data, (PVOID)KMMsg->lParam, KMMsg->wParam);
473  GlobalUnlock(hGlobal);
474  TRACE("WM_COPYGLOBALDATA to User hGlobal %p\n",hGlobal);
475  UMMsg->lParam = (LPARAM)hGlobal;
476  }
477  break;
478 
479  default:
480  break;
481  }
482 
483  return TRUE;
484 }
signed char * PCHAR
Definition: retypes.h:7
static const WCHAR Class[]
Definition: cfgmgr.c:39
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
WORD ATOM
Definition: dimm.idl:113
WPARAM wParam
Definition: winuser.h:3090
#define GMEM_SHARE
Definition: winbase.h:302
#define WM_NCCREATE
Definition: winuser.h:1665
#define GHND
Definition: winbase.h:294
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:778
LPARAM lParam
Definition: winuser.h:3091
LONG_PTR LPARAM
Definition: windef.h:208
#define PCHAR
Definition: match.c:90
#define WM_COPYDATA
Definition: winuser.h:1646
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
LPCWSTR lpszName
Definition: winuser.h:2938
struct tagCOPYDATASTRUCT * PCOPYDATASTRUCT
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define WM_COPYGLOBALDATA
Definition: undocuser.h:36
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define WM_CREATE
Definition: winuser.h:1590
LPCWSTR lpszClass
Definition: winuser.h:2939
UINT message
Definition: winuser.h:3089

Referenced by User32CallWindowProcFromKernel().

◆ MsgiKMToUMReply()

static BOOL FASTCALL MsgiKMToUMReply ( PMSG  KMMsg,
PMSG  UMMsg,
LRESULT Result 
)
static

Definition at line 505 of file message.c.

506 {
507  MsgiKMToUMCleanup(KMMsg, UMMsg);
508 
509  return TRUE;
510 }
#define TRUE
Definition: types.h:120
static VOID FASTCALL MsgiKMToUMCleanup(PMSG KMMsg, PMSG UMMsg)
Definition: message.c:487

Referenced by User32CallWindowProcFromKernel().

◆ MsgiUMToKMCleanup()

static VOID FASTCALL MsgiUMToKMCleanup ( PMSG  UMMsg,
PMSG  KMMsg 
)
static

Definition at line 411 of file message.c.

412 {
413  switch (KMMsg->message)
414  {
415  case WM_COPYDATA:
416  HeapFree(GetProcessHeap(), 0, (LPVOID) KMMsg->lParam);
417  break;
418  case WM_COPYGLOBALDATA:
419  TRACE("WM_COPYGLOBALDATA cleanup return\n");
420  GlobalUnlock((HGLOBAL)UMMsg->lParam);
421  GlobalFree((HGLOBAL)UMMsg->lParam);
422  break;
423  default:
424  break;
425  }
426 
427  return;
428 }
LPARAM lParam
Definition: winuser.h:3091
#define WM_COPYDATA
Definition: winuser.h:1646
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define WM_COPYGLOBALDATA
Definition: undocuser.h:36
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
UINT message
Definition: winuser.h:3089
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by SendMessageA(), SendMessageTimeoutA(), SendMessageTimeoutW(), and SendMessageW().

◆ MsgiUMToKMMessage()

static BOOL FASTCALL MsgiUMToKMMessage ( PMSG  UMMsg,
PMSG  KMMsg,
BOOL  Posted 
)
static

Definition at line 367 of file message.c.

368 {
369  *KMMsg = *UMMsg;
370 
371  switch (UMMsg->message)
372  {
373  case WM_COPYDATA:
374  {
375  PCOPYDATASTRUCT pUMCopyData = (PCOPYDATASTRUCT)UMMsg->lParam;
376  PCOPYDATASTRUCT pKMCopyData;
377 
378  pKMCopyData = HeapAlloc(GetProcessHeap(), 0, sizeof(COPYDATASTRUCT) + pUMCopyData->cbData);
379  if (!pKMCopyData)
380  {
382  return FALSE;
383  }
384 
385  pKMCopyData->dwData = pUMCopyData->dwData;
386  pKMCopyData->cbData = pUMCopyData->cbData;
387  pKMCopyData->lpData = pKMCopyData + 1;
388 
389  RtlCopyMemory(pKMCopyData + 1, pUMCopyData->lpData, pUMCopyData->cbData);
390 
391  KMMsg->lParam = (LPARAM)pKMCopyData;
392  }
393  break;
394 
395  case WM_COPYGLOBALDATA:
396  {
397  KMMsg->lParam = (LPARAM)GlobalLock((HGLOBAL)UMMsg->lParam);;
398  TRACE("WM_COPYGLOBALDATA get data ptr %p\n",KMMsg->lParam);
399  }
400  break;
401 
402  default:
403  break;
404  }
405 
406  return TRUE;
407 }
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
ULONG_PTR dwData
Definition: winuser.h:2975
LPARAM lParam
Definition: winuser.h:3091
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_COPYDATA
Definition: winuser.h:1646
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define SetLastError(x)
Definition: compat.h:417
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
struct tagCOPYDATASTRUCT * PCOPYDATASTRUCT
#define WM_COPYGLOBALDATA
Definition: undocuser.h:36
struct tagCOPYDATASTRUCT COPYDATASTRUCT
UINT message
Definition: winuser.h:3089
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by SendMessageA(), SendMessageTimeoutA(), SendMessageTimeoutW(), and SendMessageW().

◆ MsgiUnicodeToAnsiCleanup()

static BOOL FASTCALL MsgiUnicodeToAnsiCleanup ( LPMSG  AnsiMsg,
LPMSG  UnicodeMsg 
)
static

Definition at line 1155 of file message.c.

1156 {
1158 
1159  switch(UnicodeMsg->message)
1160  {
1161  case LB_GETTEXT:
1162  if (!listbox_has_strings( AnsiMsg->hwnd )) break;
1163  case CB_GETLBTEXT:
1164  if (AnsiMsg->message == CB_GETLBTEXT && !combobox_has_strings( AnsiMsg->hwnd )) break;
1165  case WM_GETTEXT:
1166  case WM_ASKCBFORMATNAME:
1167  {
1168  if (!AnsiMsg->lParam) break;
1169  RtlFreeHeap(GetProcessHeap(), 0, (PVOID) AnsiMsg->lParam);
1170  break;
1171  }
1172  case WM_CREATE:
1173  case WM_NCCREATE:
1174  {
1175  CREATESTRUCTA* Cs;
1176 
1177  Cs = (CREATESTRUCTA*) AnsiMsg->lParam;
1178  RtlFreeHeap(GetProcessHeap(), 0, Cs);
1179  break;
1180  }
1181 
1182  case WM_SETTEXT:
1183  case WM_WININICHANGE:
1184  case WM_DEVMODECHANGE:
1185  case CB_DIR:
1186  case LB_DIR:
1187  case LB_ADDFILE:
1188  case EM_REPLACESEL:
1189  {
1190  if (!AnsiMsg->lParam) break;
1191  RtlInitAnsiString(&AnsiString, (PSTR) AnsiMsg->lParam);
1193  break;
1194  }
1195 
1196  case LB_ADDSTRING:
1197  case LB_ADDSTRING_LOWER:
1198  case LB_ADDSTRING_UPPER:
1199  case LB_INSERTSTRING:
1200  case LB_INSERTSTRING_UPPER:
1201  case LB_INSERTSTRING_LOWER:
1202  case LB_FINDSTRING:
1203  case LB_FINDSTRINGEXACT:
1204  case LB_SELECTSTRING:
1205  {
1206  if (AnsiMsg->lParam && listbox_has_strings(AnsiMsg->hwnd))
1207  {
1208  RtlInitAnsiString(&AnsiString, (PSTR) AnsiMsg->lParam);
1210  }
1211  break;
1212  }
1213 
1214  case CB_ADDSTRING:
1215  case CB_INSERTSTRING:
1216  case CB_FINDSTRING:
1217  case CB_FINDSTRINGEXACT:
1218  case CB_SELECTSTRING:
1219  {
1220  if (AnsiMsg->lParam && combobox_has_strings(AnsiMsg->hwnd))
1221  {
1222  RtlInitAnsiString(&AnsiString, (PSTR) AnsiMsg->lParam);
1224  }
1225  break;
1226  }
1227 
1228  case WM_MDICREATE:
1229  {
1230  MDICREATESTRUCTA *cs = (MDICREATESTRUCTA *)AnsiMsg->lParam;
1231  RtlInitAnsiString(&AnsiString, (PCSTR)cs->szTitle);
1233  if (!IS_ATOM(cs->szClass))
1234  {
1235  RtlInitAnsiString(&AnsiString, (PCSTR)cs->szClass);
1237  }
1238  HeapFree(GetProcessHeap(), 0, cs);
1239  break;
1240  }
1241 
1242  }
1243 
1244  return TRUE;
1245 }
#define LB_INSERTSTRING_LOWER
Definition: controls.h:87
#define TRUE
Definition: types.h:120
#define LB_DIR
Definition: winuser.h:2015
#define LB_FINDSTRINGEXACT
Definition: winuser.h:2017
#define LB_ADDFILE
Definition: winuser.h:2012
#define LB_ADDSTRING
Definition: winuser.h:2013
#define CB_GETLBTEXT
Definition: winuser.h:1934
#define WM_ASKCBFORMATNAME
Definition: winuser.h:1855
#define WM_GETTEXT
Definition: winuser.h:1600
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define WM_DEVMODECHANGE
Definition: winuser.h:1613
#define WM_NCCREATE
Definition: winuser.h:1665
#define LB_SELECTSTRING
Definition: winuser.h:2038
#define LB_ADDSTRING_UPPER
Definition: controls.h:88
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
uint32_t cs
Definition: isohybrid.c:75
static BOOL FASTCALL combobox_has_strings(HWND hwnd)
Definition: message.c:107
#define CB_ADDSTRING
Definition: winuser.h:1918
#define CB_INSERTSTRING
Definition: winuser.h:1939
#define WM_WININICHANGE
Definition: winuser.h:1612
LPARAM lParam
Definition: winuser.h:3091
#define WM_SETTEXT
Definition: winuser.h:1599
#define GetProcessHeap()
Definition: compat.h:403
NTSYSAPI VOID NTAPI RtlFreeAnsiString(PANSI_STRING AnsiString)
static BOOL FASTCALL listbox_has_strings(HWND hwnd)
Definition: message.c:114
#define LB_GETTEXT
Definition: winuser.h:2031
#define CB_SELECTSTRING
Definition: winuser.h:1942
#define LB_INSERTSTRING_UPPER
Definition: controls.h:86
#define LB_FINDSTRING
Definition: winuser.h:2016
#define CB_DIR
Definition: winuser.h:1920
#define LB_ADDSTRING_LOWER
Definition: controls.h:89
signed char * PSTR
Definition: retypes.h:7
HWND hwnd
Definition: winuser.h:3088
#define WM_MDICREATE
Definition: winuser.h:1794
#define WM_CREATE
Definition: winuser.h:1590
#define IS_ATOM(x)
Definition: class.h:3
const char * PCSTR
Definition: typedefs.h:51
UINT message
Definition: winuser.h:3089
#define CB_FINDSTRING
Definition: winuser.h:1921
#define LB_INSERTSTRING
Definition: winuser.h:2035
#define HeapFree(x, y, z)
Definition: compat.h:402
#define EM_REPLACESEL
Definition: winuser.h:1988
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1922

Referenced by MsgiUnicodeToAnsiReply().

◆ MsgiUnicodeToAnsiMessage()

static BOOL FASTCALL MsgiUnicodeToAnsiMessage ( HWND  hwnd,
LPMSG  AnsiMsg,
LPMSG  UnicodeMsg 
)
static

Definition at line 873 of file message.c.

874 {
877 
878  *AnsiMsg = *UnicodeMsg;
879 
880  switch(UnicodeMsg->message)
881  {
882  case WM_CREATE:
883  case WM_NCCREATE:
884  {
885  MDICREATESTRUCTA *pmdi_cs;
886  CREATESTRUCTA* CsA;
887  CREATESTRUCTW* CsW;
888  ULONG NameSize, ClassSize;
890 
891  CsW = (CREATESTRUCTW*)(UnicodeMsg->lParam);
894  if (NameSize == 0)
895  {
896  return FALSE;
897  }
898  ClassSize = 0;
899  if (!IS_ATOM(CsW->lpszClass))
900  {
903  if (ClassSize == 0)
904  {
905  return FALSE;
906  }
907  }
908 
909  CsA = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(CREATESTRUCTA) + sizeof(MDICREATESTRUCTA) + NameSize + ClassSize);
910  if (NULL == CsA)
911  {
912  return FALSE;
913  }
914  memcpy(CsA, CsW, sizeof(CREATESTRUCTW));
915 
916  /* pmdi_cs starts right after CsA */
917  pmdi_cs = (MDICREATESTRUCTA*)(CsA + 1);
918 
920  RtlInitEmptyAnsiString(&AnsiString, (PCHAR)(pmdi_cs + 1), NameSize);
922  if (! NT_SUCCESS(Status))
923  {
924  RtlFreeHeap(GetProcessHeap(), 0, CsA);
925  return FALSE;
926  }
927  CsA->lpszName = AnsiString.Buffer;
928  if (!IS_ATOM(CsW->lpszClass))
929  {
931  RtlInitEmptyAnsiString(&AnsiString, (PCHAR)(pmdi_cs + 1) + NameSize, ClassSize);
933  if (! NT_SUCCESS(Status))
934  {
935  RtlFreeHeap(GetProcessHeap(), 0, CsA);
936  return FALSE;
937  }
938  CsA->lpszClass = AnsiString.Buffer;
939  }
940 
942  {
943  *pmdi_cs = *(MDICREATESTRUCTA *)CsW->lpCreateParams;
944  pmdi_cs->szTitle = CsA->lpszName;
945  pmdi_cs->szClass = CsA->lpszClass;
946  CsA->lpCreateParams = pmdi_cs;
947  }
948 
949  AnsiMsg->lParam = (LPARAM)CsA;
950  break;
951  }
952  case WM_GETTEXT:
953  case WM_ASKCBFORMATNAME:
954  {
955  if (!UnicodeMsg->lParam) break;
956  /* Ansi string might contain MBCS chars so we need 2 * the number of chars */
957  AnsiMsg->lParam = (LPARAM) RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, UnicodeMsg->wParam * 2);
958  //ERR("WM_GETTEXT U2A Size %d\n",AnsiMsg->wParam);
959 
960  if (!AnsiMsg->lParam) return FALSE;
961  break;
962  }
963 
964  case LB_GETTEXT:
965  {
966  DWORD Size = 1024;
967  if (!UnicodeMsg->lParam || !listbox_has_strings( UnicodeMsg->hwnd )) break;
968  /*Size = SendMessageA( UnicodeMsg->hwnd, LB_GETTEXTLEN, UnicodeMsg->wParam, 0 );
969  if (Size == LB_ERR)
970  {
971  ERR("LB_GETTEXT LB_ERR\n");
972  Size = sizeof(ULONG_PTR);
973  }
974  Size = (Size + 1) * sizeof(WCHAR);*/
976  if (!AnsiMsg->lParam) return FALSE;
977  break;
978  }
979 
980  case CB_GETLBTEXT:
981  {
982  DWORD Size = 1024;
983  if (!UnicodeMsg->lParam || !combobox_has_strings( UnicodeMsg->hwnd )) break;
984  /*Size = SendMessageA( UnicodeMsg->hwnd, CB_GETLBTEXTLEN, UnicodeMsg->wParam, 0 );
985  if (Size == LB_ERR)
986  {
987  ERR("CB_GETTEXT LB_ERR\n");
988  Size = sizeof(ULONG_PTR);
989  }
990  Size = (Size + 1) * sizeof(WCHAR);*/
992  if (!AnsiMsg->lParam) return FALSE;
993  break;
994  }
995 
996  case WM_SETTEXT:
997  case WM_WININICHANGE:
998  case WM_DEVMODECHANGE:
999  case CB_DIR:
1000  case LB_DIR:
1001  case LB_ADDFILE:
1002  case EM_REPLACESEL:
1003  {
1004  if (!UnicodeMsg->lParam) break;
1007  &UnicodeString,
1008  TRUE)))
1009  {
1010  return FALSE;
1011  }
1012  AnsiMsg->lParam = (LPARAM) AnsiString.Buffer;
1013  break;
1014  }
1015 
1016  case LB_ADDSTRING:
1017  case LB_ADDSTRING_LOWER:
1018  case LB_ADDSTRING_UPPER:
1019  case LB_INSERTSTRING:
1020  case LB_INSERTSTRING_UPPER:
1021  case LB_INSERTSTRING_LOWER:
1022  case LB_FINDSTRING:
1023  case LB_FINDSTRINGEXACT:
1024  case LB_SELECTSTRING:
1025  {
1026  if (UnicodeMsg->lParam && listbox_has_strings(AnsiMsg->hwnd))
1027  {
1030  &UnicodeString,
1031  TRUE)))
1032  {
1033  return FALSE;
1034  }
1035  AnsiMsg->lParam = (LPARAM) AnsiString.Buffer;
1036  }
1037  break;
1038  }
1039 
1040  case CB_ADDSTRING:
1041  case CB_INSERTSTRING:
1042  case CB_FINDSTRING:
1043  case CB_FINDSTRINGEXACT:
1044  case CB_SELECTSTRING:
1045  {
1046  if (UnicodeMsg->lParam && combobox_has_strings(AnsiMsg->hwnd))
1047  {
1050  &UnicodeString,
1051  TRUE)))
1052  {
1053  return FALSE;
1054  }
1055  AnsiMsg->lParam = (LPARAM) AnsiString.Buffer;
1056  }
1057  break;
1058  }
1059 
1060  case WM_MDICREATE:
1061  {
1062  MDICREATESTRUCTA *cs =
1063  (MDICREATESTRUCTA *)HeapAlloc(GetProcessHeap(), 0, sizeof(*cs));
1064 
1065  if (!cs)
1066  {
1067  return FALSE;
1068  }
1069 
1070  *cs = *(MDICREATESTRUCTA *)UnicodeMsg->lParam;
1071 
1072  if (!IS_ATOM(cs->szClass))
1073  {
1076  &UnicodeString,
1077  TRUE)))
1078  {
1079  HeapFree(GetProcessHeap(), 0, cs);
1080  return FALSE;
1081  }
1082  cs->szClass = AnsiString.Buffer;
1083  }
1084 
1087  &UnicodeString,
1088  TRUE)))
1089  {
1090  if (!IS_ATOM(cs->szClass))
1091  {
1092  RtlInitAnsiString(&AnsiString, cs->szClass);
1094  }
1095 
1096  HeapFree(GetProcessHeap(), 0, cs);
1097  return FALSE;
1098  }
1099  cs->szTitle = AnsiString.Buffer;
1100 
1101  AnsiMsg->lParam = (LPARAM)cs;
1102  break;
1103  }
1104 
1105  case WM_GETDLGCODE:
1106  if (UnicodeMsg->lParam)
1107  {
1108  MSG newmsg = *(MSG *)UnicodeMsg->lParam;
1109  switch(newmsg.message)
1110  {
1111  case WM_CHAR:
1112  case WM_DEADCHAR:
1113  case WM_SYSCHAR:
1114  case WM_SYSDEADCHAR:
1115  newmsg.wParam = map_wparam_char_WtoA( newmsg.wParam, 1 );
1116  break;
1117  case WM_IME_CHAR:
1118  newmsg.wParam = map_wparam_char_WtoA( newmsg.wParam, 2 );
1119  break;
1120  }
1121  }
1122  break;
1123 
1124  case WM_CHAR:
1125  {
1126  WCHAR wch = UnicodeMsg->wParam;
1127  char ch[2];
1129  DWORD len = WideCharToMultiByte( cp, 0, &wch, 1, ch, 2, NULL, NULL );
1130  AnsiMsg->wParam = (BYTE)ch[0];
1131  if (len == 2) AnsiMsg->wParam = (BYTE)ch[1];
1132  }
1133  break;
1134 
1135  case WM_CHARTOITEM:
1136  case WM_MENUCHAR:
1137  case WM_DEADCHAR:
1138  case WM_SYSCHAR:
1139  case WM_SYSDEADCHAR:
1140  case EM_SETPASSWORDCHAR:
1141  AnsiMsg->wParam = map_wparam_char_WtoA(UnicodeMsg->wParam,1);
1142  break;
1143 
1144  case WM_IME_CHAR:
1145  AnsiMsg->wParam = map_wparam_char_WtoA(UnicodeMsg->wParam,2);
1146  break;
1147  case EM_GETLINE:
1148  ERR("FIXME EM_GETLINE U2A\n");
1149  break;
1150  }
1151  return TRUE;
1152 }
signed char * PCHAR
Definition: retypes.h:7
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define LB_INSERTSTRING_LOWER
Definition: controls.h:87
#define TRUE
Definition: types.h:120
NTSYSAPI DWORD WINAPI RtlUnicodeStringToAnsiSize(const UNICODE_STRING *)
#define LB_DIR
Definition: winuser.h:2015
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1980
#define LB_FINDSTRINGEXACT
Definition: winuser.h:2017
#define LB_ADDFILE
Definition: winuser.h:2012
#define WM_GETDLGCODE
Definition: winuser.h:1671
#define WM_CHAR
Definition: winuser.h:1699
#define WideCharToMultiByte
Definition: compat.h:101
#define WM_IME_CHAR
Definition: winuser.h:1816
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define LB_ADDSTRING
Definition: winuser.h:2013
#define WM_MENUCHAR
Definition: winuser.h:1730
#define CB_GETLBTEXT
Definition: winuser.h:1934
uint16_t * PWSTR
Definition: typedefs.h:54
#define WM_ASKCBFORMATNAME
Definition: winuser.h:1855
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define WM_GETTEXT
Definition: winuser.h:1600
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define WM_DEVMODECHANGE
Definition: winuser.h:1613
#define GWL_EXSTYLE
Definition: winuser.h:845
WPARAM wParam
Definition: winuser.h:3090
#define WM_NCCREATE
Definition: winuser.h:1665
#define LB_SELECTSTRING
Definition: winuser.h:2038
#define LB_ADDSTRING_UPPER
Definition: controls.h:88
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
LPCSTR lpszName
Definition: winuser.h:2923
uint32_t cs
Definition: isohybrid.c:75
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define WM_CHARTOITEM
Definition: winuser.h:1631
static BOOL FASTCALL combobox_has_strings(HWND hwnd)
Definition: message.c:107
static WPARAM FASTCALL map_wparam_char_WtoA(WPARAM wParam, DWORD len)
Definition: message.c:262
#define WM_SYSCHAR
Definition: winuser.h:1703
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define CB_INSERTSTRING
Definition: winuser.h:1939
smooth NULL
Definition: ftsmooth.c:416
#define WM_WININICHANGE
Definition: winuser.h:1612
LPARAM lParam
Definition: winuser.h:3091
LONG_PTR LPARAM
Definition: windef.h:208
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
#define WM_SETTEXT
Definition: winuser.h:1599
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
#define WM_DEADCHAR
Definition: winuser.h:1700
#define GetProcessHeap()
Definition: compat.h:403
#define EM_SETPASSWORDCHAR
Definition: winuser.h:1996
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
if(!(yy_init))
Definition: macro.lex.yy.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSYSAPI VOID NTAPI RtlFreeAnsiString(PANSI_STRING AnsiString)
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL FASTCALL listbox_has_strings(HWND hwnd)
Definition: message.c:114
#define LB_GETTEXT
Definition: winuser.h:2031
LPVOID lpCreateParams
Definition: winuser.h:2929
LPCWSTR lpszName
Definition: winuser.h:2938
#define CB_SELECTSTRING
Definition: winuser.h:1942
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define LB_INSERTSTRING_UPPER
Definition: controls.h:86
Status
Definition: gdiplustypes.h:24
DWORD FASTCALL get_input_codepage(void)
Definition: message.c:252
#define ERR(fmt,...)
Definition: debug.h:109
#define LB_FINDSTRING
Definition: winuser.h:2016
LPVOID lpCreateParams
Definition: winuser.h:2914
#define CB_DIR
Definition: winuser.h:1920
#define LB_ADDSTRING_LOWER
Definition: controls.h:89
#define WM_SYSDEADCHAR
Definition: winuser.h:1704
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
HWND hwnd
Definition: winuser.h:3088
#define WM_MDICREATE
Definition: winuser.h:1794
POINT cp
Definition: magnifier.c:59
#define WM_CREATE
Definition: winuser.h:1590
#define EM_GETLINE
Definition: winuser.h:1973
LPCWSTR lpszClass
Definition: winuser.h:2939
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define IS_ATOM(x)
Definition: class.h:3
UINT message
Definition: winuser.h:3089
#define CB_FINDSTRING
Definition: winuser.h:1921
#define LB_INSERTSTRING
Definition: winuser.h:2035
#define HeapFree(x, y, z)
Definition: compat.h:402
#define EM_REPLACESEL
Definition: winuser.h:1988
LPCSTR lpszClass
Definition: winuser.h:2924
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1922

Referenced by IntCallWindowProcW().

◆ MsgiUnicodeToAnsiReply()

static BOOL FASTCALL MsgiUnicodeToAnsiReply ( LPMSG  AnsiMsg,
LPMSG  UnicodeMsg,
LRESULT Result 
)
static

Definition at line 1251 of file message.c.

1252 {
1253  LPSTR Buffer = (LPSTR) AnsiMsg->lParam;
1254  LPWSTR UBuffer = (LPWSTR) UnicodeMsg->lParam;
1255 
1256  switch (UnicodeMsg->message)
1257  {
1258  case WM_GETTEXT:
1259  case WM_ASKCBFORMATNAME:
1260  {
1261  DWORD len = AnsiMsg->wParam;// * 2;
1262  if (len)
1263  {
1264  if (*Result)
1265  {
1266  RtlMultiByteToUnicodeN( UBuffer, AnsiMsg->wParam*sizeof(WCHAR), &len, Buffer, strlen(Buffer)+1 );
1267  *Result = len/sizeof(WCHAR) - 1; /* do not count terminating null */
1268  //ERR("WM_GETTEXT U2A Result %d Size %d\n",*Result,AnsiMsg->wParam);
1269  }
1270  UBuffer[*Result] = 0;
1271  }
1272  break;
1273  }
1274  case LB_GETTEXT:
1275  {
1276  if (!UBuffer || !listbox_has_strings( UnicodeMsg->hwnd )) break;
1277  if (*Result >= 0)
1278  {
1279  DWORD len;
1280  RtlMultiByteToUnicodeN( UBuffer, ~0u, &len, Buffer, strlen(Buffer) + 1 );
1281  *Result = len / sizeof(WCHAR) - 1;
1282  }
1283  break;
1284  }
1285  case CB_GETLBTEXT:
1286  {
1287  if (!UBuffer || !combobox_has_strings( UnicodeMsg->hwnd )) break;
1288  if (*Result >= 0)
1289  {
1290  DWORD len;
1291  RtlMultiByteToUnicodeN( UBuffer, ~0u, &len, Buffer, strlen(Buffer) + 1 );
1292  *Result = len / sizeof(WCHAR) - 1;
1293  }
1294  break;
1295  }
1296  }
1297 
1298  MsgiUnicodeToAnsiCleanup(AnsiMsg, UnicodeMsg);
1299 
1300  return TRUE;
1301 }
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 * u
Definition: glfuncs.h:240
#define TRUE
Definition: types.h:120
static BOOL FASTCALL MsgiUnicodeToAnsiCleanup(LPMSG AnsiMsg, LPMSG UnicodeMsg)
Definition: message.c:1155
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
NTSYSAPI NTSTATUS WINAPI RtlMultiByteToUnicodeN(LPWSTR, DWORD, LPDWORD, LPCSTR, DWORD)
#define CB_GETLBTEXT
Definition: winuser.h:1934
#define WM_ASKCBFORMATNAME
Definition: winuser.h:1855
#define WM_GETTEXT
Definition: winuser.h:1600
WPARAM wParam
Definition: winuser.h:3090
char * LPSTR
Definition: xmlstorage.h:182
static BOOL FASTCALL combobox_has_strings(HWND hwnd)
Definition: message.c:107
_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:426
LPARAM lParam
Definition: winuser.h:3091
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL FASTCALL listbox_has_strings(HWND hwnd)
Definition: message.c:114
#define LB_GETTEXT
Definition: winuser.h:2031
GLenum GLsizei len
Definition: glext.h:6722
HWND hwnd
Definition: winuser.h:3088
WCHAR * LPWSTR
Definition: xmlstorage.h:184
UINT message
Definition: winuser.h:3089

Referenced by IntCallWindowProcW().

◆ MsgWaitForMultipleObjects()

DWORD WINAPI MsgWaitForMultipleObjects ( DWORD  nCount,
CONST HANDLE lpHandles,
BOOL  fWaitAll,
DWORD  dwMilliseconds,
DWORD  dwWakeMask 
)

Definition at line 3261 of file message.c.

3267 {
3268  return MsgWaitForMultipleObjectsEx(nCount, lpHandles, dwMilliseconds,
3269  dwWakeMask, fWaitAll ? MWMO_WAITALL : 0);
3270 }
DWORD WINAPI MsgWaitForMultipleObjectsEx(DWORD nCount, CONST HANDLE *lpHandles, DWORD dwMilliseconds, DWORD dwWakeMask, DWORD dwFlags)
Definition: message.c:3247
#define MWMO_WAITALL
Definition: winuser.h:898

◆ MsgWaitForMultipleObjectsEx()

DWORD WINAPI MsgWaitForMultipleObjectsEx ( DWORD  nCount,
CONST HANDLE lpHandles,
DWORD  dwMilliseconds,
DWORD  dwWakeMask,
DWORD  dwFlags 
)

Definition at line 3247 of file message.c.

3253 {
3254  return IsInsideMessagePumpHook() ? gmph.RealMsgWaitForMultipleObjectsEx(nCount, lpHandles, dwMilliseconds, dwWakeMask, dwFlags) : RealMsgWaitForMultipleObjectsEx(nCount, lpHandles,dwMilliseconds, dwWakeMask, dwFlags);
3255 }
RealMsgWaitForMultipleObjectsExProc RealMsgWaitForMultipleObjectsEx
Definition: message.c:3051
DWORD WINAPI RealMsgWaitForMultipleObjectsEx(DWORD nCount, CONST HANDLE *pHandles, DWORD dwMilliseconds, DWORD dwWakeMask, DWORD dwFlags)
BOOL WINAPI IsInsideMessagePumpHook()
Definition: message.c:3077
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
USER_MESSAGE_PUMP_ADDRESSES gmph
Definition: message.c:3068

Referenced by MsgWaitForMultipleObjects().

◆ PeekMessageA()

BOOL WINAPI DECLSPEC_HOTPATCH PeekMessageA ( LPMSG  lpMsg,
HWND  hWnd,
UINT  wMsgFilterMin,
UINT  wMsgFilterMax,
UINT  wRemoveMsg 
)

Definition at line 2186 of file message.c.

2191 {
2192  BOOL Res;
2193 
2194  Res = PeekMessageWorker(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
2195  if (-1 == (int) Res || !Res)
2196  {
2197  return FALSE;
2198  }
2199 
2200  IntConvertMsgToAnsi(lpMsg);
2201 
2202  return Res;
2203 }
HWND hWnd
Definition: settings.c:17
unsigned int BOOL
Definition: ntddk_ex.h:94
static VOID IntConvertMsgToAnsi(LPMSG lpMsg)
Definition: message.c:2064
BOOL WINAPI PeekMessageWorker(PMSG pMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)
Definition: message.c:2144

◆ PeekMessageW()

BOOL WINAPI DECLSPEC_HOTPATCH PeekMessageW ( LPMSG  lpMsg,
HWND  hWnd,
UINT  wMsgFilterMin,
UINT  wMsgFilterMax,
UINT  wRemoveMsg 
)

Definition at line 2212 of file message.c.

2218 {
2219  BOOL Res;
2220 
2221  Res = PeekMessageWorker(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
2222  if (-1 == (int) Res || !Res)
2223  {
2224  return FALSE;
2225  }
2226 
2227  return Res;
2228 }
HWND hWnd
Definition: settings.c:17
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI PeekMessageWorker(PMSG pMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)
Definition: message.c:2144

◆ PeekMessageWorker()

BOOL WINAPI PeekMessageWorker ( PMSG  pMsg,
HWND  hWnd,
UINT  wMsgFilterMin,
UINT  wMsgFilterMax,
UINT  wRemoveMsg 
)

Definition at line 2144 of file message.c.

2149 {
2150  PCLIENTINFO pci;
2151  PCLIENTTHREADINFO pcti;
2152  pci = GetWin32ClientInfo();
2153  pcti = pci->pClientThreadInfo;
2154 
2155  if (!hWnd && pci && pcti)
2156  {
2157  pci->cSpins++;
2158 
2159  if ((pci->cSpins >= 100) && (pci->dwTIFlags & TIF_SPINNING))
2160  { // Yield after 100 spin cycles and ready to swap vinyl.
2161  if (!(pci->dwTIFlags & TIF_WAITFORINPUTIDLE))
2162  { // Not waiting for idle event.
2163  if (!pcti->fsChangeBits && !pcti->fsWakeBits)
2164  { // No messages are available.
2165  if ((GetTickCount() - pcti->tickLastMsgChecked) > 1000)
2166  { // Up the msg read count if over 1 sec.
2168  }
2169  pci->cSpins = 0;
2170  ZwYieldExecution();
2171  FIXME("seeSpins!\n");
2172  return FALSE;
2173  }
2174  }
2175  }
2176  }
2177  return NtUserPeekMessage(pMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
2178 }
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:231
ULONG tickLastMsgChecked
Definition: ntuser.h:170
HWND hWnd
Definition: settings.c:17
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
#define GetWin32ClientInfo()
Definition: ntuser.h:320
#define TIF_WAITFORINPUTIDLE
Definition: ntuser.h:254
PCLIENTTHREADINFO pClientThreadInfo
Definition: ntuser.h:300
#define FIXME(fmt,...)
Definition: debug.h:110
#define TIF_SPINNING
Definition: ntuser.h:250
NTSYSAPI NTSTATUS NTAPI ZwYieldExecution(VOID)
WORD fsChangeBits
Definition: ntuser.h:166
ULONG_PTR cSpins
Definition: ntuser.h:288
DWORD dwTIFlags
Definition: ntuser.h:292
BOOL APIENTRY NtUserPeekMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg)
Definition: message.c:2174

Referenced by PeekMessageA(), and PeekMessageW().

◆ PostMessageA()

BOOL WINAPI PostMessageA ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 2235 of file message.c.

2240 {
2241  LRESULT Ret;
2242 
2243  /* Check for combo box or a list box to send names. */
2244  if (Msg == CB_DIR || Msg == LB_DIR)
2245  {
2246  /*
2247  Set DDL_POSTMSGS, so use the PostMessage function to send messages to the
2248  combo/list box. Forces a call like DlgDirListComboBox.
2249  */
2250  //wParam |= DDL_POSTMSGS;
2251  return NtUserPostMessage(hWnd, Msg, wParam, lParam);
2252  }
2253 
2254  /* No drop files or current Process, just post message. */
2255  if ( (Msg != WM_DROPFILES) ||
2258  {
2259  return NtUserPostMessage(hWnd, Msg, wParam, lParam);
2260  }
2261 
2262  /* We have drop files and this is not the same process for this window. */
2263 
2264  /* Just incase, check wParam for Global memory handle and send size. */
2265  Ret = SendMessageA( hWnd,
2267  (WPARAM)GlobalSize((HGLOBAL)wParam), // Zero if not a handle.
2268  (LPARAM)wParam); // Send wParam as lParam.
2269 
2270  if ( Ret ) return NtUserPostMessage(hWnd, Msg, (WPARAM)Ret, lParam);
2271 
2272  return FALSE;
2273 }
LRESULT WINAPI SendMessageA(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:2441
#define PtrToUint(p)
Definition: basetsd.h:85
#define QUERY_WINDOW_UNIQUE_PROCESS_ID
Definition: ntuser.h:2796
#define LB_DIR
Definition: winuser.h:2015
struct @1591 Msg[]
HWND hWnd
Definition: settings.c:17
UINT_PTR WPARAM
Definition: windef.h:207
HANDLE UniqueProcess
Definition: compat.h:482
WPARAM wParam
Definition: combotst.c:138
DWORD_PTR NTAPI NtUserQueryWindow(HWND hWnd, DWORD Index)
Definition: window.c:3997
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
#define WM_DROPFILES
Definition: winuser.h:1807
LONG_PTR LPARAM
Definition: windef.h:208
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1176
#define WM_COPYGLOBALDATA
Definition: undocuser.h:36
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define CB_DIR
Definition: winuser.h:1920
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139
BOOL APIENTRY NtUserPostMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:2062

◆ PostMessageW()

BOOL WINAPI PostMessageW ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 2280 of file message.c.

2285 {
2286  LRESULT Ret;
2287 
2288  /* Check for combo box or a list box to send names. */
2289  if (Msg == CB_DIR || Msg == LB_DIR)
2290  {
2291  /*
2292  Set DDL_POSTMSGS, so use the PostMessage function to send messages to the
2293  combo/list box. Forces a call like DlgDirListComboBox.
2294  */
2295  //wParam |= DDL_POSTMSGS;
2296  return NtUserPostMessage(hWnd, Msg, wParam, lParam);
2297  }
2298 
2299  /* No drop files or current Process, just post message. */
2300  if ( (Msg != WM_DROPFILES) ||
2303  {
2304  return NtUserPostMessage(hWnd, Msg, wParam, lParam);
2305  }
2306 
2307  /* We have drop files and this is not the same process for this window. */
2308 
2309  /* Just incase, check wParam for Global memory handle and send size. */
2310  Ret = SendMessageW( hWnd,
2312  (WPARAM)GlobalSize((HGLOBAL)wParam), // Zero if not a handle.
2313  (LPARAM)wParam); // Send wParam as lParam.
2314 
2315  if ( Ret ) return NtUserPostMessage(hWnd, Msg, (WPARAM)Ret, lParam);
2316 
2317  return FALSE;
2318 }
#define PtrToUint(p)
Definition: basetsd.h:85
#define QUERY_WINDOW_UNIQUE_PROCESS_ID
Definition: ntuser.h:2796
#define LB_DIR
Definition: winuser.h:2015
struct @1591 Msg[]
HWND hWnd
Definition: settings.c:17
UINT_PTR WPARAM
Definition: windef.h:207
HANDLE UniqueProcess
Definition: compat.h:482
WPARAM wParam
Definition: combotst.c:138
DWORD_PTR NTAPI NtUserQueryWindow(HWND hWnd, DWORD Index)
Definition: window.c:3997
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
#define WM_DROPFILES
Definition: winuser.h:1807
LONG_PTR LPARAM
Definition: windef.h:208
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1176
#define WM_COPYGLOBALDATA
Definition: undocuser.h:36
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define CB_DIR
Definition: winuser.h:1920
LRESULT WINAPI SendMessageW(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:2366
LONG_PTR LRESULT
Definition: windef.h:209