PATCH: Strange window message / queue behaviour
Marcus Meissner
marcus at jet.franken.de
Tue Feb 6 13:23:37 CST 2001
On Tue, Feb 06, 2001 at 01:00:07AM +0100, gerard patel wrote:
> At 12:00 AM 6/2/01 +0100, you wrote:
> >last paragraph), there's also the possibility that Windows recognizes that
> >it's a message known to contain pointers, and so just drops the message,
> >so that EM_GETSEL is simply never dispatched?
>
> Indeed under NT4 such a call is discarded by Windows (returns 0,
> error is set to ERROR_INVALID_PARAMETER)
I have done following patch to fix this problem.
Now the Diablo2 installer lets you install and does not fault on the 4th
letter of the license key.
Ciao, Marcus
Changelog:
PostMessageA/W ignores messages containing pointers and returns
FALSE/LastError ERROR_INVALID_PAREMETER
Index: windows/message.c
===================================================================
RCS file: /home/wine/wine/windows/message.c,v
retrieving revision 1.94
diff -u -r1.94 windows/message.c
--- windows/message.c 2001/01/29 00:33:35 1.94
+++ windows/message.c 2001/02/06 19:04:15
@@ -1597,6 +1597,79 @@
}
/***********************************************************************
+ * MSG_IsPointerMessage
+ *
+ * Check whether this message (may) contain pointers.
+ * Those messages may not be PostMessage()d or GetMessage()d, but are dropped.
+ *
+ * FIXME: list of pointer messages might be incomplete.
+ *
+ * (We could do a generic !IsBadWritePtr() check, but this would cause too
+ * much slow down I think. MM20010206)
+ */
+static BOOL MSG_IsPointerMessage(UINT message, WPARAM wParam, LPARAM lParam) {
+ switch (message) {
+ case WM_CREATE:
+ case WM_NCCREATE:
+ case WM_COMPAREITEM:
+ case WM_DELETEITEM:
+ case WM_MEASUREITEM:
+ case WM_DRAWITEM:
+ case WM_GETMINMAXINFO:
+ case WM_GETTEXT:
+ case WM_SETTEXT:
+ case WM_MDICREATE:
+ case WM_MDIGETACTIVE:
+ case WM_NCCALCSIZE:
+ case WM_WINDOWPOSCHANGING:
+ case WM_WINDOWPOSCHANGED:
+ case WM_NOTIFY:
+ case WM_GETDLGCODE:
+ case WM_WININICHANGE:
+ case WM_HELP:
+ case WM_COPYDATA:
+ case WM_STYLECHANGING:
+ case WM_STYLECHANGED:
+ case WM_DROPOBJECT:
+ case WM_DRAGMOVE:
+ case WM_DRAGSELECT:
+ case WM_QUERYDROPOBJECT:
+
+ case CB_DIR:
+ case CB_ADDSTRING:
+ case CB_INSERTSTRING:
+ case CB_FINDSTRING:
+ case CB_FINDSTRINGEXACT:
+ case CB_SELECTSTRING:
+ case CB_GETLBTEXT:
+ case CB_GETDROPPEDCONTROLRECT:
+
+ case LB_DIR:
+ case LB_ADDFILE:
+ case LB_ADDSTRING:
+ case LB_INSERTSTRING:
+ case LB_GETTEXT:
+ case LB_GETITEMRECT:
+ case LB_FINDSTRING:
+ case LB_FINDSTRINGEXACT:
+ case LB_SELECTSTRING:
+ case LB_GETSELITEMS:
+ case LB_SETTABSTOPS:
+
+ case EM_REPLACESEL:
+ case EM_GETSEL:
+ case EM_GETRECT:
+ case EM_SETRECT:
+ case EM_SETRECTNP:
+ case EM_GETLINE:
+ case EM_SETTABSTOPS:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+/***********************************************************************
* MSG_PostMessage
*/
static BOOL MSG_PostMessage( int type, HWND hwnd, UINT message,
@@ -1604,6 +1677,20 @@
{
HQUEUE16 hQueue;
WND *wndPtr;
+
+ /* See thread on wine-devel around 6.2.2001. Basically posted messages
+ * that are known to contain pointers are dropped by the Windows 32bit
+ * PostMessage() with return FALSE; and invalid parameter last error.
+ * (tested against NT4 by Gerard Patel)
+ * 16 bit does not care, so we don't either.
+ */
+ if ( (type!=QMSG_WIN16) && MSG_IsPointerMessage(message,wParam,lParam)) {
+ FIXME("Ignoring posted pointer message 0x%04x to hwnd 0x%04x.\n",
+ message,hwnd
+ );
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
if (hwnd == HWND_BROADCAST)
{
More information about the wine-patches
mailing list