Author: gadamopoulos Date: Sun Jan 22 22:27:08 2012 New Revision: 55081
URL: http://svn.reactos.org/svn/reactos?rev=55081&view=rev Log: [kernel32] - Fix IntReadConsoleOutputCharacter to copy the correct count of characters. Its 3rd parameter is a character count and not buffer size. - Should fix infinite loop when kernel32:console test runs
Modified: trunk/reactos/dll/win32/kernel32/client/file/console.c
Modified: trunk/reactos/dll/win32/kernel32/client/file/console.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/f... ============================================================================== --- trunk/reactos/dll/win32/kernel32/client/file/console.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/file/console.c [iso-8859-1] Sun Jan 22 22:27:08 2012 @@ -2634,18 +2634,17 @@ PCSR_API_MESSAGE Request; ULONG CsrRequest; NTSTATUS Status; - ULONG nChars, SizeBytes, CharSize; + ULONG SizeBytes, CharSize; DWORD CharsRead = 0;
CharSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
- nChars = min(nLength, CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR) / CharSize; - SizeBytes = nChars * CharSize; + nLength = min(nLength, CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR / CharSize); + SizeBytes = nLength * CharSize;
Request = RtlAllocateHeap(RtlGetProcessHeap(), 0, max(sizeof(CSR_API_MESSAGE), - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_CHAR) - + min (nChars, CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR / CharSize) * CharSize)); + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_CHAR) + SizeBytes)); if (Request == NULL) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); @@ -2661,7 +2660,7 @@
Request->Data.ReadConsoleOutputCharRequest.ConsoleHandle = hConsoleOutput; Request->Data.ReadConsoleOutputCharRequest.Unicode = bUnicode; - Request->Data.ReadConsoleOutputCharRequest.NumCharsToRead = min(nLength, nChars); + Request->Data.ReadConsoleOutputCharRequest.NumCharsToRead = nLength; SizeBytes = Request->Data.ReadConsoleOutputCharRequest.NumCharsToRead * CharSize;
Status = CsrClientCallServer(Request,