mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:25:39 +00:00
Implimented switch back to text mode after gditest
svn path=/trunk/; revision=1245
This commit is contained in:
parent
aa9ca10d75
commit
418efd5de8
2 changed files with 48 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: conio.c,v 1.8 2000/07/06 14:34:52 dwelch Exp $
|
/* $Id: conio.c,v 1.9 2000/07/07 01:16:50 phreak Exp $
|
||||||
*
|
*
|
||||||
* reactos/subsys/csrss/api/conio.c
|
* reactos/subsys/csrss/api/conio.c
|
||||||
*
|
*
|
||||||
|
@ -15,6 +15,7 @@
|
||||||
#include "api.h"
|
#include "api.h"
|
||||||
#include <ntdll/rtl.h>
|
#include <ntdll/rtl.h>
|
||||||
#include <ddk/ntddblue.h>
|
#include <ddk/ntddblue.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
|
@ -460,7 +461,7 @@ VOID CsrInitConsoleSupport(VOID)
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
&Iosb,
|
&Iosb,
|
||||||
0,
|
0,
|
||||||
FILE_SYNCHRONOUS_IO_ALERT);
|
0);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("CSR: Failed to open keyboard. Expect problems.\n");
|
DbgPrint("CSR: Failed to open keyboard. Expect problems.\n");
|
||||||
|
@ -477,13 +478,23 @@ VOID CsrInitConsoleSupport(VOID)
|
||||||
PhysicalConsoleSize = ScrInfo.dwSize;
|
PhysicalConsoleSize = ScrInfo.dwSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID Console_Api( DWORD Ignored )
|
VOID Console_Api( DWORD RefreshEvent )
|
||||||
{
|
{
|
||||||
/* keep reading events from the keyboard and stuffing them into the current
|
/* keep reading events from the keyboard and stuffing them into the current
|
||||||
console's input queue */
|
console's input queue */
|
||||||
ConsoleInput *KeyEventRecord;
|
ConsoleInput *KeyEventRecord;
|
||||||
IO_STATUS_BLOCK Iosb;
|
IO_STATUS_BLOCK Iosb;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
HANDLE Events[2]; // 0 = keyboard, 1 = refresh
|
||||||
|
|
||||||
|
Events[0] = 0;
|
||||||
|
Status = NtCreateEvent( &Events[0], STANDARD_RIGHTS_ALL, NULL, FALSE, FALSE );
|
||||||
|
if( !NT_SUCCESS( Status ) )
|
||||||
|
{
|
||||||
|
DbgPrint( "CSR: NtCreateEvent failed: %x\n", Status );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Events[1] = (HANDLE)RefreshEvent;
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
KeyEventRecord = RtlAllocateHeap(CsrssApiHeap,
|
KeyEventRecord = RtlAllocateHeap(CsrssApiHeap,
|
||||||
|
@ -495,13 +506,33 @@ VOID Console_Api( DWORD Ignored )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
KeyEventRecord->InputEvent.EventType = KEY_EVENT;
|
KeyEventRecord->InputEvent.EventType = KEY_EVENT;
|
||||||
Status = NtReadFile( KeyboardDeviceHandle, NULL, NULL, NULL, &Iosb, &KeyEventRecord->InputEvent.Event.KeyEvent, sizeof( KEY_EVENT_RECORD ), NULL, 0 );
|
Status = NtReadFile( KeyboardDeviceHandle, Events[0], NULL, NULL, &Iosb, &KeyEventRecord->InputEvent.Event.KeyEvent, sizeof( KEY_EVENT_RECORD ), NULL, 0 );
|
||||||
if( !NT_SUCCESS( Status ) )
|
if( !NT_SUCCESS( Status ) )
|
||||||
{
|
{
|
||||||
DbgPrint( "CSR: ReadFile on keyboard device failed\n" );
|
DbgPrint( "CSR: ReadFile on keyboard device failed\n" );
|
||||||
RtlFreeHeap( CsrssApiHeap, 0, KeyEventRecord );
|
RtlFreeHeap( CsrssApiHeap, 0, KeyEventRecord );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if( Status == STATUS_PENDING )
|
||||||
|
{
|
||||||
|
while( 1 )
|
||||||
|
{
|
||||||
|
Status = NtWaitForMultipleObjects( 2, Events, WaitAny, FALSE, NULL );
|
||||||
|
if( Status == STATUS_WAIT_0 + 1 )
|
||||||
|
{
|
||||||
|
RtlEnterCriticalSection( &ActiveConsoleLock );
|
||||||
|
CsrDrawConsole( ActiveConsole );
|
||||||
|
RtlLeaveCriticalSection( &ActiveConsoleLock );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if( Status != STATUS_WAIT_0 )
|
||||||
|
{
|
||||||
|
DbgPrint( "CSR: NtWaitForMultipleObjects failed: %x, exiting\n", Status );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else break;
|
||||||
|
}
|
||||||
|
}
|
||||||
// DbgPrint( "Char: %c\n", KeyEventRecord->InputEvent.Event.KeyEvent.uChar.AsciiChar );
|
// DbgPrint( "Char: %c\n", KeyEventRecord->InputEvent.Event.KeyEvent.uChar.AsciiChar );
|
||||||
if( KeyEventRecord->InputEvent.Event.KeyEvent.dwControlKeyState & ( RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED )&& KeyEventRecord->InputEvent.Event.KeyEvent.uChar.AsciiChar == 'q' )
|
if( KeyEventRecord->InputEvent.Event.KeyEvent.dwControlKeyState & ( RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED )&& KeyEventRecord->InputEvent.Event.KeyEvent.uChar.AsciiChar == 'q' )
|
||||||
if( KeyEventRecord->InputEvent.Event.KeyEvent.bKeyDown == TRUE )
|
if( KeyEventRecord->InputEvent.Event.KeyEvent.bKeyDown == TRUE )
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: init.c,v 1.9 2000/05/26 05:40:20 phreak Exp $
|
/* $Id: init.c,v 1.10 2000/07/07 01:16:18 phreak Exp $
|
||||||
*
|
*
|
||||||
* reactos/subsys/csrss/init.c
|
* reactos/subsys/csrss/init.c
|
||||||
*
|
*
|
||||||
|
@ -95,6 +95,9 @@ CsrServerInitialization (
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
OBJECT_ATTRIBUTES ObAttributes;
|
OBJECT_ATTRIBUTES ObAttributes;
|
||||||
UNICODE_STRING PortName;
|
UNICODE_STRING PortName;
|
||||||
|
OBJECT_ATTRIBUTES RefreshEventAttr;
|
||||||
|
UNICODE_STRING RefreshEventName;
|
||||||
|
HANDLE RefreshEventHandle;
|
||||||
|
|
||||||
Status = CsrParseCommandLine (ArgumentCount, ArgumentArray);
|
Status = CsrParseCommandLine (ArgumentCount, ArgumentArray);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -150,7 +153,15 @@ CsrServerInitialization (
|
||||||
NtClose(ApiPortHandle);
|
NtClose(ApiPortHandle);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
Status = RtlCreateUserThread( NtCurrentProcess(), NULL, FALSE, 0, NULL, NULL, (PTHREAD_START_ROUTINE)Console_Api, 0, NULL, NULL );
|
RtlInitUnicodeString( &RefreshEventName, L"\\TextConsoleRefreshEvent" );
|
||||||
|
InitializeObjectAttributes( &RefreshEventAttr, &RefreshEventName, NULL, NULL, NULL );
|
||||||
|
Status = NtCreateEvent( &RefreshEventHandle, STANDARD_RIGHTS_ALL, &RefreshEventAttr, FALSE, FALSE );
|
||||||
|
if( !NT_SUCCESS( Status ) )
|
||||||
|
{
|
||||||
|
PrintString( "CSR: Unable to create refresh event!\n" );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
Status = RtlCreateUserThread( NtCurrentProcess(), NULL, FALSE, 0, NULL, NULL, (PTHREAD_START_ROUTINE)Console_Api, (DWORD) RefreshEventHandle, NULL, NULL );
|
||||||
if( !NT_SUCCESS( Status ) )
|
if( !NT_SUCCESS( Status ) )
|
||||||
{
|
{
|
||||||
PrintString( "CSR: Unable to create console thread\n" );
|
PrintString( "CSR: Unable to create console thread\n" );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue