mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 12:29:56 +00:00
Fixed broken console code
svn path=/trunk/; revision=1562
This commit is contained in:
parent
89e2e7a616
commit
3943df51ea
2 changed files with 38 additions and 20 deletions
|
@ -189,7 +189,7 @@ typedef struct
|
||||||
#define CSRSS_MAX_WRITE_CONSOLE_REQUEST (MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_REQUEST))
|
#define CSRSS_MAX_WRITE_CONSOLE_REQUEST (MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_REQUEST))
|
||||||
#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR (MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_OUTPUT_CHAR_REQUEST ))
|
#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR (MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_OUTPUT_CHAR_REQUEST ))
|
||||||
|
|
||||||
#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB (MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB_REQUEST ))
|
#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB ((MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB_REQUEST )) / 2)
|
||||||
|
|
||||||
#define CSRSS_MAX_READ_CONSOLE_REQUEST (MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_READ_CONSOLE_REQUEST ))
|
#define CSRSS_MAX_READ_CONSOLE_REQUEST (MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_READ_CONSOLE_REQUEST ))
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: console.c,v 1.26 2001/01/21 00:07:03 phreak Exp $
|
/* $Id: console.c,v 1.27 2001/01/24 05:10:38 phreak Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
|
@ -678,22 +678,32 @@ WriteConsoleOutputCharacterA(
|
||||||
LPDWORD lpNumberOfCharsWritten
|
LPDWORD lpNumberOfCharsWritten
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CSRSS_API_REQUEST Request;
|
PCSRSS_API_REQUEST Request;
|
||||||
CSRSS_API_REPLY Reply;
|
CSRSS_API_REPLY Reply;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
WORD Size;
|
WORD Size;
|
||||||
|
|
||||||
Request.Type = CSRSS_WRITE_CONSOLE_OUTPUT_CHAR;
|
Request = HeapAlloc(GetProcessHeap(),
|
||||||
Request.Data.WriteConsoleOutputCharRequest.ConsoleHandle = hConsoleOutput;
|
HEAP_ZERO_MEMORY,
|
||||||
Request.Data.WriteConsoleOutputCharRequest.Coord = dwWriteCoord;
|
sizeof(CSRSS_API_REQUEST) + CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR);
|
||||||
|
if( !Request )
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_OUTOFMEMORY );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
Request->Type = CSRSS_WRITE_CONSOLE_OUTPUT_CHAR;
|
||||||
|
Request->Data.WriteConsoleOutputCharRequest.ConsoleHandle = hConsoleOutput;
|
||||||
|
Request->Data.WriteConsoleOutputCharRequest.Coord = dwWriteCoord;
|
||||||
if( lpNumberOfCharsWritten )
|
if( lpNumberOfCharsWritten )
|
||||||
*lpNumberOfCharsWritten = nLength;
|
*lpNumberOfCharsWritten = nLength;
|
||||||
while( nLength )
|
while( nLength )
|
||||||
{
|
{
|
||||||
Size = nLength > CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR ? CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR : nLength;
|
Size = nLength > CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR ? CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR : nLength;
|
||||||
Request.Data.WriteConsoleOutputCharRequest.Length = Size;
|
Request->Data.WriteConsoleOutputCharRequest.Length = Size;
|
||||||
|
memcpy( &Request->Data.WriteConsoleOutputCharRequest.String[0],
|
||||||
Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) );
|
lpCharacter,
|
||||||
|
Size );
|
||||||
|
Status = CsrClientCallServer( Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) );
|
||||||
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply.Status ) )
|
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply.Status ) )
|
||||||
{
|
{
|
||||||
SetLastErrorByStatus ( Status );
|
SetLastErrorByStatus ( Status );
|
||||||
|
@ -701,7 +711,7 @@ WriteConsoleOutputCharacterA(
|
||||||
}
|
}
|
||||||
nLength -= Size;
|
nLength -= Size;
|
||||||
lpCharacter += Size;
|
lpCharacter += Size;
|
||||||
Request.Data.WriteConsoleOutputCharRequest.Coord = Reply.Data.WriteConsoleOutputCharReply.EndCoord;
|
Request->Data.WriteConsoleOutputCharRequest.Coord = Reply.Data.WriteConsoleOutputCharReply.EndCoord;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -741,24 +751,32 @@ WriteConsoleOutputAttribute(
|
||||||
LPDWORD lpNumberOfAttrsWritten
|
LPDWORD lpNumberOfAttrsWritten
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CSRSS_API_REQUEST Request;
|
PCSRSS_API_REQUEST Request;
|
||||||
CSRSS_API_REPLY Reply;
|
CSRSS_API_REPLY Reply;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
WORD Size;
|
WORD Size;
|
||||||
int c;
|
|
||||||
|
|
||||||
Request.Type = CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB;
|
Request = HeapAlloc(GetProcessHeap(),
|
||||||
Request.Data.WriteConsoleOutputAttribRequest.ConsoleHandle = hConsoleOutput;
|
HEAP_ZERO_MEMORY,
|
||||||
Request.Data.WriteConsoleOutputAttribRequest.Coord = dwWriteCoord;
|
sizeof(CSRSS_API_REQUEST) + CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB);
|
||||||
|
if( !Request )
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_OUTOFMEMORY );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
Request->Type = CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB;
|
||||||
|
Request->Data.WriteConsoleOutputAttribRequest.ConsoleHandle = hConsoleOutput;
|
||||||
|
Request->Data.WriteConsoleOutputAttribRequest.Coord = dwWriteCoord;
|
||||||
if( lpNumberOfAttrsWritten )
|
if( lpNumberOfAttrsWritten )
|
||||||
*lpNumberOfAttrsWritten = nLength;
|
*lpNumberOfAttrsWritten = nLength;
|
||||||
while( nLength )
|
while( nLength )
|
||||||
{
|
{
|
||||||
Size = nLength > CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB ? CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB : nLength;
|
Size = nLength > CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB ? CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB : nLength;
|
||||||
Request.Data.WriteConsoleOutputAttribRequest.Length = Size;
|
Request->Data.WriteConsoleOutputAttribRequest.Length = Size;
|
||||||
for( c = 0; c < Size; c++ )
|
memcpy( &Request->Data.WriteConsoleOutputAttribRequest.String[0],
|
||||||
Request.Data.WriteConsoleOutputAttribRequest.String[c] = lpAttribute[c];
|
lpAttribute,
|
||||||
Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) );
|
Size * 2 );
|
||||||
|
Status = CsrClientCallServer( Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) );
|
||||||
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply.Status ) )
|
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Reply.Status ) )
|
||||||
{
|
{
|
||||||
SetLastErrorByStatus ( Status );
|
SetLastErrorByStatus ( Status );
|
||||||
|
@ -766,7 +784,7 @@ WriteConsoleOutputAttribute(
|
||||||
}
|
}
|
||||||
nLength -= Size;
|
nLength -= Size;
|
||||||
lpAttribute += Size;
|
lpAttribute += Size;
|
||||||
Request.Data.WriteConsoleOutputAttribRequest.Coord = Reply.Data.WriteConsoleOutputAttribReply.EndCoord;
|
Request->Data.WriteConsoleOutputAttribRequest.Coord = Reply.Data.WriteConsoleOutputAttribReply.EndCoord;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue