Add the optional "number of things read/written" parameters back.

svn path=/branches/condrv_restructure/; revision=63769
This commit is contained in:
Hermès Bélusca-Maïto 2014-07-29 14:00:46 +00:00
parent 5ce6a6c12b
commit 4a285f0633
2 changed files with 30 additions and 29 deletions

View file

@ -892,7 +892,7 @@ ConDrvReadConsoleOutputString(IN PCONSOLE Console,
IN ULONG NumCodesToRead,
IN PCOORD ReadCoord,
// OUT PCOORD EndCoord,
OUT PULONG CodesRead)
OUT PULONG NumCodesRead OPTIONAL)
{
SHORT Xpos, Ypos;
PVOID ReadBuffer;
@ -900,8 +900,7 @@ ConDrvReadConsoleOutputString(IN PCONSOLE Console,
ULONG CodeSize;
PCHAR_INFO Ptr;
if (Console == NULL || Buffer == NULL ||
ReadCoord == NULL || /* EndCoord == NULL || */ CodesRead == NULL)
if (Console == NULL || Buffer == NULL || ReadCoord == NULL /* || EndCoord == NULL */)
{
return STATUS_INVALID_PARAMETER;
}
@ -910,6 +909,8 @@ ConDrvReadConsoleOutputString(IN PCONSOLE Console,
ASSERT(Console == Buffer->Header.Console);
ASSERT((StringBuffer != NULL) || (StringBuffer == NULL && NumCodesToRead == 0));
if (NumCodesRead) *NumCodesRead = 0;
switch (CodeType)
{
case CODE_ASCII:
@ -985,7 +986,8 @@ ConDrvReadConsoleOutputString(IN PCONSOLE Console,
// EndCoord->X = Xpos;
// EndCoord->Y = (Ypos - Buffer->VirtualY + Buffer->ScreenBufferSize.Y) % Buffer->ScreenBufferSize.Y;
*CodesRead = (ULONG)((ULONG_PTR)ReadBuffer - (ULONG_PTR)StringBuffer) / CodeSize;
if (NumCodesRead)
*NumCodesRead = (ULONG)((ULONG_PTR)ReadBuffer - (ULONG_PTR)StringBuffer) / CodeSize;
// <= NumCodesToRead
return STATUS_SUCCESS;
@ -997,9 +999,9 @@ ConDrvWriteConsoleOutputString(IN PCONSOLE Console,
IN CODE_TYPE CodeType,
IN PVOID StringBuffer,
IN ULONG NumCodesToWrite,
IN PCOORD WriteCoord /*,
OUT PCOORD EndCoord,
OUT PULONG CodesWritten */)
IN PCOORD WriteCoord,
// OUT PCOORD EndCoord,
OUT PULONG NumCodesWritten OPTIONAL)
{
NTSTATUS Status = STATUS_SUCCESS;
PVOID WriteBuffer = NULL;
@ -1008,8 +1010,7 @@ ConDrvWriteConsoleOutputString(IN PCONSOLE Console,
ULONG CodeSize;
PCHAR_INFO Ptr;
if (Console == NULL || Buffer == NULL ||
WriteCoord == NULL /* || EndCoord == NULL || CodesWritten == NULL */)
if (Console == NULL || Buffer == NULL || WriteCoord == NULL /* || EndCoord == NULL */)
{
return STATUS_INVALID_PARAMETER;
}
@ -1018,6 +1019,8 @@ ConDrvWriteConsoleOutputString(IN PCONSOLE Console,
ASSERT(Console == Buffer->Header.Console);
ASSERT((StringBuffer != NULL) || (StringBuffer == NULL && NumCodesToWrite == 0));
if (NumCodesWritten) *NumCodesWritten = 0;
switch (CodeType)
{
case CODE_ASCII:
@ -1114,7 +1117,7 @@ ConDrvWriteConsoleOutputString(IN PCONSOLE Console,
Cleanup:
if (tmpString) RtlFreeHeap(RtlGetProcessHeap(), 0, tmpString);
// CodesWritten = Written;
// if (NumCodesWritten) *NumCodesWritten = Written;
return Status;
}
@ -1124,13 +1127,13 @@ ConDrvFillConsoleOutput(IN PCONSOLE Console,
IN CODE_TYPE CodeType,
IN CODE_ELEMENT Code,
IN ULONG NumCodesToWrite,
IN PCOORD WriteCoord /*,
OUT PULONG CodesWritten */)
IN PCOORD WriteCoord,
OUT PULONG NumCodesWritten OPTIONAL)
{
DWORD X, Y, Length; // , Written = 0;
PCHAR_INFO Ptr;
if (Console == NULL || Buffer == NULL || WriteCoord == NULL /* || CodesWritten == NULL */)
if (Console == NULL || Buffer == NULL || WriteCoord == NULL)
{
return STATUS_INVALID_PARAMETER;
}
@ -1138,6 +1141,8 @@ ConDrvFillConsoleOutput(IN PCONSOLE Console,
/* Validity check */
ASSERT(Console == Buffer->Header.Console);
if (NumCodesWritten) *NumCodesWritten = 0;
if (CodeType == CODE_ASCII)
{
/* Conversion from the ASCII char to the UNICODE char */
@ -1189,7 +1194,7 @@ ConDrvFillConsoleOutput(IN PCONSOLE Console,
TermDrawRegion(Console, &UpdateRect);
}
// CodesWritten = Written; // NumCodesToWrite;
// if (NumCodesWritten) *NumCodesWritten = Written; // NumCodesToWrite;
return STATUS_SUCCESS;
}

View file

@ -525,7 +525,7 @@ ConDrvReadConsoleOutputString(IN PCONSOLE Console,
IN ULONG NumCodesToRead,
IN PCOORD ReadCoord,
// OUT PCOORD EndCoord,
OUT PULONG CodesRead);
OUT PULONG NumCodesRead OPTIONAL);
CSR_API(SrvReadConsoleOutputString)
{
NTSTATUS Status;
@ -607,9 +607,9 @@ ConDrvWriteConsoleOutputString(IN PCONSOLE Console,
IN CODE_TYPE CodeType,
IN PVOID StringBuffer,
IN ULONG NumCodesToWrite,
IN PCOORD WriteCoord /*,
OUT PCOORD EndCoord,
OUT PULONG CodesWritten */);
IN PCOORD WriteCoord,
// OUT PCOORD EndCoord,
OUT PULONG NumCodesWritten OPTIONAL);
CSR_API(SrvWriteConsoleOutputString)
{
NTSTATUS Status;
@ -677,11 +677,9 @@ CSR_API(SrvWriteConsoleOutputString)
WriteOutputCodeRequest->CodeType,
pCode,
WriteOutputCodeRequest->NumCodes,
&WriteOutputCodeRequest->Coord /*,
&WriteOutputCodeRequest->EndCoord,
&WriteOutputCodeRequest->NrCharactersWritten */);
// WriteOutputCodeRequest->NrCharactersWritten = Written;
&WriteOutputCodeRequest->Coord,
// &WriteOutputCodeRequest->EndCoord,
&WriteOutputCodeRequest->NumCodes);
ConSrvReleaseScreenBuffer(Buffer, TRUE);
return Status;
@ -693,8 +691,8 @@ ConDrvFillConsoleOutput(IN PCONSOLE Console,
IN CODE_TYPE CodeType,
IN CODE_ELEMENT Code,
IN ULONG NumCodesToWrite,
IN PCOORD WriteCoord /*,
OUT PULONG CodesWritten */);
IN PCOORD WriteCoord,
OUT PULONG NumCodesWritten OPTIONAL);
CSR_API(SrvFillConsoleOutput)
{
NTSTATUS Status;
@ -721,10 +719,8 @@ CSR_API(SrvFillConsoleOutput)
CodeType,
FillOutputRequest->Code,
FillOutputRequest->NumCodes,
&FillOutputRequest->WriteCoord /*,
&FillOutputRequest->NrCharactersWritten */);
// FillOutputRequest->NrCharactersWritten = Written;
&FillOutputRequest->WriteCoord,
&FillOutputRequest->NumCodes);
ConSrvReleaseScreenBuffer(Buffer, TRUE);
return Status;