richedit: Null terminate streamed out rich text.

Dylan Smith dylan.ah.smith at
Fri Apr 24 02:25:46 CDT 2009

This can easily be tested by saving a rich text document in wordpad. The
rich text will always be null terminated, unlike plain text files which
will not have a terminating null byte.

I noticed in a bug 14827 that AutoCAD 2005 looked for this NULL byte to
determine the length of the rich text in its EditStreamCallback function
given to EM_STREAMOUT, instead of using the cb parameter that provides
the length.
 dlls/riched20/writer.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
-------------- next part --------------
diff --git a/dlls/riched20/writer.c b/dlls/riched20/writer.c
index d1d9990..b6c3ed6 100644
--- a/dlls/riched20/writer.c
+++ b/dlls/riched20/writer.c
@@ -904,7 +904,7 @@ ME_StreamOutRTF(ME_TextEditor *editor, ME_OutStream *pStream, int nStart, int nC
     p = ME_FindItemFwd(p, diRunOrParagraphOrEnd);
-  if (!ME_StreamOutPrint(pStream, "}"))
+  if (!ME_StreamOutMove(pStream, "}\0", 2))
     return FALSE;
   return TRUE;

More information about the wine-patches mailing list