From f12bbaea409f9a5e456aacd6e57470ef9b07a60a Mon Sep 17 00:00:00 2001 From: ondrej Date: Mon, 18 Jul 2016 08:41:46 +0000 Subject: [PATCH] win32: DrawText: fix output string length for DT_MODIFYSTRING git-svn-id: trunk@52709 - --- lcl/interfaces/win32/win32winapi.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/lcl/interfaces/win32/win32winapi.inc b/lcl/interfaces/win32/win32winapi.inc index 52e7ee2b34..cb6e322bcd 100644 --- a/lcl/interfaces/win32/win32winapi.inc +++ b/lcl/interfaces/win32/win32winapi.inc @@ -1116,6 +1116,7 @@ begin Result := Windows.DrawTextW(DC, PWideChar(W), len, @Rect, Flags); if (Flags and DT_MODIFYSTRING <> 0) then begin + W := WideString(PWideChar(W)); // trim to first #0 s := UTF16ToUTF8(W); if s<>'' then Move(s[1], Str^, Length(s)+1) // the programmer has to make sure there's enough space in Str