Author: hbelusca
Date: Mon Jul 28 13:37:54 2014
New Revision: 63753
URL:
http://svn.reactos.org/svn/reactos?rev=63753&view=rev
Log:
[KERNEL32]
- No need to use another NTSTATUS variable, since all of the information is already
contained in ApiMessage.Status.
- Do not hardcode the type of the request variables in the sizeofs used in the
CsrClientCallServer calls.
Modified:
branches/condrv_restructure/dll/win32/kernel32/client/console/readwrite.c
Modified: branches/condrv_restructure/dll/win32/kernel32/client/console/readwrite.c
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/dll/win32/ke…
==============================================================================
--- branches/condrv_restructure/dll/win32/kernel32/client/console/readwrite.c [iso-8859-1]
(original)
+++ branches/condrv_restructure/dll/win32/kernel32/client/console/readwrite.c [iso-8859-1]
Mon Jul 28 13:37:54 2014
@@ -33,7 +33,6 @@
PCONSOLE_READCONSOLE_CONTROL pInputControl,
BOOL bUnicode)
{
- NTSTATUS Status;
CONSOLE_API_MESSAGE ApiMessage;
PCONSOLE_READCONSOLE ReadConsoleRequest = &ApiMessage.Data.ReadConsoleRequest;
PCSR_CAPTURE_BUFFER CaptureBuffer;
@@ -79,13 +78,13 @@
}
/* Call the server */
- Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
- CaptureBuffer,
- CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepReadConsole),
- sizeof(CONSOLE_READCONSOLE));
+ CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
+ CaptureBuffer,
+ CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepReadConsole),
+ sizeof(*ReadConsoleRequest));
/* Check for success */
- if (NT_SUCCESS(Status))
+ if (NT_SUCCESS(ApiMessage.Status))
{
memcpy(lpBuffer,
ReadConsoleRequest->Buffer,
@@ -105,7 +104,7 @@
*lpNumberOfCharsRead = 0;
/* Error out */
- BaseSetLastNTError(Status);
+ BaseSetLastNTError(ApiMessage.Status);
}
CsrFreeCaptureBuffer(CaptureBuffer);
@@ -113,7 +112,7 @@
/* Return TRUE or FALSE */
// return TRUE;
return (ReadConsoleRequest->NrCharactersRead > 0);
- // return NT_SUCCESS(Status);
+ // return NT_SUCCESS(ApiMessage.Status);
}
@@ -126,7 +125,6 @@
WORD wFlags,
BOOLEAN bUnicode)
{
- NTSTATUS Status;
CONSOLE_API_MESSAGE ApiMessage;
PCONSOLE_GETINPUT GetInputRequest = &ApiMessage.Data.GetInputRequest;
PCSR_CAPTURE_BUFFER CaptureBuffer;
@@ -164,14 +162,13 @@
GetInputRequest->Unicode = bUnicode;
/* Call the server */
- Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
- CaptureBuffer,
- CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepGetConsoleInput),
- sizeof(CONSOLE_GETINPUT));
- DPRINT("Server returned: %x\n", Status);
+ CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
+ CaptureBuffer,
+ CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepGetConsoleInput),
+ sizeof(*GetInputRequest));
/* Check for success */
- if (NT_SUCCESS(Status))
+ if (NT_SUCCESS(ApiMessage.Status))
{
/* Return the number of events read */
DPRINT("Events read: %lx\n", GetInputRequest->InputsRead);
@@ -191,7 +188,7 @@
*lpNumberOfEventsRead = 0;
/* Error out */
- BaseSetLastNTError(Status);
+ BaseSetLastNTError(ApiMessage.Status);
}
/* Release the capture buffer */
@@ -199,7 +196,7 @@
/* Return TRUE or FALSE */
return (GetInputRequest->InputsRead > 0);
- // return NT_SUCCESS(Status);
+ // return NT_SUCCESS(ApiMessage.Status);
}
@@ -252,8 +249,7 @@
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
CaptureBuffer,
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepReadConsoleOutput),
- sizeof(CONSOLE_READOUTPUT));
- DPRINT("Server returned: %x\n", ApiMessage.Status);
+ sizeof(*ReadOutputRequest));
/* Check for success */
if (NT_SUCCESS(ApiMessage.Status))
@@ -295,7 +291,6 @@
COORD dwReadCoord,
LPDWORD lpNumberOfCodesRead)
{
- NTSTATUS Status;
BOOL bRet = TRUE;
CONSOLE_API_MESSAGE ApiMessage;
PCONSOLE_READOUTPUTCODE ReadOutputCodeRequest =
&ApiMessage.Data.ReadOutputCodeRequest;
@@ -346,13 +341,13 @@
ReadOutputCodeRequest->NumCodesToRead = nLength;
/* Call the server */
- Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
- CaptureBuffer,
- CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepReadConsoleOutputString),
- sizeof(CONSOLE_READOUTPUTCODE));
+ CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
+ CaptureBuffer,
+ CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepReadConsoleOutputString),
+ sizeof(*ReadOutputCodeRequest));
/* Check for success */
- if (NT_SUCCESS(Status))
+ if (NT_SUCCESS(ApiMessage.Status))
{
CodesRead = ReadOutputCodeRequest->CodesRead;
memcpy(pCode, ReadOutputCodeRequest->pCode.pCode, CodesRead * CodeSize);
@@ -370,7 +365,7 @@
*lpNumberOfCodesRead = 0;
/* Error out */
- BaseSetLastNTError(Status);
+ BaseSetLastNTError(ApiMessage.Status);
bRet = FALSE;
}
@@ -393,7 +388,6 @@
LPVOID lpReserved,
BOOL bUnicode)
{
- NTSTATUS Status;
BOOL bRet = TRUE;
CONSOLE_API_MESSAGE ApiMessage;
PCONSOLE_WRITECONSOLE WriteConsoleRequest =
&ApiMessage.Data.WriteConsoleRequest;
@@ -425,13 +419,13 @@
WriteConsoleRequest->Unicode = bUnicode;
/* Call the server */
- Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
- CaptureBuffer,
- CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepWriteConsole),
- sizeof(CONSOLE_WRITECONSOLE));
+ CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
+ CaptureBuffer,
+ CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepWriteConsole),
+ sizeof(*WriteConsoleRequest));
/* Check for success */
- if (NT_SUCCESS(Status))
+ if (NT_SUCCESS(ApiMessage.Status))
{
if (lpNumberOfCharsWritten != NULL)
*lpNumberOfCharsWritten = WriteConsoleRequest->NrCharactersWritten;
@@ -444,7 +438,7 @@
*lpNumberOfCharsWritten = 0;
/* Error out */
- BaseSetLastNTError(Status);
+ BaseSetLastNTError(ApiMessage.Status);
bRet = FALSE;
}
@@ -497,8 +491,7 @@
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
CaptureBuffer,
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepWriteConsoleInput),
- sizeof(CONSOLE_WRITEINPUT));
- DPRINT("Server returned: %x\n", ApiMessage.Status);
+ sizeof(*WriteInputRequest));
/* Check for success */
if (NT_SUCCESS(ApiMessage.Status))
@@ -583,8 +576,7 @@
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
CaptureBuffer,
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepWriteConsoleOutput),
- sizeof(CONSOLE_WRITEOUTPUT));
- DPRINT("Server returned: %x\n", ApiMessage.Status);
+ sizeof(*WriteOutputRequest));
/* Check for success */
if (!NT_SUCCESS(ApiMessage.Status))
@@ -614,7 +606,6 @@
COORD dwWriteCoord,
LPDWORD lpNumberOfCodesWritten)
{
- NTSTATUS Status;
BOOL bRet = TRUE;
CONSOLE_API_MESSAGE ApiMessage;
PCONSOLE_WRITEOUTPUTCODE WriteOutputCodeRequest =
&ApiMessage.Data.WriteOutputCodeRequest;
@@ -665,13 +656,13 @@
WriteOutputCodeRequest->Length = (USHORT)nLength;
/* Call the server */
- Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
- CaptureBuffer,
- CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepWriteConsoleOutputString),
- sizeof(CONSOLE_WRITEOUTPUTCODE));
+ CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
+ CaptureBuffer,
+ CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepWriteConsoleOutputString),
+ sizeof(*WriteOutputCodeRequest));
/* Check for success */
- if (NT_SUCCESS(Status))
+ if (NT_SUCCESS(ApiMessage.Status))
{
// WriteOutputCodeRequest->Coord = WriteOutputCodeRequest->EndCoord;
@@ -687,7 +678,7 @@
*lpNumberOfCodesWritten = 0;
/* Error out */
- BaseSetLastNTError(Status);
+ BaseSetLastNTError(ApiMessage.Status);
bRet = FALSE;
}
@@ -706,7 +697,6 @@
COORD dwWriteCoord,
LPDWORD lpNumberOfCodesWritten)
{
- NTSTATUS Status;
CONSOLE_API_MESSAGE ApiMessage;
PCONSOLE_FILLOUTPUTCODE FillOutputRequest = &ApiMessage.Data.FillOutputRequest;
@@ -737,13 +727,13 @@
FillOutputRequest->Length = nLength;
/* Call the server */
- Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
- NULL,
- CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepFillConsoleOutput),
- sizeof(CONSOLE_FILLOUTPUTCODE));
+ CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
+ NULL,
+ CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepFillConsoleOutput),
+ sizeof(*FillOutputRequest));
/* Check for success */
- if (NT_SUCCESS(Status))
+ if (NT_SUCCESS(ApiMessage.Status))
{
if (lpNumberOfCodesWritten != NULL)
*lpNumberOfCodesWritten = FillOutputRequest->Length;
@@ -756,7 +746,7 @@
if (lpNumberOfCodesWritten != NULL)
*lpNumberOfCodesWritten = 0;
- BaseSetLastNTError(Status);
+ BaseSetLastNTError(ApiMessage.Status);
return FALSE;
}
}