mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
[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. svn path=/branches/condrv_restructure/; revision=63753
This commit is contained in:
parent
b06a89c070
commit
dd733c2951
1 changed files with 41 additions and 51 deletions
|
@ -33,7 +33,6 @@ IntReadConsole(HANDLE hConsoleInput,
|
||||||
PCONSOLE_READCONSOLE_CONTROL pInputControl,
|
PCONSOLE_READCONSOLE_CONTROL pInputControl,
|
||||||
BOOL bUnicode)
|
BOOL bUnicode)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
|
||||||
CONSOLE_API_MESSAGE ApiMessage;
|
CONSOLE_API_MESSAGE ApiMessage;
|
||||||
PCONSOLE_READCONSOLE ReadConsoleRequest = &ApiMessage.Data.ReadConsoleRequest;
|
PCONSOLE_READCONSOLE ReadConsoleRequest = &ApiMessage.Data.ReadConsoleRequest;
|
||||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||||
|
@ -79,13 +78,13 @@ IntReadConsole(HANDLE hConsoleInput,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call the server */
|
/* Call the server */
|
||||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||||
CaptureBuffer,
|
CaptureBuffer,
|
||||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepReadConsole),
|
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepReadConsole),
|
||||||
sizeof(CONSOLE_READCONSOLE));
|
sizeof(*ReadConsoleRequest));
|
||||||
|
|
||||||
/* Check for success */
|
/* Check for success */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(ApiMessage.Status))
|
||||||
{
|
{
|
||||||
memcpy(lpBuffer,
|
memcpy(lpBuffer,
|
||||||
ReadConsoleRequest->Buffer,
|
ReadConsoleRequest->Buffer,
|
||||||
|
@ -105,7 +104,7 @@ IntReadConsole(HANDLE hConsoleInput,
|
||||||
*lpNumberOfCharsRead = 0;
|
*lpNumberOfCharsRead = 0;
|
||||||
|
|
||||||
/* Error out */
|
/* Error out */
|
||||||
BaseSetLastNTError(Status);
|
BaseSetLastNTError(ApiMessage.Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
CsrFreeCaptureBuffer(CaptureBuffer);
|
CsrFreeCaptureBuffer(CaptureBuffer);
|
||||||
|
@ -113,7 +112,7 @@ IntReadConsole(HANDLE hConsoleInput,
|
||||||
/* Return TRUE or FALSE */
|
/* Return TRUE or FALSE */
|
||||||
// return TRUE;
|
// return TRUE;
|
||||||
return (ReadConsoleRequest->NrCharactersRead > 0);
|
return (ReadConsoleRequest->NrCharactersRead > 0);
|
||||||
// return NT_SUCCESS(Status);
|
// return NT_SUCCESS(ApiMessage.Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,7 +125,6 @@ IntGetConsoleInput(HANDLE hConsoleInput,
|
||||||
WORD wFlags,
|
WORD wFlags,
|
||||||
BOOLEAN bUnicode)
|
BOOLEAN bUnicode)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
|
||||||
CONSOLE_API_MESSAGE ApiMessage;
|
CONSOLE_API_MESSAGE ApiMessage;
|
||||||
PCONSOLE_GETINPUT GetInputRequest = &ApiMessage.Data.GetInputRequest;
|
PCONSOLE_GETINPUT GetInputRequest = &ApiMessage.Data.GetInputRequest;
|
||||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||||
|
@ -164,14 +162,13 @@ IntGetConsoleInput(HANDLE hConsoleInput,
|
||||||
GetInputRequest->Unicode = bUnicode;
|
GetInputRequest->Unicode = bUnicode;
|
||||||
|
|
||||||
/* Call the server */
|
/* Call the server */
|
||||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||||
CaptureBuffer,
|
CaptureBuffer,
|
||||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetConsoleInput),
|
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetConsoleInput),
|
||||||
sizeof(CONSOLE_GETINPUT));
|
sizeof(*GetInputRequest));
|
||||||
DPRINT("Server returned: %x\n", Status);
|
|
||||||
|
|
||||||
/* Check for success */
|
/* Check for success */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(ApiMessage.Status))
|
||||||
{
|
{
|
||||||
/* Return the number of events read */
|
/* Return the number of events read */
|
||||||
DPRINT("Events read: %lx\n", GetInputRequest->InputsRead);
|
DPRINT("Events read: %lx\n", GetInputRequest->InputsRead);
|
||||||
|
@ -191,7 +188,7 @@ IntGetConsoleInput(HANDLE hConsoleInput,
|
||||||
*lpNumberOfEventsRead = 0;
|
*lpNumberOfEventsRead = 0;
|
||||||
|
|
||||||
/* Error out */
|
/* Error out */
|
||||||
BaseSetLastNTError(Status);
|
BaseSetLastNTError(ApiMessage.Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release the capture buffer */
|
/* Release the capture buffer */
|
||||||
|
@ -199,7 +196,7 @@ IntGetConsoleInput(HANDLE hConsoleInput,
|
||||||
|
|
||||||
/* Return TRUE or FALSE */
|
/* Return TRUE or FALSE */
|
||||||
return (GetInputRequest->InputsRead > 0);
|
return (GetInputRequest->InputsRead > 0);
|
||||||
// return NT_SUCCESS(Status);
|
// return NT_SUCCESS(ApiMessage.Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,8 +249,7 @@ IntReadConsoleOutput(HANDLE hConsoleOutput,
|
||||||
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||||
CaptureBuffer,
|
CaptureBuffer,
|
||||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepReadConsoleOutput),
|
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepReadConsoleOutput),
|
||||||
sizeof(CONSOLE_READOUTPUT));
|
sizeof(*ReadOutputRequest));
|
||||||
DPRINT("Server returned: %x\n", ApiMessage.Status);
|
|
||||||
|
|
||||||
/* Check for success */
|
/* Check for success */
|
||||||
if (NT_SUCCESS(ApiMessage.Status))
|
if (NT_SUCCESS(ApiMessage.Status))
|
||||||
|
@ -295,7 +291,6 @@ IntReadConsoleOutputCode(HANDLE hConsoleOutput,
|
||||||
COORD dwReadCoord,
|
COORD dwReadCoord,
|
||||||
LPDWORD lpNumberOfCodesRead)
|
LPDWORD lpNumberOfCodesRead)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
|
||||||
BOOL bRet = TRUE;
|
BOOL bRet = TRUE;
|
||||||
CONSOLE_API_MESSAGE ApiMessage;
|
CONSOLE_API_MESSAGE ApiMessage;
|
||||||
PCONSOLE_READOUTPUTCODE ReadOutputCodeRequest = &ApiMessage.Data.ReadOutputCodeRequest;
|
PCONSOLE_READOUTPUTCODE ReadOutputCodeRequest = &ApiMessage.Data.ReadOutputCodeRequest;
|
||||||
|
@ -346,13 +341,13 @@ IntReadConsoleOutputCode(HANDLE hConsoleOutput,
|
||||||
ReadOutputCodeRequest->NumCodesToRead = nLength;
|
ReadOutputCodeRequest->NumCodesToRead = nLength;
|
||||||
|
|
||||||
/* Call the server */
|
/* Call the server */
|
||||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||||
CaptureBuffer,
|
CaptureBuffer,
|
||||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepReadConsoleOutputString),
|
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepReadConsoleOutputString),
|
||||||
sizeof(CONSOLE_READOUTPUTCODE));
|
sizeof(*ReadOutputCodeRequest));
|
||||||
|
|
||||||
/* Check for success */
|
/* Check for success */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(ApiMessage.Status))
|
||||||
{
|
{
|
||||||
CodesRead = ReadOutputCodeRequest->CodesRead;
|
CodesRead = ReadOutputCodeRequest->CodesRead;
|
||||||
memcpy(pCode, ReadOutputCodeRequest->pCode.pCode, CodesRead * CodeSize);
|
memcpy(pCode, ReadOutputCodeRequest->pCode.pCode, CodesRead * CodeSize);
|
||||||
|
@ -370,7 +365,7 @@ IntReadConsoleOutputCode(HANDLE hConsoleOutput,
|
||||||
*lpNumberOfCodesRead = 0;
|
*lpNumberOfCodesRead = 0;
|
||||||
|
|
||||||
/* Error out */
|
/* Error out */
|
||||||
BaseSetLastNTError(Status);
|
BaseSetLastNTError(ApiMessage.Status);
|
||||||
bRet = FALSE;
|
bRet = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,7 +388,6 @@ IntWriteConsole(HANDLE hConsoleOutput,
|
||||||
LPVOID lpReserved,
|
LPVOID lpReserved,
|
||||||
BOOL bUnicode)
|
BOOL bUnicode)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
|
||||||
BOOL bRet = TRUE;
|
BOOL bRet = TRUE;
|
||||||
CONSOLE_API_MESSAGE ApiMessage;
|
CONSOLE_API_MESSAGE ApiMessage;
|
||||||
PCONSOLE_WRITECONSOLE WriteConsoleRequest = &ApiMessage.Data.WriteConsoleRequest;
|
PCONSOLE_WRITECONSOLE WriteConsoleRequest = &ApiMessage.Data.WriteConsoleRequest;
|
||||||
|
@ -425,13 +419,13 @@ IntWriteConsole(HANDLE hConsoleOutput,
|
||||||
WriteConsoleRequest->Unicode = bUnicode;
|
WriteConsoleRequest->Unicode = bUnicode;
|
||||||
|
|
||||||
/* Call the server */
|
/* Call the server */
|
||||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||||
CaptureBuffer,
|
CaptureBuffer,
|
||||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepWriteConsole),
|
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepWriteConsole),
|
||||||
sizeof(CONSOLE_WRITECONSOLE));
|
sizeof(*WriteConsoleRequest));
|
||||||
|
|
||||||
/* Check for success */
|
/* Check for success */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(ApiMessage.Status))
|
||||||
{
|
{
|
||||||
if (lpNumberOfCharsWritten != NULL)
|
if (lpNumberOfCharsWritten != NULL)
|
||||||
*lpNumberOfCharsWritten = WriteConsoleRequest->NrCharactersWritten;
|
*lpNumberOfCharsWritten = WriteConsoleRequest->NrCharactersWritten;
|
||||||
|
@ -444,7 +438,7 @@ IntWriteConsole(HANDLE hConsoleOutput,
|
||||||
*lpNumberOfCharsWritten = 0;
|
*lpNumberOfCharsWritten = 0;
|
||||||
|
|
||||||
/* Error out */
|
/* Error out */
|
||||||
BaseSetLastNTError(Status);
|
BaseSetLastNTError(ApiMessage.Status);
|
||||||
bRet = FALSE;
|
bRet = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,8 +491,7 @@ IntWriteConsoleInput(HANDLE hConsoleInput,
|
||||||
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||||
CaptureBuffer,
|
CaptureBuffer,
|
||||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepWriteConsoleInput),
|
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepWriteConsoleInput),
|
||||||
sizeof(CONSOLE_WRITEINPUT));
|
sizeof(*WriteInputRequest));
|
||||||
DPRINT("Server returned: %x\n", ApiMessage.Status);
|
|
||||||
|
|
||||||
/* Check for success */
|
/* Check for success */
|
||||||
if (NT_SUCCESS(ApiMessage.Status))
|
if (NT_SUCCESS(ApiMessage.Status))
|
||||||
|
@ -583,8 +576,7 @@ IntWriteConsoleOutput(HANDLE hConsoleOutput,
|
||||||
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||||
CaptureBuffer,
|
CaptureBuffer,
|
||||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepWriteConsoleOutput),
|
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepWriteConsoleOutput),
|
||||||
sizeof(CONSOLE_WRITEOUTPUT));
|
sizeof(*WriteOutputRequest));
|
||||||
DPRINT("Server returned: %x\n", ApiMessage.Status);
|
|
||||||
|
|
||||||
/* Check for success */
|
/* Check for success */
|
||||||
if (!NT_SUCCESS(ApiMessage.Status))
|
if (!NT_SUCCESS(ApiMessage.Status))
|
||||||
|
@ -614,7 +606,6 @@ IntWriteConsoleOutputCode(HANDLE hConsoleOutput,
|
||||||
COORD dwWriteCoord,
|
COORD dwWriteCoord,
|
||||||
LPDWORD lpNumberOfCodesWritten)
|
LPDWORD lpNumberOfCodesWritten)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
|
||||||
BOOL bRet = TRUE;
|
BOOL bRet = TRUE;
|
||||||
CONSOLE_API_MESSAGE ApiMessage;
|
CONSOLE_API_MESSAGE ApiMessage;
|
||||||
PCONSOLE_WRITEOUTPUTCODE WriteOutputCodeRequest = &ApiMessage.Data.WriteOutputCodeRequest;
|
PCONSOLE_WRITEOUTPUTCODE WriteOutputCodeRequest = &ApiMessage.Data.WriteOutputCodeRequest;
|
||||||
|
@ -665,13 +656,13 @@ IntWriteConsoleOutputCode(HANDLE hConsoleOutput,
|
||||||
WriteOutputCodeRequest->Length = (USHORT)nLength;
|
WriteOutputCodeRequest->Length = (USHORT)nLength;
|
||||||
|
|
||||||
/* Call the server */
|
/* Call the server */
|
||||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||||
CaptureBuffer,
|
CaptureBuffer,
|
||||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepWriteConsoleOutputString),
|
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepWriteConsoleOutputString),
|
||||||
sizeof(CONSOLE_WRITEOUTPUTCODE));
|
sizeof(*WriteOutputCodeRequest));
|
||||||
|
|
||||||
/* Check for success */
|
/* Check for success */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(ApiMessage.Status))
|
||||||
{
|
{
|
||||||
// WriteOutputCodeRequest->Coord = WriteOutputCodeRequest->EndCoord;
|
// WriteOutputCodeRequest->Coord = WriteOutputCodeRequest->EndCoord;
|
||||||
|
|
||||||
|
@ -687,7 +678,7 @@ IntWriteConsoleOutputCode(HANDLE hConsoleOutput,
|
||||||
*lpNumberOfCodesWritten = 0;
|
*lpNumberOfCodesWritten = 0;
|
||||||
|
|
||||||
/* Error out */
|
/* Error out */
|
||||||
BaseSetLastNTError(Status);
|
BaseSetLastNTError(ApiMessage.Status);
|
||||||
bRet = FALSE;
|
bRet = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,7 +697,6 @@ IntFillConsoleOutputCode(HANDLE hConsoleOutput,
|
||||||
COORD dwWriteCoord,
|
COORD dwWriteCoord,
|
||||||
LPDWORD lpNumberOfCodesWritten)
|
LPDWORD lpNumberOfCodesWritten)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
|
||||||
CONSOLE_API_MESSAGE ApiMessage;
|
CONSOLE_API_MESSAGE ApiMessage;
|
||||||
PCONSOLE_FILLOUTPUTCODE FillOutputRequest = &ApiMessage.Data.FillOutputRequest;
|
PCONSOLE_FILLOUTPUTCODE FillOutputRequest = &ApiMessage.Data.FillOutputRequest;
|
||||||
|
|
||||||
|
@ -737,13 +727,13 @@ IntFillConsoleOutputCode(HANDLE hConsoleOutput,
|
||||||
FillOutputRequest->Length = nLength;
|
FillOutputRequest->Length = nLength;
|
||||||
|
|
||||||
/* Call the server */
|
/* Call the server */
|
||||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||||
NULL,
|
NULL,
|
||||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepFillConsoleOutput),
|
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepFillConsoleOutput),
|
||||||
sizeof(CONSOLE_FILLOUTPUTCODE));
|
sizeof(*FillOutputRequest));
|
||||||
|
|
||||||
/* Check for success */
|
/* Check for success */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(ApiMessage.Status))
|
||||||
{
|
{
|
||||||
if (lpNumberOfCodesWritten != NULL)
|
if (lpNumberOfCodesWritten != NULL)
|
||||||
*lpNumberOfCodesWritten = FillOutputRequest->Length;
|
*lpNumberOfCodesWritten = FillOutputRequest->Length;
|
||||||
|
@ -756,7 +746,7 @@ IntFillConsoleOutputCode(HANDLE hConsoleOutput,
|
||||||
if (lpNumberOfCodesWritten != NULL)
|
if (lpNumberOfCodesWritten != NULL)
|
||||||
*lpNumberOfCodesWritten = 0;
|
*lpNumberOfCodesWritten = 0;
|
||||||
|
|
||||||
BaseSetLastNTError(Status);
|
BaseSetLastNTError(ApiMessage.Status);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue