mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
[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 svn path=/trunk/; revision=55081
This commit is contained in:
parent
51772abf74
commit
51a64982dd
1 changed files with 5 additions and 6 deletions
|
@ -2634,18 +2634,17 @@ IntReadConsoleOutputCharacter(HANDLE hConsoleOutput,
|
||||||
PCSR_API_MESSAGE Request;
|
PCSR_API_MESSAGE Request;
|
||||||
ULONG CsrRequest;
|
ULONG CsrRequest;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG nChars, SizeBytes, CharSize;
|
ULONG SizeBytes, CharSize;
|
||||||
DWORD CharsRead = 0;
|
DWORD CharsRead = 0;
|
||||||
|
|
||||||
CharSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
|
CharSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
|
||||||
|
|
||||||
nChars = min(nLength, CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR) / CharSize;
|
nLength = min(nLength, CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR / CharSize);
|
||||||
SizeBytes = nChars * CharSize;
|
SizeBytes = nLength * CharSize;
|
||||||
|
|
||||||
Request = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
Request = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
||||||
max(sizeof(CSR_API_MESSAGE),
|
max(sizeof(CSR_API_MESSAGE),
|
||||||
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_CHAR)
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_CHAR) + SizeBytes));
|
||||||
+ min (nChars, CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR / CharSize) * CharSize));
|
|
||||||
if (Request == NULL)
|
if (Request == NULL)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
|
@ -2661,7 +2660,7 @@ IntReadConsoleOutputCharacter(HANDLE hConsoleOutput,
|
||||||
|
|
||||||
Request->Data.ReadConsoleOutputCharRequest.ConsoleHandle = hConsoleOutput;
|
Request->Data.ReadConsoleOutputCharRequest.ConsoleHandle = hConsoleOutput;
|
||||||
Request->Data.ReadConsoleOutputCharRequest.Unicode = bUnicode;
|
Request->Data.ReadConsoleOutputCharRequest.Unicode = bUnicode;
|
||||||
Request->Data.ReadConsoleOutputCharRequest.NumCharsToRead = min(nLength, nChars);
|
Request->Data.ReadConsoleOutputCharRequest.NumCharsToRead = nLength;
|
||||||
SizeBytes = Request->Data.ReadConsoleOutputCharRequest.NumCharsToRead * CharSize;
|
SizeBytes = Request->Data.ReadConsoleOutputCharRequest.NumCharsToRead * CharSize;
|
||||||
|
|
||||||
Status = CsrClientCallServer(Request,
|
Status = CsrClientCallServer(Request,
|
||||||
|
|
Loading…
Reference in a new issue