--- trunk/reactos/subsys/csrss/win32csr/conio.c 2005-05-08 03:09:14 UTC (rev 15110)
+++ trunk/reactos/subsys/csrss/win32csr/conio.c 2005-05-08 04:07:56 UTC (rev 15111)
@@ -75,7 +75,7 @@
ConioConsoleCtrlEvent(DWORD Event, PCSRSS_PROCESS_DATA ProcessData)
{
HANDLE Thread;
-
+
DPRINT("ConioConsoleCtrlEvent Parent ProcessId = %x\n", ProcessData->ProcessId);
if (ProcessData->CtrlDispatcher)
@@ -105,7 +105,7 @@
{
DWORD Offset = 2 * (Buff->CurrentY * Buff->MaxX);
UINT Pos;
-
+
for (Pos = 0; Pos < Buff->MaxX; Pos++)
{
/* Fill the cell: Offset is incremented by the macro */
@@ -154,9 +154,9 @@
Console->Title.MaximumLength = Console->Title.Length = 0;
Console->Title.Buffer = NULL;
-
+
RtlCreateUnicodeString(&Console->Title, L"Command Prompt");
-
+
Console->Header.ReferenceCount = 0;
Console->WaitingChars = 0;
Console->WaitingLines = 0;
@@ -302,7 +302,7 @@
return Status;
}
ProcessData->CtrlDispatcher = Request->Data.AllocConsoleRequest.CtrlDispatcher;
- DPRINT("CSRSS:CtrlDispatcher address: %x\n", ProcessData->CtrlDispatcher);
+ DPRINT("CSRSS:CtrlDispatcher address: %x\n", ProcessData->CtrlDispatcher);
InsertHeadList(&ProcessData->Console->ProcessList, &ProcessData->ProcessEntry);
return STATUS_SUCCESS;
@@ -329,7 +329,7 @@
{
ConioDeleteConsole((Object_t *) Console);
}
-
+
return STATUS_SUCCESS;
}
@@ -513,9 +513,9 @@
ULONG nNumberOfCharsToRead, CharSize;
PCSRSS_CONSOLE Console;
NTSTATUS Status;
-
+
DPRINT("CsrReadConsole\n");
-
+
CharSize = (Request->Data.ReadConsoleRequest.Unicode ? sizeof(WCHAR) : sizeof(CHAR));
/* truncate length to CSRSS_MAX_READ_CONSOLE_REQUEST */
@@ -785,7 +785,7 @@
DstY = (DstRegion->top + ScreenBuffer->ShowY) % ScreenBuffer->MaxY;
SrcOffset = (SrcY * ScreenBuffer->MaxX + SrcRegion->left + ScreenBuffer->ShowX) * 2;
DstOffset = (DstY * ScreenBuffer->MaxX + DstRegion->left + ScreenBuffer->ShowX) * 2;
-
+
for (i = SrcRegion->top; i <= SrcRegion->bottom; i++)
{
RtlCopyMemory(
@@ -827,7 +827,7 @@
DWORD Delta;
ULONG i;
CHAR Char;
-
+
if(bUnicode)
ConsoleUnicodeCharToAnsiChar(Console, &Char, &CharInfo->Char.UnicodeChar);
else
@@ -875,7 +875,7 @@
ULONG CharSize = (Request->Data.WriteConsoleRequest.Unicode ? sizeof(WCHAR) : sizeof(CHAR));
DPRINT("CsrWriteConsole\n");
-
+
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
@@ -997,7 +997,7 @@
/* process Ctrl-C and Ctrl-Break */
if (Console->Mode & ENABLE_PROCESSED_INPUT &&
KeyEventRecord->InputEvent.Event.KeyEvent.bKeyDown &&
- ((KeyEventRecord->InputEvent.Event.KeyEvent.wVirtualKeyCode == VK_PAUSE) ||
+ ((KeyEventRecord->InputEvent.Event.KeyEvent.wVirtualKeyCode == VK_PAUSE) ||
(KeyEventRecord->InputEvent.Event.KeyEvent.wVirtualKeyCode == 'C')) &&
(KeyEventRecord->InputEvent.Event.KeyEvent.dwControlKeyState & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)))
{
@@ -1043,10 +1043,10 @@
else if (Console->ActiveBuffer->ShowY != Console->ActiveBuffer->CurrentY)
/* only scroll down if there is room to scroll down into */
{
- if (Console->ActiveBuffer->ShowY % Console->ActiveBuffer->MaxY !=
+ if (Console->ActiveBuffer->ShowY % Console->ActiveBuffer->MaxY !=
Console->ActiveBuffer->CurrentY)
{
- if (((Console->ActiveBuffer->CurrentY + 1) % Console->ActiveBuffer->MaxY) !=
+ if (((Console->ActiveBuffer->CurrentY + 1) % Console->ActiveBuffer->MaxY) !=
(Console->ActiveBuffer->ShowY + Console->ActiveBuffer->MaxY) %
Console->ActiveBuffer->MaxY)
{
@@ -1222,7 +1222,7 @@
RepeatCount = 1;
VirtualScanCode = (msg->lParam >> 16) & 0xff;
- Down = msg->message == WM_KEYDOWN || msg->message == WM_CHAR ||
+ Down = msg->message == WM_KEYDOWN || msg->message == WM_CHAR ||
msg->message == WM_SYSKEYDOWN || msg->message == WM_SYSCHAR;
GetKeyboardState(KeyState);
@@ -1232,9 +1232,9 @@
{
VirtualKeyCode = LastVirtualKey;
UnicodeChar = msg->wParam;
- }
+ }
else
- {
+ {
WCHAR Chars[2];
INT RetChars = 0;
@@ -1253,7 +1253,7 @@
{
AsciiChar = 0;
}
-
+
er.EventType = KEY_EVENT;
er.Event.KeyEvent.bKeyDown = Down;
er.Event.KeyEvent.wRepeatCount = RepeatCount;
@@ -1263,7 +1263,7 @@
er.Event.KeyEvent.wVirtualScanCode = VirtualScanCode;
if (TextMode)
- {
+ {
if (0 != (ShiftState & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED))
&& VK_TAB == VirtualKeyCode)
{
@@ -1283,7 +1283,7 @@
}
}
- if (NULL == Console)
+ if (NULL == Console)
{
return;
}
@@ -1294,9 +1294,9 @@
{
return;
}
-
+
ConInRec->InputEvent = er;
- ConInRec->Fake = UnicodeChar &&
+ ConInRec->Fake = UnicodeChar &&
(msg->message != WM_CHAR && msg->message != WM_SYSCHAR &&
msg->message != WM_KEYUP && msg->message != WM_SYSKEYUP);
ConInRec->NotChar = (msg->message != WM_CHAR && msg->message != WM_SYSCHAR);
@@ -1314,7 +1314,7 @@
VirtualKeyCode,
(AsciiChar >= ' ') ? AsciiChar : '.',
ShiftState);
-
+
if (! ConInRec->Fake || ! ConInRec->NotChar)
{
/* FIXME - convert to ascii */
@@ -1339,7 +1339,7 @@
PrivateCsrssRegisterPrimitive();
/* This call turns on the input system in win32k */
PrivateCsrssAcquireOrReleaseInputOwnership(FALSE);
-
+
while (TRUE)
{
GetMessageW(&msg, 0, 0, 0);
@@ -1362,7 +1362,7 @@
NTSTATUS Status;
PCSRSS_SCREEN_BUFFER Buff;
PCONSOLE_SCREEN_BUFFER_INFO pInfo;
-
+
DPRINT("CsrGetScreenBufferInfo\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
@@ -1399,7 +1399,7 @@
PCSRSS_SCREEN_BUFFER Buff;
LONG OldCursorX, OldCursorY;
LONG NewCursorX, NewCursorY;
-
+
DPRINT("CsrSetCursor\n");
Status = ConioConsoleFromProcessData(ProcessData, &Console);
@@ -1491,7 +1491,7 @@
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
-
+
CharSize = (Request->Data.WriteConsoleOutputCharRequest.Unicode ? sizeof(WCHAR) : sizeof(CHAR));
if (Request->Header.DataSize
@@ -1576,7 +1576,7 @@
RECT UpdateRect;
DPRINT("CsrFillOutputChar\n");
-
+
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
@@ -1643,13 +1643,13 @@
NTSTATUS Status;
BOOLEAN Done = FALSE;
ConsoleInput *Input;
-
+
DPRINT("CsrReadInputEvent\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Reply->Data.ReadInputReply.Event = ProcessData->ConsoleEvent;
-
+
Status = ConioLockConsole(ProcessData, Request->Data.ReadInputRequest.ConsoleHandle, &Console);
if (! NT_SUCCESS(Status))
{
@@ -1668,7 +1668,7 @@
Reply->Data.ReadInputReply.MoreEvents = TRUE;
break;
}
-
+
RemoveEntryList(&Input->ListEntry);
if (!Done && !Input->Fake)
@@ -1693,7 +1693,7 @@
}
HeapFree(Win32CsrApiHeap, 0, Input);
}
-
+
if (Done)
{
Status = STATUS_SUCCESS;
@@ -1725,7 +1725,7 @@
RECT UpdateRect;
DPRINT("CsrWriteConsoleOutputAttrib\n");
-
+
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
@@ -1812,7 +1812,7 @@
{
return Reply->Status = Status;
}
-
+
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Status = ConioLockScreenBuffer(ProcessData, Request->Data.FillOutputAttribRequest.ConsoleHandle, &Buff);
@@ -1866,7 +1866,7 @@
{
PCSRSS_SCREEN_BUFFER Buff;
NTSTATUS Status;
-
+
DPRINT("CsrGetCursorInfo\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
@@ -1890,7 +1890,7 @@
DWORD Size;
BOOL Visible;
NTSTATUS Status;
-
+
DPRINT("CsrSetCursorInfo\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
@@ -1951,7 +1951,7 @@
NTSTATUS Status;
PCSRSS_CONSOLE Console;
PCSRSS_SCREEN_BUFFER Buff;
- LONG OldCursorX, OldCursorY;
+ LONG OldCursorX, OldCursorY;
DPRINT("CsrSetTextAttrib\n");
@@ -2069,7 +2069,7 @@
PCSRSS_CONSOLE Console;
PCSRSS_SCREEN_BUFFER Buff;
NTSTATUS Status;
-
+
DPRINT("CsrCreateScreenBuffer\n");
if (ProcessData == NULL)
@@ -2186,7 +2186,7 @@
Status = ConioLockConsole(ProcessData, Request->Data.SetTitleRequest.Console, &Console);
if(! NT_SUCCESS(Status))
{
- Reply->Status = Status;
+ Reply->Status = Status;
}
else
{
@@ -2211,7 +2211,7 @@
{
NTSTATUS Status;
PCSRSS_CONSOLE Console;
-
+
DPRINT("CsrGetTitle\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
@@ -2224,7 +2224,7 @@
DPRINT1("Can't get console\n");
return Reply->Status = Status;
}
-
+
/* Copy title of the console to the user title buffer */
RtlZeroMemory(&Reply->Data.GetTitleReply, sizeof(CSRSS_GET_TITLE_REPLY));
Reply->Data.GetTitleReply.ConsoleHandle = Request->Data.GetTitleRequest.ConsoleHandle;
@@ -2281,7 +2281,7 @@
BufferCoord = Request->Data.WriteConsoleOutputRequest.BufferCoord;
CharInfo = Request->Data.WriteConsoleOutputRequest.CharInfo;
if (((PVOID)CharInfo < ProcessData->CsrSectionViewBase) ||
- (((PVOID)CharInfo + PSize) >
+ (((PVOID)CharInfo + PSize) >
(ProcessData->CsrSectionViewBase + ProcessData->CsrSectionViewSize)))
{
ConioUnlockScreenBuffer(Buff);
@@ -2510,9 +2510,9 @@
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = Reply->Header.MessageSize - LPC_MESSAGE_BASE_SIZE;
ReadBuffer = Reply->Data.ReadConsoleOutputCharReply.String;
-
+
CharSize = (Request->Data.ReadConsoleOutputCharRequest.Unicode ? sizeof(WCHAR) : sizeof(CHAR));
-
+
Status = ConioConsoleFromProcessData(ProcessData, &Console);
if (! NT_SUCCESS(Status))
{
@@ -2531,7 +2531,7 @@
for (i = 0; i < Request->Data.ReadConsoleOutputCharRequest.NumCharsToRead; ++i)
{
Char = Buff->Buffer[(Xpos * 2) + (Ypos * 2 * Buff->MaxX)];
-
+
if(Request->Data.ReadConsoleOutputCharRequest.Unicode)
{
ConsoleAnsiCharToUnicodeChar(Console, (WCHAR*)ReadBuffer, &Char);
@@ -2566,7 +2566,7 @@
{
ConioUnlockConsole(Console);
}
-
+
Reply->Data.ReadConsoleOutputCharReply.CharsRead = (DWORD)((ULONG_PTR)ReadBuffer - (ULONG_PTR)Reply->Data.ReadConsoleOutputCharReply.String) / CharSize;
return Reply->Status;
@@ -2636,7 +2636,7 @@
PLIST_ENTRY CurrentItem;
DWORD NumEvents;
ConsoleInput *Input;
-
+
DPRINT("CsrGetNumberOfConsoleInputEvents\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
@@ -2647,10 +2647,10 @@
{
return Reply->Status = Status;
}
-
+
CurrentItem = Console->InputEvents.Flink;
NumEvents = 0;
-
+
/* If there are any events ... */
while (CurrentItem != &Console->InputEvents)
{
@@ -2663,10 +2663,10 @@
}
ConioUnlockConsole(Console);
-
+
Reply->Status = STATUS_SUCCESS;
Reply->Data.GetNumInputEventsReply.NumInputEvents = NumEvents;
-
+
return Reply->Status;
}
@@ -2681,22 +2681,22 @@
PINPUT_RECORD InputRecord;
ConsoleInput* Item;
UINT NumItems;
-
+
DPRINT("CsrPeekConsoleInput\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
-
+
Status = ConioLockConsole(ProcessData, Request->Data.GetNumInputEventsRequest.ConsoleHandle, &Console);
if(! NT_SUCCESS(Status))
{
return Reply->Status = Status;
}
-
+
InputRecord = Request->Data.PeekConsoleInputRequest.InputRecord;
Length = Request->Data.PeekConsoleInputRequest.Length;
Size = Length * sizeof(INPUT_RECORD);
-
+
if (((PVOID)InputRecord < ProcessData->CsrSectionViewBase)
|| (((PVOID)InputRecord + Size) > (ProcessData->CsrSectionViewBase + ProcessData->CsrSectionViewSize)))
{
@@ -2704,13 +2704,13 @@
Reply->Status = STATUS_ACCESS_VIOLATION;
return Reply->Status ;
}
-
+
NumItems = 0;
-
+
if (! IsListEmpty(&Console->InputEvents))
{
CurrentItem = Console->InputEvents.Flink;
-
+
while (CurrentItem != &Console->InputEvents && NumItems < Length)
{
Item = CONTAINING_RECORD(CurrentItem, ConsoleInput, ListEntry);
@@ -2720,7 +2720,7 @@
CurrentItem = CurrentItem->Flink;
continue;
}
-
+
++NumItems;
*InputRecord = Item->InputEvent;
@@ -2728,7 +2728,7 @@
{
ConioInputEventToAnsi(Console, InputRecord);
}
-
+
InputRecord++;
CurrentItem = CurrentItem->Flink;
}
@@ -2758,18 +2758,18 @@
RECT ScreenRect;
DWORD i, Y, X, Offset;
UINT CodePage;
-
+
DPRINT("CsrReadConsoleOutput\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
-
+
Status = ConioLockScreenBuffer(ProcessData, Request->Data.ReadConsoleOutputRequest.ConsoleHandle, &Buff);
if (! NT_SUCCESS(Status))
{
return Reply->Status = Status;
}
-
+
CharInfo = Request->Data.ReadConsoleOutputRequest.CharInfo;
ReadRegion.left = Request->Data.ReadConsoleOutputRequest.ReadRegion.Left;
ReadRegion.top = Request->Data.ReadConsoleOutputRequest.ReadRegion.Top;
@@ -2782,7 +2782,7 @@
/* FIXME: Is this correct? */
CodePage = ProcessData->Console->OutputCodePage;
-
+
if (((PVOID)CharInfo < ProcessData->CsrSectionViewBase)
|| (((PVOID)CharInfo + Size) > (ProcessData->CsrSectionViewBase + ProcessData->CsrSectionViewSize)))
{
@@ -2790,7 +2790,7 @@
Reply->Status = STATUS_ACCESS_VIOLATION;
return Reply->Status ;
}
-
+
SizeY = RtlRosMin(BufferSize.Y - BufferCoord.Y, ConioRectHeight(&ReadRegion));
SizeX = RtlRosMin(BufferSize.X - BufferCoord.X, ConioRectWidth(&ReadRegion));
ReadRegion.bottom = ReadRegion.top + SizeY;
@@ -2807,7 +2807,7 @@
for (i = 0, Y = ReadRegion.top; Y < ReadRegion.bottom; ++i, ++Y)
{
CurCharInfo = CharInfo + (i * BufferSize.X);
-
+
Offset = (((Y + Buff->ShowY) % Buff->MaxY) * Buff->MaxX + ReadRegion.left) * 2;
for (X = ReadRegion.left; X < ReadRegion.right; ++X)
{
@@ -2827,13 +2827,13 @@
}
ConioUnlockScreenBuffer(Buff);
-
+
Reply->Status = STATUS_SUCCESS;
Reply->Data.ReadConsoleOutputReply.ReadRegion.Right = ReadRegion.left + SizeX - 1;
Reply->Data.ReadConsoleOutputReply.ReadRegion.Bottom = ReadRegion.top + SizeY - 1;
Reply->Data.ReadConsoleOutputReply.ReadRegion.Left = ReadRegion.left;
Reply->Data.ReadConsoleOutputReply.ReadRegion.Top = ReadRegion.top;
-
+
return Reply->Status;
}
@@ -2847,22 +2847,22 @@
DWORD Size;
DWORD i;
ConsoleInput* Record;
-
+
DPRINT("CsrWriteConsoleInput\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
-
+
Status = ConioLockConsole(ProcessData, Request->Data.WriteConsoleInputRequest.ConsoleHandle, &Console);
if (! NT_SUCCESS(Status))
{
return Reply->Status = Status;
}
-
+
InputRecord = Request->Data.WriteConsoleInputRequest.InputRecord;
Length = Request->Data.WriteConsoleInputRequest.Length;
Size = Length * sizeof(INPUT_RECORD);
-
+
if (((PVOID)InputRecord < ProcessData->CsrSectionViewBase)
|| (((PVOID)InputRecord + Size) > (ProcessData->CsrSectionViewBase + ProcessData->CsrSectionViewSize)))
{
@@ -2870,7 +2870,7 @@
Reply->Status = STATUS_ACCESS_VIOLATION;
return Reply->Status ;
}
-
+
for (i = 0; i < Length; i++)
{
Record = HeapAlloc(Win32CsrApiHeap, 0, sizeof(ConsoleInput));
@@ -2892,7 +2892,7 @@
}
ConioUnlockConsole(Console);
-
+
Reply->Status = STATUS_SUCCESS;
Reply->Data.WriteConsoleInputReply.Length = i;
@@ -2928,7 +2928,7 @@
Console->HardwareState = ConsoleHwState;
}
- return STATUS_SUCCESS;
+ return STATUS_SUCCESS;
}
return STATUS_INVALID_PARAMETER_3; /* Client: (handle, set_get, [mode]) */
@@ -2938,12 +2938,12 @@
{
PCSRSS_CONSOLE Console;
NTSTATUS Status;
-
+
DPRINT("CsrHardwareStateProperty\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
-
+
Status = ConioLockConsole(ProcessData,
Request->Data.ConsoleHardwareStateRequest.ConsoleHandle,
&Console);
@@ -2958,7 +2958,7 @@
case CONSOLE_HARDWARE_STATE_GET:
Reply->Data.ConsoleHardwareStateReply.State = Console->HardwareState;
break;
[truncated at 1000 lines; 10086 more skipped]