mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 05:00:27 +00:00
[CONSRV]
Rename functions to their new scheme: ConSrv* instead of Win32Csr* or Conio* (with some exceptions for the latter case). No code changes. svn path=/branches/ros-csrss/; revision=58213
This commit is contained in:
parent
fe7b0f74d3
commit
50a9e6a485
11 changed files with 401 additions and 406 deletions
|
@ -324,7 +324,7 @@ CSR_API(SrvAddConsoleAlias)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiMessage->Status = ConioGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
ApiMessage->Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if (!NT_SUCCESS(ApiMessage->Status))
|
if (!NT_SUCCESS(ApiMessage->Status))
|
||||||
{
|
{
|
||||||
return ApiMessage->Status;
|
return ApiMessage->Status;
|
||||||
|
@ -336,7 +336,7 @@ CSR_API(SrvAddConsoleAlias)
|
||||||
Header = IntCreateAliasHeader(lpExeName);
|
Header = IntCreateAliasHeader(lpExeName);
|
||||||
if (!Header)
|
if (!Header)
|
||||||
{
|
{
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
IntInsertAliasHeader(&Console->Aliases, Header);
|
IntInsertAliasHeader(&Console->Aliases, Header);
|
||||||
|
@ -354,7 +354,7 @@ CSR_API(SrvAddConsoleAlias)
|
||||||
{
|
{
|
||||||
ApiMessage->Status = STATUS_INVALID_PARAMETER;
|
ApiMessage->Status = STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return ApiMessage->Status;
|
return ApiMessage->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,12 +362,12 @@ CSR_API(SrvAddConsoleAlias)
|
||||||
|
|
||||||
if (!Entry)
|
if (!Entry)
|
||||||
{
|
{
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntInsertAliasEntry(Header, Entry);
|
IntInsertAliasEntry(Header, Entry);
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ CSR_API(SrvGetConsoleAlias)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiMessage->Status = ConioGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
ApiMessage->Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if (!NT_SUCCESS(ApiMessage->Status))
|
if (!NT_SUCCESS(ApiMessage->Status))
|
||||||
{
|
{
|
||||||
return ApiMessage->Status;
|
return ApiMessage->Status;
|
||||||
|
@ -420,27 +420,27 @@ CSR_API(SrvGetConsoleAlias)
|
||||||
Header = IntFindAliasHeader(Console->Aliases, lpExeName);
|
Header = IntFindAliasHeader(Console->Aliases, lpExeName);
|
||||||
if (!Header)
|
if (!Header)
|
||||||
{
|
{
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry = IntGetAliasEntry(Header, lpSource);
|
Entry = IntGetAliasEntry(Header, lpSource);
|
||||||
if (!Entry)
|
if (!Entry)
|
||||||
{
|
{
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Length = (wcslen(Entry->lpTarget) + 1) * sizeof(WCHAR);
|
Length = (wcslen(Entry->lpTarget) + 1) * sizeof(WCHAR);
|
||||||
if (Length > ConsoleAliasRequest->TargetLength)
|
if (Length > ConsoleAliasRequest->TargetLength)
|
||||||
{
|
{
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_BUFFER_TOO_SMALL;
|
return STATUS_BUFFER_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wcscpy(lpTarget, Entry->lpTarget);
|
wcscpy(lpTarget, Entry->lpTarget);
|
||||||
ConsoleAliasRequest->TargetLength = Length;
|
ConsoleAliasRequest->TargetLength = Length;
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ CSR_API(SrvGetConsoleAliases)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiMessage->Status = ConioGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
ApiMessage->Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if (!NT_SUCCESS(ApiMessage->Status))
|
if (!NT_SUCCESS(ApiMessage->Status))
|
||||||
{
|
{
|
||||||
return ApiMessage->Status;
|
return ApiMessage->Status;
|
||||||
|
@ -477,13 +477,13 @@ CSR_API(SrvGetConsoleAliases)
|
||||||
Header = IntFindAliasHeader(Console->Aliases, GetAllAliasesRequest->ExeName);
|
Header = IntFindAliasHeader(Console->Aliases, GetAllAliasesRequest->ExeName);
|
||||||
if (!Header)
|
if (!Header)
|
||||||
{
|
{
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IntGetAllConsoleAliasesLength(Header) > GetAllAliasesRequest->AliasesBufferLength)
|
if (IntGetAllConsoleAliasesLength(Header) > GetAllAliasesRequest->AliasesBufferLength)
|
||||||
{
|
{
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_BUFFER_OVERFLOW;
|
return STATUS_BUFFER_OVERFLOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,7 +492,7 @@ CSR_API(SrvGetConsoleAliases)
|
||||||
GetAllAliasesRequest->AliasesBufferLength);
|
GetAllAliasesRequest->AliasesBufferLength);
|
||||||
|
|
||||||
GetAllAliasesRequest->AliasesBufferLength = BytesWritten;
|
GetAllAliasesRequest->AliasesBufferLength = BytesWritten;
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,7 +516,7 @@ CSR_API(SrvGetConsoleAliasesLength)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiMessage->Status = ConioGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
ApiMessage->Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if (!NT_SUCCESS(ApiMessage->Status))
|
if (!NT_SUCCESS(ApiMessage->Status))
|
||||||
{
|
{
|
||||||
return ApiMessage->Status;
|
return ApiMessage->Status;
|
||||||
|
@ -525,13 +525,13 @@ CSR_API(SrvGetConsoleAliasesLength)
|
||||||
Header = IntFindAliasHeader(Console->Aliases, GetAllAliasesLengthRequest->ExeName);
|
Header = IntFindAliasHeader(Console->Aliases, GetAllAliasesLengthRequest->ExeName);
|
||||||
if (!Header)
|
if (!Header)
|
||||||
{
|
{
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Length = IntGetAllConsoleAliasesLength(Header);
|
Length = IntGetAllConsoleAliasesLength(Header);
|
||||||
GetAllAliasesLengthRequest->Length = Length;
|
GetAllAliasesLengthRequest->Length = Length;
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,7 +552,7 @@ CSR_API(SrvGetConsoleAliasExes)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiMessage->Status = ConioGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
ApiMessage->Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if (!NT_SUCCESS(ApiMessage->Status))
|
if (!NT_SUCCESS(ApiMessage->Status))
|
||||||
{
|
{
|
||||||
return ApiMessage->Status;
|
return ApiMessage->Status;
|
||||||
|
@ -562,13 +562,13 @@ CSR_API(SrvGetConsoleAliasExes)
|
||||||
|
|
||||||
if (ExesLength > GetAliasesExesRequest->Length)
|
if (ExesLength > GetAliasesExesRequest->Length)
|
||||||
{
|
{
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_BUFFER_OVERFLOW;
|
return STATUS_BUFFER_OVERFLOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetAliasesExesRequest->ExeNames == NULL)
|
if (GetAliasesExesRequest->ExeNames == NULL)
|
||||||
{
|
{
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ CSR_API(SrvGetConsoleAliasExes)
|
||||||
GetAliasesExesRequest->Length);
|
GetAliasesExesRequest->Length);
|
||||||
|
|
||||||
GetAliasesExesRequest->Length = BytesWritten;
|
GetAliasesExesRequest->Length = BytesWritten;
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,11 +587,11 @@ CSR_API(SrvGetConsoleAliasExesLength)
|
||||||
PCONSOLE Console;
|
PCONSOLE Console;
|
||||||
DPRINT("SrvGetConsoleAliasExesLength entered\n");
|
DPRINT("SrvGetConsoleAliasExesLength entered\n");
|
||||||
|
|
||||||
ApiMessage->Status = ConioGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
ApiMessage->Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if (NT_SUCCESS(ApiMessage->Status))
|
if (NT_SUCCESS(ApiMessage->Status))
|
||||||
{
|
{
|
||||||
GetAliasesExesLengthRequest->Length = IntGetConsoleAliasesExesLength(Console->Aliases);
|
GetAliasesExesLengthRequest->Length = IntGetConsoleAliasesExesLength(Console->Aliases);
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
}
|
}
|
||||||
return ApiMessage->Status;
|
return ApiMessage->Status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,7 +256,7 @@ ConioProcessKey(MSG *msg, PCONSOLE Console, BOOL TextMode)
|
||||||
{
|
{
|
||||||
current = CONTAINING_RECORD(current_entry, CONSOLE_PROCESS_DATA, ConsoleLink);
|
current = CONTAINING_RECORD(current_entry, CONSOLE_PROCESS_DATA, ConsoleLink);
|
||||||
current_entry = current_entry->Flink;
|
current_entry = current_entry->Flink;
|
||||||
ConioConsoleCtrlEvent(CTRL_C_EVENT, current);
|
ConSrvConsoleCtrlEvent(CTRL_C_EVENT, current);
|
||||||
}
|
}
|
||||||
if (Console->LineBuffer && !Console->LineComplete)
|
if (Console->LineBuffer && !Console->LineComplete)
|
||||||
{
|
{
|
||||||
|
@ -360,7 +360,7 @@ ReadInputBufferThread(IN PLIST_ENTRY WaitList,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Somebody is closing a handle to this input buffer,
|
* Somebody is closing a handle to this input buffer,
|
||||||
* by calling Win32CsrCloseHandleEntry.
|
* by calling ConSrvCloseHandleEntry.
|
||||||
* See whether we are linked to that handle (ie. we
|
* See whether we are linked to that handle (ie. we
|
||||||
* are a waiter for this handle), and if so, return.
|
* are a waiter for this handle), and if so, return.
|
||||||
*/
|
*/
|
||||||
|
@ -491,7 +491,7 @@ ReadCharsThread(IN PLIST_ENTRY WaitList,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Somebody is closing a handle to this input buffer,
|
* Somebody is closing a handle to this input buffer,
|
||||||
* by calling Win32CsrCloseHandleEntry.
|
* by calling ConSrvCloseHandleEntry.
|
||||||
* See whether we are linked to that handle (ie. we
|
* See whether we are linked to that handle (ie. we
|
||||||
* are a waiter for this handle), and if so, return.
|
* are a waiter for this handle), and if so, return.
|
||||||
*/
|
*/
|
||||||
|
@ -715,7 +715,7 @@ CSR_API(SrvReadConsole)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ConioGetInputBufferAndHandleEntry(ProcessData, ReadConsoleRequest->InputHandle, &InputBuffer, &HandleEntry, GENERIC_READ, TRUE);
|
Status = ConSrvGetInputBufferAndHandleEntry(ProcessData, ReadConsoleRequest->InputHandle, &InputBuffer, &HandleEntry, GENERIC_READ, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
ReadConsoleRequest->NrCharactersRead = 0;
|
ReadConsoleRequest->NrCharactersRead = 0;
|
||||||
|
@ -728,7 +728,7 @@ CSR_API(SrvReadConsole)
|
||||||
ApiMessage,
|
ApiMessage,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
ConioReleaseInputBuffer(InputBuffer, TRUE);
|
ConSrvReleaseInputBuffer(InputBuffer, TRUE);
|
||||||
|
|
||||||
if (Status == STATUS_PENDING)
|
if (Status == STATUS_PENDING)
|
||||||
*ReplyCode = CsrReplyPending;
|
*ReplyCode = CsrReplyPending;
|
||||||
|
@ -757,7 +757,7 @@ CSR_API(SrvGetConsoleInput)
|
||||||
|
|
||||||
GetInputRequest->InputsRead = 0;
|
GetInputRequest->InputsRead = 0;
|
||||||
|
|
||||||
Status = ConioGetInputBufferAndHandleEntry(ProcessData, GetInputRequest->InputHandle, &InputBuffer, &HandleEntry, GENERIC_READ, TRUE);
|
Status = ConSrvGetInputBufferAndHandleEntry(ProcessData, GetInputRequest->InputHandle, &InputBuffer, &HandleEntry, GENERIC_READ, TRUE);
|
||||||
if(!NT_SUCCESS(Status)) return Status;
|
if(!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
InputInfo.CallingThread = CsrGetClientThread();
|
InputInfo.CallingThread = CsrGetClientThread();
|
||||||
|
@ -769,7 +769,7 @@ CSR_API(SrvGetConsoleInput)
|
||||||
ApiMessage,
|
ApiMessage,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
ConioReleaseInputBuffer(InputBuffer, TRUE);
|
ConSrvReleaseInputBuffer(InputBuffer, TRUE);
|
||||||
|
|
||||||
if (Status == STATUS_PENDING)
|
if (Status == STATUS_PENDING)
|
||||||
*ReplyCode = CsrReplyPending;
|
*ReplyCode = CsrReplyPending;
|
||||||
|
@ -798,7 +798,7 @@ CSR_API(SrvWriteConsoleInput)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ConioGetInputBuffer(ProcessData, WriteInputRequest->InputHandle, &InputBuffer, GENERIC_WRITE, TRUE);
|
Status = ConSrvGetInputBuffer(ProcessData, WriteInputRequest->InputHandle, &InputBuffer, GENERIC_WRITE, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
Console = InputBuffer->Header.Console;
|
Console = InputBuffer->Header.Console;
|
||||||
|
@ -819,7 +819,7 @@ CSR_API(SrvWriteConsoleInput)
|
||||||
Status = ConioProcessChar(Console, InputRecord++);
|
Status = ConioProcessChar(Console, InputRecord++);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConioReleaseInputBuffer(InputBuffer, TRUE);
|
ConSrvReleaseInputBuffer(InputBuffer, TRUE);
|
||||||
|
|
||||||
WriteInputRequest->Length = i;
|
WriteInputRequest->Length = i;
|
||||||
|
|
||||||
|
@ -836,7 +836,7 @@ CSR_API(SrvFlushConsoleInputBuffer)
|
||||||
|
|
||||||
DPRINT("SrvFlushConsoleInputBuffer\n");
|
DPRINT("SrvFlushConsoleInputBuffer\n");
|
||||||
|
|
||||||
Status = ConioGetInputBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
Status = ConSrvGetInputBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||||
FlushInputBufferRequest->InputHandle,
|
FlushInputBufferRequest->InputHandle,
|
||||||
&InputBuffer,
|
&InputBuffer,
|
||||||
GENERIC_WRITE,
|
GENERIC_WRITE,
|
||||||
|
@ -853,7 +853,7 @@ CSR_API(SrvFlushConsoleInputBuffer)
|
||||||
}
|
}
|
||||||
ResetEvent(InputBuffer->ActiveEvent);
|
ResetEvent(InputBuffer->ActiveEvent);
|
||||||
|
|
||||||
ConioReleaseInputBuffer(InputBuffer, TRUE);
|
ConSrvReleaseInputBuffer(InputBuffer, TRUE);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -868,7 +868,7 @@ CSR_API(SrvGetConsoleNumberOfInputEvents)
|
||||||
|
|
||||||
DPRINT("SrvGetConsoleNumberOfInputEvents\n");
|
DPRINT("SrvGetConsoleNumberOfInputEvents\n");
|
||||||
|
|
||||||
Status = ConioGetInputBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), GetNumInputEventsRequest->InputHandle, &InputBuffer, GENERIC_READ, TRUE);
|
Status = ConSrvGetInputBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), GetNumInputEventsRequest->InputHandle, &InputBuffer, GENERIC_READ, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
CurrentInput = InputBuffer->InputEvents.Flink;
|
CurrentInput = InputBuffer->InputEvents.Flink;
|
||||||
|
@ -881,7 +881,7 @@ CSR_API(SrvGetConsoleNumberOfInputEvents)
|
||||||
NumEvents++;
|
NumEvents++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConioReleaseInputBuffer(InputBuffer, TRUE);
|
ConSrvReleaseInputBuffer(InputBuffer, TRUE);
|
||||||
|
|
||||||
GetNumInputEventsRequest->NumInputEvents = NumEvents;
|
GetNumInputEventsRequest->NumInputEvents = NumEvents;
|
||||||
|
|
||||||
|
|
|
@ -86,13 +86,6 @@ typedef struct _CONSOLE
|
||||||
|
|
||||||
CONSOLE_SELECTION_INFO Selection;
|
CONSOLE_SELECTION_INFO Selection;
|
||||||
|
|
||||||
/**************************** Aliases and Histories ***************************/
|
|
||||||
struct _ALIAS_HEADER *Aliases;
|
|
||||||
LIST_ENTRY HistoryBuffers;
|
|
||||||
UINT HistoryBufferSize; /* Size for newly created history buffers */
|
|
||||||
UINT NumberOfHistoryBuffers; /* Maximum number of history buffers allowed */
|
|
||||||
BOOLEAN HistoryNoDup; /* Remove old duplicate history entries */
|
|
||||||
|
|
||||||
/******************************* Screen buffers *******************************/
|
/******************************* Screen buffers *******************************/
|
||||||
LIST_ENTRY BufferList; /* List of all screen buffers for this console */
|
LIST_ENTRY BufferList; /* List of all screen buffers for this console */
|
||||||
PCONSOLE_SCREEN_BUFFER ActiveBuffer; /* Pointer to currently active screen buffer */
|
PCONSOLE_SCREEN_BUFFER ActiveBuffer; /* Pointer to currently active screen buffer */
|
||||||
|
@ -102,6 +95,13 @@ typedef struct _CONSOLE
|
||||||
|
|
||||||
DWORD HardwareState; /* _GDI_MANAGED, _DIRECT */
|
DWORD HardwareState; /* _GDI_MANAGED, _DIRECT */
|
||||||
|
|
||||||
|
/**************************** Aliases and Histories ***************************/
|
||||||
|
struct _ALIAS_HEADER *Aliases;
|
||||||
|
LIST_ENTRY HistoryBuffers;
|
||||||
|
UINT HistoryBufferSize; /* Size for newly created history buffers */
|
||||||
|
UINT NumberOfHistoryBuffers; /* Maximum number of history buffers allowed */
|
||||||
|
BOOLEAN HistoryNoDup; /* Remove old duplicate history entries */
|
||||||
|
|
||||||
/****************************** GUI-related data ******************************/
|
/****************************** GUI-related data ******************************/
|
||||||
UNICODE_STRING Title; /* Title of console */
|
UNICODE_STRING Title; /* Title of console */
|
||||||
HWND hWindow;
|
HWND hWindow;
|
||||||
|
@ -169,29 +169,25 @@ typedef struct _CONSOLE_VTBL
|
||||||
#define ConioResizeBuffer(Console, Buff, Size) (Console)->Vtbl->ResizeBuffer((Console), (Buff), (Size))
|
#define ConioResizeBuffer(Console, Buff, Size) (Console)->Vtbl->ResizeBuffer((Console), (Buff), (Size))
|
||||||
|
|
||||||
/* console.c */
|
/* console.c */
|
||||||
#define ConioGetConsole(ProcessData, Console, LockConsole) \
|
VOID WINAPI ConSrvDeleteConsole(PCONSOLE Console);
|
||||||
ConioConsoleFromProcessData((ProcessData), (Console), (LockConsole))
|
VOID WINAPI ConSrvInitConsoleSupport(VOID);
|
||||||
#define ConioReleaseConsole(Console, ConsoleLocked) \
|
NTSTATUS WINAPI ConSrvInitConsole(PCONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLeaderProcess);
|
||||||
Win32CsrUnlockConsole((Console), (ConsoleLocked))
|
|
||||||
VOID WINAPI ConioDeleteConsole(PCONSOLE Console);
|
|
||||||
VOID WINAPI CsrInitConsoleSupport(VOID);
|
|
||||||
NTSTATUS WINAPI CsrInitConsole(PCONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLeaderProcess);
|
|
||||||
VOID FASTCALL ConioPause(PCONSOLE Console, UINT Flags);
|
VOID FASTCALL ConioPause(PCONSOLE Console, UINT Flags);
|
||||||
VOID FASTCALL ConioUnpause(PCONSOLE Console, UINT Flags);
|
VOID FASTCALL ConioUnpause(PCONSOLE Console, UINT Flags);
|
||||||
VOID FASTCALL ConioConsoleCtrlEvent(DWORD Event, PCONSOLE_PROCESS_DATA ProcessData);
|
VOID FASTCALL ConSrvConsoleCtrlEvent(DWORD Event, PCONSOLE_PROCESS_DATA ProcessData);
|
||||||
VOID FASTCALL ConioConsoleCtrlEventTimeout(DWORD Event,
|
VOID FASTCALL ConSrvConsoleCtrlEventTimeout(DWORD Event,
|
||||||
PCONSOLE_PROCESS_DATA ProcessData,
|
PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
DWORD Timeout);
|
DWORD Timeout);
|
||||||
|
|
||||||
/* coninput.c */
|
/* coninput.c */
|
||||||
#define ConioGetInputBuffer(ProcessData, Handle, Ptr, Access, LockConsole) \
|
#define ConSrvGetInputBuffer(ProcessData, Handle, Ptr, Access, LockConsole) \
|
||||||
Win32CsrLockObject((ProcessData), (Handle), (Object_t **)(Ptr), NULL, \
|
ConSrvGetObject((ProcessData), (Handle), (Object_t **)(Ptr), NULL, \
|
||||||
(Access), (LockConsole), CONIO_INPUT_BUFFER_MAGIC)
|
(Access), (LockConsole), CONIO_INPUT_BUFFER_MAGIC)
|
||||||
#define ConioGetInputBufferAndHandleEntry(ProcessData, Handle, Ptr, Entry, Access, LockConsole) \
|
#define ConSrvGetInputBufferAndHandleEntry(ProcessData, Handle, Ptr, Entry, Access, LockConsole) \
|
||||||
Win32CsrLockObject((ProcessData), (Handle), (Object_t **)(Ptr), (Entry), \
|
ConSrvGetObject((ProcessData), (Handle), (Object_t **)(Ptr), (Entry), \
|
||||||
(Access), (LockConsole), CONIO_INPUT_BUFFER_MAGIC)
|
(Access), (LockConsole), CONIO_INPUT_BUFFER_MAGIC)
|
||||||
#define ConioReleaseInputBuffer(Buff, IsConsoleLocked) \
|
#define ConSrvReleaseInputBuffer(Buff, IsConsoleLocked) \
|
||||||
Win32CsrUnlockObject(&(Buff)->Header, (IsConsoleLocked))
|
ConSrvReleaseObject(&(Buff)->Header, (IsConsoleLocked))
|
||||||
void WINAPI ConioProcessKey(MSG *msg, PCONSOLE Console, BOOL TextMode);
|
void WINAPI ConioProcessKey(MSG *msg, PCONSOLE Console, BOOL TextMode);
|
||||||
|
|
||||||
/* conoutput.c */
|
/* conoutput.c */
|
||||||
|
@ -199,19 +195,19 @@ void WINAPI ConioProcessKey(MSG *msg, PCONSOLE Console, BOOL TextMode);
|
||||||
(((Rect)->Top) > ((Rect)->Bottom) ? 0 : ((Rect)->Bottom) - ((Rect)->Top) + 1)
|
(((Rect)->Top) > ((Rect)->Bottom) ? 0 : ((Rect)->Bottom) - ((Rect)->Top) + 1)
|
||||||
#define ConioRectWidth(Rect) \
|
#define ConioRectWidth(Rect) \
|
||||||
(((Rect)->Left) > ((Rect)->Right) ? 0 : ((Rect)->Right) - ((Rect)->Left) + 1)
|
(((Rect)->Left) > ((Rect)->Right) ? 0 : ((Rect)->Right) - ((Rect)->Left) + 1)
|
||||||
#define ConioGetScreenBuffer(ProcessData, Handle, Ptr, Access, LockConsole) \
|
#define ConSrvGetScreenBuffer(ProcessData, Handle, Ptr, Access, LockConsole) \
|
||||||
Win32CsrLockObject((ProcessData), (Handle), (Object_t **)(Ptr), NULL, \
|
ConSrvGetObject((ProcessData), (Handle), (Object_t **)(Ptr), NULL, \
|
||||||
(Access), (LockConsole), CONIO_SCREEN_BUFFER_MAGIC)
|
(Access), (LockConsole), CONIO_SCREEN_BUFFER_MAGIC)
|
||||||
#define ConioGetScreenBufferAndHandleEntry(ProcessData, Handle, Ptr, Entry, Access, LockConsole) \
|
#define ConSrvGetScreenBufferAndHandleEntry(ProcessData, Handle, Ptr, Entry, Access, LockConsole) \
|
||||||
Win32CsrLockObject((ProcessData), (Handle), (Object_t **)(Ptr), (Entry), \
|
ConSrvGetObject((ProcessData), (Handle), (Object_t **)(Ptr), (Entry), \
|
||||||
(Access), (LockConsole), CONIO_SCREEN_BUFFER_MAGIC)
|
(Access), (LockConsole), CONIO_SCREEN_BUFFER_MAGIC)
|
||||||
#define ConioReleaseScreenBuffer(Buff, IsConsoleLocked) \
|
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked) \
|
||||||
Win32CsrUnlockObject(&(Buff)->Header, (IsConsoleLocked))
|
ConSrvReleaseObject(&(Buff)->Header, (IsConsoleLocked))
|
||||||
PBYTE FASTCALL ConioCoordToPointer(PCONSOLE_SCREEN_BUFFER Buf, ULONG X, ULONG Y);
|
PBYTE FASTCALL ConioCoordToPointer(PCONSOLE_SCREEN_BUFFER Buf, ULONG X, ULONG Y);
|
||||||
VOID FASTCALL ConioDrawConsole(PCONSOLE Console);
|
VOID FASTCALL ConioDrawConsole(PCONSOLE Console);
|
||||||
NTSTATUS FASTCALL ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff,
|
NTSTATUS FASTCALL ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff,
|
||||||
CHAR *Buffer, DWORD Length, BOOL Attrib);
|
CHAR *Buffer, DWORD Length, BOOL Attrib);
|
||||||
NTSTATUS FASTCALL CsrInitConsoleScreenBuffer(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buffer);
|
NTSTATUS FASTCALL ConSrvInitConsoleScreenBuffer(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buffer);
|
||||||
VOID WINAPI ConioDeleteScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer);
|
VOID WINAPI ConioDeleteScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer);
|
||||||
DWORD FASTCALL ConioEffectiveCursorSize(PCONSOLE Console, DWORD Scale);
|
DWORD FASTCALL ConioEffectiveCursorSize(PCONSOLE Console, DWORD Scale);
|
||||||
|
|
||||||
|
|
|
@ -58,10 +58,10 @@ ClearLineBuffer(PCONSOLE_SCREEN_BUFFER Buff)
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
CsrInitConsoleScreenBuffer(PCONSOLE Console,
|
ConSrvInitConsoleScreenBuffer(PCONSOLE Console,
|
||||||
PCONSOLE_SCREEN_BUFFER Buffer)
|
PCONSOLE_SCREEN_BUFFER Buffer)
|
||||||
{
|
{
|
||||||
DPRINT("CsrInitConsoleScreenBuffer Size X %d Size Y %d\n", Buffer->MaxX, Buffer->MaxY);
|
DPRINT("ConSrvInitConsoleScreenBuffer Size X %d Size Y %d\n", Buffer->MaxX, Buffer->MaxY);
|
||||||
|
|
||||||
Buffer->Header.Type = CONIO_SCREEN_BUFFER_MAGIC;
|
Buffer->Header.Type = CONIO_SCREEN_BUFFER_MAGIC;
|
||||||
Buffer->Header.Console = Console;
|
Buffer->Header.Console = Console;
|
||||||
|
@ -486,7 +486,7 @@ DoWriteConsole(IN PCSR_API_MESSAGE ApiMessage,
|
||||||
DWORD Written = 0;
|
DWORD Written = 0;
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
|
|
||||||
Status = ConioGetScreenBuffer(ConsoleGetPerProcessData(ClientThread->Process), WriteConsoleRequest->OutputHandle, &Buff, GENERIC_WRITE, FALSE);
|
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(ClientThread->Process), WriteConsoleRequest->OutputHandle, &Buff, GENERIC_WRITE, FALSE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
Console = Buff->Header.Console;
|
Console = Buff->Header.Console;
|
||||||
|
@ -504,7 +504,7 @@ DoWriteConsole(IN PCSR_API_MESSAGE ApiMessage,
|
||||||
NULL))
|
NULL))
|
||||||
{
|
{
|
||||||
/* Fail */
|
/* Fail */
|
||||||
ConioReleaseScreenBuffer(Buff, FALSE);
|
ConSrvReleaseScreenBuffer(Buff, FALSE);
|
||||||
return STATUS_NO_MEMORY;
|
return STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -558,7 +558,7 @@ DoWriteConsole(IN PCSR_API_MESSAGE ApiMessage,
|
||||||
WriteConsoleRequest->NrCharactersWritten = Written;
|
WriteConsoleRequest->NrCharactersWritten = Written;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConioReleaseScreenBuffer(Buff, FALSE);
|
ConSrvReleaseScreenBuffer(Buff, FALSE);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -598,7 +598,7 @@ CSR_API(SrvReadConsoleOutput)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ConioGetScreenBuffer(ProcessData, ReadOutputRequest->OutputHandle, &Buff, GENERIC_READ, TRUE);
|
Status = ConSrvGetScreenBuffer(ProcessData, ReadOutputRequest->OutputHandle, &Buff, GENERIC_READ, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
/* FIXME: Is this correct? */
|
/* FIXME: Is this correct? */
|
||||||
|
@ -612,7 +612,7 @@ CSR_API(SrvReadConsoleOutput)
|
||||||
ConioInitRect(&ScreenRect, 0, 0, Buff->MaxY, Buff->MaxX);
|
ConioInitRect(&ScreenRect, 0, 0, Buff->MaxY, Buff->MaxX);
|
||||||
if (!ConioGetIntersection(&ReadRegion, &ScreenRect, &ReadRegion))
|
if (!ConioGetIntersection(&ReadRegion, &ScreenRect, &ReadRegion))
|
||||||
{
|
{
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,7 +639,7 @@ CSR_API(SrvReadConsoleOutput)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
|
|
||||||
ReadOutputRequest->ReadRegion.Right = ReadRegion.Left + SizeX - 1;
|
ReadOutputRequest->ReadRegion.Right = ReadRegion.Left + SizeX - 1;
|
||||||
ReadOutputRequest->ReadRegion.Bottom = ReadRegion.Top + SizeY - 1;
|
ReadOutputRequest->ReadRegion.Bottom = ReadRegion.Top + SizeY - 1;
|
||||||
|
@ -704,7 +704,7 @@ CSR_API(SrvWriteConsoleOutput)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ConioGetScreenBuffer(ProcessData,
|
Status = ConSrvGetScreenBuffer(ProcessData,
|
||||||
WriteOutputRequest->OutputHandle,
|
WriteOutputRequest->OutputHandle,
|
||||||
&Buff,
|
&Buff,
|
||||||
GENERIC_WRITE,
|
GENERIC_WRITE,
|
||||||
|
@ -724,7 +724,7 @@ CSR_API(SrvWriteConsoleOutput)
|
||||||
ConioInitRect(&ScreenBuffer, 0, 0, Buff->MaxY - 1, Buff->MaxX - 1);
|
ConioInitRect(&ScreenBuffer, 0, 0, Buff->MaxY - 1, Buff->MaxX - 1);
|
||||||
if (!ConioGetIntersection(&WriteRegion, &ScreenBuffer, &WriteRegion))
|
if (!ConioGetIntersection(&WriteRegion, &ScreenBuffer, &WriteRegion))
|
||||||
{
|
{
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
|
|
||||||
/* It is okay to have a WriteRegion completely outside the screen buffer.
|
/* It is okay to have a WriteRegion completely outside the screen buffer.
|
||||||
No data is written then. */
|
No data is written then. */
|
||||||
|
@ -754,7 +754,7 @@ CSR_API(SrvWriteConsoleOutput)
|
||||||
|
|
||||||
ConioDrawRegion(Console, &WriteRegion);
|
ConioDrawRegion(Console, &WriteRegion);
|
||||||
|
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
|
|
||||||
WriteOutputRequest->WriteRegion.Right = WriteRegion.Left + SizeX - 1;
|
WriteOutputRequest->WriteRegion.Right = WriteRegion.Left + SizeX - 1;
|
||||||
WriteOutputRequest->WriteRegion.Bottom = WriteRegion.Top + SizeY - 1;
|
WriteOutputRequest->WriteRegion.Bottom = WriteRegion.Top + SizeY - 1;
|
||||||
|
@ -806,7 +806,7 @@ CSR_API(SrvReadConsoleOutputString)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ConioGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), ReadOutputCodeRequest->OutputHandle, &Buff, GENERIC_READ, TRUE);
|
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), ReadOutputCodeRequest->OutputHandle, &Buff, GENERIC_READ, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
Console = Buff->Header.Console;
|
Console = Buff->Header.Console;
|
||||||
|
@ -880,7 +880,7 @@ CSR_API(SrvReadConsoleOutputString)
|
||||||
ReadOutputCodeRequest->EndCoord.X = Xpos;
|
ReadOutputCodeRequest->EndCoord.X = Xpos;
|
||||||
ReadOutputCodeRequest->EndCoord.Y = (Ypos - Buff->VirtualY + Buff->MaxY) % Buff->MaxY;
|
ReadOutputCodeRequest->EndCoord.Y = (Ypos - Buff->VirtualY + Buff->MaxY) % Buff->MaxY;
|
||||||
|
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
|
|
||||||
ReadOutputCodeRequest->CodesRead = (DWORD)((ULONG_PTR)ReadBuffer - (ULONG_PTR)ReadOutputCodeRequest->pCode.pCode) / CodeSize;
|
ReadOutputCodeRequest->CodesRead = (DWORD)((ULONG_PTR)ReadBuffer - (ULONG_PTR)ReadOutputCodeRequest->pCode.pCode) / CodeSize;
|
||||||
// <= ReadOutputCodeRequest->NumCodesToRead
|
// <= ReadOutputCodeRequest->NumCodesToRead
|
||||||
|
@ -930,7 +930,7 @@ CSR_API(SrvWriteConsoleOutputString)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ConioGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||||
WriteOutputCodeRequest->OutputHandle,
|
WriteOutputCodeRequest->OutputHandle,
|
||||||
&Buff,
|
&Buff,
|
||||||
GENERIC_WRITE,
|
GENERIC_WRITE,
|
||||||
|
@ -1015,7 +1015,7 @@ CSR_API(SrvWriteConsoleOutputString)
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, tmpString);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, tmpString);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
|
|
||||||
// WriteOutputCodeRequest->NrCharactersWritten = Written;
|
// WriteOutputCodeRequest->NrCharactersWritten = Written;
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -1035,7 +1035,7 @@ CSR_API(SrvFillConsoleOutput)
|
||||||
|
|
||||||
DPRINT("SrvFillConsoleOutput\n");
|
DPRINT("SrvFillConsoleOutput\n");
|
||||||
|
|
||||||
Status = ConioGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), FillOutputRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE);
|
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), FillOutputRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
Console = Buff->Header.Console;
|
Console = Buff->Header.Console;
|
||||||
|
@ -1062,7 +1062,7 @@ CSR_API(SrvFillConsoleOutput)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1089,7 +1089,7 @@ CSR_API(SrvFillConsoleOutput)
|
||||||
ConioDrawRegion(Console, &UpdateRect);
|
ConioDrawRegion(Console, &UpdateRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
/*
|
/*
|
||||||
Length = FillOutputRequest->Length;
|
Length = FillOutputRequest->Length;
|
||||||
FillOutputRequest->NrCharactersWritten = Length;
|
FillOutputRequest->NrCharactersWritten = Length;
|
||||||
|
@ -1105,12 +1105,12 @@ CSR_API(SrvGetConsoleCursorInfo)
|
||||||
|
|
||||||
DPRINT("SrvGetConsoleCursorInfo\n");
|
DPRINT("SrvGetConsoleCursorInfo\n");
|
||||||
|
|
||||||
Status = ConioGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), CursorInfoRequest->OutputHandle, &Buff, GENERIC_READ, TRUE);
|
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), CursorInfoRequest->OutputHandle, &Buff, GENERIC_READ, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
CursorInfoRequest->Info.bVisible = Buff->CursorInfo.bVisible;
|
CursorInfoRequest->Info.bVisible = Buff->CursorInfo.bVisible;
|
||||||
CursorInfoRequest->Info.dwSize = Buff->CursorInfo.dwSize;
|
CursorInfoRequest->Info.dwSize = Buff->CursorInfo.dwSize;
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1126,7 +1126,7 @@ CSR_API(SrvSetConsoleCursorInfo)
|
||||||
|
|
||||||
DPRINT("SrvSetConsoleCursorInfo\n");
|
DPRINT("SrvSetConsoleCursorInfo\n");
|
||||||
|
|
||||||
Status = ConioGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), CursorInfoRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE);
|
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), CursorInfoRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
Console = Buff->Header.Console;
|
Console = Buff->Header.Console;
|
||||||
|
@ -1151,12 +1151,12 @@ CSR_API(SrvSetConsoleCursorInfo)
|
||||||
|
|
||||||
if (!ConioSetCursorInfo(Console, Buff))
|
if (!ConioSetCursorInfo(Console, Buff))
|
||||||
{
|
{
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1172,7 +1172,7 @@ CSR_API(SrvSetConsoleCursorPosition)
|
||||||
|
|
||||||
DPRINT("SrvSetConsoleCursorPosition\n");
|
DPRINT("SrvSetConsoleCursorPosition\n");
|
||||||
|
|
||||||
Status = ConioGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetCursorPositionRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE);
|
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetCursorPositionRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
Console = Buff->Header.Console;
|
Console = Buff->Header.Console;
|
||||||
|
@ -1182,7 +1182,7 @@ CSR_API(SrvSetConsoleCursorPosition)
|
||||||
if ( NewCursorX < 0 || NewCursorX >= Buff->MaxX ||
|
if ( NewCursorX < 0 || NewCursorX >= Buff->MaxX ||
|
||||||
NewCursorY < 0 || NewCursorY >= Buff->MaxY )
|
NewCursorY < 0 || NewCursorY >= Buff->MaxY )
|
||||||
{
|
{
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
OldCursorX = Buff->CurrentX;
|
OldCursorX = Buff->CurrentX;
|
||||||
|
@ -1193,12 +1193,12 @@ CSR_API(SrvSetConsoleCursorPosition)
|
||||||
{
|
{
|
||||||
if (!ConioSetScreenInfo(Console, Buff, OldCursorX, OldCursorY))
|
if (!ConioSetScreenInfo(Console, Buff, OldCursorX, OldCursorY))
|
||||||
{
|
{
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1212,7 +1212,7 @@ CSR_API(SrvSetConsoleTextAttribute)
|
||||||
|
|
||||||
DPRINT("SrvSetConsoleTextAttribute\n");
|
DPRINT("SrvSetConsoleTextAttribute\n");
|
||||||
|
|
||||||
Status = ConioGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetTextAttribRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE);
|
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetTextAttribRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
Console = Buff->Header.Console;
|
Console = Buff->Header.Console;
|
||||||
|
@ -1222,12 +1222,12 @@ CSR_API(SrvSetConsoleTextAttribute)
|
||||||
{
|
{
|
||||||
if (!ConioUpdateScreenInfo(Console, Buff))
|
if (!ConioUpdateScreenInfo(Console, Buff))
|
||||||
{
|
{
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1244,7 +1244,7 @@ CSR_API(SrvCreateConsoleScreenBuffer)
|
||||||
|
|
||||||
RtlEnterCriticalSection(&ProcessData->HandleTableLock);
|
RtlEnterCriticalSection(&ProcessData->HandleTableLock);
|
||||||
|
|
||||||
Status = ConioGetConsole(ProcessData, &Console, TRUE);
|
Status = ConSrvGetConsole(ProcessData, &Console, TRUE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
||||||
|
@ -1277,10 +1277,10 @@ CSR_API(SrvCreateConsoleScreenBuffer)
|
||||||
Buff->MaxY = 25;
|
Buff->MaxY = 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = CsrInitConsoleScreenBuffer(Console, Buff);
|
Status = ConSrvInitConsoleScreenBuffer(Console, Buff);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
Status = Win32CsrInsertObject(ProcessData,
|
Status = ConSrvInsertObject(ProcessData,
|
||||||
&CreateScreenBufferRequest->OutputHandle,
|
&CreateScreenBufferRequest->OutputHandle,
|
||||||
&Buff->Header,
|
&Buff->Header,
|
||||||
CreateScreenBufferRequest->Access,
|
CreateScreenBufferRequest->Access,
|
||||||
|
@ -1293,7 +1293,7 @@ CSR_API(SrvCreateConsoleScreenBuffer)
|
||||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
|
|
||||||
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
||||||
|
|
||||||
|
@ -1310,7 +1310,7 @@ CSR_API(SrvGetConsoleScreenBufferInfo)
|
||||||
|
|
||||||
DPRINT("SrvGetConsoleScreenBufferInfo\n");
|
DPRINT("SrvGetConsoleScreenBufferInfo\n");
|
||||||
|
|
||||||
Status = ConioGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), ScreenBufferInfoRequest->OutputHandle, &Buff, GENERIC_READ, TRUE);
|
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), ScreenBufferInfoRequest->OutputHandle, &Buff, GENERIC_READ, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
Console = Buff->Header.Console;
|
Console = Buff->Header.Console;
|
||||||
|
@ -1327,7 +1327,7 @@ CSR_API(SrvGetConsoleScreenBufferInfo)
|
||||||
pInfo->dwMaximumWindowSize.X = Buff->MaxX;
|
pInfo->dwMaximumWindowSize.X = Buff->MaxX;
|
||||||
pInfo->dwMaximumWindowSize.Y = Buff->MaxY;
|
pInfo->dwMaximumWindowSize.Y = Buff->MaxY;
|
||||||
|
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1341,14 +1341,14 @@ CSR_API(SrvSetConsoleActiveScreenBuffer)
|
||||||
|
|
||||||
DPRINT("SrvSetConsoleActiveScreenBuffer\n");
|
DPRINT("SrvSetConsoleActiveScreenBuffer\n");
|
||||||
|
|
||||||
Status = ConioGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetScreenBufferRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE);
|
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetScreenBufferRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
Console = Buff->Header.Console;
|
Console = Buff->Header.Console;
|
||||||
|
|
||||||
if (Buff == Console->ActiveBuffer)
|
if (Buff == Console->ActiveBuffer)
|
||||||
{
|
{
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1364,7 +1364,7 @@ CSR_API(SrvSetConsoleActiveScreenBuffer)
|
||||||
/* Redraw the console */
|
/* Redraw the console */
|
||||||
ConioDrawConsole(Console);
|
ConioDrawConsole(Console);
|
||||||
|
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1394,7 +1394,7 @@ CSR_API(SrvScrollConsoleScreenBuffer)
|
||||||
DestinationOrigin = ScrollScreenBufferRequest->DestinationOrigin;
|
DestinationOrigin = ScrollScreenBufferRequest->DestinationOrigin;
|
||||||
Fill = ScrollScreenBufferRequest->Fill;
|
Fill = ScrollScreenBufferRequest->Fill;
|
||||||
|
|
||||||
Status = ConioGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), OutputHandle, &Buff, GENERIC_WRITE, TRUE);
|
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), OutputHandle, &Buff, GENERIC_WRITE, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
Console = Buff->Header.Console;
|
Console = Buff->Header.Console;
|
||||||
|
@ -1405,7 +1405,7 @@ CSR_API(SrvScrollConsoleScreenBuffer)
|
||||||
ConioInitRect(&ScreenBuffer, 0, 0, Buff->MaxY - 1, Buff->MaxX - 1);
|
ConioInitRect(&ScreenBuffer, 0, 0, Buff->MaxY - 1, Buff->MaxX - 1);
|
||||||
if (!ConioGetIntersection(&SrcRegion, &ScreenBuffer, &ScrollRectangle))
|
if (!ConioGetIntersection(&SrcRegion, &ScreenBuffer, &ScrollRectangle))
|
||||||
{
|
{
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1424,7 +1424,7 @@ CSR_API(SrvScrollConsoleScreenBuffer)
|
||||||
ClipRectangle = ScrollScreenBufferRequest->ClipRectangle;
|
ClipRectangle = ScrollScreenBufferRequest->ClipRectangle;
|
||||||
if (!ConioGetIntersection(&ClipRectangle, &ClipRectangle, &ScreenBuffer))
|
if (!ConioGetIntersection(&ClipRectangle, &ClipRectangle, &ScreenBuffer))
|
||||||
{
|
{
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1456,7 +1456,7 @@ CSR_API(SrvScrollConsoleScreenBuffer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1467,11 +1467,11 @@ CSR_API(SrvSetConsoleScreenBufferSize)
|
||||||
PCONSOLE_SETSCREENBUFFERSIZE SetScreenBufferSizeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetScreenBufferSizeRequest;
|
PCONSOLE_SETSCREENBUFFERSIZE SetScreenBufferSizeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetScreenBufferSizeRequest;
|
||||||
PCONSOLE_SCREEN_BUFFER Buff;
|
PCONSOLE_SCREEN_BUFFER Buff;
|
||||||
|
|
||||||
Status = ConioGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetScreenBufferSizeRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE);
|
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetScreenBufferSizeRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
Status = ConioResizeBuffer(Buff->Header.Console, Buff, SetScreenBufferSizeRequest->Size);
|
Status = ConioResizeBuffer(Buff->Header.Console, Buff, SetScreenBufferSizeRequest->Size);
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,13 +32,13 @@ DtbgIsDesktopVisible(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
ConioConsoleCtrlEventTimeout(DWORD Event,
|
ConSrvConsoleCtrlEventTimeout(DWORD Event,
|
||||||
PCONSOLE_PROCESS_DATA ProcessData,
|
PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
DWORD Timeout)
|
DWORD Timeout)
|
||||||
{
|
{
|
||||||
HANDLE Thread;
|
HANDLE Thread;
|
||||||
|
|
||||||
DPRINT("ConioConsoleCtrlEvent Parent ProcessId = %x\n", ProcessData->Process->ClientId.UniqueProcess);
|
DPRINT("ConSrvConsoleCtrlEvent Parent ProcessId = %x\n", ProcessData->Process->ClientId.UniqueProcess);
|
||||||
|
|
||||||
if (ProcessData->CtrlDispatcher)
|
if (ProcessData->CtrlDispatcher)
|
||||||
{
|
{
|
||||||
|
@ -58,13 +58,40 @@ ConioConsoleCtrlEventTimeout(DWORD Event,
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
ConioConsoleCtrlEvent(DWORD Event, PCONSOLE_PROCESS_DATA ProcessData)
|
ConSrvConsoleCtrlEvent(DWORD Event, PCONSOLE_PROCESS_DATA ProcessData)
|
||||||
{
|
{
|
||||||
ConioConsoleCtrlEventTimeout(Event, ProcessData, 0);
|
ConSrvConsoleCtrlEventTimeout(Event, ProcessData, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID FASTCALL
|
||||||
|
ConioPause(PCONSOLE Console, UINT Flags)
|
||||||
|
{
|
||||||
|
Console->PauseFlags |= Flags;
|
||||||
|
if (!Console->UnpauseEvent)
|
||||||
|
Console->UnpauseEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID FASTCALL
|
||||||
|
ConioUnpause(PCONSOLE Console, UINT Flags)
|
||||||
|
{
|
||||||
|
Console->PauseFlags &= ~Flags;
|
||||||
|
|
||||||
|
// if ((Console->PauseFlags & (PAUSED_FROM_KEYBOARD | PAUSED_FROM_SCROLLBAR | PAUSED_FROM_SELECTION)) == 0)
|
||||||
|
if (Console->PauseFlags == 0 && Console->UnpauseEvent)
|
||||||
|
{
|
||||||
|
SetEvent(Console->UnpauseEvent);
|
||||||
|
CloseHandle(Console->UnpauseEvent);
|
||||||
|
Console->UnpauseEvent = NULL;
|
||||||
|
|
||||||
|
CsrNotifyWait(&Console->WriteWaitQueue,
|
||||||
|
WaitAll,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS WINAPI
|
NTSTATUS WINAPI
|
||||||
CsrInitConsole(PCONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLeaderProcess)
|
ConSrvInitConsole(PCONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLeaderProcess)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
SECURITY_ATTRIBUTES SecurityAttributes;
|
SECURITY_ATTRIBUTES SecurityAttributes;
|
||||||
|
@ -190,7 +217,7 @@ CsrInitConsole(PCONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLeaderProc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = CsrInitConsoleScreenBuffer(Console, NewBuffer);
|
Status = ConSrvInitConsoleScreenBuffer(Console, NewBuffer);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ConioCleanupConsole(Console);
|
ConioCleanupConsole(Console);
|
||||||
|
@ -198,7 +225,7 @@ CsrInitConsole(PCONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLeaderProc
|
||||||
DeleteCriticalSection(&Console->Lock);
|
DeleteCriticalSection(&Console->Lock);
|
||||||
CloseHandle(Console->InputBuffer.ActiveEvent);
|
CloseHandle(Console->InputBuffer.ActiveEvent);
|
||||||
RtlFreeHeap(ConSrvHeap, 0, NewBuffer);
|
RtlFreeHeap(ConSrvHeap, 0, NewBuffer);
|
||||||
DPRINT1("CsrInitConsoleScreenBuffer: failed\n");
|
DPRINT1("ConSrvInitConsoleScreenBuffer: failed\n");
|
||||||
RtlFreeHeap(ConSrvHeap, 0, Console);
|
RtlFreeHeap(ConSrvHeap, 0, Console);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -211,6 +238,50 @@ CsrInitConsole(PCONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLeaderProc
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID WINAPI
|
||||||
|
ConSrvInitConsoleSupport(VOID)
|
||||||
|
{
|
||||||
|
DPRINT("CONSRV: ConSrvInitConsoleSupport()\n");
|
||||||
|
|
||||||
|
/* Should call LoadKeyboardLayout */
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID WINAPI
|
||||||
|
ConSrvDeleteConsole(PCONSOLE Console)
|
||||||
|
{
|
||||||
|
ConsoleInput *Event;
|
||||||
|
|
||||||
|
DPRINT("ConSrvDeleteConsole\n");
|
||||||
|
|
||||||
|
/* Drain input event queue */
|
||||||
|
while (Console->InputBuffer.InputEvents.Flink != &Console->InputBuffer.InputEvents)
|
||||||
|
{
|
||||||
|
Event = (ConsoleInput *) Console->InputBuffer.InputEvents.Flink;
|
||||||
|
Console->InputBuffer.InputEvents.Flink = Console->InputBuffer.InputEvents.Flink->Flink;
|
||||||
|
Console->InputBuffer.InputEvents.Flink->Flink->Blink = &Console->InputBuffer.InputEvents;
|
||||||
|
RtlFreeHeap(ConSrvHeap, 0, Event);
|
||||||
|
}
|
||||||
|
|
||||||
|
ConioCleanupConsole(Console);
|
||||||
|
if (Console->LineBuffer)
|
||||||
|
RtlFreeHeap(ConSrvHeap, 0, Console->LineBuffer);
|
||||||
|
while (!IsListEmpty(&Console->HistoryBuffers))
|
||||||
|
HistoryDeleteBuffer((struct _HISTORY_BUFFER *)Console->HistoryBuffers.Flink);
|
||||||
|
|
||||||
|
ConioDeleteScreenBuffer(Console->ActiveBuffer);
|
||||||
|
if (!IsListEmpty(&Console->BufferList))
|
||||||
|
{
|
||||||
|
DPRINT1("BUG: screen buffer list not empty\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseHandle(Console->InputBuffer.ActiveEvent);
|
||||||
|
if (Console->UnpauseEvent) CloseHandle(Console->UnpauseEvent);
|
||||||
|
DeleteCriticalSection(&Console->Lock);
|
||||||
|
RtlFreeUnicodeString(&Console->Title);
|
||||||
|
IntDeleteAllAliases(Console->Aliases);
|
||||||
|
RtlFreeHeap(ConSrvHeap, 0, Console);
|
||||||
|
}
|
||||||
|
|
||||||
CSR_API(SrvOpenConsole)
|
CSR_API(SrvOpenConsole)
|
||||||
{
|
{
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
@ -257,7 +328,7 @@ CSR_API(SrvOpenConsole)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Status = Win32CsrInsertObject(ProcessData,
|
Status = ConSrvInsertObject(ProcessData,
|
||||||
&OpenConsoleRequest->ConsoleHandle,
|
&OpenConsoleRequest->ConsoleHandle,
|
||||||
Object,
|
Object,
|
||||||
DesiredAccess,
|
DesiredAccess,
|
||||||
|
@ -289,11 +360,11 @@ CSR_API(SrvAllocConsole)
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/** This comes from ConsoleConnect!! **/
|
/** This comes from ConSrvConnect!! **/
|
||||||
DPRINT1("SrvAllocConsole - Checkpoint 1\n");
|
DPRINT1("SrvAllocConsole - Checkpoint 1\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We are about to create a new console. However when ConsoleNewProcess
|
* We are about to create a new console. However when ConSrvNewProcess
|
||||||
* was called, we didn't know that we wanted to create a new console and
|
* was called, we didn't know that we wanted to create a new console and
|
||||||
* therefore, we by default inherited the handles table from our parent
|
* therefore, we by default inherited the handles table from our parent
|
||||||
* process. It's only now that we notice that in fact we do not need
|
* process. It's only now that we notice that in fact we do not need
|
||||||
|
@ -302,11 +373,11 @@ CSR_API(SrvAllocConsole)
|
||||||
* Therefore, free the console we can have and our handles table,
|
* Therefore, free the console we can have and our handles table,
|
||||||
* and recreate a new one later on.
|
* and recreate a new one later on.
|
||||||
*/
|
*/
|
||||||
Win32CsrReleaseConsole(ProcessData);
|
ConSrvRemoveConsole(ProcessData);
|
||||||
// Win32CsrFreeHandlesTable(ProcessData);
|
// ConSrvFreeHandlesTable(ProcessData);
|
||||||
|
|
||||||
/* Initialize a new Console owned by the Console Leader Process */
|
/* Initialize a new Console owned by the Console Leader Process */
|
||||||
Status = Win32CsrAllocateConsole(ProcessData,
|
Status = ConSrvAllocateConsole(ProcessData,
|
||||||
&AllocConsoleRequest->InputHandle,
|
&AllocConsoleRequest->InputHandle,
|
||||||
&AllocConsoleRequest->OutputHandle,
|
&AllocConsoleRequest->OutputHandle,
|
||||||
&AllocConsoleRequest->ErrorHandle,
|
&AllocConsoleRequest->ErrorHandle,
|
||||||
|
@ -333,7 +404,7 @@ CSR_API(SrvAllocConsole)
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtDuplicateObject() failed: %lu\n", Status);
|
DPRINT1("NtDuplicateObject() failed: %lu\n", Status);
|
||||||
Win32CsrReleaseConsole(ProcessData);
|
ConSrvRemoveConsole(ProcessData);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,11 +471,11 @@ CSR_API(SrvAttachConsole)
|
||||||
DPRINT1("AttachConsole OK\n");
|
DPRINT1("AttachConsole OK\n");
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/** This comes from ConsoleNewProcess!! **/
|
/** This comes from ConSrvNewProcess!! **/
|
||||||
SourceProcessData = ConsoleGetPerProcessData(SourceProcess);
|
SourceProcessData = ConsoleGetPerProcessData(SourceProcess);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We are about to create a new console. However when ConsoleNewProcess
|
* We are about to create a new console. However when ConSrvNewProcess
|
||||||
* was called, we didn't know that we wanted to create a new console and
|
* was called, we didn't know that we wanted to create a new console and
|
||||||
* therefore, we by default inherited the handles table from our parent
|
* therefore, we by default inherited the handles table from our parent
|
||||||
* process. It's only now that we notice that in fact we do not need
|
* process. It's only now that we notice that in fact we do not need
|
||||||
|
@ -413,8 +484,8 @@ CSR_API(SrvAttachConsole)
|
||||||
* Therefore, free the console we can have and our handles table,
|
* Therefore, free the console we can have and our handles table,
|
||||||
* and recreate a new one later on.
|
* and recreate a new one later on.
|
||||||
*/
|
*/
|
||||||
Win32CsrReleaseConsole(TargetProcessData);
|
ConSrvRemoveConsole(TargetProcessData);
|
||||||
// Win32CsrFreeHandlesTable(TargetProcessData);
|
// ConSrvFreeHandlesTable(TargetProcessData);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Inherit the console from the parent,
|
* Inherit the console from the parent,
|
||||||
|
@ -428,9 +499,9 @@ CSR_API(SrvAttachConsole)
|
||||||
}
|
}
|
||||||
TargetProcessData->Console = SourceProcessData->Console;
|
TargetProcessData->Console = SourceProcessData->Console;
|
||||||
|
|
||||||
/// REMARK: This code comes from Win32CsrAllocateConsole.
|
/// REMARK: This code comes from ConSrvAllocateConsole.
|
||||||
/* Initialize the handles table */
|
/* Initialize the handles table */
|
||||||
Status = Win32CsrInitHandlesTable(TargetProcessData,
|
Status = ConSrvInitHandlesTable(TargetProcessData,
|
||||||
&AttachConsoleRequest->InputHandle,
|
&AttachConsoleRequest->InputHandle,
|
||||||
&AttachConsoleRequest->OutputHandle,
|
&AttachConsoleRequest->OutputHandle,
|
||||||
&AttachConsoleRequest->ErrorHandle);
|
&AttachConsoleRequest->ErrorHandle);
|
||||||
|
@ -438,7 +509,7 @@ CSR_API(SrvAttachConsole)
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to initialize the handles table\n");
|
DPRINT1("Failed to initialize the handles table\n");
|
||||||
|
|
||||||
// Win32CsrReleaseConsole(TargetProcessData);
|
// ConSrvRemoveConsole(TargetProcessData);
|
||||||
TargetProcessData->Console = NULL;
|
TargetProcessData->Console = NULL;
|
||||||
goto Quit;
|
goto Quit;
|
||||||
}
|
}
|
||||||
|
@ -446,7 +517,7 @@ CSR_API(SrvAttachConsole)
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/** This comes from ConsoleConnect / SrvAllocConsole!! **/
|
/** This comes from ConSrvConnect / SrvAllocConsole!! **/
|
||||||
/* Add a reference count because the process is tied to the console */
|
/* Add a reference count because the process is tied to the console */
|
||||||
_InterlockedIncrement(&TargetProcessData->Console->ReferenceCount);
|
_InterlockedIncrement(&TargetProcessData->Console->ReferenceCount);
|
||||||
|
|
||||||
|
@ -467,7 +538,7 @@ CSR_API(SrvAttachConsole)
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtDuplicateObject() failed: %lu\n", Status);
|
DPRINT1("NtDuplicateObject() failed: %lu\n", Status);
|
||||||
Win32CsrReleaseConsole(TargetProcessData);
|
ConSrvRemoveConsole(TargetProcessData);
|
||||||
goto Quit;
|
goto Quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,81 +567,10 @@ Quit:
|
||||||
CSR_API(SrvFreeConsole)
|
CSR_API(SrvFreeConsole)
|
||||||
{
|
{
|
||||||
DPRINT1("SrvFreeConsole\n");
|
DPRINT1("SrvFreeConsole\n");
|
||||||
Win32CsrReleaseConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process));
|
ConSrvRemoveConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process));
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID WINAPI
|
|
||||||
ConioDeleteConsole(PCONSOLE Console)
|
|
||||||
{
|
|
||||||
ConsoleInput *Event;
|
|
||||||
|
|
||||||
DPRINT("ConioDeleteConsole\n");
|
|
||||||
|
|
||||||
/* Drain input event queue */
|
|
||||||
while (Console->InputBuffer.InputEvents.Flink != &Console->InputBuffer.InputEvents)
|
|
||||||
{
|
|
||||||
Event = (ConsoleInput *) Console->InputBuffer.InputEvents.Flink;
|
|
||||||
Console->InputBuffer.InputEvents.Flink = Console->InputBuffer.InputEvents.Flink->Flink;
|
|
||||||
Console->InputBuffer.InputEvents.Flink->Flink->Blink = &Console->InputBuffer.InputEvents;
|
|
||||||
RtlFreeHeap(ConSrvHeap, 0, Event);
|
|
||||||
}
|
|
||||||
|
|
||||||
ConioCleanupConsole(Console);
|
|
||||||
if (Console->LineBuffer)
|
|
||||||
RtlFreeHeap(ConSrvHeap, 0, Console->LineBuffer);
|
|
||||||
while (!IsListEmpty(&Console->HistoryBuffers))
|
|
||||||
HistoryDeleteBuffer((struct _HISTORY_BUFFER *)Console->HistoryBuffers.Flink);
|
|
||||||
|
|
||||||
ConioDeleteScreenBuffer(Console->ActiveBuffer);
|
|
||||||
if (!IsListEmpty(&Console->BufferList))
|
|
||||||
{
|
|
||||||
DPRINT1("BUG: screen buffer list not empty\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
CloseHandle(Console->InputBuffer.ActiveEvent);
|
|
||||||
if (Console->UnpauseEvent) CloseHandle(Console->UnpauseEvent);
|
|
||||||
DeleteCriticalSection(&Console->Lock);
|
|
||||||
RtlFreeUnicodeString(&Console->Title);
|
|
||||||
IntDeleteAllAliases(Console->Aliases);
|
|
||||||
RtlFreeHeap(ConSrvHeap, 0, Console);
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID WINAPI
|
|
||||||
CsrInitConsoleSupport(VOID)
|
|
||||||
{
|
|
||||||
DPRINT("CSR: CsrInitConsoleSupport()\n");
|
|
||||||
|
|
||||||
/* Should call LoadKeyboardLayout */
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID FASTCALL
|
|
||||||
ConioPause(PCONSOLE Console, UINT Flags)
|
|
||||||
{
|
|
||||||
Console->PauseFlags |= Flags;
|
|
||||||
if (!Console->UnpauseEvent)
|
|
||||||
Console->UnpauseEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID FASTCALL
|
|
||||||
ConioUnpause(PCONSOLE Console, UINT Flags)
|
|
||||||
{
|
|
||||||
Console->PauseFlags &= ~Flags;
|
|
||||||
|
|
||||||
// if ((Console->PauseFlags & (PAUSED_FROM_KEYBOARD | PAUSED_FROM_SCROLLBAR | PAUSED_FROM_SELECTION)) == 0)
|
|
||||||
if (Console->PauseFlags == 0 && Console->UnpauseEvent)
|
|
||||||
{
|
|
||||||
SetEvent(Console->UnpauseEvent);
|
|
||||||
CloseHandle(Console->UnpauseEvent);
|
|
||||||
Console->UnpauseEvent = NULL;
|
|
||||||
|
|
||||||
CsrNotifyWait(&Console->WriteWaitQueue,
|
|
||||||
WaitAll,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CSR_API(SrvSetConsoleMode)
|
CSR_API(SrvSetConsoleMode)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -579,7 +579,7 @@ CSR_API(SrvSetConsoleMode)
|
||||||
|
|
||||||
DPRINT("SrvSetConsoleMode\n");
|
DPRINT("SrvSetConsoleMode\n");
|
||||||
|
|
||||||
Status = Win32CsrLockObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
Status = ConSrvGetObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||||
ConsoleModeRequest->ConsoleHandle,
|
ConsoleModeRequest->ConsoleHandle,
|
||||||
&Object, NULL, GENERIC_WRITE, TRUE, 0);
|
&Object, NULL, GENERIC_WRITE, TRUE, 0);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
@ -601,7 +601,7 @@ CSR_API(SrvSetConsoleMode)
|
||||||
Status = STATUS_INVALID_HANDLE;
|
Status = STATUS_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Win32CsrUnlockObject(Object, TRUE);
|
ConSrvReleaseObject(Object, TRUE);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -614,7 +614,7 @@ CSR_API(SrvGetConsoleMode)
|
||||||
|
|
||||||
DPRINT("SrvGetConsoleMode\n");
|
DPRINT("SrvGetConsoleMode\n");
|
||||||
|
|
||||||
Status = Win32CsrLockObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
Status = ConSrvGetObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||||
ConsoleModeRequest->ConsoleHandle,
|
ConsoleModeRequest->ConsoleHandle,
|
||||||
&Object, NULL, GENERIC_READ, TRUE, 0);
|
&Object, NULL, GENERIC_READ, TRUE, 0);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
@ -636,7 +636,7 @@ CSR_API(SrvGetConsoleMode)
|
||||||
Status = STATUS_INVALID_HANDLE;
|
Status = STATUS_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Win32CsrUnlockObject(Object, TRUE);
|
ConSrvReleaseObject(Object, TRUE);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -659,7 +659,7 @@ CSR_API(SrvSetConsoleTitle)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ConioGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if(NT_SUCCESS(Status))
|
if(NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, TitleRequest->Length);
|
Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, TitleRequest->Length);
|
||||||
|
@ -685,7 +685,7 @@ CSR_API(SrvSetConsoleTitle)
|
||||||
Status = STATUS_NO_MEMORY;
|
Status = STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -709,7 +709,7 @@ CSR_API(SrvGetConsoleTitle)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ConioGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Can't get console\n");
|
DPRINT1("Can't get console\n");
|
||||||
|
@ -726,7 +726,7 @@ CSR_API(SrvGetConsoleTitle)
|
||||||
|
|
||||||
TitleRequest->Length = Console->Title.Length;
|
TitleRequest->Length = Console->Title.Length;
|
||||||
|
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -774,7 +774,7 @@ CSR_API(SrvGetConsoleHardwareState)
|
||||||
|
|
||||||
DPRINT("SrvGetConsoleHardwareState\n");
|
DPRINT("SrvGetConsoleHardwareState\n");
|
||||||
|
|
||||||
Status = ConioGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||||
HardwareStateRequest->OutputHandle,
|
HardwareStateRequest->OutputHandle,
|
||||||
&Buff,
|
&Buff,
|
||||||
GENERIC_READ,
|
GENERIC_READ,
|
||||||
|
@ -788,7 +788,7 @@ CSR_API(SrvGetConsoleHardwareState)
|
||||||
Console = Buff->Header.Console;
|
Console = Buff->Header.Console;
|
||||||
HardwareStateRequest->State = Console->HardwareState;
|
HardwareStateRequest->State = Console->HardwareState;
|
||||||
|
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -802,7 +802,7 @@ CSR_API(SrvSetConsoleHardwareState)
|
||||||
|
|
||||||
DPRINT("SrvSetConsoleHardwareState\n");
|
DPRINT("SrvSetConsoleHardwareState\n");
|
||||||
|
|
||||||
Status = ConioGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||||
HardwareStateRequest->OutputHandle,
|
HardwareStateRequest->OutputHandle,
|
||||||
&Buff,
|
&Buff,
|
||||||
GENERIC_READ,
|
GENERIC_READ,
|
||||||
|
@ -817,7 +817,7 @@ CSR_API(SrvSetConsoleHardwareState)
|
||||||
Console = Buff->Header.Console;
|
Console = Buff->Header.Console;
|
||||||
Status = SetConsoleHardwareState(Console, HardwareStateRequest->State);
|
Status = SetConsoleHardwareState(Console, HardwareStateRequest->State);
|
||||||
|
|
||||||
ConioReleaseScreenBuffer(Buff, TRUE);
|
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -830,11 +830,11 @@ CSR_API(SrvGetConsoleWindow)
|
||||||
|
|
||||||
DPRINT("SrvGetConsoleWindow\n");
|
DPRINT("SrvGetConsoleWindow\n");
|
||||||
|
|
||||||
Status = ConioGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
GetWindowRequest->WindowHandle = Console->hWindow;
|
GetWindowRequest->WindowHandle = Console->hWindow;
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -847,14 +847,14 @@ CSR_API(SrvSetConsoleIcon)
|
||||||
|
|
||||||
DPRINT("SrvSetConsoleIcon\n");
|
DPRINT("SrvSetConsoleIcon\n");
|
||||||
|
|
||||||
Status = ConioGetConsole(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 = (ConioChangeIcon(Console, SetIconRequest->WindowIcon)
|
Status = (ConioChangeIcon(Console, SetIconRequest->WindowIcon)
|
||||||
? STATUS_SUCCESS
|
? STATUS_SUCCESS
|
||||||
: STATUS_UNSUCCESSFUL);
|
: STATUS_UNSUCCESSFUL);
|
||||||
|
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -868,12 +868,12 @@ CSR_API(SrvGetConsoleCP)
|
||||||
DPRINT("SrvGetConsoleCP, getting %s Code Page\n",
|
DPRINT("SrvGetConsoleCP, getting %s Code Page\n",
|
||||||
ConsoleCPRequest->InputCP ? "Input" : "Output");
|
ConsoleCPRequest->InputCP ? "Input" : "Output");
|
||||||
|
|
||||||
Status = ConioGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
ConsoleCPRequest->CodePage = (ConsoleCPRequest->InputCP ? Console->CodePage
|
ConsoleCPRequest->CodePage = (ConsoleCPRequest->InputCP ? Console->CodePage
|
||||||
: Console->OutputCodePage);
|
: Console->OutputCodePage);
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -886,7 +886,7 @@ CSR_API(SrvSetConsoleCP)
|
||||||
DPRINT("SrvSetConsoleCP, setting %s Code Page\n",
|
DPRINT("SrvSetConsoleCP, setting %s Code Page\n",
|
||||||
ConsoleCPRequest->InputCP ? "Input" : "Output");
|
ConsoleCPRequest->InputCP ? "Input" : "Output");
|
||||||
|
|
||||||
Status = ConioGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
if (IsValidCodePage(ConsoleCPRequest->CodePage))
|
if (IsValidCodePage(ConsoleCPRequest->CodePage))
|
||||||
|
@ -896,11 +896,11 @@ CSR_API(SrvSetConsoleCP)
|
||||||
else
|
else
|
||||||
Console->OutputCodePage = ConsoleCPRequest->CodePage;
|
Console->OutputCodePage = ConsoleCPRequest->CodePage;
|
||||||
|
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -927,7 +927,7 @@ CSR_API(SrvGetConsoleProcessList)
|
||||||
|
|
||||||
Buffer = GetProcessListRequest->pProcessIds;
|
Buffer = GetProcessListRequest->pProcessIds;
|
||||||
|
|
||||||
Status = ConioGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
for (current_entry = Console->ProcessList.Flink;
|
for (current_entry = Console->ProcessList.Flink;
|
||||||
|
@ -941,7 +941,7 @@ CSR_API(SrvGetConsoleProcessList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
|
|
||||||
GetProcessListRequest->nProcessIdsTotal = nItems;
|
GetProcessListRequest->nProcessIdsTotal = nItems;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -956,7 +956,7 @@ CSR_API(SrvGenerateConsoleCtrlEvent)
|
||||||
PLIST_ENTRY current_entry;
|
PLIST_ENTRY current_entry;
|
||||||
DWORD Group;
|
DWORD Group;
|
||||||
|
|
||||||
Status = ConioGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
Group = GenerateCtrlEventRequest->ProcessGroup;
|
Group = GenerateCtrlEventRequest->ProcessGroup;
|
||||||
|
@ -968,12 +968,12 @@ CSR_API(SrvGenerateConsoleCtrlEvent)
|
||||||
current = CONTAINING_RECORD(current_entry, CONSOLE_PROCESS_DATA, ConsoleLink);
|
current = CONTAINING_RECORD(current_entry, CONSOLE_PROCESS_DATA, ConsoleLink);
|
||||||
if (Group == 0 || current->Process->ProcessGroupId == Group)
|
if (Group == 0 || current->Process->ProcessGroupId == Group)
|
||||||
{
|
{
|
||||||
ConioConsoleCtrlEvent(GenerateCtrlEventRequest->Event, current);
|
ConSrvConsoleCtrlEvent(GenerateCtrlEventRequest->Event, current);
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -984,13 +984,13 @@ CSR_API(SrvGetConsoleSelectionInfo)
|
||||||
PCONSOLE_GETSELECTIONINFO GetSelectionInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetSelectionInfoRequest;
|
PCONSOLE_GETSELECTIONINFO GetSelectionInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetSelectionInfoRequest;
|
||||||
PCONSOLE Console;
|
PCONSOLE Console;
|
||||||
|
|
||||||
Status = ConioGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
memset(&GetSelectionInfoRequest->Info, 0, sizeof(CONSOLE_SELECTION_INFO));
|
memset(&GetSelectionInfoRequest->Info, 0, sizeof(CONSOLE_SELECTION_INFO));
|
||||||
if (Console->Selection.dwFlags != 0)
|
if (Console->Selection.dwFlags != 0)
|
||||||
GetSelectionInfoRequest->Info = Console->Selection;
|
GetSelectionInfoRequest->Info = Console->Selection;
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
|
@ -140,50 +140,49 @@ CSR_API(SrvVerifyConsoleIoHandle);
|
||||||
CSR_API(SrvDuplicateHandle);
|
CSR_API(SrvDuplicateHandle);
|
||||||
/// CSR_API(CsrGetInputWaitHandle);
|
/// CSR_API(CsrGetInputWaitHandle);
|
||||||
|
|
||||||
NTSTATUS FASTCALL Win32CsrInitHandlesTable(IN OUT PCONSOLE_PROCESS_DATA ProcessData,
|
NTSTATUS FASTCALL ConSrvInitHandlesTable(IN OUT PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
OUT PHANDLE pInputHandle,
|
OUT PHANDLE pInputHandle,
|
||||||
OUT PHANDLE pOutputHandle,
|
OUT PHANDLE pOutputHandle,
|
||||||
OUT PHANDLE pErrorHandle);
|
OUT PHANDLE pErrorHandle);
|
||||||
NTSTATUS FASTCALL Win32CsrInheritHandlesTable(IN PCONSOLE_PROCESS_DATA SourceProcessData,
|
NTSTATUS FASTCALL ConSrvInheritHandlesTable(IN PCONSOLE_PROCESS_DATA SourceProcessData,
|
||||||
IN PCONSOLE_PROCESS_DATA TargetProcessData);
|
IN PCONSOLE_PROCESS_DATA TargetProcessData);
|
||||||
VOID FASTCALL Win32CsrFreeHandlesTable(PCONSOLE_PROCESS_DATA ProcessData);
|
VOID FASTCALL ConSrvFreeHandlesTable(PCONSOLE_PROCESS_DATA ProcessData);
|
||||||
NTSTATUS FASTCALL Win32CsrInsertObject(PCONSOLE_PROCESS_DATA ProcessData,
|
NTSTATUS FASTCALL ConSrvInsertObject(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
PHANDLE Handle,
|
PHANDLE Handle,
|
||||||
Object_t *Object,
|
Object_t *Object,
|
||||||
DWORD Access,
|
DWORD Access,
|
||||||
BOOL Inheritable,
|
BOOL Inheritable,
|
||||||
DWORD ShareMode);
|
DWORD ShareMode);
|
||||||
NTSTATUS FASTCALL Win32CsrLockObject(PCONSOLE_PROCESS_DATA ProcessData,
|
NTSTATUS FASTCALL ConSrvRemoveObject(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
|
HANDLE Handle);
|
||||||
|
NTSTATUS FASTCALL ConSrvGetObject(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
HANDLE Handle,
|
HANDLE Handle,
|
||||||
Object_t** Object,
|
Object_t** Object,
|
||||||
PCONSOLE_IO_HANDLE* Entry OPTIONAL,
|
PCONSOLE_IO_HANDLE* Entry OPTIONAL,
|
||||||
DWORD Access,
|
DWORD Access,
|
||||||
BOOL LockConsole,
|
BOOL LockConsole,
|
||||||
ULONG Type);
|
ULONG Type);
|
||||||
VOID FASTCALL Win32CsrUnlockObject(Object_t *Object,
|
VOID FASTCALL ConSrvReleaseObject(Object_t *Object,
|
||||||
BOOL IsConsoleLocked);
|
BOOL IsConsoleLocked);
|
||||||
VOID FASTCALL Win32CsrUnlockConsole(struct _CONSOLE* Console,
|
NTSTATUS FASTCALL ConSrvAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
BOOL IsConsoleLocked);
|
|
||||||
NTSTATUS FASTCALL Win32CsrReleaseObject(PCONSOLE_PROCESS_DATA ProcessData,
|
|
||||||
HANDLE Handle);
|
|
||||||
|
|
||||||
NTSTATUS FASTCALL Win32CsrAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData,
|
|
||||||
PHANDLE pInputHandle,
|
PHANDLE pInputHandle,
|
||||||
PHANDLE pOutputHandle,
|
PHANDLE pOutputHandle,
|
||||||
PHANDLE pErrorHandle,
|
PHANDLE pErrorHandle,
|
||||||
int ShowCmd,
|
int ShowCmd,
|
||||||
PCSR_PROCESS CsrProcess);
|
PCSR_PROCESS CsrProcess);
|
||||||
VOID FASTCALL Win32CsrReleaseConsole(PCONSOLE_PROCESS_DATA ProcessData);
|
VOID FASTCALL ConSrvRemoveConsole(PCONSOLE_PROCESS_DATA ProcessData);
|
||||||
NTSTATUS FASTCALL ConioConsoleFromProcessData(PCONSOLE_PROCESS_DATA ProcessData,
|
NTSTATUS FASTCALL ConSrvGetConsole(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
struct _CONSOLE** Console,
|
struct _CONSOLE** Console,
|
||||||
BOOL LockConsole);
|
BOOL LockConsole);
|
||||||
|
VOID FASTCALL ConSrvReleaseConsole(struct _CONSOLE* Console,
|
||||||
|
BOOL IsConsoleLocked);
|
||||||
|
|
||||||
NTSTATUS NTAPI ConsoleNewProcess(PCSR_PROCESS SourceProcess,
|
NTSTATUS NTAPI ConSrvNewProcess(PCSR_PROCESS SourceProcess,
|
||||||
PCSR_PROCESS TargetProcess);
|
PCSR_PROCESS TargetProcess);
|
||||||
NTSTATUS NTAPI ConsoleConnect(IN PCSR_PROCESS CsrProcess,
|
NTSTATUS NTAPI ConSrvConnect(IN PCSR_PROCESS CsrProcess,
|
||||||
IN OUT PVOID ConnectionInfo,
|
IN OUT PVOID ConnectionInfo,
|
||||||
IN OUT PULONG ConnectionInfoLength);
|
IN OUT PULONG ConnectionInfoLength);
|
||||||
VOID NTAPI ConsoleDisconnect(PCSR_PROCESS Process);
|
VOID NTAPI ConSrvDisconnect(PCSR_PROCESS Process);
|
||||||
|
|
||||||
/* lineinput.c */
|
/* lineinput.c */
|
||||||
CSR_API(SrvGetConsoleCommandHistoryLength);
|
CSR_API(SrvGetConsoleCommandHistoryLength);
|
||||||
|
|
|
@ -1285,7 +1285,7 @@ GuiConsoleHandleClose(PCONSOLE Console, HWND hWnd)
|
||||||
/* FIXME: Windows will wait up to 5 seconds for the thread to exit.
|
/* FIXME: Windows will wait up to 5 seconds for the thread to exit.
|
||||||
* We shouldn't wait here, though, since the console lock is entered.
|
* We shouldn't wait here, though, since the console lock is entered.
|
||||||
* A copy of the thread list probably needs to be made. */
|
* A copy of the thread list probably needs to be made. */
|
||||||
ConioConsoleCtrlEvent(CTRL_CLOSE_EVENT, current);
|
ConSrvConsoleCtrlEvent(CTRL_CLOSE_EVENT, current);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// LOCK /// LeaveCriticalSection(&Console->Lock);
|
/// LOCK /// LeaveCriticalSection(&Console->Lock);
|
||||||
|
@ -2159,7 +2159,7 @@ GuiConsoleGuiThread(PVOID Data)
|
||||||
MSG msg;
|
MSG msg;
|
||||||
PHANDLE GraphicsStartupEvent = (PHANDLE) Data;
|
PHANDLE GraphicsStartupEvent = (PHANDLE) Data;
|
||||||
|
|
||||||
NotifyWnd = CreateWindowW(L"Win32CsrCreateNotify",
|
NotifyWnd = CreateWindowW(L"ConSrvCreateNotify",
|
||||||
L"",
|
L"",
|
||||||
WS_OVERLAPPEDWINDOW,
|
WS_OVERLAPPEDWINDOW,
|
||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
|
@ -2200,7 +2200,7 @@ GuiInit(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
wc.cbSize = sizeof(WNDCLASSEXW);
|
wc.cbSize = sizeof(WNDCLASSEXW);
|
||||||
wc.lpszClassName = L"Win32CsrCreateNotify";
|
wc.lpszClassName = L"ConSrvCreateNotify";
|
||||||
wc.lpfnWndProc = GuiConsoleNotifyWndProc;
|
wc.lpfnWndProc = GuiConsoleNotifyWndProc;
|
||||||
wc.style = 0;
|
wc.style = 0;
|
||||||
wc.hInstance = (HINSTANCE)GetModuleHandleW(NULL);
|
wc.hInstance = (HINSTANCE)GetModuleHandleW(NULL);
|
||||||
|
@ -2345,7 +2345,7 @@ GuiInitConsole(PCONSOLE Console, int ShowCmd)
|
||||||
if (NULL == ThreadHandle)
|
if (NULL == ThreadHandle)
|
||||||
{
|
{
|
||||||
CloseHandle(GraphicsStartupEvent);
|
CloseHandle(GraphicsStartupEvent);
|
||||||
DPRINT1("Win32Csr: Failed to create graphics console thread. Expect problems\n");
|
DPRINT1("CONSRV: Failed to create graphics console thread. Expect problems\n");
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
SetThreadPriority(ThreadHandle, THREAD_PRIORITY_HIGHEST);
|
SetThreadPriority(ThreadHandle, THREAD_PRIORITY_HIGHEST);
|
||||||
|
@ -2356,7 +2356,7 @@ GuiInitConsole(PCONSOLE Console, int ShowCmd)
|
||||||
|
|
||||||
if (NULL == NotifyWnd)
|
if (NULL == NotifyWnd)
|
||||||
{
|
{
|
||||||
DPRINT1("Win32Csr: Failed to create notification window.\n");
|
DPRINT1("CONSRV: Failed to create notification window.\n");
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2364,7 +2364,7 @@ GuiInitConsole(PCONSOLE Console, int ShowCmd)
|
||||||
sizeof(GUI_CONSOLE_DATA));
|
sizeof(GUI_CONSOLE_DATA));
|
||||||
if (!GuiData)
|
if (!GuiData)
|
||||||
{
|
{
|
||||||
DPRINT1("Win32Csr: Failed to create GUI_CONSOLE_DATA\n");
|
DPRINT1("CONSRV: Failed to create GUI_CONSOLE_DATA\n");
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ AdjustHandleCounts(PCONSOLE_IO_HANDLE Entry, INT Change)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
Win32CsrCreateHandleEntry(PCONSOLE_IO_HANDLE Entry)
|
ConSrvCreateHandleEntry(PCONSOLE_IO_HANDLE Entry)
|
||||||
{
|
{
|
||||||
/// LOCK /// Object_t *Object = Entry->Object;
|
/// LOCK /// Object_t *Object = Entry->Object;
|
||||||
/// LOCK /// EnterCriticalSection(&Object->Console->Lock);
|
/// LOCK /// EnterCriticalSection(&Object->Console->Lock);
|
||||||
|
@ -44,7 +44,7 @@ Win32CsrCreateHandleEntry(PCONSOLE_IO_HANDLE Entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
Win32CsrCloseHandleEntry(PCONSOLE_IO_HANDLE Entry)
|
ConSrvCloseHandleEntry(PCONSOLE_IO_HANDLE Entry)
|
||||||
{
|
{
|
||||||
Object_t *Object = Entry->Object;
|
Object_t *Object = Entry->Object;
|
||||||
if (Object != NULL)
|
if (Object != NULL)
|
||||||
|
@ -104,7 +104,7 @@ Win32CsrCloseHandleEntry(PCONSOLE_IO_HANDLE Entry)
|
||||||
|
|
||||||
/* static */ NTSTATUS
|
/* static */ NTSTATUS
|
||||||
FASTCALL
|
FASTCALL
|
||||||
Win32CsrInitHandlesTable(IN OUT PCONSOLE_PROCESS_DATA ProcessData,
|
ConSrvInitHandlesTable(IN OUT PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
OUT PHANDLE pInputHandle,
|
OUT PHANDLE pInputHandle,
|
||||||
OUT PHANDLE pOutputHandle,
|
OUT PHANDLE pOutputHandle,
|
||||||
OUT PHANDLE pErrorHandle)
|
OUT PHANDLE pErrorHandle)
|
||||||
|
@ -125,7 +125,7 @@ Win32CsrInitHandlesTable(IN OUT PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
RtlEnterCriticalSection(&ProcessData->HandleTableLock);
|
RtlEnterCriticalSection(&ProcessData->HandleTableLock);
|
||||||
|
|
||||||
/* Insert the Input handle */
|
/* Insert the Input handle */
|
||||||
Status = Win32CsrInsertObject(ProcessData,
|
Status = ConSrvInsertObject(ProcessData,
|
||||||
&InputHandle,
|
&InputHandle,
|
||||||
&ProcessData->Console->InputBuffer.Header,
|
&ProcessData->Console->InputBuffer.Header,
|
||||||
GENERIC_READ | GENERIC_WRITE,
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
|
@ -135,12 +135,12 @@ Win32CsrInitHandlesTable(IN OUT PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to insert the input handle\n");
|
DPRINT1("Failed to insert the input handle\n");
|
||||||
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
||||||
Win32CsrFreeHandlesTable(ProcessData);
|
ConSrvFreeHandlesTable(ProcessData);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert the Output handle */
|
/* Insert the Output handle */
|
||||||
Status = Win32CsrInsertObject(ProcessData,
|
Status = ConSrvInsertObject(ProcessData,
|
||||||
&OutputHandle,
|
&OutputHandle,
|
||||||
&ProcessData->Console->ActiveBuffer->Header,
|
&ProcessData->Console->ActiveBuffer->Header,
|
||||||
GENERIC_READ | GENERIC_WRITE,
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
|
@ -150,12 +150,12 @@ Win32CsrInitHandlesTable(IN OUT PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to insert the output handle\n");
|
DPRINT1("Failed to insert the output handle\n");
|
||||||
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
||||||
Win32CsrFreeHandlesTable(ProcessData);
|
ConSrvFreeHandlesTable(ProcessData);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert the Error handle */
|
/* Insert the Error handle */
|
||||||
Status = Win32CsrInsertObject(ProcessData,
|
Status = ConSrvInsertObject(ProcessData,
|
||||||
&ErrorHandle,
|
&ErrorHandle,
|
||||||
&ProcessData->Console->ActiveBuffer->Header,
|
&ProcessData->Console->ActiveBuffer->Header,
|
||||||
GENERIC_READ | GENERIC_WRITE,
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
|
@ -165,7 +165,7 @@ Win32CsrInitHandlesTable(IN OUT PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to insert the error handle\n");
|
DPRINT1("Failed to insert the error handle\n");
|
||||||
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
||||||
Win32CsrFreeHandlesTable(ProcessData);
|
ConSrvFreeHandlesTable(ProcessData);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ Win32CsrInitHandlesTable(IN OUT PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FASTCALL
|
FASTCALL
|
||||||
Win32CsrInheritHandlesTable(IN PCONSOLE_PROCESS_DATA SourceProcessData,
|
ConSrvInheritHandlesTable(IN PCONSOLE_PROCESS_DATA SourceProcessData,
|
||||||
IN PCONSOLE_PROCESS_DATA TargetProcessData)
|
IN PCONSOLE_PROCESS_DATA TargetProcessData)
|
||||||
{
|
{
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
@ -219,10 +219,10 @@ Win32CsrInheritHandlesTable(IN PCONSOLE_PROCESS_DATA SourceProcessData,
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Copy the handle data and increment the reference count of the
|
* Copy the handle data and increment the reference count of the
|
||||||
* pointed object (via the call to Win32CsrCreateHandleEntry).
|
* pointed object (via the call to ConSrvCreateHandleEntry).
|
||||||
*/
|
*/
|
||||||
TargetProcessData->HandleTable[i] = SourceProcessData->HandleTable[i];
|
TargetProcessData->HandleTable[i] = SourceProcessData->HandleTable[i];
|
||||||
Win32CsrCreateHandleEntry(&TargetProcessData->HandleTable[i]);
|
ConSrvCreateHandleEntry(&TargetProcessData->HandleTable[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,9 +233,9 @@ Quit:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FASTCALL
|
FASTCALL
|
||||||
Win32CsrFreeHandlesTable(PCONSOLE_PROCESS_DATA ProcessData)
|
ConSrvFreeHandlesTable(PCONSOLE_PROCESS_DATA ProcessData)
|
||||||
{
|
{
|
||||||
DPRINT1("Win32CsrFreeHandlesTable\n");
|
DPRINT1("ConSrvFreeHandlesTable\n");
|
||||||
|
|
||||||
RtlEnterCriticalSection(&ProcessData->HandleTableLock);
|
RtlEnterCriticalSection(&ProcessData->HandleTableLock);
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ Win32CsrFreeHandlesTable(PCONSOLE_PROCESS_DATA ProcessData)
|
||||||
/* Close all console handles and free the handle table memory */
|
/* Close all console handles and free the handle table memory */
|
||||||
for (i = 0; i < ProcessData->HandleTableSize; i++)
|
for (i = 0; i < ProcessData->HandleTableSize; i++)
|
||||||
{
|
{
|
||||||
Win32CsrCloseHandleEntry(&ProcessData->HandleTable[i]);
|
ConSrvCloseHandleEntry(&ProcessData->HandleTable[i]);
|
||||||
}
|
}
|
||||||
RtlFreeHeap(ConSrvHeap, 0, ProcessData->HandleTable);
|
RtlFreeHeap(ConSrvHeap, 0, ProcessData->HandleTable);
|
||||||
ProcessData->HandleTable = NULL;
|
ProcessData->HandleTable = NULL;
|
||||||
|
@ -259,7 +259,7 @@ Win32CsrFreeHandlesTable(PCONSOLE_PROCESS_DATA ProcessData)
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FASTCALL
|
FASTCALL
|
||||||
Win32CsrInsertObject(PCONSOLE_PROCESS_DATA ProcessData,
|
ConSrvInsertObject(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
PHANDLE Handle,
|
PHANDLE Handle,
|
||||||
Object_t *Object,
|
Object_t *Object,
|
||||||
DWORD Access,
|
DWORD Access,
|
||||||
|
@ -303,7 +303,7 @@ Win32CsrInsertObject(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
ProcessData->HandleTable[i].Access = Access;
|
ProcessData->HandleTable[i].Access = Access;
|
||||||
ProcessData->HandleTable[i].Inheritable = Inheritable;
|
ProcessData->HandleTable[i].Inheritable = Inheritable;
|
||||||
ProcessData->HandleTable[i].ShareMode = ShareMode;
|
ProcessData->HandleTable[i].ShareMode = ShareMode;
|
||||||
Win32CsrCreateHandleEntry(&ProcessData->HandleTable[i]);
|
ConSrvCreateHandleEntry(&ProcessData->HandleTable[i]);
|
||||||
*Handle = ULongToHandle((i << 2) | 0x3);
|
*Handle = ULongToHandle((i << 2) | 0x3);
|
||||||
|
|
||||||
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
||||||
|
@ -313,7 +313,7 @@ Win32CsrInsertObject(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FASTCALL
|
FASTCALL
|
||||||
Win32CsrReleaseObject(PCONSOLE_PROCESS_DATA ProcessData,
|
ConSrvRemoveObject(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
HANDLE Handle)
|
HANDLE Handle)
|
||||||
{
|
{
|
||||||
ULONG_PTR h = (ULONG_PTR)Handle >> 2;
|
ULONG_PTR h = (ULONG_PTR)Handle >> 2;
|
||||||
|
@ -328,8 +328,8 @@ Win32CsrReleaseObject(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
return STATUS_INVALID_HANDLE;
|
return STATUS_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT1("Win32CsrReleaseObject - Process 0x%p, Release 0x%p\n", ProcessData->Process, &ProcessData->HandleTable[h]);
|
DPRINT1("ConSrvRemoveObject - Process 0x%p, Release 0x%p\n", ProcessData->Process, &ProcessData->HandleTable[h]);
|
||||||
Win32CsrCloseHandleEntry(&ProcessData->HandleTable[h]);
|
ConSrvCloseHandleEntry(&ProcessData->HandleTable[h]);
|
||||||
|
|
||||||
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ Win32CsrReleaseObject(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FASTCALL
|
FASTCALL
|
||||||
Win32CsrLockObject(PCONSOLE_PROCESS_DATA ProcessData,
|
ConSrvGetObject(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
HANDLE Handle,
|
HANDLE Handle,
|
||||||
Object_t** Object,
|
Object_t** Object,
|
||||||
PCONSOLE_IO_HANDLE* Entry OPTIONAL,
|
PCONSOLE_IO_HANDLE* Entry OPTIONAL,
|
||||||
|
@ -353,7 +353,7 @@ Win32CsrLockObject(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
ASSERT(Object);
|
ASSERT(Object);
|
||||||
if (Entry) *Entry = NULL;
|
if (Entry) *Entry = NULL;
|
||||||
|
|
||||||
// DPRINT("Win32CsrLockObject, Object: %x, %x, %x\n",
|
// DPRINT("ConSrvGetObject, Object: %x, %x, %x\n",
|
||||||
// Object, Handle, ProcessData ? ProcessData->HandleTableSize : 0);
|
// Object, Handle, ProcessData ? ProcessData->HandleTableSize : 0);
|
||||||
|
|
||||||
RtlEnterCriticalSection(&ProcessData->HandleTableLock);
|
RtlEnterCriticalSection(&ProcessData->HandleTableLock);
|
||||||
|
@ -387,28 +387,17 @@ Win32CsrLockObject(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL
|
|
||||||
Win32CsrUnlockConsole(PCONSOLE Console,
|
|
||||||
BOOL IsConsoleLocked)
|
|
||||||
{
|
|
||||||
if (IsConsoleLocked) LeaveCriticalSection(&Console->Lock);
|
|
||||||
|
|
||||||
/* Decrement reference count */
|
|
||||||
if (_InterlockedDecrement(&Console->ReferenceCount) == 0)
|
|
||||||
ConioDeleteConsole(Console);
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FASTCALL
|
FASTCALL
|
||||||
Win32CsrUnlockObject(Object_t *Object,
|
ConSrvReleaseObject(Object_t *Object,
|
||||||
BOOL IsConsoleLocked)
|
BOOL IsConsoleLocked)
|
||||||
{
|
{
|
||||||
Win32CsrUnlockConsole(Object->Console, IsConsoleLocked);
|
ConSrvReleaseConsole(Object->Console, IsConsoleLocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FASTCALL
|
FASTCALL
|
||||||
Win32CsrAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData,
|
ConSrvAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
PHANDLE pInputHandle,
|
PHANDLE pInputHandle,
|
||||||
PHANDLE pOutputHandle,
|
PHANDLE pOutputHandle,
|
||||||
PHANDLE pErrorHandle,
|
PHANDLE pErrorHandle,
|
||||||
|
@ -418,7 +407,7 @@ Win32CsrAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
/* Initialize a new Console owned by the Console Leader Process */
|
/* Initialize a new Console owned by the Console Leader Process */
|
||||||
Status = CsrInitConsole(&ProcessData->Console, ShowCmd, CsrProcess);
|
Status = ConSrvInitConsole(&ProcessData->Console, ShowCmd, CsrProcess);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Console initialization failed\n");
|
DPRINT1("Console initialization failed\n");
|
||||||
|
@ -426,7 +415,7 @@ Win32CsrAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the handles table */
|
/* Initialize the handles table */
|
||||||
Status = Win32CsrInitHandlesTable(ProcessData,
|
Status = ConSrvInitHandlesTable(ProcessData,
|
||||||
pInputHandle,
|
pInputHandle,
|
||||||
pOutputHandle,
|
pOutputHandle,
|
||||||
pErrorHandle);
|
pErrorHandle);
|
||||||
|
@ -434,8 +423,8 @@ Win32CsrAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to initialize the handles table\n");
|
DPRINT1("Failed to initialize the handles table\n");
|
||||||
|
|
||||||
// Win32CsrReleaseConsole(ProcessData);
|
// ConSrvRemoveConsole(ProcessData);
|
||||||
ConioDeleteConsole(ProcessData->Console);
|
ConSrvDeleteConsole(ProcessData->Console);
|
||||||
ProcessData->Console = NULL;
|
ProcessData->Console = NULL;
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -446,25 +435,25 @@ Win32CsrAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FASTCALL
|
FASTCALL
|
||||||
Win32CsrReleaseConsole(PCONSOLE_PROCESS_DATA ProcessData)
|
ConSrvRemoveConsole(PCONSOLE_PROCESS_DATA ProcessData)
|
||||||
{
|
{
|
||||||
PCONSOLE Console;
|
PCONSOLE Console;
|
||||||
|
|
||||||
DPRINT1("Win32CsrReleaseConsole\n");
|
DPRINT1("ConSrvRemoveConsole\n");
|
||||||
|
|
||||||
/* Close all console handles and free the handle table memory */
|
/* Close all console handles and free the handle table memory */
|
||||||
Win32CsrFreeHandlesTable(ProcessData);
|
ConSrvFreeHandlesTable(ProcessData);
|
||||||
|
|
||||||
/* Detach process from console */
|
/* Detach process from console */
|
||||||
Console = ProcessData->Console;
|
Console = ProcessData->Console;
|
||||||
if (Console != NULL)
|
if (Console != NULL)
|
||||||
{
|
{
|
||||||
DPRINT1("Win32CsrReleaseConsole - Console->ReferenceCount = %lu - We are going to decrement it !\n", Console->ReferenceCount);
|
DPRINT1("ConSrvRemoveConsole - Console->ReferenceCount = %lu - We are going to decrement it !\n", Console->ReferenceCount);
|
||||||
ProcessData->Console = NULL;
|
ProcessData->Console = NULL;
|
||||||
EnterCriticalSection(&Console->Lock);
|
EnterCriticalSection(&Console->Lock);
|
||||||
DPRINT1("Win32CsrReleaseConsole - Locking OK\n");
|
DPRINT1("ConSrvRemoveConsole - Locking OK\n");
|
||||||
RemoveEntryList(&ProcessData->ConsoleLink);
|
RemoveEntryList(&ProcessData->ConsoleLink);
|
||||||
Win32CsrUnlockConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
//CloseHandle(ProcessData->ConsoleEvent);
|
//CloseHandle(ProcessData->ConsoleEvent);
|
||||||
//ProcessData->ConsoleEvent = NULL;
|
//ProcessData->ConsoleEvent = NULL;
|
||||||
}
|
}
|
||||||
|
@ -472,7 +461,7 @@ Win32CsrReleaseConsole(PCONSOLE_PROCESS_DATA ProcessData)
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FASTCALL
|
FASTCALL
|
||||||
ConioConsoleFromProcessData(PCONSOLE_PROCESS_DATA ProcessData,
|
ConSrvGetConsole(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
PCONSOLE* Console,
|
PCONSOLE* Console,
|
||||||
BOOL LockConsole)
|
BOOL LockConsole)
|
||||||
{
|
{
|
||||||
|
@ -498,11 +487,22 @@ ConioConsoleFromProcessData(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID FASTCALL
|
||||||
|
ConSrvReleaseConsole(PCONSOLE Console,
|
||||||
|
BOOL IsConsoleLocked)
|
||||||
|
{
|
||||||
|
if (IsConsoleLocked) LeaveCriticalSection(&Console->Lock);
|
||||||
|
|
||||||
|
/* Decrement reference count */
|
||||||
|
if (_InterlockedDecrement(&Console->ReferenceCount) == 0)
|
||||||
|
ConSrvDeleteConsole(Console);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
ConsoleNewProcess(PCSR_PROCESS SourceProcess,
|
ConSrvNewProcess(PCSR_PROCESS SourceProcess,
|
||||||
PCSR_PROCESS TargetProcess)
|
PCSR_PROCESS TargetProcess)
|
||||||
{
|
{
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -511,22 +511,22 @@ ConsoleNewProcess(PCSR_PROCESS SourceProcess,
|
||||||
* Copy the parent's handles table here if both the parent and the child
|
* Copy the parent's handles table here if both the parent and the child
|
||||||
* processes are CUI. If we must actually create our proper console (and
|
* processes are CUI. If we must actually create our proper console (and
|
||||||
* thus do not inherit from the console handles of the parent's), then we
|
* thus do not inherit from the console handles of the parent's), then we
|
||||||
* will clean this table in the next ConsoleConnect call. Why we are doing
|
* will clean this table in the next ConSrvConnect call. Why we are doing
|
||||||
* this? It's because here, we still don't know whether or not we must create
|
* this? It's because here, we still don't know whether or not we must create
|
||||||
* a new console instead of inherit it from the parent, and, because in
|
* a new console instead of inherit it from the parent, and, because in
|
||||||
* ConsoleConnect we don't have any reference to the parent process anymore.
|
* ConSrvConnect we don't have any reference to the parent process anymore.
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
PCONSOLE_PROCESS_DATA SourceProcessData, TargetProcessData;
|
PCONSOLE_PROCESS_DATA SourceProcessData, TargetProcessData;
|
||||||
|
|
||||||
DPRINT1("ConsoleNewProcess inside\n");
|
DPRINT1("ConSrvNewProcess inside\n");
|
||||||
DPRINT1("SourceProcess = 0x%p ; TargetProcess = 0x%p\n", SourceProcess, TargetProcess);
|
DPRINT1("SourceProcess = 0x%p ; TargetProcess = 0x%p\n", SourceProcess, TargetProcess);
|
||||||
|
|
||||||
/* An empty target process is invalid */
|
/* An empty target process is invalid */
|
||||||
if (!TargetProcess)
|
if (!TargetProcess)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
DPRINT1("ConsoleNewProcess - OK\n");
|
DPRINT1("ConSrvNewProcess - OK\n");
|
||||||
|
|
||||||
TargetProcessData = ConsoleGetPerProcessData(TargetProcess);
|
TargetProcessData = ConsoleGetPerProcessData(TargetProcess);
|
||||||
DPRINT1("TargetProcessData = 0x%p\n", TargetProcessData);
|
DPRINT1("TargetProcessData = 0x%p\n", TargetProcessData);
|
||||||
|
@ -562,7 +562,7 @@ ConsoleNewProcess(PCSR_PROCESS SourceProcess,
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = Win32CsrInheritHandlesTable(SourceProcessData, TargetProcessData);
|
Status = ConSrvInheritHandlesTable(SourceProcessData, TargetProcessData);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -573,7 +573,7 @@ ConsoleNewProcess(PCSR_PROCESS SourceProcess,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT1("ConsoleNewProcess - We don't launch a Console process : SourceProcessData->Console = 0x%p ; TargetProcess->Flags = %lu\n", SourceProcessData->Console, TargetProcess->Flags);
|
DPRINT1("ConSrvNewProcess - We don't launch a Console process : SourceProcessData->Console = 0x%p ; TargetProcess->Flags = %lu\n", SourceProcessData->Console, TargetProcess->Flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -581,7 +581,7 @@ ConsoleNewProcess(PCSR_PROCESS SourceProcess,
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
ConsoleConnect(IN PCSR_PROCESS CsrProcess,
|
ConSrvConnect(IN PCSR_PROCESS CsrProcess,
|
||||||
IN OUT PVOID ConnectionInfo,
|
IN OUT PVOID ConnectionInfo,
|
||||||
IN OUT PULONG ConnectionInfoLength)
|
IN OUT PULONG ConnectionInfoLength)
|
||||||
{
|
{
|
||||||
|
@ -593,7 +593,7 @@ ConsoleConnect(IN PCSR_PROCESS CsrProcess,
|
||||||
PCONSOLE_CONNECTION_INFO ConnectInfo = (PCONSOLE_CONNECTION_INFO)ConnectionInfo;
|
PCONSOLE_CONNECTION_INFO ConnectInfo = (PCONSOLE_CONNECTION_INFO)ConnectionInfo;
|
||||||
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrProcess);
|
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrProcess);
|
||||||
|
|
||||||
DPRINT1("ConsoleConnect\n");
|
DPRINT1("ConSrvConnect\n");
|
||||||
|
|
||||||
if ( ConnectionInfo == NULL ||
|
if ( ConnectionInfo == NULL ||
|
||||||
ConnectionInfoLength == NULL ||
|
ConnectionInfoLength == NULL ||
|
||||||
|
@ -606,7 +606,7 @@ ConsoleConnect(IN PCSR_PROCESS CsrProcess,
|
||||||
/* If we don't need a console, then get out of here */
|
/* If we don't need a console, then get out of here */
|
||||||
if (!ConnectInfo->ConsoleNeeded || !ProcessData->ConsoleApp) // In fact, it is for GUI apps.
|
if (!ConnectInfo->ConsoleNeeded || !ProcessData->ConsoleApp) // In fact, it is for GUI apps.
|
||||||
{
|
{
|
||||||
DPRINT("ConsoleConnect - No console needed\n");
|
DPRINT("ConSrvConnect - No console needed\n");
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -614,10 +614,10 @@ ConsoleConnect(IN PCSR_PROCESS CsrProcess,
|
||||||
if (!ConnectInfo->Console ||
|
if (!ConnectInfo->Console ||
|
||||||
ConnectInfo->Console != ProcessData->ParentConsole)
|
ConnectInfo->Console != ProcessData->ParentConsole)
|
||||||
{
|
{
|
||||||
DPRINT1("ConsoleConnect - Allocate a new console\n");
|
DPRINT1("ConSrvConnect - Allocate a new console\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We are about to create a new console. However when ConsoleNewProcess
|
* We are about to create a new console. However when ConSrvNewProcess
|
||||||
* was called, we didn't know that we wanted to create a new console and
|
* was called, we didn't know that we wanted to create a new console and
|
||||||
* therefore, we by default inherited the handles table from our parent
|
* therefore, we by default inherited the handles table from our parent
|
||||||
* process. It's only now that we notice that in fact we do not need
|
* process. It's only now that we notice that in fact we do not need
|
||||||
|
@ -626,10 +626,10 @@ ConsoleConnect(IN PCSR_PROCESS CsrProcess,
|
||||||
* Therefore, free the console we can have and our handles table,
|
* Therefore, free the console we can have and our handles table,
|
||||||
* and recreate a new one later on.
|
* and recreate a new one later on.
|
||||||
*/
|
*/
|
||||||
Win32CsrReleaseConsole(ProcessData);
|
ConSrvRemoveConsole(ProcessData);
|
||||||
|
|
||||||
/* Initialize a new Console owned by the Console Leader Process */
|
/* Initialize a new Console owned by the Console Leader Process */
|
||||||
Status = Win32CsrAllocateConsole(ProcessData,
|
Status = ConSrvAllocateConsole(ProcessData,
|
||||||
&ConnectInfo->InputHandle,
|
&ConnectInfo->InputHandle,
|
||||||
&ConnectInfo->OutputHandle,
|
&ConnectInfo->OutputHandle,
|
||||||
&ConnectInfo->ErrorHandle,
|
&ConnectInfo->ErrorHandle,
|
||||||
|
@ -643,7 +643,7 @@ ConsoleConnect(IN PCSR_PROCESS CsrProcess,
|
||||||
}
|
}
|
||||||
else /* We inherit it from the parent */
|
else /* We inherit it from the parent */
|
||||||
{
|
{
|
||||||
DPRINT1("ConsoleConnect - Reuse current (parent's) console\n");
|
DPRINT1("ConSrvConnect - Reuse current (parent's) console\n");
|
||||||
|
|
||||||
/* Reuse our current console */
|
/* Reuse our current console */
|
||||||
ProcessData->Console = ConnectInfo->Console;
|
ProcessData->Console = ConnectInfo->Console;
|
||||||
|
@ -665,7 +665,7 @@ ConsoleConnect(IN PCSR_PROCESS CsrProcess,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtDuplicateObject() failed: %lu\n", Status);
|
DPRINT1("NtDuplicateObject() failed: %lu\n", Status);
|
||||||
Win32CsrReleaseConsole(ProcessData);
|
ConSrvRemoveConsole(ProcessData);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,7 +684,7 @@ ConsoleConnect(IN PCSR_PROCESS CsrProcess,
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
WINAPI
|
WINAPI
|
||||||
ConsoleDisconnect(PCSR_PROCESS Process)
|
ConSrvDisconnect(PCSR_PROCESS Process)
|
||||||
{
|
{
|
||||||
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(Process);
|
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(Process);
|
||||||
|
|
||||||
|
@ -692,12 +692,12 @@ ConsoleDisconnect(PCSR_PROCESS Process)
|
||||||
* This function is called whenever a new process (GUI or CUI) is destroyed.
|
* This function is called whenever a new process (GUI or CUI) is destroyed.
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
DPRINT1("ConsoleDisconnect called\n");
|
DPRINT1("ConSrvDisconnect called\n");
|
||||||
if ( ProcessData->Console != NULL ||
|
if ( ProcessData->Console != NULL ||
|
||||||
ProcessData->HandleTable != NULL )
|
ProcessData->HandleTable != NULL )
|
||||||
{
|
{
|
||||||
DPRINT1("ConsoleDisconnect - calling Win32CsrReleaseConsole\n");
|
DPRINT1("ConSrvDisconnect - calling ConSrvRemoveConsole\n");
|
||||||
Win32CsrReleaseConsole(ProcessData);
|
ConSrvRemoveConsole(ProcessData);
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlDeleteCriticalSection(&ProcessData->HandleTableLock);
|
RtlDeleteCriticalSection(&ProcessData->HandleTableLock);
|
||||||
|
@ -709,7 +709,7 @@ CSR_API(SrvCloseHandle)
|
||||||
{
|
{
|
||||||
PCONSOLE_CLOSEHANDLE CloseHandleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CloseHandleRequest;
|
PCONSOLE_CLOSEHANDLE CloseHandleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CloseHandleRequest;
|
||||||
|
|
||||||
return Win32CsrReleaseObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
return ConSrvRemoveObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||||
CloseHandleRequest->ConsoleHandle);
|
CloseHandleRequest->ConsoleHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -773,7 +773,7 @@ CSR_API(SrvDuplicateHandle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiMessage->Status = Win32CsrInsertObject(ProcessData,
|
ApiMessage->Status = ConSrvInsertObject(ProcessData,
|
||||||
&DuplicateHandleRequest->ConsoleHandle, // Use the new handle value!
|
&DuplicateHandleRequest->ConsoleHandle, // Use the new handle value!
|
||||||
Entry->Object,
|
Entry->Object,
|
||||||
DesiredAccess,
|
DesiredAccess,
|
||||||
|
@ -782,7 +782,7 @@ CSR_API(SrvDuplicateHandle)
|
||||||
if (NT_SUCCESS(ApiMessage->Status) &&
|
if (NT_SUCCESS(ApiMessage->Status) &&
|
||||||
DuplicateHandleRequest->Options & DUPLICATE_CLOSE_SOURCE)
|
DuplicateHandleRequest->Options & DUPLICATE_CLOSE_SOURCE)
|
||||||
{
|
{
|
||||||
Win32CsrCloseHandleEntry(Entry);
|
ConSrvCloseHandleEntry(Entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
||||||
|
|
|
@ -302,7 +302,7 @@ PCHAR ConsoleServerApiNameTable[ConsolepMaxApiNumber] =
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PCSR_API_ROUTINE Win32CsrApiDefinitions[] =
|
PCSR_API_ROUTINE ConSrvApiDefinitions[] =
|
||||||
{
|
{
|
||||||
CsrGetHandle,
|
CsrGetHandle,
|
||||||
CsrGetHandle,
|
CsrGetHandle,
|
||||||
|
@ -330,7 +330,7 @@ PCSR_API_ROUTINE Win32CsrApiDefinitions[] =
|
||||||
CsrGenerateCtrlEvent,
|
CsrGenerateCtrlEvent,
|
||||||
};
|
};
|
||||||
|
|
||||||
static CSRSS_API_DEFINITION Win32CsrApiDefinitions[] =
|
static CSRSS_API_DEFINITION ConSrvApiDefinitions[] =
|
||||||
{
|
{
|
||||||
CSRSS_DEFINE_API(GET_INPUT_HANDLE, CsrGetHandle),
|
CSRSS_DEFINE_API(GET_INPUT_HANDLE, CsrGetHandle),
|
||||||
CSRSS_DEFINE_API(GET_OUTPUT_HANDLE, CsrGetHandle),
|
CSRSS_DEFINE_API(GET_OUTPUT_HANDLE, CsrGetHandle),
|
||||||
|
@ -451,7 +451,7 @@ CSR_SERVER_DLL_INIT(ConServerDllInitialization)
|
||||||
// BaseSrvSharedHeap = LoadedServerDll->SharedSection; // Get the CSR shared heap.
|
// BaseSrvSharedHeap = LoadedServerDll->SharedSection; // Get the CSR shared heap.
|
||||||
// LoadedServerDll->SharedSection = BaseStaticServerData;
|
// LoadedServerDll->SharedSection = BaseStaticServerData;
|
||||||
|
|
||||||
CsrInitConsoleSupport();
|
ConSrvInitConsoleSupport();
|
||||||
|
|
||||||
/* Setup the DLL Object */
|
/* Setup the DLL Object */
|
||||||
LoadedServerDll->ApiBase = CONSRV_FIRST_API_NUMBER;
|
LoadedServerDll->ApiBase = CONSRV_FIRST_API_NUMBER;
|
||||||
|
@ -460,10 +460,10 @@ CSR_SERVER_DLL_INIT(ConServerDllInitialization)
|
||||||
LoadedServerDll->ValidTable = ConsoleServerApiServerValidTable;
|
LoadedServerDll->ValidTable = ConsoleServerApiServerValidTable;
|
||||||
LoadedServerDll->NameTable = ConsoleServerApiNameTable;
|
LoadedServerDll->NameTable = ConsoleServerApiNameTable;
|
||||||
LoadedServerDll->SizeOfProcessData = sizeof(CONSOLE_PROCESS_DATA);
|
LoadedServerDll->SizeOfProcessData = sizeof(CONSOLE_PROCESS_DATA);
|
||||||
LoadedServerDll->ConnectCallback = ConsoleConnect;
|
LoadedServerDll->ConnectCallback = ConSrvConnect;
|
||||||
LoadedServerDll->DisconnectCallback = ConsoleDisconnect;
|
LoadedServerDll->DisconnectCallback = ConSrvDisconnect;
|
||||||
LoadedServerDll->NewProcessCallback = ConsoleNewProcess;
|
LoadedServerDll->NewProcessCallback = ConSrvNewProcess;
|
||||||
// LoadedServerDll->HardErrorCallback = Win32CsrHardError;
|
// LoadedServerDll->HardErrorCallback = ConSrvHardError;
|
||||||
|
|
||||||
/* All done */
|
/* All done */
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
|
|
@ -167,7 +167,7 @@ CSR_API(SrvGetConsoleCommandHistoryLength)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ConioGetConsole(ProcessData, &Console, TRUE);
|
Status = ConSrvGetConsole(ProcessData, &Console, TRUE);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
Hist = HistoryFindBuffer(Console, &GetCommandHistoryLengthRequest->ExeName);
|
Hist = HistoryFindBuffer(Console, &GetCommandHistoryLengthRequest->ExeName);
|
||||||
|
@ -177,7 +177,7 @@ CSR_API(SrvGetConsoleCommandHistoryLength)
|
||||||
Length += Hist->Entries[i].Length + sizeof(WCHAR);
|
Length += Hist->Entries[i].Length + sizeof(WCHAR);
|
||||||
}
|
}
|
||||||
GetCommandHistoryLengthRequest->Length = Length;
|
GetCommandHistoryLengthRequest->Length = Length;
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ CSR_API(SrvGetConsoleCommandHistory)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ConioGetConsole(ProcessData, &Console, TRUE);
|
Status = ConSrvGetConsole(ProcessData, &Console, TRUE);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
Hist = HistoryFindBuffer(Console, &GetCommandHistoryRequest->ExeName);
|
Hist = HistoryFindBuffer(Console, &GetCommandHistoryRequest->ExeName);
|
||||||
|
@ -225,7 +225,7 @@ CSR_API(SrvGetConsoleCommandHistory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GetCommandHistoryRequest->Length = Buffer - (PBYTE)GetCommandHistoryRequest->History;
|
GetCommandHistoryRequest->Length = Buffer - (PBYTE)GetCommandHistoryRequest->History;
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -246,12 +246,12 @@ CSR_API(SrvExpungeConsoleCommandHistory)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ConioGetConsole(ProcessData, &Console, TRUE);
|
Status = ConSrvGetConsole(ProcessData, &Console, TRUE);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
Hist = HistoryFindBuffer(Console, &ExpungeCommandHistoryRequest->ExeName);
|
Hist = HistoryFindBuffer(Console, &ExpungeCommandHistoryRequest->ExeName);
|
||||||
HistoryDeleteBuffer(Hist);
|
HistoryDeleteBuffer(Hist);
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ CSR_API(SrvSetConsoleNumberOfCommands)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ConioGetConsole(ProcessData, &Console, TRUE);
|
Status = ConSrvGetConsole(ProcessData, &Console, TRUE);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
Hist = HistoryFindBuffer(Console, &SetHistoryNumberCommandsRequest->ExeName);
|
Hist = HistoryFindBuffer(Console, &SetHistoryNumberCommandsRequest->ExeName);
|
||||||
|
@ -302,7 +302,7 @@ CSR_API(SrvSetConsoleNumberOfCommands)
|
||||||
RtlFreeHeap(ConSrvHeap, 0, OldEntryList);
|
RtlFreeHeap(ConSrvHeap, 0, OldEntryList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -311,13 +311,13 @@ CSR_API(SrvGetConsoleHistory)
|
||||||
{
|
{
|
||||||
PCONSOLE_GETSETHISTORYINFO HistoryInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HistoryInfoRequest;
|
PCONSOLE_GETSETHISTORYINFO HistoryInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HistoryInfoRequest;
|
||||||
PCONSOLE Console;
|
PCONSOLE Console;
|
||||||
NTSTATUS Status = ConioGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
NTSTATUS Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
HistoryInfoRequest->HistoryBufferSize = Console->HistoryBufferSize;
|
HistoryInfoRequest->HistoryBufferSize = Console->HistoryBufferSize;
|
||||||
HistoryInfoRequest->NumberOfHistoryBuffers = Console->NumberOfHistoryBuffers;
|
HistoryInfoRequest->NumberOfHistoryBuffers = Console->NumberOfHistoryBuffers;
|
||||||
HistoryInfoRequest->dwFlags = Console->HistoryNoDup;
|
HistoryInfoRequest->dwFlags = Console->HistoryNoDup;
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -326,13 +326,13 @@ CSR_API(SrvSetConsoleHistory)
|
||||||
{
|
{
|
||||||
PCONSOLE_GETSETHISTORYINFO HistoryInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HistoryInfoRequest;
|
PCONSOLE_GETSETHISTORYINFO HistoryInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HistoryInfoRequest;
|
||||||
PCONSOLE Console;
|
PCONSOLE Console;
|
||||||
NTSTATUS Status = ConioGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
NTSTATUS Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
Console->HistoryBufferSize = HistoryInfoRequest->HistoryBufferSize;
|
Console->HistoryBufferSize = HistoryInfoRequest->HistoryBufferSize;
|
||||||
Console->NumberOfHistoryBuffers = HistoryInfoRequest->NumberOfHistoryBuffers;
|
Console->NumberOfHistoryBuffers = HistoryInfoRequest->NumberOfHistoryBuffers;
|
||||||
Console->HistoryNoDup = HistoryInfoRequest->dwFlags & HISTORY_NO_DUP_FLAG;
|
Console->HistoryNoDup = HistoryInfoRequest->dwFlags & HISTORY_NO_DUP_FLAG;
|
||||||
ConioReleaseConsole(Console, TRUE);
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -460,7 +460,7 @@ TuiConsoleThread(PVOID Data)
|
||||||
(PVOID)Console);
|
(PVOID)Console);
|
||||||
if (NULL == NewWindow)
|
if (NULL == NewWindow)
|
||||||
{
|
{
|
||||||
DPRINT1("CSR: Unable to create console window\n");
|
DPRINT1("CONSRV: Unable to create console window\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Console->hWindow = NewWindow;
|
Console->hWindow = NewWindow;
|
||||||
|
@ -528,7 +528,7 @@ TuiInitConsole(PCONSOLE Console)
|
||||||
NULL);
|
NULL);
|
||||||
if (NULL == ThreadHandle)
|
if (NULL == ThreadHandle)
|
||||||
{
|
{
|
||||||
DPRINT1("CSR: Unable to create console thread\n");
|
DPRINT1("CONSRV: Unable to create console thread\n");
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
CloseHandle(ThreadHandle);
|
CloseHandle(ThreadHandle);
|
||||||
|
|
Loading…
Reference in a new issue