Fix WM_GETTEXT handling

svn path=/trunk/; revision=4796
This commit is contained in:
Gé van Geldorp 2003-05-29 13:17:41 +00:00
parent d5d6a165bd
commit 9906724442
2 changed files with 16 additions and 8 deletions

View file

@ -1,4 +1,4 @@
/* $Id: defwnd.c,v 1.49 2003/05/26 10:52:15 rcampbell Exp $ /* $Id: defwnd.c,v 1.50 2003/05/29 13:17:41 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
@ -1435,7 +1435,7 @@ DefWindowProcA(HWND hWnd,
{ {
if (wParam > 1) if (wParam > 1)
{ {
((PSTR)lParam) = '\0'; *((PSTR)lParam) = '\0';
} }
return(0); return(0);
} }
@ -1445,7 +1445,7 @@ DefWindowProcA(HWND hWnd,
case WM_SETTEXT: case WM_SETTEXT:
{ {
if (WindowTextAtom != 0) if (0 == WindowTextAtom)
{ {
WindowTextAtom = WindowTextAtom =
(LPSTR)(DWORD)GlobalAddAtomA("USER32!WindowTextAtomW"); (LPSTR)(DWORD)GlobalAddAtomA("USER32!WindowTextAtomW");

View file

@ -1,4 +1,4 @@
/* $Id: message.c,v 1.16 2003/05/21 22:58:43 gvg Exp $ /* $Id: message.c,v 1.17 2003/05/29 13:17:41 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
@ -83,13 +83,21 @@ User32FreeAsciiConvertedMessage(UINT Msg, WPARAM wParam, LPARAM lParam)
LPSTR TempString; LPSTR TempString;
LPSTR InString; LPSTR InString;
InString = (LPSTR)lParam; InString = (LPSTR)lParam;
TempString = RtlAllocateHeap(RtlGetProcessHeap(), 0, strlen(InString)); TempString = RtlAllocateHeap(RtlGetProcessHeap(), 0, strlen(InString) + 1);
strcpy(TempString, InString); strcpy(TempString, InString);
RtlInitAnsiString(&AnsiString, TempString); RtlInitAnsiString(&AnsiString, TempString);
UnicodeString.Length = wParam; UnicodeString.Length = wParam * sizeof(WCHAR);
UnicodeString.MaximumLength = wParam; UnicodeString.MaximumLength = wParam * sizeof(WCHAR);
UnicodeString.Buffer = (PWSTR)lParam; UnicodeString.Buffer = (PWSTR)lParam;
RtlAnsiStringToUnicodeString(&UnicodeString, &AnsiString, FALSE); if (! NT_SUCCESS(RtlAnsiStringToUnicodeString(&UnicodeString,
&AnsiString,
FALSE)))
{
if (1 <= wParam)
{
UnicodeString.Buffer[0] = L'\0';
}
}
RtlFreeHeap(RtlGetProcessHeap(), 0, TempString); RtlFreeHeap(RtlGetProcessHeap(), 0, TempString);
break; break;
} }