I found this while trying to get Quicken 2000 Deluxe to run under wine. Q2k was crashing when adding a new security (stock) if nothing was seleted in the Asset Class ListBox. (It doesn't do this under "real Win NT"...) It turns out that Q2k seems to keep processing the value returned by WM_GETTEXT regardless of the number of characters WM_GETTEXT returns. Since wine's WM_GETTEXT was not returning a NULL string (='\0'), a subsequent strcpy (or some such) was choking because the string was not null terminated. The attached patch sets the return string to '\0' if LB_GETCURSEL returns LB_ERR. (Although this behaviour is not specified on msdn.microsoft.com, I figure it can't hurt, since the program calling WM_GETTEXT should be expecting the buffer to get changed by the call...) I don't know (and have not checked) to see if other *_GETTEXT message handlers need to do the same... One last point: I'm fairly new at C coding. If there's a better way to do what this patch does, feel free to improve upon it... <grin> Carl
Index: controls/combo.c =================================================================== RCS file: /home/wine/wine/controls/combo.c,v retrieving revision 1.85 diff -u -r1.85 combo.c --- controls/combo.c 10 Jul 2002 23:11:28 -0000 1.85 +++ controls/combo.c 15 Jul 2002 17:02:47 -0000 @@ -1603,6 +1603,15 @@ return (LRESULT)n; } } + /* LB_GETCURSEL returned LB_ERR - truncate string, return zero */ + if (unicode) + { + LPWSTR lpText = (LPWSTR)lParam; + lpText[0] = '\0'; + } else { + LPSTR lpText = (LPSTR)lParam; + lpText[0] = '\0'; + } return 0; }