19#include "../concfg/font.h"
38#define ConSrvLockConsoleListExclusive() \
39 RtlAcquireResourceExclusive(&ListLock, TRUE)
41#define ConSrvLockConsoleListShared() \
42 RtlAcquireResourceShared(&ListLock, TRUE)
44#define ConSrvUnlockConsoleList() \
45 RtlReleaseResource(&ListLock)
57 DPRINT(
"Insert in the list\n");
76#define CONSOLE_HANDLES_INCREMENT 2 * 3
87 DPRINT(
"Insert in the list\n");
99 DPRINT(
"Creation of a new handles table\n");
223 if (UniDest->Buffer ==
NULL)
return FALSE;
258 if (!ValidHandle)
return FALSE;
285 if (RetVal) *
Console = ValidatedConsole;
303 ProcessData->ConsoleHandle,
349 DPRINT(
"CONSRV: ConSrvInitConsoleSupport()\n");
364 IN HANDLE ConsoleLeaderProcessHandle);
373#define PATH_SEPARATOR L'\\'
382 ConsoleInitInfo->ConsoleStartInfo->IconIndex = 0;
384 if ((ConsoleInitInfo->ConsoleStartInfo->dwStartupFlags & STARTF_TITLEISLINKNAME) == 0)
393 if (LinkName ==
NULL)
411 CLSCTX_INPROC_SERVER,
439 hRes = IShellLinkW_GetShowCmd(pshl, &ShowCmd);
440 if (
SUCCEEDED(hRes)) ConsoleInitInfo->ConsoleStartInfo->wShowWindow = (
WORD)ShowCmd;
447 hRes = IShellLinkW_GetIconLocation(pshl,
450 &ConsoleInitInfo->ConsoleStartInfo->IconIndex);
453 ConsoleInitInfo->ConsoleStartInfo->IconIndex = 0;
464 IPersistFile_Release(ppf);
466 IShellLinkW_Release(pshl);
481 ConsoleInitInfo->AppName,
489 IconPath = ConsoleInitInfo->AppName;
493 DPRINT(
"IconPath = '%S' ; IconIndex = %lu\n",
494 IconPath, ConsoleInitInfo->ConsoleStartInfo->IconIndex);
511 ConsoleInitInfo->ConsoleStartInfo->IconIndex,
515 ConsoleInitInfo->ConsoleStartInfo->IconIndex,
520 if (
hIcon !=
NULL) ConsoleInitInfo->ConsoleStartInfo->hIcon =
hIcon;
549 if (NewConsole ==
NULL || ConsoleInitInfo ==
NULL)
554 DPRINT(
"Initialization of console '%S' for process '%S' on desktop '%S'\n",
555 ConsoleInitInfo->ConsoleTitle ? ConsoleInitInfo->ConsoleTitle :
L"n/a",
556 ConsoleInitInfo->AppName ? ConsoleInitInfo->AppName :
L"n/a",
557 ConsoleInitInfo->Desktop ? ConsoleInitInfo->Desktop :
L"n/a");
566 Length =
min(ConsoleInitInfo->TitleLength,
589 ConsoleInitInfo->ConsoleStartInfo->dwStartupFlags &= ~STARTF_TITLEISLINKNAME;
596 if ((ConsoleInitInfo->ConsoleStartInfo->dwStartupFlags & STARTF_TITLEISLINKNAME) == 0)
613 ConsoleInfo->ScreenAttributes = (
USHORT)ConsoleInitInfo->ConsoleStartInfo->wFillAttribute;
617 ConsoleInfo->ScreenBufferSize = ConsoleInitInfo->ConsoleStartInfo->dwScreenBufferSize;
619 if (ConsoleInitInfo->ConsoleStartInfo->dwStartupFlags &
STARTF_USESIZE)
621 ConsoleInfo->WindowSize = ConsoleInitInfo->ConsoleStartInfo->dwWindowSize;
634 ConsoleInfo->WindowPosition.x = ConsoleInitInfo->ConsoleStartInfo->dwWindowOrigin.X;
635 ConsoleInfo->WindowPosition.y = ConsoleInitInfo->ConsoleStartInfo->dwWindowOrigin.Y;
657 ConsoleLeaderProcess->ProcessHandle);
660 DPRINT1(
"CONSRV: Failed to initialize a terminal, Status = 0x%08lx\n",
Status);
663 DPRINT(
"CONSRV: Terminal initialized\n");
681 DPRINT1(
"Not enough memory for console creation.\n");
689 DPRINT1(
"Creating a new console failed, Status = 0x%08lx\n",
Status);
695 DPRINT(
"Console initialized\n");
701 WCHAR DefaultTitle[128];
740 Console->NumberOfHistoryBuffers = 0;
767 DPRINT1(
"NtCreateEvent(InitEvents[INIT_SUCCESS]) failed: %lu\n",
Status);
776 DPRINT1(
"NtCreateEvent(InitEvents[INIT_FAILURE]) failed: %lu\n",
Status);
790 DPRINT1(
"Failed to register terminal to the given console, Status = 0x%08lx\n",
Status);
797 DPRINT(
"Terminal attached\n");
816 *NewConsoleHandle = ConsoleHandle;
824 DPRINT(
"ConSrvDeleteConsole\n");
921 DPRINT1(
"Failed to insert the input handle\n");
930 &
Console->ActiveBuffer->Header,
936 DPRINT1(
"Failed to insert the output handle\n");
945 &
Console->ActiveBuffer->Header,
951 DPRINT1(
"Failed to insert the error handle\n");
962 *pErrorHandle = ErrorHandle;
995 ProcessData->Process);
998 DPRINT1(
"Console initialization failed\n");
1003 ProcessData->ConsoleHandle = ConsoleHandle;
1013 DPRINT1(
"Failed to initialize the process handles\n");
1015 ProcessData->ConsoleHandle =
NULL;
1022 ProcessData->Process->ProcessHandle,
1023 &ConsoleInitInfo->ConsoleStartInfo->InitEvents[
INIT_SUCCESS],
1027 DPRINT1(
"NtDuplicateObject(InitEvents[INIT_SUCCESS]) failed: %lu\n",
Status);
1030 ProcessData->ConsoleHandle =
NULL;
1036 ProcessData->Process->ProcessHandle,
1037 &ConsoleInitInfo->ConsoleStartInfo->InitEvents[
INIT_FAILURE],
1041 DPRINT1(
"NtDuplicateObject(InitEvents[INIT_FAILURE]) failed: %lu\n",
Status);
1043 ConsoleInitInfo->ConsoleStartInfo->InitEvents[
INIT_SUCCESS],
1047 ProcessData->ConsoleHandle =
NULL;
1053 Console->InputBuffer.ActiveEvent,
1054 ProcessData->Process->ProcessHandle,
1055 &ConsoleInitInfo->ConsoleStartInfo->InputWaitHandle,
1059 DPRINT1(
"NtDuplicateObject(InputWaitHandle) failed: %lu\n",
Status);
1061 ConsoleInitInfo->ConsoleStartInfo->InitEvents[
INIT_FAILURE],
1064 ConsoleInitInfo->ConsoleStartInfo->InitEvents[
INIT_SUCCESS],
1068 ProcessData->ConsoleHandle =
NULL;
1073 ProcessData->ConsoleApp =
TRUE;
1077 ConsoleInitInfo->ConsoleStartInfo->ConsoleHandle = ProcessData->ConsoleHandle;
1118 ProcessData->ConsoleHandle = ConsoleHandle;
1120 if (CreateNewHandleTable)
1142 DPRINT1(
"Failed to initialize the process handles\n");
1143 ProcessData->ConsoleHandle =
NULL;
1151 ProcessData->Process->ProcessHandle,
1156 DPRINT1(
"NtDuplicateObject(InitEvents[INIT_SUCCESS]) failed: %lu\n",
Status);
1158 ProcessData->ConsoleHandle =
NULL;
1164 ProcessData->Process->ProcessHandle,
1169 DPRINT1(
"NtDuplicateObject(InitEvents[INIT_FAILURE]) failed: %lu\n",
Status);
1174 ProcessData->ConsoleHandle =
NULL;
1180 Console->InputBuffer.ActiveEvent,
1181 ProcessData->Process->ProcessHandle,
1182 &ConsoleStartInfo->InputWaitHandle,
1186 DPRINT1(
"NtDuplicateObject(InputWaitHandle) failed: %lu\n",
Status);
1194 ProcessData->ConsoleHandle =
NULL;
1199 ProcessData->ConsoleApp =
TRUE;
1203 ConsoleStartInfo->ConsoleHandle = ProcessData->ConsoleHandle;
1233 DPRINT(
"ConSrvRemoveConsole\n");
1236 ProcessData->ConsoleApp =
FALSE;
1237 ProcessData->Process->Flags &= ~CsrProcessIsConsoleApp;
1241 ProcessData->ConsoleHandle,
1248 DPRINT(
"ConSrvRemoveConsole - Locking OK\n");
1257 ProcessData->ConsoleHandle =
NULL;
1266 if (ProcessData ==
Console->NotifiedLastCloseProcess)
1277 else if (ProcessData == ConsoleLeaderProcess)
1295 DPRINT(
"ConSrvRemoveConsole - Decrement Console->ReferenceCount = %lu\n",
Console->ReferenceCount);
1311 DPRINT(
"ConSrvConsoleCtrlEventTimeout Parent ProcessId = %x\n", ProcessData->Process->ClientId.UniqueProcess);
1316 if (ProcessData->CtrlRoutine ==
NULL)
return Status;
1325 ProcessData->CtrlRoutine,
1330 DPRINT1(
"Failed thread creation, Status = 0x%08lx\n",
Status);
1334 DPRINT(
"ProcessData->CtrlRoutine remote thread creation succeeded, ProcessId = %x, Process = 0x%p\n",
1335 ProcessData->Process->ClientId.UniqueProcess, ProcessData->Process);
1348 DPRINT1(
"ConSrvConsoleCtrlEventTimeout - Caught an exception, Status = 0x%08lx\n",
Status);
1384 *ProcessIdsTotal = 0;
1386 for (current_entry =
Console->ProcessList.Flink;
1387 current_entry != &
Console->ProcessList;
1388 current_entry = current_entry->
Flink)
1391 if (++(*ProcessIdsTotal) <= MaxIdListItems)
1420 current_entry =
Console->ProcessList.Flink;
1421 while (current_entry != &
Console->ProcessList)
1424 current_entry = current_entry->
Flink;
1430 if (ProcessGroupId == 0 ||
current->Process->ProcessGroupId == ProcessGroupId)
1467 current_entry =
Console->ProcessList.Flink;
1468 while (current_entry != &
Console->ProcessList)
1471 current_entry = current_entry->
Flink;
1489 if (ProcessData->ConsoleHandle !=
NULL)
1491 DPRINT1(
"Process already has a console\n");
1496 (
PVOID*)&AllocConsoleRequest->ConsoleStartInfo,
1500 (
PVOID*)&AllocConsoleRequest->ConsoleTitle,
1501 AllocConsoleRequest->TitleLength,
1504 (
PVOID*)&AllocConsoleRequest->Desktop,
1505 AllocConsoleRequest->DesktopLength,
1508 (
PVOID*)&AllocConsoleRequest->CurDir,
1509 AllocConsoleRequest->CurDirLength,
1512 (
PVOID*)&AllocConsoleRequest->AppName,
1513 AllocConsoleRequest->AppNameLength,
1522 ConsoleInitInfo.
TitleLength = AllocConsoleRequest->TitleLength;
1523 ConsoleInitInfo.
ConsoleTitle = AllocConsoleRequest->ConsoleTitle;
1524 ConsoleInitInfo.
DesktopLength = AllocConsoleRequest->DesktopLength;
1525 ConsoleInitInfo.
Desktop = AllocConsoleRequest->Desktop;
1526 ConsoleInitInfo.
AppNameLength = AllocConsoleRequest->AppNameLength;
1527 ConsoleInitInfo.
AppName = AllocConsoleRequest->AppName;
1528 ConsoleInitInfo.
CurDirLength = AllocConsoleRequest->CurDirLength;
1529 ConsoleInitInfo.
CurDir = AllocConsoleRequest->CurDir;
1533 &AllocConsoleRequest->ConsoleStartInfo->InputHandle,
1534 &AllocConsoleRequest->ConsoleStartInfo->OutputHandle,
1535 &AllocConsoleRequest->ConsoleStartInfo->ErrorHandle,
1539 DPRINT1(
"Console allocation failed\n");
1544 ProcessData->PropRoutine = AllocConsoleRequest->PropRoutine;
1545 ProcessData->CtrlRoutine = AllocConsoleRequest->CtrlRoutine;
1564 DPRINT1(
"Process already has a console\n");
1569 (
PVOID*)&AttachConsoleRequest->ConsoleStartInfo,
1590 DPRINT1(
"SrvAttachConsole - Cannot retrieve basic process info, Status = 0x%08lx\n",
Status);
1616 &AttachConsoleRequest->ConsoleStartInfo->InputHandle,
1617 &AttachConsoleRequest->ConsoleStartInfo->OutputHandle,
1618 &AttachConsoleRequest->ConsoleStartInfo->ErrorHandle,
1619 AttachConsoleRequest->ConsoleStartInfo);
1622 DPRINT1(
"Console inheritance failed\n");
1627 TargetProcessData->
PropRoutine = AttachConsoleRequest->PropRoutine;
1628 TargetProcessData->
CtrlRoutine = AttachConsoleRequest->CtrlRoutine;
1646 if ((FreeConsoleRequest->ConsoleHandle ==
NULL) ||
1647 (FreeConsoleRequest->ConsoleHandle != ProcessData->ConsoleHandle))
1665 PULONG ConsoleMode = &ConsoleModeRequest->Mode;
1668 ConsoleModeRequest->Handle,
1708#define CONSOLE_VALID_CONTROL_MODES ( ENABLE_EXTENDED_FLAGS | \
1709 ENABLE_INSERT_MODE | ENABLE_QUICK_EDIT_MODE )
1714 ULONG ConsoleMode = ConsoleModeRequest->Mode;
1717 ConsoleModeRequest->Handle,
1725 ConsoleMode &= ~CONSOLE_VALID_CONTROL_MODES;
1735 ConsoleMode = ConsoleModeRequest->Mode;
1767 (
PVOID)&TitleRequest->Title,
1768 TitleRequest->Length,
1775 if (TitleRequest->Unicode)
1777 if (TitleRequest->Length >=
sizeof(
WCHAR))
1782 TitleRequest->Length =
Length;
1786 TitleRequest->Length =
Console->Title.Length;
1791 if (TitleRequest->Length >=
sizeof(
CHAR))
1796 TitleRequest->Title,
Length,
1799 TitleRequest->Length =
Length;
1803 TitleRequest->Length =
Console->Title.Length /
sizeof(
WCHAR);
1818 (
PVOID)&TitleRequest->Title,
1819 TitleRequest->Length,
1825 if (TitleRequest->Unicode)
1828 Length = TitleRequest->Length;
1834 TitleRequest->Title, TitleRequest->Length,
1853 if (TitleRequest->Unicode)
1860 TitleRequest->Title, TitleRequest->Length,
1881 DPRINT(
"SrvGetConsoleCP, getting %s Code Page\n",
1882 GetConsoleCPRequest->OutputCP ?
"Output" :
"Input");
1885 &GetConsoleCPRequest->CodePage,
1886 GetConsoleCPRequest->OutputCP);
1897 DPRINT(
"SrvSetConsoleCP, setting %s Code Page\n",
1898 SetConsoleCPRequest->OutputCP ?
"Output" :
"Input");
1901 SetConsoleCPRequest->CodePage,
1902 SetConsoleCPRequest->OutputCP);
1910 (
PVOID)&GetProcessListRequest->ProcessIdsList,
1911 GetProcessListRequest->ProcessCount,
1918 GetProcessListRequest->ProcessIdsList,
1919 GetProcessListRequest->ProcessCount,
1920 &GetProcessListRequest->ProcessCount);
1928 GenerateCtrlEventRequest->ProcessGroupId,
1929 GenerateCtrlEventRequest->CtrlEvent);
1941 Console->NotifiedLastCloseProcess = ProcessData;
1966 if (GetKbdLayoutNameRequest->Ansi)
2051 switch (
Console->OutputCodePage)
#define IsCJKCharSet(CharSet)
#define CP_CHINESE_SIMPLIFIED
#define CP_CHINESE_TRADITIONAL
#define ConsoleGetPerProcessData(Process)
HINSTANCE ConSrvDllInstance
NTSTATUS NTAPI CsrUnlockProcess(IN PCSR_PROCESS CsrProcess)
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
#define CsrGetClientThread()
BOOLEAN NTAPI CsrImpersonateClient(IN PCSR_THREAD CsrThread)
BOOLEAN NTAPI CsrRevertToSelf(VOID)
VOID NTAPI CsrDereferenceWait(IN PLIST_ENTRY WaitList)
VOID NTAPI CsrSetForegroundPriority(IN PCSR_PROCESS CsrProcess)
NTSTATUS NTAPI CsrLockProcessByClientId(IN HANDLE Pid, OUT PCSR_PROCESS *CsrProcess OPTIONAL)
VOID NTAPI CsrSetBackgroundPriority(IN PCSR_PROCESS CsrProcess)
BOOLEAN NTAPI CsrNotifyWait(IN PLIST_ENTRY WaitList, IN BOOLEAN NotifyAll, IN PVOID WaitArgument1, IN PVOID WaitArgument2)
#define STATUS_INVALID_HANDLE
#define STATUS_NOT_SUPPORTED
#define STATUS_NOT_IMPLEMENTED
#define NT_SUCCESS(StatCode)
#define INVALID_HANDLE_VALUE
#define WideCharToMultiByte
#define MultiByteToWideChar
HANDLE WINAPI CreateRemoteThread(IN HANDLE hProcess, IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
UINT WINAPI GetOEMCP(void)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
static const WCHAR IconPath[]
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define InsertHeadList(ListHead, Entry)
#define IsListEmpty(ListHead)
#define InitializeListHead(ListHead)
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define EXCEPTION_EXECUTE_HANDLER
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
@ ProcessBasicInformation
NTSYSAPI NTSTATUS WINAPI RtlGetLastNtStatus(void)
long __cdecl _InterlockedIncrement(_Interlocked_operand_ long volatile *_Addend)
long __cdecl _InterlockedExchange(_Interlocked_operand_ long volatile *_Target, long _Value)
long __cdecl _InterlockedDecrement(_Interlocked_operand_ long volatile *_Addend)
struct task_struct * current
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI ULONG NTAPI RtlDosSearchPath_U(_In_ PCWSTR Path, _In_ PCWSTR FileName, _In_ PCWSTR Extension, _In_ ULONG BufferSize, _Out_ PWSTR Buffer, _Out_ PWSTR *PartName)
NTSYSAPI VOID NTAPI RtlInitializeResource(_In_ PRTL_RESOURCE Resource)
#define NtCurrentProcess()
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
_In_ ULONG _In_ ULONG _In_ ULONG Length
NTSTATUS NTAPI NtSetEvent(IN HANDLE EventHandle, OUT PLONG PreviousState OPTIONAL)
NTSTATUS NTAPI NtCreateEvent(OUT PHANDLE EventHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN EVENT_TYPE EventType, IN BOOLEAN InitialState)
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
#define STATUS_BAD_IMPERSONATION_LEVEL
NTSTATUS NTAPI NtDuplicateObject(IN HANDLE SourceProcessHandle, IN HANDLE SourceHandle, IN HANDLE TargetProcessHandle OPTIONAL, OUT PHANDLE TargetHandle OPTIONAL, IN ACCESS_MASK DesiredAccess, IN ULONG HandleAttributes, IN ULONG Options)
const GUID IID_IPersistFile
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
#define SUBLANG_CHINESE_TRADITIONAL
#define SUBLANG_CHINESE_SIMPLIFIED
#define SUBLANG_ENGLISH_US
PCONSOLE_START_INFO ConsoleStartInfo
LPTHREAD_START_ROUTINE CtrlRoutine
LPTHREAD_START_ROUTINE PropRoutine
struct _LIST_ENTRY * Flink
static CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
#define TermChangeTitle(Console)
#define TermRefreshInternalInfo(Console)
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_ACCESS_DENIED
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
BYTE CodePageToCharSet(_In_ UINT CodePage)
Retrieves the character set associated with a given code page.
VOID ConCfgGetDefaultSettings(IN OUT PCONSOLE_STATE_INFO ConsoleInfo)
BOOLEAN ConCfgReadUserSettings(IN OUT PCONSOLE_STATE_INFO ConsoleInfo, IN BOOLEAN DefaultSettings)
struct _CONSOLE_STATE_INFO * PCONSOLE_STATE_INFO
struct _CONSOLE_STATE_INFO CONSOLE_STATE_INFO
VOID IntDeleteAllAliases(PCONSRV_CONSOLE Console)
#define CON_API(Name, TYPE, RequestName)
#define CON_API_NOCONSOLE(Name, TYPE, RequestName)
BOOLEAN NTAPI ConDrvValidateConsoleState(IN PCONSOLE Console, IN CONSOLE_STATE ExpectedState)
VOID NTAPI ConDrvUnpause(PCONSOLE Console)
BOOLEAN NTAPI ConDrvValidateConsoleUnsafe(IN PCONSOLE Console, IN CONSOLE_STATE ExpectedState, IN BOOLEAN LockConsole)
VOID NTAPI ConDrvDeleteConsole(IN PCONSOLE Console)
NTSTATUS NTAPI ConDrvGetConsoleCP(IN PCONSOLE Console, OUT PUINT CodePage, IN BOOLEAN OutputCP)
NTSTATUS NTAPI ConDrvSetConsoleMode(IN PCONSOLE Console, IN PCONSOLE_IO_OBJECT Object, IN ULONG ConsoleMode)
NTSTATUS NTAPI ConDrvAttachTerminal(IN PCONSOLE Console, IN PTERMINAL Terminal)
NTSTATUS NTAPI ConDrvSetConsoleCP(IN PCONSOLE Console, IN UINT CodePage, IN BOOLEAN OutputCP)
NTSTATUS NTAPI ConDrvGetConsoleMode(IN PCONSOLE Console, IN PCONSOLE_IO_OBJECT Object, OUT PULONG ConsoleMode)
NTSTATUS NTAPI ConDrvInitConsole(IN OUT PCONSOLE Console, IN PCONSOLE_INFO ConsoleInfo)
VOID NTAPI ConDrvPause(PCONSOLE Console)
static VOID ConsoleFreeUnicodeString(IN PUNICODE_STRING UnicodeString)
VOID ConioUnpause(PCONSRV_CONSOLE Console, UCHAR Flags)
NTSTATUS NTAPI ConSrvSetConsoleProcessFocus(IN PCONSRV_CONSOLE Console, IN BOOLEAN SetForeground)
VOID ConSrvSetProcessFocus(IN PCSR_PROCESS CsrProcess, IN BOOLEAN SetForeground)
static BOOL LoadShellLinkConsoleInfo(IN OUT PCONSOLE_STATE_INFO ConsoleInfo, IN OUT PCONSOLE_INIT_INFO ConsoleInitInfo)
BOOLEAN NTAPI ConSrvValidateConsole(OUT PCONSRV_CONSOLE *Console, IN HANDLE ConsoleHandle, IN CONSOLE_STATE ExpectedState, IN BOOLEAN LockConsole)
static NTSTATUS RemoveConsoleByPointer(IN PCONSRV_CONSOLE Console)
VOID NTAPI ConSrvInitConsoleSupport(VOID)
PCONSOLE_PROCESS_DATA NTAPI ConSrvGetConsoleLeaderProcess(IN PCONSRV_CONSOLE Console)
NTSTATUS ConSrvConsoleCtrlEventTimeout(IN ULONG CtrlEvent, IN PCONSOLE_PROCESS_DATA ProcessData, IN ULONG Timeout)
NTSTATUS NTAPI ConSrvConsoleProcessCtrlEvent(IN PCONSRV_CONSOLE Console, IN ULONG ProcessGroupId, IN ULONG CtrlEvent)
NTSTATUS NTAPI ConSrvInitConsole(OUT PHANDLE NewConsoleHandle, OUT PCONSRV_CONSOLE *NewConsole, IN OUT PCONSOLE_INIT_INFO ConsoleInitInfo, IN PCSR_PROCESS ConsoleLeaderProcess)
NTSTATUS ConSrvAllocateConsole(IN OUT PCONSOLE_PROCESS_DATA ProcessData, OUT PHANDLE pInputHandle, OUT PHANDLE pOutputHandle, OUT PHANDLE pErrorHandle, IN OUT PCONSOLE_INIT_INFO ConsoleInitInfo)
static PCONSRV_CONSOLE * ConsoleList
VOID ConioPause(PCONSRV_CONSOLE Console, UCHAR Flags)
static NTSTATUS ConSrvInitProcessHandles(IN OUT PCONSOLE_PROCESS_DATA ProcessData, IN PCONSRV_CONSOLE Console, OUT PHANDLE pInputHandle, OUT PHANDLE pOutputHandle, OUT PHANDLE pErrorHandle)
NTSTATUS NTAPI ConSrvGetConsoleProcessList(IN PCONSRV_CONSOLE Console, IN OUT PULONG ProcessIdsList, IN ULONG MaxIdListItems, OUT PULONG ProcessIdsTotal)
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
static RTL_RESOURCE ListLock
#define CONSOLE_VALID_CONTROL_MODES
NTSTATUS ConSrvRemoveConsole(IN OUT PCONSOLE_PROCESS_DATA ProcessData)
#define ConSrvLockConsoleListExclusive()
NTSTATUS ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent, IN PCONSOLE_PROCESS_DATA ProcessData)
#define ConSrvUnlockConsoleList()
#define ConSrvLockConsoleListShared()
NTSTATUS ConSrvInheritConsole(IN OUT PCONSOLE_PROCESS_DATA ProcessData, IN HANDLE ConsoleHandle, IN BOOLEAN CreateNewHandleTable, OUT PHANDLE pInputHandle, OUT PHANDLE pOutputHandle, OUT PHANDLE pErrorHandle, IN OUT PCONSOLE_START_INFO ConsoleStartInfo)
static ULONG ConsoleListSize
#define CONSOLE_HANDLES_INCREMENT
NTSTATUS NTAPI ConSrvDeinitTerminal(IN OUT PTERMINAL Terminal)
NTSTATUS NTAPI ConSrvInitTerminal(IN OUT PTERMINAL Terminal, IN OUT PCONSOLE_STATE_INFO ConsoleInfo, IN OUT PCONSOLE_INIT_INFO ConsoleInitInfo, IN HANDLE ConsoleLeaderProcessHandle)
static BOOLEAN ConsoleCreateUnicodeString(IN OUT PUNICODE_STRING UniDest, IN PCWSTR Source)
static NTSTATUS InsertConsole(OUT PHANDLE Handle, IN PCONSRV_CONSOLE Console)
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
VOID NTAPI ConSrvDeleteConsole(PCONSRV_CONSOLE Console)
NTSTATUS ConSrvGetObject(IN PCONSOLE_PROCESS_DATA ProcessData, IN HANDLE Handle, OUT PCONSOLE_IO_OBJECT *Object, OUT PVOID *Entry OPTIONAL, IN ULONG Access, IN BOOLEAN LockConsole, IN CONSOLE_IO_OBJECT_TYPE Type)
NTSTATUS ConSrvInsertObject(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PHANDLE Handle, IN PCONSOLE_IO_OBJECT Object, IN ULONG Access, IN BOOLEAN Inheritable, IN ULONG ShareMode)
VOID ConSrvFreeHandlesTable(IN PCONSOLE_PROCESS_DATA ProcessData)
VOID ConSrvReleaseObject(IN PCONSOLE_IO_OBJECT Object, IN BOOLEAN IsConsoleLocked)
#define ConsoleAllocHeap(Flags, Size)
#define ConsoleFreeHeap(HeapBase)
VOID HistoryDeleteBuffers(PCONSRV_CONSOLE Console)
#define IDS_CONSOLE_TITLE
#define STARTF_USEPOSITION
#define STARTF_USECOUNTCHARS
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define STARTF_USEFILLATTRIBUTE
#define STARTF_RUNFULLSCREEN
#define ATTACH_PARENT_PROCESS
#define ENABLE_QUICK_EDIT_MODE
#define ENABLE_EXTENDED_FLAGS
#define ENABLE_INSERT_MODE
#define CTRL_LAST_CLOSE_EVENT
BOOL WINAPI GetKeyboardLayoutNameW(_Out_writes_(KL_NAMELENGTH) LPWSTR)
BOOL WINAPI GetKeyboardLayoutNameA(_Out_writes_(KL_NAMELENGTH) LPSTR)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
UINT WINAPI PrivateExtractIconsW(_In_reads_(MAX_PATH) LPCWSTR szFileName, _In_ int nIconIndex, _In_ int cxIcon, _In_ int cyIcon, _Out_writes_opt_(nIcons) HICON *phicon, _Out_writes_opt_(nIcons) UINT *piconid, _In_ UINT nIcons, _In_ UINT flags)
#define LR_COPYFROMRESOURCE
int WINAPI GetSystemMetrics(_In_ int)
_Must_inspect_result_ _In_ ULONG Flags
#define DUPLICATE_CLOSE_SOURCE