Clinton Stimpson wrote:
The following patch will fix the crash. MSDN documentation says "*lstrlen* assumes that /lpString/ is a null-terminated string, or NULL"
The inline lstrlenW is used only internally by Wine code, and we want it to crash when passed a NULL pointer. In this case, you should fix the Wine code calling lstrlenW to not use a NULL pointer.
Mike
Mike McCormack wrote:
Clinton Stimpson wrote:
The following patch will fix the crash. MSDN documentation says "*lstrlen* assumes that /lpString/ is a null-terminated string, or NULL"
The inline lstrlenW is used only internally by Wine code, and we want it to crash when passed a NULL pointer. In this case, you should fix the Wine code calling lstrlenW to not use a NULL pointer.
Mike
Mike,
Oh, used internally, ok (I thought it was public and that the wine debugger said Paf 5.2 called that lstrlenW directly). So here's another patch that fixes a crash in Personal Ancestral File 5.2 when opening notes for an individual that has no notes. I'm not sure that's how it is supposed to be fixed, but at least you can see that the root of the crash is a EM_SETTEXTEX message with lParam = NULL.
Also, it looks like bugs 4344 and 4585 were fixed quite recently.
Thanks, Clint
Index: caret.c =================================================================== RCS file: /home/wine/wine/dlls/riched20/caret.c,v retrieving revision 1.27 diff -u -r1.27 caret.c --- caret.c 23 May 2006 12:48:31 -0000 1.27 +++ caret.c 7 Jun 2006 01:16:34 -0000 @@ -382,8 +382,10 @@ ME_DeleteSelection(editor);
assert(nCursor>=0 && nCursor<editor->nCursors); - if (len == -1) + if (len == -1 && str) len = lstrlenW(str); + else if(len == -1) + len = 0; while (len) { pos = str; Index: editor.c =================================================================== RCS file: /home/wine/wine/dlls/riched20/editor.c,v retrieving revision 1.108 diff -u -r1.108 editor.c --- editor.c 23 May 2006 12:48:31 -0000 1.108 +++ editor.c 7 Jun 2006 01:16:34 -0000 @@ -1591,7 +1591,9 @@ { LPWSTR wszText = (LPWSTR)lParam; SETTEXTEX *pStruct = (SETTEXTEX *)wParam; - size_t len = lstrlenW(wszText); + size_t len = 0; + if(wszText) + len = lstrlenW(wszText); int from, to; ME_Style *style; TRACE("EM_SETTEXEX - %s, flags %d, cp %d\n", debugstr_w(wszText), (int)pStruct->flags, pStruct->codepage);
Clinton Stimpson wrote:
Oh, used internally, ok (I thought it was public and that the wine debugger said Paf 5.2 called that lstrlenW directly).
The public version is defined in dlls/kernel/string.c, and has an exception handler as required by Win32.
So here's another patch that fixes a crash in Personal Ancestral File 5.2 when opening notes for an individual that has no notes. I'm not sure that's how it is supposed to be fixed, but at least you can see that the root of the crash is a EM_SETTEXTEX message with lParam = NULL.
These patches should be sent to wine-patches.
Does the Richedit control return an error, or clear itself when passed EM_SETTEXTEX with lParam = NULL?
Mike
Mike McCormack wrote:
Clinton Stimpson wrote:
Oh, used internally, ok (I thought it was public and that the wine debugger said Paf 5.2 called that lstrlenW directly).
The public version is defined in dlls/kernel/string.c, and has an exception handler as required by Win32.
So here's another patch that fixes a crash in Personal Ancestral File 5.2 when opening notes for an individual that has no notes. I'm not sure that's how it is supposed to be fixed, but at least you can see that the root of the crash is a EM_SETTEXTEX message with lParam = NULL.
These patches should be sent to wine-patches.
Does the Richedit control return an error, or clear itself when passed EM_SETTEXTEX with lParam = NULL?
On Windows, it returns 1 and clears itself. Unless the ST_SELECTION flag is set, in which case it returns 0, and actually replaces the text with nothing. My patch to wine results in the same behavior. I'll send it to wine-patches.
Thanks, Clint