mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 18:52:57 +00:00
[CONSRV] Finally fix CONSOLE vs. CONSRV_CONSOLE/WINSRV_CONSOLE stuff. CORE-9496
What remains to be cleared up are the ugly casts.
This commit is contained in:
parent
a3ea0a39f1
commit
75d0346c54
17 changed files with 265 additions and 345 deletions
|
@ -40,7 +40,7 @@ list(APPEND CONSRV_SOURCE
|
||||||
consrv/consrv.h)
|
consrv/consrv.h)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Explicitely enable MS extensions to be able to use unnamed (anonymous) nested structs.
|
# Explicitly enable MS extensions to be able to use unnamed (anonymous) nested structs.
|
||||||
#
|
#
|
||||||
# FIXME: http://www.cmake.org/Bug/view.php?id=12998
|
# FIXME: http://www.cmake.org/Bug/view.php?id=12998
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
|
|
@ -18,88 +18,7 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* GLOBALS ********************************************************************/
|
/* CONSOLE VALIDATION FUNCTIONS ***********************************************/
|
||||||
|
|
||||||
static ULONG CurrentConsoleID = 0;
|
|
||||||
|
|
||||||
/* Linked list of consoles */
|
|
||||||
static LIST_ENTRY ConDrvConsoleList;
|
|
||||||
static RTL_RESOURCE ListLock;
|
|
||||||
|
|
||||||
#define ConDrvLockConsoleListExclusive() \
|
|
||||||
RtlAcquireResourceExclusive(&ListLock, TRUE)
|
|
||||||
|
|
||||||
#define ConDrvLockConsoleListShared() \
|
|
||||||
RtlAcquireResourceShared(&ListLock, TRUE)
|
|
||||||
|
|
||||||
#define ConDrvUnlockConsoleList() \
|
|
||||||
RtlReleaseResource(&ListLock)
|
|
||||||
|
|
||||||
|
|
||||||
static NTSTATUS
|
|
||||||
ConDrvInsertConsole(IN PCONSOLE Console)
|
|
||||||
{
|
|
||||||
ASSERT(Console);
|
|
||||||
|
|
||||||
/* All went right, so add the console to the list */
|
|
||||||
ConDrvLockConsoleListExclusive();
|
|
||||||
|
|
||||||
DPRINT("Insert in the list\n");
|
|
||||||
InsertTailList(&ConDrvConsoleList, &Console->ListEntry);
|
|
||||||
|
|
||||||
// FIXME: Move this code to the caller function!!
|
|
||||||
/* Get a new console ID */
|
|
||||||
_InterlockedExchange((PLONG)&Console->ConsoleID, CurrentConsoleID);
|
|
||||||
_InterlockedIncrement((PLONG)&CurrentConsoleID);
|
|
||||||
|
|
||||||
/* Unlock the console list and return success */
|
|
||||||
ConDrvUnlockConsoleList();
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static NTSTATUS
|
|
||||||
RemoveConsole(IN PCONSOLE Console)
|
|
||||||
{
|
|
||||||
// ASSERT(Console);
|
|
||||||
if (!Console) return STATUS_INVALID_PARAMETER;
|
|
||||||
|
|
||||||
/* Remove the console from the list */
|
|
||||||
ConDrvLockConsoleListExclusive();
|
|
||||||
|
|
||||||
RemoveEntryList(&Console->ListEntry);
|
|
||||||
|
|
||||||
/* Unlock the console list and return success */
|
|
||||||
ConDrvUnlockConsoleList();
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS **********************************************************/
|
|
||||||
|
|
||||||
VOID NTAPI
|
|
||||||
ConDrvPause(PCONSOLE Console)
|
|
||||||
{
|
|
||||||
/* In case we are already paused, just exit... */
|
|
||||||
if (Console->ConsolePaused) return;
|
|
||||||
|
|
||||||
/* ... otherwise set the flag */
|
|
||||||
Console->ConsolePaused = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID NTAPI
|
|
||||||
ConDrvUnpause(PCONSOLE Console)
|
|
||||||
{
|
|
||||||
/* In case we are already unpaused, just exit... */
|
|
||||||
if (!Console->ConsolePaused) return;
|
|
||||||
|
|
||||||
/* ... otherwise reset the flag */
|
|
||||||
Console->ConsolePaused = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Console accessibility check helpers
|
|
||||||
*/
|
|
||||||
|
|
||||||
BOOLEAN NTAPI
|
BOOLEAN NTAPI
|
||||||
ConDrvValidateConsoleState(IN PCONSOLE Console,
|
ConDrvValidateConsoleState(IN PCONSOLE Console,
|
||||||
|
@ -143,43 +62,24 @@ ConDrvValidateConsoleUnsafe(IN PCONSOLE Console,
|
||||||
|
|
||||||
/* CONSOLE INITIALIZATION FUNCTIONS *******************************************/
|
/* CONSOLE INITIALIZATION FUNCTIONS *******************************************/
|
||||||
|
|
||||||
VOID NTAPI
|
|
||||||
ConDrvInitConsoleSupport(VOID)
|
|
||||||
{
|
|
||||||
DPRINT("CONSRV: ConDrvInitConsoleSupport()\n");
|
|
||||||
|
|
||||||
/* Initialize the console list and its lock */
|
|
||||||
InitializeListHead(&ConDrvConsoleList);
|
|
||||||
RtlInitializeResource(&ListLock);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For resetting the terminal - defined in dummyterm.c */
|
/* For resetting the terminal - defined in dummyterm.c */
|
||||||
VOID ResetTerminal(IN PCONSOLE Console);
|
VOID ResetTerminal(IN PCONSOLE Console);
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
ConDrvInitConsole(OUT PCONSOLE* NewConsole,
|
ConDrvInitConsole(
|
||||||
IN PCONSOLE_INFO ConsoleInfo)
|
IN OUT PCONSOLE Console,
|
||||||
|
IN PCONSOLE_INFO ConsoleInfo)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
// CONSOLE_INFO CapturedConsoleInfo;
|
// CONSOLE_INFO CapturedConsoleInfo;
|
||||||
TEXTMODE_BUFFER_INFO ScreenBufferInfo;
|
TEXTMODE_BUFFER_INFO ScreenBufferInfo;
|
||||||
PCONSOLE Console;
|
|
||||||
PCONSOLE_SCREEN_BUFFER NewBuffer;
|
PCONSOLE_SCREEN_BUFFER NewBuffer;
|
||||||
|
|
||||||
if (NewConsole == NULL || ConsoleInfo == NULL)
|
if (Console == NULL || ConsoleInfo == NULL)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
*NewConsole = NULL;
|
/* Reset the console structure */
|
||||||
|
RtlZeroMemory(Console, sizeof(*Console));
|
||||||
/*
|
|
||||||
* Allocate a new console
|
|
||||||
*/
|
|
||||||
Console = ConsoleAllocHeap(HEAP_ZERO_MEMORY, sizeof(*Console));
|
|
||||||
if (NULL == Console)
|
|
||||||
{
|
|
||||||
DPRINT1("Not enough memory for console creation.\n");
|
|
||||||
return STATUS_NO_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set and fix the screen buffer size if needed.
|
* Set and fix the screen buffer size if needed.
|
||||||
|
@ -211,7 +111,6 @@ ConDrvInitConsole(OUT PCONSOLE* NewConsole,
|
||||||
{
|
{
|
||||||
DPRINT1("ConDrvInitInputBuffer: failed, Status = 0x%08lx\n", Status);
|
DPRINT1("ConDrvInitInputBuffer: failed, Status = 0x%08lx\n", Status);
|
||||||
DeleteCriticalSection(&Console->Lock);
|
DeleteCriticalSection(&Console->Lock);
|
||||||
ConsoleFreeHeap(Console);
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +139,6 @@ ConDrvInitConsole(OUT PCONSOLE* NewConsole,
|
||||||
DPRINT1("ConDrvCreateScreenBuffer: failed, Status = 0x%08lx\n", Status);
|
DPRINT1("ConDrvCreateScreenBuffer: failed, Status = 0x%08lx\n", Status);
|
||||||
ConDrvDeinitInputBuffer(Console);
|
ConDrvDeinitInputBuffer(Console);
|
||||||
DeleteCriticalSection(&Console->Lock);
|
DeleteCriticalSection(&Console->Lock);
|
||||||
ConsoleFreeHeap(Console);
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
/* Make the new screen buffer active */
|
/* Make the new screen buffer active */
|
||||||
|
@ -249,21 +147,11 @@ ConDrvInitConsole(OUT PCONSOLE* NewConsole,
|
||||||
|
|
||||||
DPRINT("Console initialized\n");
|
DPRINT("Console initialized\n");
|
||||||
|
|
||||||
/* All went right, so add the console to the list */
|
|
||||||
Status = ConDrvInsertConsole(Console);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
/* Fail */
|
|
||||||
ConDrvDeleteConsole(Console);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The initialization is finished */
|
/* The initialization is finished */
|
||||||
DPRINT("Change state\n");
|
DPRINT("Change state\n");
|
||||||
Console->State = CONSOLE_RUNNING;
|
Console->State = CONSOLE_RUNNING;
|
||||||
|
|
||||||
/* Return the newly created console to the caller and a success code too */
|
/* The caller now has a newly initialized console */
|
||||||
*NewConsole = Console;
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,7 +222,7 @@ ConDrvDeleteConsole(IN PCONSOLE Console)
|
||||||
* Forbid validation of any console by other threads
|
* Forbid validation of any console by other threads
|
||||||
* during the deletion of this console.
|
* during the deletion of this console.
|
||||||
*/
|
*/
|
||||||
ConDrvLockConsoleListExclusive();
|
// ConDrvLockConsoleListExclusive();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the console is already being destroyed, i.e. not running
|
* If the console is already being destroyed, i.e. not running
|
||||||
|
@ -343,8 +231,6 @@ ConDrvDeleteConsole(IN PCONSOLE Console)
|
||||||
if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE) &&
|
if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE) &&
|
||||||
!ConDrvValidateConsoleUnsafe(Console, CONSOLE_INITIALIZING, TRUE))
|
!ConDrvValidateConsoleUnsafe(Console, CONSOLE_INITIALIZING, TRUE))
|
||||||
{
|
{
|
||||||
/* Unlock the console list and return */
|
|
||||||
ConDrvUnlockConsoleList();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,13 +244,12 @@ ConDrvDeleteConsole(IN PCONSOLE Console)
|
||||||
/*
|
/*
|
||||||
* Allow other threads to finish their job: basically, unlock
|
* Allow other threads to finish their job: basically, unlock
|
||||||
* all other calls to EnterCriticalSection(&Console->Lock); by
|
* all other calls to EnterCriticalSection(&Console->Lock); by
|
||||||
* ConDrvValidateConsoleUnsafe functions so that they just see
|
* ConDrvValidateConsoleUnsafe() functions so that they just see
|
||||||
* that we are not in CONSOLE_RUNNING state anymore, or unlock
|
* that we are not in CONSOLE_RUNNING state anymore, or unlock
|
||||||
* other concurrent calls to ConDrvDeleteConsole so that they
|
* other concurrent calls to ConDrvDeleteConsole() so that they
|
||||||
* can see that we are in fact already deleting the console.
|
* can see that we are in fact already deleting the console.
|
||||||
*/
|
*/
|
||||||
LeaveCriticalSection(&Console->Lock);
|
LeaveCriticalSection(&Console->Lock);
|
||||||
ConDrvUnlockConsoleList();
|
|
||||||
|
|
||||||
/* Deregister the terminal */
|
/* Deregister the terminal */
|
||||||
DPRINT("Deregister terminal\n");
|
DPRINT("Deregister terminal\n");
|
||||||
|
@ -377,11 +262,8 @@ ConDrvDeleteConsole(IN PCONSOLE Console)
|
||||||
* ...unless to cancel console deletion ?).
|
* ...unless to cancel console deletion ?).
|
||||||
***/
|
***/
|
||||||
|
|
||||||
ConDrvLockConsoleListExclusive();
|
|
||||||
|
|
||||||
if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_TERMINATING, TRUE))
|
if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_TERMINATING, TRUE))
|
||||||
{
|
{
|
||||||
ConDrvUnlockConsoleList();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,9 +273,6 @@ ConDrvDeleteConsole(IN PCONSOLE Console)
|
||||||
/* We really delete the console. Reset the count to be sure. */
|
/* We really delete the console. Reset the count to be sure. */
|
||||||
Console->ReferenceCount = 0;
|
Console->ReferenceCount = 0;
|
||||||
|
|
||||||
/* Remove the console from the list */
|
|
||||||
RemoveConsole(Console);
|
|
||||||
|
|
||||||
/* Delete the last screen buffer */
|
/* Delete the last screen buffer */
|
||||||
ConDrvDeleteScreenBuffer(Console->ActiveBuffer);
|
ConDrvDeleteScreenBuffer(Console->ActiveBuffer);
|
||||||
Console->ActiveBuffer = NULL;
|
Console->ActiveBuffer = NULL;
|
||||||
|
@ -412,18 +291,34 @@ ConDrvDeleteConsole(IN PCONSOLE Console)
|
||||||
LeaveCriticalSection(&Console->Lock);
|
LeaveCriticalSection(&Console->Lock);
|
||||||
DPRINT("ConDrvDeleteConsole - Destroying lock\n");
|
DPRINT("ConDrvDeleteConsole - Destroying lock\n");
|
||||||
DeleteCriticalSection(&Console->Lock);
|
DeleteCriticalSection(&Console->Lock);
|
||||||
DPRINT("ConDrvDeleteConsole - Lock destroyed ; freeing console\n");
|
DPRINT("ConDrvDeleteConsole - Lock destroyed\n");
|
||||||
|
|
||||||
ConsoleFreeHeap(Console);
|
|
||||||
DPRINT("ConDrvDeleteConsole - Console destroyed\n");
|
DPRINT("ConDrvDeleteConsole - Console destroyed\n");
|
||||||
|
|
||||||
/* Unlock the console list and return */
|
|
||||||
ConDrvUnlockConsoleList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* PUBLIC DRIVER APIS *********************************************************/
|
/* PUBLIC DRIVER APIS *********************************************************/
|
||||||
|
|
||||||
|
VOID NTAPI
|
||||||
|
ConDrvPause(PCONSOLE Console)
|
||||||
|
{
|
||||||
|
/* In case we are already paused, just exit... */
|
||||||
|
if (Console->ConsolePaused) return;
|
||||||
|
|
||||||
|
/* ... otherwise set the flag */
|
||||||
|
Console->ConsolePaused = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID NTAPI
|
||||||
|
ConDrvUnpause(PCONSOLE Console)
|
||||||
|
{
|
||||||
|
/* In case we are already unpaused, just exit... */
|
||||||
|
if (!Console->ConsolePaused) return;
|
||||||
|
|
||||||
|
/* ... otherwise reset the flag */
|
||||||
|
Console->ConsolePaused = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
ConDrvGetConsoleMode(IN PCONSOLE Console,
|
ConDrvGetConsoleMode(IN PCONSOLE Console,
|
||||||
IN PCONSOLE_IO_OBJECT Object,
|
IN PCONSOLE_IO_OBJECT Object,
|
||||||
|
|
|
@ -35,6 +35,7 @@ CSR_API(SrvInvalidateBitMapRect)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCONSOLE_INVALIDATEDIBITS InvalidateDIBitsRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.InvalidateDIBitsRequest;
|
PCONSOLE_INVALIDATEDIBITS InvalidateDIBitsRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.InvalidateDIBitsRequest;
|
||||||
|
PCONSRV_CONSOLE Console;
|
||||||
PCONSOLE_SCREEN_BUFFER Buffer;
|
PCONSOLE_SCREEN_BUFFER Buffer;
|
||||||
|
|
||||||
DPRINT("SrvInvalidateBitMapRect\n");
|
DPRINT("SrvInvalidateBitMapRect\n");
|
||||||
|
@ -44,15 +45,17 @@ CSR_API(SrvInvalidateBitMapRect)
|
||||||
&Buffer, GENERIC_READ, TRUE);
|
&Buffer, GENERIC_READ, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
|
Console = (PCONSRV_CONSOLE)Buffer->Header.Console;
|
||||||
|
|
||||||
/* In text-mode only, draw the VDM buffer if present */
|
/* In text-mode only, draw the VDM buffer if present */
|
||||||
if (GetType(Buffer) == TEXTMODE_BUFFER && Buffer->Header.Console->VDMBuffer)
|
if (GetType(Buffer) == TEXTMODE_BUFFER && Console->VDMBuffer)
|
||||||
{
|
{
|
||||||
PTEXTMODE_SCREEN_BUFFER TextBuffer = (PTEXTMODE_SCREEN_BUFFER)Buffer;
|
PTEXTMODE_SCREEN_BUFFER TextBuffer = (PTEXTMODE_SCREEN_BUFFER)Buffer;
|
||||||
|
|
||||||
/*Status =*/ ConDrvWriteConsoleOutputVDM(Buffer->Header.Console,
|
/*Status =*/ ConDrvWriteConsoleOutputVDM(Buffer->Header.Console,
|
||||||
TextBuffer,
|
TextBuffer,
|
||||||
Buffer->Header.Console->VDMBuffer,
|
Console->VDMBuffer,
|
||||||
Buffer->Header.Console->VDMBufferSize,
|
Console->VDMBufferSize,
|
||||||
&InvalidateDIBitsRequest->Region);
|
&InvalidateDIBitsRequest->Region);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,12 @@
|
||||||
|
|
||||||
/* GLOBALS ********************************************************************/
|
/* GLOBALS ********************************************************************/
|
||||||
|
|
||||||
|
// static ULONG CurrentConsoleID = 0;
|
||||||
|
|
||||||
/* The list of the ConSrv consoles */
|
/* The list of the ConSrv consoles */
|
||||||
static ULONG ConsoleListSize;
|
static ULONG ConsoleListSize;
|
||||||
static PCONSRV_CONSOLE* ConsoleList;
|
static PCONSRV_CONSOLE* ConsoleList;
|
||||||
|
// static LIST_ENTRY ConDrvConsoleList;
|
||||||
static RTL_RESOURCE ListLock;
|
static RTL_RESOURCE ListLock;
|
||||||
|
|
||||||
#define ConSrvLockConsoleListExclusive() \
|
#define ConSrvLockConsoleListExclusive() \
|
||||||
|
@ -41,10 +44,34 @@ static RTL_RESOURCE ListLock;
|
||||||
#define ConSrvUnlockConsoleList() \
|
#define ConSrvUnlockConsoleList() \
|
||||||
RtlReleaseResource(&ListLock)
|
RtlReleaseResource(&ListLock)
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
static NTSTATUS
|
||||||
|
ConDrvInsertConsole(
|
||||||
|
IN PCONSOLE Console)
|
||||||
|
{
|
||||||
|
ASSERT(Console);
|
||||||
|
|
||||||
|
/* All went right, so add the console to the list */
|
||||||
|
ConSrvLockConsoleListExclusive();
|
||||||
|
|
||||||
|
DPRINT("Insert in the list\n");
|
||||||
|
InsertTailList(&ConDrvConsoleList, &Console->ListEntry);
|
||||||
|
|
||||||
|
// FIXME: Move this code to the caller function!!
|
||||||
|
/* Get a new console ID */
|
||||||
|
_InterlockedExchange((PLONG)&Console->ConsoleID, CurrentConsoleID);
|
||||||
|
_InterlockedIncrement((PLONG)&CurrentConsoleID);
|
||||||
|
|
||||||
|
/* Unlock the console list and return success */
|
||||||
|
ConSrvUnlockConsoleList();
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
InsertConsole(OUT PHANDLE Handle,
|
InsertConsole(
|
||||||
IN PCONSRV_CONSOLE Console)
|
OUT PHANDLE Handle,
|
||||||
|
IN PCONSRV_CONSOLE Console)
|
||||||
{
|
{
|
||||||
#define CONSOLE_HANDLES_INCREMENT 2 * 3
|
#define CONSOLE_HANDLES_INCREMENT 2 * 3
|
||||||
|
|
||||||
|
@ -163,49 +190,23 @@ RemoveConsoleByPointer(IN PCONSRV_CONSOLE Console)
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN NTAPI
|
#if 0
|
||||||
ConSrvValidateConsole(OUT PCONSRV_CONSOLE* Console,
|
static NTSTATUS
|
||||||
IN HANDLE ConsoleHandle,
|
RemoveConsole(IN PCONSOLE Console)
|
||||||
IN CONSOLE_STATE ExpectedState,
|
|
||||||
IN BOOLEAN LockConsole)
|
|
||||||
{
|
{
|
||||||
BOOLEAN RetVal = FALSE;
|
// ASSERT(Console);
|
||||||
PCONSRV_CONSOLE ValidatedConsole;
|
if (!Console) return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
BOOLEAN ValidHandle = ((HandleToULong(ConsoleHandle) & 0x3) == 0x3);
|
/* Remove the console from the list */
|
||||||
ULONG Index = HandleToULong(ConsoleHandle) >> 2;
|
ConSrvLockConsoleListExclusive();
|
||||||
|
|
||||||
if (!ValidHandle) return FALSE;
|
RemoveEntryList(&Console->ListEntry);
|
||||||
|
|
||||||
if (!Console) return FALSE;
|
/* Unlock the console list and return success */
|
||||||
*Console = NULL;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Forbid creation or deletion of consoles when
|
|
||||||
* checking for the existence of a console.
|
|
||||||
*/
|
|
||||||
ConSrvLockConsoleListShared();
|
|
||||||
|
|
||||||
if (Index >= ConsoleListSize ||
|
|
||||||
(ValidatedConsole = ConsoleList[Index]) == NULL)
|
|
||||||
{
|
|
||||||
/* Unlock the console list and return */
|
|
||||||
ConSrvUnlockConsoleList();
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
ValidatedConsole = ConsoleList[Index];
|
|
||||||
|
|
||||||
/* Unlock the console list and return */
|
|
||||||
ConSrvUnlockConsoleList();
|
ConSrvUnlockConsoleList();
|
||||||
|
return STATUS_SUCCESS;
|
||||||
RetVal = ConDrvValidateConsoleUnsafe((PCONSOLE)ValidatedConsole,
|
|
||||||
ExpectedState,
|
|
||||||
LockConsole);
|
|
||||||
if (RetVal) *Console = ValidatedConsole;
|
|
||||||
|
|
||||||
return RetVal;
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS **********************************************************/
|
/* PRIVATE FUNCTIONS **********************************************************/
|
||||||
|
@ -239,32 +240,51 @@ ConsoleFreeUnicodeString(IN PUNICODE_STRING UnicodeString)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
|
||||||
ConioPause(PCONSRV_CONSOLE Console, UCHAR Flags)
|
|
||||||
{
|
|
||||||
Console->PauseFlags |= Flags;
|
|
||||||
ConDrvPause((PCONSOLE)Console);
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
/* CONSOLE VALIDATION FUNCTIONS ***********************************************/
|
||||||
ConioUnpause(PCONSRV_CONSOLE Console, UCHAR Flags)
|
|
||||||
{
|
|
||||||
Console->PauseFlags &= ~Flags;
|
|
||||||
|
|
||||||
// if ((Console->PauseFlags & (PAUSED_FROM_KEYBOARD | PAUSED_FROM_SCROLLBAR | PAUSED_FROM_SELECTION)) == 0)
|
BOOLEAN NTAPI
|
||||||
if (Console->PauseFlags == 0)
|
ConSrvValidateConsole(OUT PCONSRV_CONSOLE* Console,
|
||||||
|
IN HANDLE ConsoleHandle,
|
||||||
|
IN CONSOLE_STATE ExpectedState,
|
||||||
|
IN BOOLEAN LockConsole)
|
||||||
|
{
|
||||||
|
BOOLEAN RetVal = FALSE;
|
||||||
|
PCONSRV_CONSOLE ValidatedConsole;
|
||||||
|
|
||||||
|
BOOLEAN ValidHandle = ((HandleToULong(ConsoleHandle) & 0x3) == 0x3);
|
||||||
|
ULONG Index = HandleToULong(ConsoleHandle) >> 2;
|
||||||
|
|
||||||
|
if (!ValidHandle) return FALSE;
|
||||||
|
|
||||||
|
if (!Console) return FALSE;
|
||||||
|
*Console = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Forbid creation or deletion of consoles when
|
||||||
|
* checking for the existence of a console.
|
||||||
|
*/
|
||||||
|
ConSrvLockConsoleListShared();
|
||||||
|
|
||||||
|
if (Index >= ConsoleListSize ||
|
||||||
|
(ValidatedConsole = ConsoleList[Index]) == NULL)
|
||||||
{
|
{
|
||||||
ConDrvUnpause((PCONSOLE)Console);
|
/* Unlock the console list and return */
|
||||||
|
ConSrvUnlockConsoleList();
|
||||||
CsrNotifyWait(&Console->WriteWaitQueue,
|
return FALSE;
|
||||||
TRUE,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
if (!IsListEmpty(&Console->WriteWaitQueue))
|
|
||||||
{
|
|
||||||
CsrDereferenceWait(&Console->WriteWaitQueue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ValidatedConsole = ConsoleList[Index];
|
||||||
|
|
||||||
|
/* Unlock the console list */
|
||||||
|
ConSrvUnlockConsoleList();
|
||||||
|
|
||||||
|
RetVal = ConDrvValidateConsoleUnsafe((PCONSOLE)ValidatedConsole,
|
||||||
|
ExpectedState,
|
||||||
|
LockConsole);
|
||||||
|
if (RetVal) *Console = ValidatedConsole;
|
||||||
|
|
||||||
|
return RetVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -331,6 +351,7 @@ ConSrvInitConsoleSupport(VOID)
|
||||||
/* Initialize the console list and its lock */
|
/* Initialize the console list and its lock */
|
||||||
ConsoleListSize = 0;
|
ConsoleListSize = 0;
|
||||||
ConsoleList = NULL;
|
ConsoleList = NULL;
|
||||||
|
// InitializeListHead(&ConDrvConsoleList);
|
||||||
RtlInitializeResource(&ListLock);
|
RtlInitializeResource(&ListLock);
|
||||||
|
|
||||||
/* Should call LoadKeyboardLayout */
|
/* Should call LoadKeyboardLayout */
|
||||||
|
@ -645,15 +666,27 @@ ConSrvInitConsole(OUT PHANDLE NewConsoleHandle,
|
||||||
DrvConsoleInfo.ScreenAttrib = ConsoleInfo->ScreenAttributes;
|
DrvConsoleInfo.ScreenAttrib = ConsoleInfo->ScreenAttributes;
|
||||||
DrvConsoleInfo.PopupAttrib = ConsoleInfo->PopupAttributes;
|
DrvConsoleInfo.PopupAttrib = ConsoleInfo->PopupAttributes;
|
||||||
DrvConsoleInfo.CodePage = ConsoleInfo->CodePage;
|
DrvConsoleInfo.CodePage = ConsoleInfo->CodePage;
|
||||||
Status = ConDrvInitConsole(&Console, &DrvConsoleInfo);
|
|
||||||
|
/*
|
||||||
|
* Allocate a new console
|
||||||
|
*/
|
||||||
|
Console = ConsoleAllocHeap(HEAP_ZERO_MEMORY, sizeof(*Console));
|
||||||
|
if (Console == NULL)
|
||||||
|
{
|
||||||
|
DPRINT1("Not enough memory for console creation.\n");
|
||||||
|
ConSrvDeinitTerminal(&Terminal);
|
||||||
|
return STATUS_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = ConDrvInitConsole((PCONSOLE)Console, &DrvConsoleInfo);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Creating a new console failed, Status = 0x%08lx\n", Status);
|
DPRINT1("Creating a new console failed, Status = 0x%08lx\n", Status);
|
||||||
|
ConsoleFreeHeap(Console);
|
||||||
ConSrvDeinitTerminal(&Terminal);
|
ConSrvDeinitTerminal(&Terminal);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(Console);
|
|
||||||
DPRINT("Console initialized\n");
|
DPRINT("Console initialized\n");
|
||||||
|
|
||||||
/*** Register ConSrv features ***/
|
/*** Register ConSrv features ***/
|
||||||
|
@ -684,6 +717,7 @@ ConSrvInitConsole(OUT PHANDLE NewConsoleHandle,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initialize process support */
|
/* Initialize process support */
|
||||||
|
// InitProcessSupport(Console);
|
||||||
InitializeListHead(&Console->ProcessList);
|
InitializeListHead(&Console->ProcessList);
|
||||||
Console->NotifiedLastCloseProcess = NULL;
|
Console->NotifiedLastCloseProcess = NULL;
|
||||||
Console->NotifyLastClose = FALSE;
|
Console->NotifyLastClose = FALSE;
|
||||||
|
@ -695,6 +729,7 @@ ConSrvInitConsole(OUT PHANDLE NewConsoleHandle,
|
||||||
InitializeListHead(&Console->WriteWaitQueue);
|
InitializeListHead(&Console->WriteWaitQueue);
|
||||||
|
|
||||||
/* Initialize the alias and history buffers */
|
/* Initialize the alias and history buffers */
|
||||||
|
// InitAliasesHistory(Console);
|
||||||
Console->Aliases = NULL;
|
Console->Aliases = NULL;
|
||||||
InitializeListHead(&Console->HistoryBuffers);
|
InitializeListHead(&Console->HistoryBuffers);
|
||||||
Console->NumberOfHistoryBuffers = 0;
|
Console->NumberOfHistoryBuffers = 0;
|
||||||
|
@ -703,6 +738,7 @@ ConSrvInitConsole(OUT PHANDLE NewConsoleHandle,
|
||||||
Console->HistoryNoDup = ConsoleInfo->HistoryNoDup;
|
Console->HistoryNoDup = ConsoleInfo->HistoryNoDup;
|
||||||
|
|
||||||
/* Initialize the Input Line Discipline */
|
/* Initialize the Input Line Discipline */
|
||||||
|
// InitLineInput(Console);
|
||||||
Console->LineBuffer = NULL;
|
Console->LineBuffer = NULL;
|
||||||
Console->LinePos = Console->LineMaxSize = Console->LineSize = 0;
|
Console->LinePos = Console->LineMaxSize = Console->LineSize = 0;
|
||||||
Console->LineComplete = Console->LineUpPressed = FALSE;
|
Console->LineComplete = Console->LineUpPressed = FALSE;
|
||||||
|
@ -724,7 +760,7 @@ ConSrvInitConsole(OUT PHANDLE NewConsoleHandle,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtCreateEvent(InitEvents[INIT_SUCCESS]) failed: %lu\n", Status);
|
DPRINT1("NtCreateEvent(InitEvents[INIT_SUCCESS]) failed: %lu\n", Status);
|
||||||
ConDrvDeleteConsole(Console);
|
ConDrvDeleteConsole((PCONSOLE)Console);
|
||||||
ConSrvDeinitTerminal(&Terminal);
|
ConSrvDeinitTerminal(&Terminal);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -734,7 +770,7 @@ ConSrvInitConsole(OUT PHANDLE NewConsoleHandle,
|
||||||
{
|
{
|
||||||
DPRINT1("NtCreateEvent(InitEvents[INIT_FAILURE]) failed: %lu\n", Status);
|
DPRINT1("NtCreateEvent(InitEvents[INIT_FAILURE]) failed: %lu\n", Status);
|
||||||
NtClose(Console->InitEvents[INIT_SUCCESS]);
|
NtClose(Console->InitEvents[INIT_SUCCESS]);
|
||||||
ConDrvDeleteConsole(Console);
|
ConDrvDeleteConsole((PCONSOLE)Console);
|
||||||
ConSrvDeinitTerminal(&Terminal);
|
ConSrvDeinitTerminal(&Terminal);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -743,19 +779,28 @@ ConSrvInitConsole(OUT PHANDLE NewConsoleHandle,
|
||||||
* Attach the ConSrv terminal to the console.
|
* Attach the ConSrv terminal to the console.
|
||||||
* This call makes a copy of our local Terminal variable.
|
* This call makes a copy of our local Terminal variable.
|
||||||
*/
|
*/
|
||||||
Status = ConDrvAttachTerminal(Console, &Terminal);
|
Status = ConDrvAttachTerminal((PCONSOLE)Console, &Terminal);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to register terminal to the given console, Status = 0x%08lx\n", Status);
|
DPRINT1("Failed to register terminal to the given console, Status = 0x%08lx\n", Status);
|
||||||
NtClose(Console->InitEvents[INIT_FAILURE]);
|
NtClose(Console->InitEvents[INIT_FAILURE]);
|
||||||
NtClose(Console->InitEvents[INIT_SUCCESS]);
|
NtClose(Console->InitEvents[INIT_SUCCESS]);
|
||||||
ConDrvDeleteConsole(Console);
|
ConDrvDeleteConsole((PCONSOLE)Console);
|
||||||
ConSrvDeinitTerminal(&Terminal);
|
ConSrvDeinitTerminal(&Terminal);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
DPRINT("Terminal attached\n");
|
DPRINT("Terminal attached\n");
|
||||||
|
|
||||||
/* All went right, so add the console to the list */
|
/* All went right, so add the console to the list */
|
||||||
|
#if 0
|
||||||
|
Status = ConDrvInsertConsole((PCONSOLE)Console);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
/* Fail */
|
||||||
|
ConDrvDeleteConsole((PCONSOLE)Console);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
Status = InsertConsole(&ConsoleHandle, Console);
|
Status = InsertConsole(&ConsoleHandle, Console);
|
||||||
|
|
||||||
// FIXME! We do not support at all asynchronous console creation!
|
// FIXME! We do not support at all asynchronous console creation!
|
||||||
|
@ -773,7 +818,10 @@ ConSrvDeleteConsole(PCONSRV_CONSOLE Console)
|
||||||
{
|
{
|
||||||
DPRINT("ConSrvDeleteConsole\n");
|
DPRINT("ConSrvDeleteConsole\n");
|
||||||
|
|
||||||
// FIXME: Send a terminate message to all the processes owning this console
|
// FIXME: Send a terminate message to all the processes owning this console.
|
||||||
|
// NOTE: In principle there should be none, because such processes would
|
||||||
|
// have a reference to the console and thus this function would not have
|
||||||
|
// been called in the first place.
|
||||||
|
|
||||||
/* Remove the console from the list */
|
/* Remove the console from the list */
|
||||||
RemoveConsoleByPointer(Console);
|
RemoveConsoleByPointer(Console);
|
||||||
|
@ -802,9 +850,36 @@ ConSrvDeleteConsole(PCONSRV_CONSOLE Console)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ConioPause(PCONSRV_CONSOLE Console, UCHAR Flags)
|
||||||
|
{
|
||||||
|
Console->PauseFlags |= Flags;
|
||||||
|
ConDrvPause((PCONSOLE)Console);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ConioUnpause(PCONSRV_CONSOLE Console, UCHAR Flags)
|
||||||
|
{
|
||||||
|
Console->PauseFlags &= ~Flags;
|
||||||
|
|
||||||
|
// if ((Console->PauseFlags & (PAUSED_FROM_KEYBOARD | PAUSED_FROM_SCROLLBAR | PAUSED_FROM_SELECTION)) == 0)
|
||||||
|
if (Console->PauseFlags == 0)
|
||||||
|
{
|
||||||
|
ConDrvUnpause((PCONSOLE)Console);
|
||||||
|
|
||||||
|
CsrNotifyWait(&Console->WriteWaitQueue,
|
||||||
|
TRUE,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
if (!IsListEmpty(&Console->WriteWaitQueue))
|
||||||
|
{
|
||||||
|
CsrDereferenceWait(&Console->WriteWaitQueue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* CONSOLE PROCESS MANAGEMENT FUNCTIONS ***************************************/
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
ConSrvConsoleCtrlEventTimeout(IN ULONG CtrlEvent,
|
ConSrvConsoleCtrlEventTimeout(IN ULONG CtrlEvent,
|
||||||
|
@ -1157,6 +1232,7 @@ CSR_API(SrvGetConsoleMode)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
|
PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
|
||||||
|
PCONSRV_CONSOLE Console;
|
||||||
PCONSOLE_IO_OBJECT Object;
|
PCONSOLE_IO_OBJECT Object;
|
||||||
|
|
||||||
PULONG ConsoleMode = &ConsoleModeRequest->Mode;
|
PULONG ConsoleMode = &ConsoleModeRequest->Mode;
|
||||||
|
@ -1166,9 +1242,10 @@ CSR_API(SrvGetConsoleMode)
|
||||||
&Object, NULL, GENERIC_READ, TRUE, 0);
|
&Object, NULL, GENERIC_READ, TRUE, 0);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
|
Console = (PCONSRV_CONSOLE)Object->Console;
|
||||||
|
|
||||||
/* Get the standard console modes */
|
/* Get the standard console modes */
|
||||||
Status = ConDrvGetConsoleMode(Object->Console, Object,
|
Status = ConDrvGetConsoleMode(Object->Console, Object, ConsoleMode);
|
||||||
ConsoleMode);
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -1177,13 +1254,13 @@ CSR_API(SrvGetConsoleMode)
|
||||||
*/
|
*/
|
||||||
if (INPUT_BUFFER == Object->Type)
|
if (INPUT_BUFFER == Object->Type)
|
||||||
{
|
{
|
||||||
if (Object->Console->InsertMode || Object->Console->QuickEdit)
|
if (Console->InsertMode || Console->QuickEdit)
|
||||||
{
|
{
|
||||||
/* Windows also adds ENABLE_EXTENDED_FLAGS, even if it's not documented on MSDN */
|
/* Windows also adds ENABLE_EXTENDED_FLAGS, even if it's not documented on MSDN */
|
||||||
*ConsoleMode |= ENABLE_EXTENDED_FLAGS;
|
*ConsoleMode |= ENABLE_EXTENDED_FLAGS;
|
||||||
|
|
||||||
if (Object->Console->InsertMode) *ConsoleMode |= ENABLE_INSERT_MODE;
|
if (Console->InsertMode) *ConsoleMode |= ENABLE_INSERT_MODE;
|
||||||
if (Object->Console->QuickEdit ) *ConsoleMode |= ENABLE_QUICK_EDIT_MODE;
|
if (Console->QuickEdit ) *ConsoleMode |= ENABLE_QUICK_EDIT_MODE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1205,6 +1282,7 @@ CSR_API(SrvSetConsoleMode)
|
||||||
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
|
PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
|
||||||
|
PCONSRV_CONSOLE Console;
|
||||||
PCONSOLE_IO_OBJECT Object;
|
PCONSOLE_IO_OBJECT Object;
|
||||||
|
|
||||||
ULONG ConsoleMode = ConsoleModeRequest->Mode;
|
ULONG ConsoleMode = ConsoleModeRequest->Mode;
|
||||||
|
@ -1214,10 +1292,11 @@ CSR_API(SrvSetConsoleMode)
|
||||||
&Object, NULL, GENERIC_WRITE, TRUE, 0);
|
&Object, NULL, GENERIC_WRITE, TRUE, 0);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
|
Console = (PCONSRV_CONSOLE)Object->Console;
|
||||||
|
|
||||||
/* Set the standard console modes (without the CONSRV-specific input modes) */
|
/* Set the standard console modes (without the CONSRV-specific input modes) */
|
||||||
ConsoleMode &= ~CONSOLE_VALID_CONTROL_MODES; // Remove CONSRV-specific input modes.
|
ConsoleMode &= ~CONSOLE_VALID_CONTROL_MODES; // Remove CONSRV-specific input modes.
|
||||||
Status = ConDrvSetConsoleMode(Object->Console, Object,
|
Status = ConDrvSetConsoleMode(Object->Console, Object, ConsoleMode);
|
||||||
ConsoleMode);
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -1240,8 +1319,8 @@ CSR_API(SrvSetConsoleMode)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Object->Console->InsertMode = !!(ConsoleMode & ENABLE_INSERT_MODE);
|
Console->InsertMode = !!(ConsoleMode & ENABLE_INSERT_MODE);
|
||||||
Object->Console->QuickEdit = !!(ConsoleMode & ENABLE_QUICK_EDIT_MODE);
|
Console->QuickEdit = !!(ConsoleMode & ENABLE_QUICK_EDIT_MODE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1407,7 +1486,7 @@ CSR_API(SrvGetConsoleCP)
|
||||||
Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
Status = ConDrvGetConsoleCP(Console,
|
Status = ConDrvGetConsoleCP((PCONSOLE)Console,
|
||||||
&GetConsoleCPRequest->CodePage,
|
&GetConsoleCPRequest->CodePage,
|
||||||
GetConsoleCPRequest->OutputCP);
|
GetConsoleCPRequest->OutputCP);
|
||||||
|
|
||||||
|
@ -1432,7 +1511,7 @@ CSR_API(SrvSetConsoleCP)
|
||||||
Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
Status = ConDrvSetConsoleCP(Console,
|
Status = ConDrvSetConsoleCP((PCONSOLE)Console,
|
||||||
SetConsoleCPRequest->CodePage,
|
SetConsoleCPRequest->CodePage,
|
||||||
SetConsoleCPRequest->OutputCP);
|
SetConsoleCPRequest->OutputCP);
|
||||||
|
|
||||||
|
|
|
@ -60,14 +60,8 @@ typedef struct ConsoleInput_t
|
||||||
INPUT_RECORD InputEvent;
|
INPUT_RECORD InputEvent;
|
||||||
} ConsoleInput;
|
} ConsoleInput;
|
||||||
|
|
||||||
// Helper for code refactoring
|
|
||||||
// #define USE_NEW_CONSOLE_WAY
|
|
||||||
|
|
||||||
#ifndef USE_NEW_CONSOLE_WAY
|
|
||||||
#include "include/conio.h"
|
#include "include/conio.h"
|
||||||
#else
|
|
||||||
#include "include/conio_winsrv.h"
|
#include "include/conio_winsrv.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "include/console.h"
|
#include "include/console.h"
|
||||||
#include "include/settings.h"
|
#include "include/settings.h"
|
||||||
|
|
|
@ -72,7 +72,7 @@ CSR_API(SrvGetConsoleHardwareState)
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Console = Buff->Header.Console;
|
Console = (PCONSRV_CONSOLE)Buff->Header.Console;
|
||||||
HardwareStateRequest->State = Console->HardwareState;
|
HardwareStateRequest->State = Console->HardwareState;
|
||||||
|
|
||||||
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
|
@ -104,7 +104,7 @@ CSR_API(SrvSetConsoleHardwareState)
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("Setting console hardware state.\n");
|
DPRINT("Setting console hardware state.\n");
|
||||||
Console = Buff->Header.Console;
|
Console = (PCONSRV_CONSOLE)Buff->Header.Console;
|
||||||
Status = SetConsoleHardwareState(Console, HardwareStateRequest->State);
|
Status = SetConsoleHardwareState(Console, HardwareStateRequest->State);
|
||||||
|
|
||||||
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
|
@ -168,7 +168,7 @@ CSR_API(SrvGetLargestConsoleWindowSize)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCONSOLE_GETLARGESTWINDOWSIZE GetLargestWindowSizeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetLargestWindowSizeRequest;
|
PCONSOLE_GETLARGESTWINDOWSIZE GetLargestWindowSizeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetLargestWindowSizeRequest;
|
||||||
PCONSOLE /*PCONSRV_CONSOLE*/ Console;
|
PCONSRV_CONSOLE Console;
|
||||||
PCONSOLE_SCREEN_BUFFER Buff;
|
PCONSOLE_SCREEN_BUFFER Buff;
|
||||||
|
|
||||||
Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||||
|
@ -178,7 +178,7 @@ CSR_API(SrvGetLargestConsoleWindowSize)
|
||||||
TRUE);
|
TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
Console = Buff->Header.Console;
|
Console = (PCONSRV_CONSOLE)Buff->Header.Console;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve the largest possible console window size, without
|
* Retrieve the largest possible console window size, without
|
||||||
|
@ -196,7 +196,7 @@ CSR_API(SrvShowConsoleCursor)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCONSOLE_SHOWCURSOR ShowCursorRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ShowCursorRequest;
|
PCONSOLE_SHOWCURSOR ShowCursorRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ShowCursorRequest;
|
||||||
PCONSOLE /*PCONSRV_CONSOLE*/ Console;
|
PCONSRV_CONSOLE Console;
|
||||||
PCONSOLE_SCREEN_BUFFER Buff;
|
PCONSOLE_SCREEN_BUFFER Buff;
|
||||||
|
|
||||||
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||||
|
@ -206,7 +206,7 @@ CSR_API(SrvShowConsoleCursor)
|
||||||
TRUE);
|
TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
Console = Buff->Header.Console;
|
Console = (PCONSRV_CONSOLE)Buff->Header.Console;
|
||||||
|
|
||||||
ShowCursorRequest->RefCount = TermShowMouseCursor(Console, ShowCursorRequest->Show);
|
ShowCursorRequest->RefCount = TermShowMouseCursor(Console, ShowCursorRequest->Show);
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ CSR_API(SrvGetConsoleNumberOfFonts)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCONSOLE_GETNUMFONTS GetNumFontsRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetNumFontsRequest;
|
PCONSOLE_GETNUMFONTS GetNumFontsRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetNumFontsRequest;
|
||||||
PCONSOLE /*PCONSRV_CONSOLE*/ Console;
|
PCONSRV_CONSOLE Console;
|
||||||
|
|
||||||
Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||||
&Console, TRUE);
|
&Console, TRUE);
|
||||||
|
@ -400,7 +400,7 @@ CSR_API(SrvGetConsoleFontInfo)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCONSOLE_GETFONTINFO GetFontInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetFontInfoRequest;
|
PCONSOLE_GETFONTINFO GetFontInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetFontInfoRequest;
|
||||||
// PCONSOLE /*PCONSRV_CONSOLE*/ Console;
|
// PCONSRV_CONSOLE Console;
|
||||||
PCONSOLE_SCREEN_BUFFER Buff;
|
PCONSOLE_SCREEN_BUFFER Buff;
|
||||||
|
|
||||||
Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||||
|
@ -411,7 +411,7 @@ CSR_API(SrvGetConsoleFontInfo)
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
// FIXME!
|
// FIXME!
|
||||||
// Console = Buff->Header.Console;
|
// Console = (PCONSRV_CONSOLE)Buff->Header.Console;
|
||||||
// TermGetFontInfo(Console, ...);
|
// TermGetFontInfo(Console, ...);
|
||||||
DPRINT1("%s not yet implemented\n", __FUNCTION__);
|
DPRINT1("%s not yet implemented\n", __FUNCTION__);
|
||||||
GetFontInfoRequest->NumFonts = 0;
|
GetFontInfoRequest->NumFonts = 0;
|
||||||
|
@ -425,7 +425,7 @@ CSR_API(SrvGetConsoleFontSize)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCONSOLE_GETFONTSIZE GetFontSizeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetFontSizeRequest;
|
PCONSOLE_GETFONTSIZE GetFontSizeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetFontSizeRequest;
|
||||||
// PCONSOLE /*PCONSRV_CONSOLE*/ Console;
|
// PCONSRV_CONSOLE Console;
|
||||||
PCONSOLE_SCREEN_BUFFER Buff;
|
PCONSOLE_SCREEN_BUFFER Buff;
|
||||||
|
|
||||||
Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||||
|
@ -436,7 +436,7 @@ CSR_API(SrvGetConsoleFontSize)
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
// FIXME!
|
// FIXME!
|
||||||
// Console = Buff->Header.Console;
|
// Console = (PCONSRV_CONSOLE)Buff->Header.Console;
|
||||||
// TermGetFontSize(Console, ...);
|
// TermGetFontSize(Console, ...);
|
||||||
DPRINT1("%s not yet implemented\n", __FUNCTION__);
|
DPRINT1("%s not yet implemented\n", __FUNCTION__);
|
||||||
|
|
||||||
|
@ -449,7 +449,7 @@ CSR_API(SrvGetConsoleCurrentFont)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCONSOLE_GETCURRENTFONT GetCurrentFontRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetCurrentFontRequest;
|
PCONSOLE_GETCURRENTFONT GetCurrentFontRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetCurrentFontRequest;
|
||||||
// PCONSOLE /*PCONSRV_CONSOLE*/ Console;
|
// PCONSRV_CONSOLE Console;
|
||||||
PCONSOLE_SCREEN_BUFFER Buff;
|
PCONSOLE_SCREEN_BUFFER Buff;
|
||||||
|
|
||||||
Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||||
|
@ -460,7 +460,7 @@ CSR_API(SrvGetConsoleCurrentFont)
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
// FIXME!
|
// FIXME!
|
||||||
// Console = Buff->Header.Console;
|
// Console = (PCONSRV_CONSOLE)Buff->Header.Console;
|
||||||
// TermGetCurrentFont(Console, ...);
|
// TermGetCurrentFont(Console, ...);
|
||||||
DPRINT1("%s not yet implemented\n", __FUNCTION__);
|
DPRINT1("%s not yet implemented\n", __FUNCTION__);
|
||||||
GetCurrentFontRequest->FontIndex = 0;
|
GetCurrentFontRequest->FontIndex = 0;
|
||||||
|
@ -474,7 +474,7 @@ CSR_API(SrvSetConsoleFont)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCONSOLE_SETFONT SetFontRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetFontRequest;
|
PCONSOLE_SETFONT SetFontRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetFontRequest;
|
||||||
// PCONSOLE /*PCONSRV_CONSOLE*/ Console;
|
// PCONSRV_CONSOLE Console;
|
||||||
PCONSOLE_SCREEN_BUFFER Buff;
|
PCONSOLE_SCREEN_BUFFER Buff;
|
||||||
|
|
||||||
Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||||
|
@ -485,7 +485,7 @@ CSR_API(SrvSetConsoleFont)
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
// FIXME!
|
// FIXME!
|
||||||
// Console = Buff->Header.Console;
|
// Console = (PCONSRV_CONSOLE)Buff->Header.Console;
|
||||||
// TermSetFont(Console, ...);
|
// TermSetFont(Console, ...);
|
||||||
DPRINT1("%s not yet implemented\n", __FUNCTION__);
|
DPRINT1("%s not yet implemented\n", __FUNCTION__);
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ GuiPaintGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer,
|
||||||
PRECT rcView,
|
PRECT rcView,
|
||||||
PRECT rcFramebuffer)
|
PRECT rcFramebuffer)
|
||||||
{
|
{
|
||||||
PCONSRV_CONSOLE Console = Buffer->Header.Console;
|
PCONSRV_CONSOLE Console = (PCONSRV_CONSOLE)Buffer->Header.Console;
|
||||||
// ASSERT(Console == GuiData->Console);
|
// ASSERT(Console == GuiData->Console);
|
||||||
|
|
||||||
ConioInitLongRect(rcFramebuffer, 0, 0, 0, 0);
|
ConioInitLongRect(rcFramebuffer, 0, 0, 0, 0);
|
||||||
|
|
|
@ -768,7 +768,7 @@ GuiSetActiveScreenBuffer(IN OUT PFRONTEND This)
|
||||||
GuiData->WindowSizeLock = TRUE;
|
GuiData->WindowSizeLock = TRUE;
|
||||||
|
|
||||||
InterlockedExchangePointer((PVOID*)&GuiData->ActiveBuffer,
|
InterlockedExchangePointer((PVOID*)&GuiData->ActiveBuffer,
|
||||||
ConDrvGetActiveScreenBuffer(GuiData->Console));
|
ConDrvGetActiveScreenBuffer((PCONSOLE)GuiData->Console));
|
||||||
|
|
||||||
GuiData->WindowSizeLock = FALSE;
|
GuiData->WindowSizeLock = FALSE;
|
||||||
LeaveCriticalSection(&GuiData->Lock);
|
LeaveCriticalSection(&GuiData->Lock);
|
||||||
|
|
|
@ -343,7 +343,7 @@ GuiPasteToTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
|
||||||
* This function supposes that the system clipboard was opened.
|
* This function supposes that the system clipboard was opened.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PCONSRV_CONSOLE Console = Buffer->Header.Console;
|
PCONSRV_CONSOLE Console = (PCONSRV_CONSOLE)Buffer->Header.Console;
|
||||||
|
|
||||||
HANDLE hData;
|
HANDLE hData;
|
||||||
LPWSTR pszText;
|
LPWSTR pszText;
|
||||||
|
@ -369,7 +369,7 @@ GuiPaintCaret(
|
||||||
ULONG LeftColumn,
|
ULONG LeftColumn,
|
||||||
ULONG RightColumn)
|
ULONG RightColumn)
|
||||||
{
|
{
|
||||||
PCONSRV_CONSOLE Console = Buffer->Header.Console;
|
PCONSRV_CONSOLE Console = (PCONSRV_CONSOLE)Buffer->Header.Console;
|
||||||
|
|
||||||
ULONG CursorX, CursorY, CursorHeight;
|
ULONG CursorX, CursorY, CursorHeight;
|
||||||
HBRUSH CursorBrush, OldBrush;
|
HBRUSH CursorBrush, OldBrush;
|
||||||
|
@ -435,7 +435,7 @@ GuiPaintTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
|
||||||
PRECT rcView,
|
PRECT rcView,
|
||||||
PRECT rcFramebuffer)
|
PRECT rcFramebuffer)
|
||||||
{
|
{
|
||||||
PCONSRV_CONSOLE Console = Buffer->Header.Console;
|
PCONSRV_CONSOLE Console = (PCONSRV_CONSOLE)Buffer->Header.Console;
|
||||||
ULONG TopLine, BottomLine, LeftColumn, RightColumn;
|
ULONG TopLine, BottomLine, LeftColumn, RightColumn;
|
||||||
ULONG Line, Char, Start;
|
ULONG Line, Char, Start;
|
||||||
PCHAR_INFO From;
|
PCHAR_INFO From;
|
||||||
|
|
|
@ -262,21 +262,22 @@ ConSrvTermInitTerminal(IN OUT PTERMINAL This,
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PFRONTEND FrontEnd = This->Context;
|
PFRONTEND FrontEnd = This->Context;
|
||||||
|
PCONSRV_CONSOLE ConSrvConsole = (PCONSRV_CONSOLE)Console;
|
||||||
|
|
||||||
/* Initialize the console pointer for our frontend */
|
/* Initialize the console pointer for our frontend */
|
||||||
FrontEnd->Console = Console;
|
FrontEnd->Console = ConSrvConsole;
|
||||||
|
|
||||||
/** HACK HACK!! Copy FrontEnd into the console!! **/
|
/** HACK HACK!! Copy FrontEnd into the console!! **/
|
||||||
DPRINT("Using FrontEndIFace HACK(1), should be removed after proper implementation!\n");
|
DPRINT("Using FrontEndIFace HACK(1), should be removed after proper implementation!\n");
|
||||||
Console->FrontEndIFace = *FrontEnd;
|
ConSrvConsole->FrontEndIFace = *FrontEnd;
|
||||||
|
|
||||||
Status = FrontEnd->Vtbl->InitFrontEnd(FrontEnd, FrontEnd->Console);
|
Status = FrontEnd->Vtbl->InitFrontEnd(FrontEnd, ConSrvConsole);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
DPRINT1("InitFrontEnd failed, Status = 0x%08lx\n", Status);
|
DPRINT1("InitFrontEnd failed, Status = 0x%08lx\n", Status);
|
||||||
|
|
||||||
/** HACK HACK!! Be sure FrontEndIFace is correctly updated in the console!! **/
|
/** HACK HACK!! Be sure FrontEndIFace is correctly updated in the console!! **/
|
||||||
DPRINT("Using FrontEndIFace HACK(2), should be removed after proper implementation!\n");
|
DPRINT("Using FrontEndIFace HACK(2), should be removed after proper implementation!\n");
|
||||||
Console->FrontEndIFace = *FrontEnd;
|
ConSrvConsole->FrontEndIFace = *FrontEnd;
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -969,11 +970,12 @@ static TERMINAL_VTBL ConSrvTermVtbl =
|
||||||
VOID
|
VOID
|
||||||
ResetFrontEnd(IN PCONSOLE Console)
|
ResetFrontEnd(IN PCONSOLE Console)
|
||||||
{
|
{
|
||||||
|
PCONSRV_CONSOLE ConSrvConsole = (PCONSRV_CONSOLE)Console;
|
||||||
if (!Console) return;
|
if (!Console) return;
|
||||||
|
|
||||||
/* Reinitialize the frontend interface */
|
/* Reinitialize the frontend interface */
|
||||||
RtlZeroMemory(&Console->FrontEndIFace, sizeof(Console->FrontEndIFace));
|
RtlZeroMemory(&ConSrvConsole->FrontEndIFace, sizeof(ConSrvConsole->FrontEndIFace));
|
||||||
Console->FrontEndIFace.Vtbl = &ConSrvTermVtbl;
|
ConSrvConsole->FrontEndIFace.Vtbl = &ConSrvTermVtbl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ ConSrvCloseHandle(IN PCONSOLE_IO_HANDLE Handle)
|
||||||
if (Object->Type == INPUT_BUFFER)
|
if (Object->Type == INPUT_BUFFER)
|
||||||
{
|
{
|
||||||
// PCONSOLE_INPUT_BUFFER InputBuffer = (PCONSOLE_INPUT_BUFFER)Object;
|
// PCONSOLE_INPUT_BUFFER InputBuffer = (PCONSOLE_INPUT_BUFFER)Object;
|
||||||
PCONSOLE Console = Object->Console;
|
PCONSRV_CONSOLE Console = (PCONSRV_CONSOLE)Object->Console;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wake up all the writing waiters related to this handle for this
|
* Wake up all the writing waiters related to this handle for this
|
||||||
|
@ -125,7 +125,7 @@ static VOID ConSrvFreeHandlesTable(PCONSOLE_PROCESS_DATA ProcessData);
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
ConSrvInitHandlesTable(IN OUT PCONSOLE_PROCESS_DATA ProcessData,
|
ConSrvInitHandlesTable(IN OUT PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
IN PCONSOLE Console,
|
IN PCONSRV_CONSOLE Console,
|
||||||
OUT PHANDLE pInputHandle,
|
OUT PHANDLE pInputHandle,
|
||||||
OUT PHANDLE pOutputHandle,
|
OUT PHANDLE pOutputHandle,
|
||||||
OUT PHANDLE pErrorHandle)
|
OUT PHANDLE pErrorHandle)
|
||||||
|
@ -410,7 +410,7 @@ ConSrvGetObject(IN PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
ULONG Index = HandleToULong(Handle) >> 2;
|
ULONG Index = HandleToULong(Handle) >> 2;
|
||||||
PCONSOLE_IO_HANDLE HandleEntry = NULL;
|
PCONSOLE_IO_HANDLE HandleEntry = NULL;
|
||||||
PCONSOLE_IO_OBJECT ObjectEntry = NULL;
|
PCONSOLE_IO_OBJECT ObjectEntry = NULL;
|
||||||
// PCONSOLE ObjectConsole;
|
// PCONSRV_CONSOLE ObjectConsole;
|
||||||
|
|
||||||
ASSERT(Object);
|
ASSERT(Object);
|
||||||
if (Entry) *Entry = NULL;
|
if (Entry) *Entry = NULL;
|
||||||
|
@ -465,7 +465,8 @@ VOID
|
||||||
ConSrvReleaseObject(IN PCONSOLE_IO_OBJECT Object,
|
ConSrvReleaseObject(IN PCONSOLE_IO_OBJECT Object,
|
||||||
IN BOOLEAN IsConsoleLocked)
|
IN BOOLEAN IsConsoleLocked)
|
||||||
{
|
{
|
||||||
ConSrvReleaseConsole(Object->Console, IsConsoleLocked);
|
PCONSRV_CONSOLE ObjectConsole = (PCONSRV_CONSOLE)Object->Console;
|
||||||
|
ConSrvReleaseConsole(ObjectConsole, IsConsoleLocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -611,7 +612,7 @@ ConSrvInheritConsole(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
PCONSOLE_START_INFO ConsoleStartInfo)
|
PCONSOLE_START_INFO ConsoleStartInfo)
|
||||||
{
|
{
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
PCONSOLE Console;
|
PCONSRV_CONSOLE Console;
|
||||||
|
|
||||||
/* Validate and lock the console */
|
/* Validate and lock the console */
|
||||||
if (!ConSrvValidateConsole(&Console,
|
if (!ConSrvValidateConsole(&Console,
|
||||||
|
@ -734,7 +735,7 @@ Quit:
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
ConSrvRemoveConsole(PCONSOLE_PROCESS_DATA ProcessData)
|
ConSrvRemoveConsole(PCONSOLE_PROCESS_DATA ProcessData)
|
||||||
{
|
{
|
||||||
PCONSOLE Console;
|
PCONSRV_CONSOLE Console;
|
||||||
PCONSOLE_PROCESS_DATA ConsoleLeaderProcess;
|
PCONSOLE_PROCESS_DATA ConsoleLeaderProcess;
|
||||||
|
|
||||||
DPRINT("ConSrvRemoveConsole\n");
|
DPRINT("ConSrvRemoveConsole\n");
|
||||||
|
@ -808,6 +809,7 @@ ConSrvRemoveConsole(PCONSOLE_PROCESS_DATA ProcessData)
|
||||||
|
|
||||||
/* PUBLIC SERVER APIS *********************************************************/
|
/* PUBLIC SERVER APIS *********************************************************/
|
||||||
|
|
||||||
|
/* API_NUMBER: ConsolepOpenConsole */
|
||||||
CSR_API(SrvOpenConsole)
|
CSR_API(SrvOpenConsole)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -818,7 +820,7 @@ CSR_API(SrvOpenConsole)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCONSOLE_OPENCONSOLE OpenConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.OpenConsoleRequest;
|
PCONSOLE_OPENCONSOLE OpenConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.OpenConsoleRequest;
|
||||||
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
|
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
|
||||||
PCONSOLE Console;
|
PCONSRV_CONSOLE Console;
|
||||||
|
|
||||||
DWORD DesiredAccess = OpenConsoleRequest->DesiredAccess;
|
DWORD DesiredAccess = OpenConsoleRequest->DesiredAccess;
|
||||||
DWORD ShareMode = OpenConsoleRequest->ShareMode;
|
DWORD ShareMode = OpenConsoleRequest->ShareMode;
|
||||||
|
@ -877,7 +879,7 @@ CSR_API(SrvDuplicateHandle)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCONSOLE_DUPLICATEHANDLE DuplicateHandleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.DuplicateHandleRequest;
|
PCONSOLE_DUPLICATEHANDLE DuplicateHandleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.DuplicateHandleRequest;
|
||||||
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
|
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
|
||||||
PCONSOLE Console;
|
PCONSRV_CONSOLE Console;
|
||||||
|
|
||||||
HANDLE SourceHandle = DuplicateHandleRequest->SourceHandle;
|
HANDLE SourceHandle = DuplicateHandleRequest->SourceHandle;
|
||||||
ULONG Index = HandleToULong(SourceHandle) >> 2;
|
ULONG Index = HandleToULong(SourceHandle) >> 2;
|
||||||
|
@ -951,7 +953,7 @@ CSR_API(SrvGetHandleInformation)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCONSOLE_GETHANDLEINFO GetHandleInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetHandleInfoRequest;
|
PCONSOLE_GETHANDLEINFO GetHandleInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetHandleInfoRequest;
|
||||||
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
|
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
|
||||||
PCONSOLE Console;
|
PCONSRV_CONSOLE Console;
|
||||||
|
|
||||||
HANDLE Handle = GetHandleInfoRequest->Handle;
|
HANDLE Handle = GetHandleInfoRequest->Handle;
|
||||||
ULONG Index = HandleToULong(Handle) >> 2;
|
ULONG Index = HandleToULong(Handle) >> 2;
|
||||||
|
@ -1000,7 +1002,7 @@ CSR_API(SrvSetHandleInformation)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCONSOLE_SETHANDLEINFO SetHandleInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetHandleInfoRequest;
|
PCONSOLE_SETHANDLEINFO SetHandleInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetHandleInfoRequest;
|
||||||
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
|
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
|
||||||
PCONSOLE Console;
|
PCONSRV_CONSOLE Console;
|
||||||
|
|
||||||
HANDLE Handle = SetHandleInfoRequest->Handle;
|
HANDLE Handle = SetHandleInfoRequest->Handle;
|
||||||
ULONG Index = HandleToULong(Handle) >> 2;
|
ULONG Index = HandleToULong(Handle) >> 2;
|
||||||
|
@ -1051,7 +1053,7 @@ CSR_API(SrvCloseHandle)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCONSOLE_CLOSEHANDLE CloseHandleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CloseHandleRequest;
|
PCONSOLE_CLOSEHANDLE CloseHandleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CloseHandleRequest;
|
||||||
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
|
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
|
||||||
PCONSOLE Console;
|
PCONSRV_CONSOLE Console;
|
||||||
|
|
||||||
Status = ConSrvGetConsole(ProcessData, &Console, TRUE);
|
Status = ConSrvGetConsole(ProcessData, &Console, TRUE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -1072,7 +1074,7 @@ CSR_API(SrvVerifyConsoleIoHandle)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCONSOLE_VERIFYHANDLE VerifyHandleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.VerifyHandleRequest;
|
PCONSOLE_VERIFYHANDLE VerifyHandleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.VerifyHandleRequest;
|
||||||
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
|
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
|
||||||
PCONSOLE Console;
|
PCONSRV_CONSOLE Console;
|
||||||
|
|
||||||
HANDLE IoHandle = VerifyHandleRequest->Handle;
|
HANDLE IoHandle = VerifyHandleRequest->Handle;
|
||||||
ULONG Index = HandleToULong(IoHandle) >> 2;
|
ULONG Index = HandleToULong(IoHandle) >> 2;
|
||||||
|
|
|
@ -12,22 +12,6 @@
|
||||||
|
|
||||||
#include "rect.h"
|
#include "rect.h"
|
||||||
|
|
||||||
// This is ALMOST a HACK!!!!!!!
|
|
||||||
// Helpers for code refactoring
|
|
||||||
#ifdef USE_NEW_CONSOLE_WAY
|
|
||||||
|
|
||||||
#define _CONSRV_CONSOLE _WINSRV_CONSOLE
|
|
||||||
#define CONSRV_CONSOLE WINSRV_CONSOLE
|
|
||||||
#define PCONSRV_CONSOLE PWINSRV_CONSOLE
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define _CONSRV_CONSOLE _CONSOLE
|
|
||||||
#define CONSRV_CONSOLE CONSOLE
|
|
||||||
#define PCONSRV_CONSOLE PCONSOLE
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Default attributes */
|
/* Default attributes */
|
||||||
#define DEFAULT_SCREEN_ATTRIB (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)
|
#define DEFAULT_SCREEN_ATTRIB (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)
|
||||||
#define DEFAULT_POPUP_ATTRIB (FOREGROUND_BLUE | FOREGROUND_RED | \
|
#define DEFAULT_POPUP_ATTRIB (FOREGROUND_BLUE | FOREGROUND_RED | \
|
||||||
|
@ -308,27 +292,12 @@ typedef enum _CONSOLE_STATE
|
||||||
CONSOLE_IN_DESTRUCTION /* Console in destruction */
|
CONSOLE_IN_DESTRUCTION /* Console in destruction */
|
||||||
} CONSOLE_STATE, *PCONSOLE_STATE;
|
} CONSOLE_STATE, *PCONSOLE_STATE;
|
||||||
|
|
||||||
// HACK!!
|
|
||||||
struct _CONSOLE;
|
|
||||||
/* HACK: */ typedef struct _CONSOLE *PCONSOLE;
|
|
||||||
#ifndef USE_NEW_CONSOLE_WAY
|
|
||||||
#include "conio_winsrv.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct _CONSOLE
|
typedef struct _CONSOLE
|
||||||
{
|
{
|
||||||
/******************************* Console Set-up *******************************/
|
/******************************* Console Set-up *******************************/
|
||||||
|
|
||||||
#ifndef USE_NEW_CONSOLE_WAY
|
|
||||||
WINSRV_CONSOLE; // HACK HACK!!
|
|
||||||
#endif
|
|
||||||
|
|
||||||
LONG ReferenceCount; /* Is incremented each time a handle to something in the console (a screen-buffer or the input buffer of this console) gets referenced */
|
LONG ReferenceCount; /* Is incremented each time a handle to something in the console (a screen-buffer or the input buffer of this console) gets referenced */
|
||||||
CRITICAL_SECTION Lock;
|
CRITICAL_SECTION Lock;
|
||||||
|
|
||||||
ULONG ConsoleID; /* The ID of the console */
|
|
||||||
LIST_ENTRY ListEntry; /* Entry in the list of consoles */
|
|
||||||
|
|
||||||
CONSOLE_STATE State; /* State of the console */
|
CONSOLE_STATE State; /* State of the console */
|
||||||
TERMINAL TermIFace; /* Terminal-specific interface */
|
TERMINAL TermIFace; /* Terminal-specific interface */
|
||||||
|
|
||||||
|
@ -347,7 +316,7 @@ typedef struct _CONSOLE
|
||||||
COORD ConsoleSize; /* The current size of the console, for text-mode only */
|
COORD ConsoleSize; /* The current size of the console, for text-mode only */
|
||||||
BOOLEAN FixedSize; /* TRUE if the console is of fixed size */
|
BOOLEAN FixedSize; /* TRUE if the console is of fixed size */
|
||||||
BOOLEAN IsCJK; /* TRUE if Chinese, Japanese or Korean (CJK) */
|
BOOLEAN IsCJK; /* TRUE if Chinese, Japanese or Korean (CJK) */
|
||||||
} CONSOLE; // , *PCONSOLE;
|
} CONSOLE, *PCONSOLE;
|
||||||
|
|
||||||
/* console.c */
|
/* console.c */
|
||||||
VOID NTAPI
|
VOID NTAPI
|
||||||
|
@ -355,11 +324,6 @@ ConDrvPause(PCONSOLE Console);
|
||||||
VOID NTAPI
|
VOID NTAPI
|
||||||
ConDrvUnpause(PCONSOLE Console);
|
ConDrvUnpause(PCONSOLE Console);
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent,
|
|
||||||
IN PCONSOLE_PROCESS_DATA ProcessData);
|
|
||||||
|
|
||||||
|
|
||||||
#define GetConsoleInputBufferMode(Console) \
|
#define GetConsoleInputBufferMode(Console) \
|
||||||
(Console)->InputBuffer.Mode
|
(Console)->InputBuffer.Mode
|
||||||
|
|
||||||
|
|
|
@ -11,23 +11,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "rect.h"
|
// #include "rect.h"
|
||||||
|
|
||||||
// This is ALMOST a HACK!!!!!!!
|
|
||||||
// Helpers for code refactoring
|
|
||||||
#ifdef USE_NEW_CONSOLE_WAY
|
|
||||||
|
|
||||||
#define _CONSRV_CONSOLE _WINSRV_CONSOLE
|
|
||||||
#define CONSRV_CONSOLE WINSRV_CONSOLE
|
|
||||||
#define PCONSRV_CONSOLE PWINSRV_CONSOLE
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define _CONSRV_CONSOLE _CONSOLE
|
|
||||||
#define CONSRV_CONSOLE CONSOLE
|
|
||||||
#define PCONSRV_CONSOLE PCONSOLE
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CSR_DEFAULT_CURSOR_SIZE 25
|
#define CSR_DEFAULT_CURSOR_SIZE 25
|
||||||
|
|
||||||
|
@ -39,15 +23,12 @@ typedef struct _CHAR_CELL
|
||||||
} CHAR_CELL, *PCHAR_CELL;
|
} CHAR_CELL, *PCHAR_CELL;
|
||||||
C_ASSERT(sizeof(CHAR_CELL) == 2);
|
C_ASSERT(sizeof(CHAR_CELL) == 2);
|
||||||
|
|
||||||
// HACK!!
|
// #include "conio.h"
|
||||||
struct _WINSRV_CONSOLE;
|
|
||||||
/* HACK: */ typedef struct _WINSRV_CONSOLE *PWINSRV_CONSOLE;
|
|
||||||
#ifdef USE_NEW_CONSOLE_WAY
|
|
||||||
#include "conio.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct _FRONTEND FRONTEND, *PFRONTEND;
|
typedef struct _FRONTEND FRONTEND, *PFRONTEND;
|
||||||
|
|
||||||
|
struct _CONSRV_CONSOLE;
|
||||||
|
|
||||||
typedef struct _FRONTEND_VTBL
|
typedef struct _FRONTEND_VTBL
|
||||||
{
|
{
|
||||||
// NTSTATUS (NTAPI *UnloadFrontEnd)(IN OUT PFRONTEND This);
|
// NTSTATUS (NTAPI *UnloadFrontEnd)(IN OUT PFRONTEND This);
|
||||||
|
@ -127,20 +108,21 @@ struct _FRONTEND
|
||||||
#define PAUSED_FROM_SCROLLBAR 0x2
|
#define PAUSED_FROM_SCROLLBAR 0x2
|
||||||
#define PAUSED_FROM_SELECTION 0x4
|
#define PAUSED_FROM_SELECTION 0x4
|
||||||
|
|
||||||
typedef struct _WINSRV_CONSOLE
|
typedef struct _CONSRV_CONSOLE
|
||||||
{
|
{
|
||||||
/******************************* Console Set-up *******************************/
|
/******************************* Console Set-up *******************************/
|
||||||
/* This **MUST** be FIRST!! */
|
/* This **MUST** be FIRST!! */
|
||||||
#ifdef USE_NEW_CONSOLE_WAY
|
|
||||||
CONSOLE;
|
CONSOLE;
|
||||||
// CONSOLE Console;
|
// CONSOLE Console;
|
||||||
// // PCONSOLE Console;
|
// // PCONSOLE Console;
|
||||||
#endif
|
|
||||||
|
|
||||||
// LONG ReferenceCount; /* Is incremented each time a handle to something in the console (a screen-buffer or the input buffer of this console) gets referenced */
|
// LONG ReferenceCount; /* Is incremented each time a handle to something in the console (a screen-buffer or the input buffer of this console) gets referenced */
|
||||||
// CRITICAL_SECTION Lock;
|
// CRITICAL_SECTION Lock;
|
||||||
// CONSOLE_STATE State; /* State of the console */
|
// CONSOLE_STATE State; /* State of the console */
|
||||||
|
|
||||||
|
// ULONG ConsoleID; /* The ID of the console */
|
||||||
|
// LIST_ENTRY ListEntry; /* Entry in the list of consoles */
|
||||||
|
|
||||||
HANDLE InitEvents[MAX_INIT_EVENTS]; /* Initialization events */
|
HANDLE InitEvents[MAX_INIT_EVENTS]; /* Initialization events */
|
||||||
|
|
||||||
FRONTEND FrontEndIFace; /* Frontend-specific interface */
|
FRONTEND FrontEndIFace; /* Frontend-specific interface */
|
||||||
|
@ -194,7 +176,7 @@ typedef struct _WINSRV_CONSOLE
|
||||||
UNICODE_STRING Title; /* Title of console. Always NULL-terminated */
|
UNICODE_STRING Title; /* Title of console. Always NULL-terminated */
|
||||||
COLORREF Colors[16]; /* Colour palette */
|
COLORREF Colors[16]; /* Colour palette */
|
||||||
|
|
||||||
} WINSRV_CONSOLE; // , *PWINSRV_CONSOLE;
|
} CONSRV_CONSOLE, *PCONSRV_CONSOLE;
|
||||||
|
|
||||||
/* console.c */
|
/* console.c */
|
||||||
VOID ConioPause(PCONSRV_CONSOLE Console, UCHAR Flags);
|
VOID ConioPause(PCONSRV_CONSOLE Console, UCHAR Flags);
|
||||||
|
@ -205,6 +187,7 @@ ConSrvGetConsoleLeaderProcess(IN PCONSRV_CONSOLE Console);
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent,
|
ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent,
|
||||||
IN PCONSOLE_PROCESS_DATA ProcessData);
|
IN PCONSOLE_PROCESS_DATA ProcessData);
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
ConSrvConsoleProcessCtrlEvent(IN PCONSRV_CONSOLE Console,
|
ConSrvConsoleProcessCtrlEvent(IN PCONSRV_CONSOLE Console,
|
||||||
IN ULONG ProcessGroupId,
|
IN ULONG ProcessGroupId,
|
||||||
|
@ -227,9 +210,6 @@ ConioProcessInputEvent(PCONSRV_CONSOLE Console,
|
||||||
|
|
||||||
/* conoutput.c */
|
/* conoutput.c */
|
||||||
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y);
|
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y);
|
||||||
NTSTATUS ConioResizeBuffer(PCONSOLE Console,
|
|
||||||
PTEXTMODE_SCREEN_BUFFER ScreenBuffer,
|
|
||||||
COORD Size);
|
|
||||||
|
|
||||||
/* terminal.c */
|
/* terminal.c */
|
||||||
VOID ConioDrawConsole(PCONSRV_CONSOLE Console);
|
VOID ConioDrawConsole(PCONSRV_CONSOLE Console);
|
||||||
|
|
|
@ -8,12 +8,11 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
VOID NTAPI
|
|
||||||
ConDrvInitConsoleSupport(VOID);
|
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
ConDrvInitConsole(OUT PCONSOLE* NewConsole,
|
ConDrvInitConsole(
|
||||||
IN PCONSOLE_INFO ConsoleInfo);
|
IN OUT PCONSOLE Console,
|
||||||
|
IN PCONSOLE_INFO ConsoleInfo);
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
ConDrvAttachTerminal(IN PCONSOLE Console,
|
ConDrvAttachTerminal(IN PCONSOLE Console,
|
||||||
IN PTERMINAL Terminal);
|
IN PTERMINAL Terminal);
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
|
|
||||||
/* FUNCTIONS ******************************************************************/
|
/* FUNCTIONS ******************************************************************/
|
||||||
|
|
||||||
VOID ConSrvApplyUserSettings(IN PCONSOLE Console,
|
VOID
|
||||||
IN PCONSOLE_STATE_INFO ConsoleInfo);
|
ConSrvApplyUserSettings(
|
||||||
|
IN PCONSRV_CONSOLE Console,
|
||||||
|
IN PCONSOLE_STATE_INFO ConsoleInfo);
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -569,7 +569,6 @@ CSR_SERVER_DLL_INIT(ConServerDllInitialization)
|
||||||
if (!ConSrvHeap) return STATUS_NO_MEMORY;
|
if (!ConSrvHeap) return STATUS_NO_MEMORY;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ConDrvInitConsoleSupport();
|
|
||||||
ConSrvInitConsoleSupport();
|
ConSrvInitConsoleSupport();
|
||||||
|
|
||||||
/* Setup the DLL Object */
|
/* Setup the DLL Object */
|
||||||
|
|
|
@ -29,12 +29,13 @@ ConDrvChangeScreenBufferAttributes(IN PCONSOLE Console,
|
||||||
IN USHORT NewScreenAttrib,
|
IN USHORT NewScreenAttrib,
|
||||||
IN USHORT NewPopupAttrib);
|
IN USHORT NewPopupAttrib);
|
||||||
/*
|
/*
|
||||||
* NOTE: This function explicitely references Console->ActiveBuffer.
|
* NOTE: This function explicitly references Console->ActiveBuffer.
|
||||||
* It is possible that it should go into some frontend...
|
* It is possible that it should go into some frontend...
|
||||||
*/
|
*/
|
||||||
VOID
|
VOID
|
||||||
ConSrvApplyUserSettings(IN PCONSOLE Console,
|
ConSrvApplyUserSettings(
|
||||||
IN PCONSOLE_STATE_INFO ConsoleInfo)
|
IN PCONSRV_CONSOLE Console,
|
||||||
|
IN PCONSOLE_STATE_INFO ConsoleInfo)
|
||||||
{
|
{
|
||||||
PCONSOLE_SCREEN_BUFFER ActiveBuffer = Console->ActiveBuffer;
|
PCONSOLE_SCREEN_BUFFER ActiveBuffer = Console->ActiveBuffer;
|
||||||
|
|
||||||
|
@ -123,7 +124,7 @@ ConSrvApplyUserSettings(IN PCONSOLE Console,
|
||||||
if (BufSize.X != ActiveBuffer->ScreenBufferSize.X ||
|
if (BufSize.X != ActiveBuffer->ScreenBufferSize.X ||
|
||||||
BufSize.Y != ActiveBuffer->ScreenBufferSize.Y)
|
BufSize.Y != ActiveBuffer->ScreenBufferSize.Y)
|
||||||
{
|
{
|
||||||
if (NT_SUCCESS(ConioResizeBuffer(Console, Buffer, BufSize)))
|
if (NT_SUCCESS(ConioResizeBuffer((PCONSOLE)Console, Buffer, BufSize)))
|
||||||
SizeChanged = TRUE;
|
SizeChanged = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +132,7 @@ ConSrvApplyUserSettings(IN PCONSOLE Console,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Apply foreground and background colors for both screen and popup */
|
/* Apply foreground and background colors for both screen and popup */
|
||||||
ConDrvChangeScreenBufferAttributes(Console,
|
ConDrvChangeScreenBufferAttributes((PCONSOLE)Console,
|
||||||
Buffer,
|
Buffer,
|
||||||
ConsoleInfo->ScreenAttributes,
|
ConsoleInfo->ScreenAttributes,
|
||||||
ConsoleInfo->PopupAttributes);
|
ConsoleInfo->PopupAttributes);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue