2012-10-25 20:40:41 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS Console Server DLL
|
|
|
|
* FILE: win32ss/user/consrv/consrv.h
|
|
|
|
* PURPOSE: Main header - Definitions
|
|
|
|
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
|
|
|
*/
|
2012-10-22 23:55:51 +00:00
|
|
|
|
|
|
|
#ifndef __CONSRV_H__
|
|
|
|
#define __CONSRV_H__
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
/* PSDK/NDK Headers */
|
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
#include <windows.h>
|
|
|
|
#define NTOS_MODE_USER
|
|
|
|
#include <ndk/ntndk.h>
|
|
|
|
|
2013-01-04 00:41:10 +00:00
|
|
|
/* Public Win32K Headers */
|
|
|
|
#include <ntuser.h>
|
|
|
|
|
2012-10-22 23:55:51 +00:00
|
|
|
/* CSRSS Header */
|
|
|
|
#include <csr/csrsrv.h>
|
|
|
|
|
|
|
|
/* CONSOLE Headers */
|
2012-11-07 21:10:48 +00:00
|
|
|
#include <win/console.h>
|
2012-10-22 23:55:51 +00:00
|
|
|
#include <win/conmsg.h>
|
2012-10-23 22:31:36 +00:00
|
|
|
|
|
|
|
#include "resource.h"
|
2012-10-22 23:55:51 +00:00
|
|
|
|
|
|
|
/* Shared header with console.dll */
|
|
|
|
#include "console.h"
|
|
|
|
|
2012-10-25 22:14:46 +00:00
|
|
|
|
2012-11-07 21:10:48 +00:00
|
|
|
extern HINSTANCE ConSrvDllInstance;
|
2012-10-22 23:55:51 +00:00
|
|
|
extern HANDLE ConSrvHeap;
|
2012-10-23 22:31:36 +00:00
|
|
|
// extern HANDLE BaseSrvSharedHeap;
|
|
|
|
// extern PBASE_STATIC_SERVER_DATA BaseStaticServerData;
|
2012-10-22 23:55:51 +00:00
|
|
|
|
2013-01-02 00:32:20 +00:00
|
|
|
/* Object type magic numbers */
|
2013-01-18 22:31:16 +00:00
|
|
|
#define CONIO_INPUT_BUFFER_MAGIC 0x00000001 // --> Input-type handles
|
2013-01-02 00:32:20 +00:00
|
|
|
#define CONIO_SCREEN_BUFFER_MAGIC 0x00000002 // --> Output-type handles
|
2012-11-07 21:10:48 +00:00
|
|
|
|
2012-12-30 21:02:12 +00:00
|
|
|
/* Common things to input/output/console objects */
|
2012-10-23 22:31:36 +00:00
|
|
|
typedef struct Object_tt
|
|
|
|
{
|
2013-01-18 22:31:16 +00:00
|
|
|
ULONG Type;
|
2013-01-05 23:37:04 +00:00
|
|
|
struct _CONSOLE *Console;
|
2012-10-23 22:31:36 +00:00
|
|
|
LONG AccessRead, AccessWrite;
|
|
|
|
LONG ExclusiveRead, ExclusiveWrite;
|
|
|
|
LONG HandleCount;
|
|
|
|
} Object_t;
|
2012-10-22 23:55:51 +00:00
|
|
|
|
2012-10-23 22:31:36 +00:00
|
|
|
|
2013-01-05 23:37:04 +00:00
|
|
|
typedef struct _CONSOLE_IO_HANDLE
|
2012-11-07 21:10:48 +00:00
|
|
|
{
|
2012-12-30 21:02:12 +00:00
|
|
|
Object_t *Object; /* The object on which the handle points to */
|
2012-11-07 21:10:48 +00:00
|
|
|
DWORD Access;
|
|
|
|
BOOL Inheritable;
|
|
|
|
DWORD ShareMode;
|
2013-01-05 23:37:04 +00:00
|
|
|
} CONSOLE_IO_HANDLE, *PCONSOLE_IO_HANDLE;
|
2012-11-07 21:10:48 +00:00
|
|
|
|
|
|
|
|
2013-01-15 00:02:07 +00:00
|
|
|
#define ConsoleGetPerProcessData(Process) \
|
|
|
|
((PCONSOLE_PROCESS_DATA)((Process)->ServerData[CONSRV_SERVERDLL_INDEX]))
|
2012-12-30 21:02:12 +00:00
|
|
|
|
|
|
|
typedef struct _CONSOLE_PROCESS_DATA
|
|
|
|
{
|
|
|
|
LIST_ENTRY ConsoleLink;
|
2013-01-02 00:32:20 +00:00
|
|
|
PCSR_PROCESS Process; // Process owning this structure.
|
2012-12-30 21:02:12 +00:00
|
|
|
HANDLE ConsoleEvent;
|
2013-01-05 23:37:04 +00:00
|
|
|
/* PCONSOLE */ struct _CONSOLE* Console;
|
|
|
|
/* PCONSOLE */ struct _CONSOLE* ParentConsole;
|
2013-01-02 00:32:20 +00:00
|
|
|
|
|
|
|
BOOL ConsoleApp; // TRUE if it is a CUI app, FALSE otherwise.
|
|
|
|
|
2012-12-30 21:02:12 +00:00
|
|
|
RTL_CRITICAL_SECTION HandleTableLock;
|
|
|
|
ULONG HandleTableSize;
|
2013-01-05 23:37:04 +00:00
|
|
|
PCONSOLE_IO_HANDLE HandleTable; // Length-varying table
|
2013-01-15 00:02:07 +00:00
|
|
|
|
2012-12-30 21:02:12 +00:00
|
|
|
LPTHREAD_START_ROUTINE CtrlDispatcher;
|
|
|
|
} CONSOLE_PROCESS_DATA, *PCONSOLE_PROCESS_DATA;
|
|
|
|
|
2012-11-07 21:10:48 +00:00
|
|
|
|
2012-10-23 22:31:36 +00:00
|
|
|
/* alias.c */
|
|
|
|
CSR_API(SrvAddConsoleAlias);
|
|
|
|
CSR_API(SrvGetConsoleAlias);
|
|
|
|
CSR_API(SrvGetConsoleAliases);
|
|
|
|
CSR_API(SrvGetConsoleAliasesLength);
|
|
|
|
CSR_API(SrvGetConsoleAliasExes);
|
|
|
|
CSR_API(SrvGetConsoleAliasExesLength);
|
2012-10-22 23:55:51 +00:00
|
|
|
|
|
|
|
/* coninput.c */
|
2012-11-07 21:10:48 +00:00
|
|
|
CSR_API(SrvGetConsoleInput);
|
|
|
|
CSR_API(SrvWriteConsoleInput);
|
2012-10-22 23:55:51 +00:00
|
|
|
CSR_API(SrvReadConsole);
|
|
|
|
CSR_API(SrvFlushConsoleInputBuffer);
|
|
|
|
CSR_API(SrvGetConsoleNumberOfInputEvents);
|
|
|
|
|
|
|
|
/* conoutput.c */
|
2012-11-07 21:10:48 +00:00
|
|
|
CSR_API(SrvReadConsoleOutput);
|
|
|
|
CSR_API(SrvWriteConsoleOutput);
|
|
|
|
CSR_API(SrvReadConsoleOutputString);
|
|
|
|
CSR_API(SrvWriteConsoleOutputString);
|
|
|
|
CSR_API(SrvFillConsoleOutput);
|
2012-10-22 23:55:51 +00:00
|
|
|
CSR_API(SrvWriteConsole);
|
2012-11-07 21:10:48 +00:00
|
|
|
CSR_API(SrvSetConsoleCursorPosition);
|
2012-10-22 23:55:51 +00:00
|
|
|
CSR_API(SrvGetConsoleCursorInfo);
|
|
|
|
CSR_API(SrvSetConsoleCursorInfo);
|
2012-11-07 21:10:48 +00:00
|
|
|
CSR_API(SrvSetConsoleTextAttribute);
|
2012-10-22 23:55:51 +00:00
|
|
|
CSR_API(SrvCreateConsoleScreenBuffer);
|
2012-11-07 21:10:48 +00:00
|
|
|
CSR_API(SrvGetConsoleScreenBufferInfo);
|
2012-10-22 23:55:51 +00:00
|
|
|
CSR_API(SrvSetConsoleActiveScreenBuffer);
|
|
|
|
CSR_API(SrvScrollConsoleScreenBuffer);
|
|
|
|
CSR_API(SrvSetConsoleScreenBufferSize);
|
|
|
|
|
2012-10-23 22:31:36 +00:00
|
|
|
/* console.c */
|
2012-11-07 21:10:48 +00:00
|
|
|
CSR_API(SrvOpenConsole);
|
2012-10-23 22:31:36 +00:00
|
|
|
CSR_API(SrvAllocConsole);
|
2013-01-13 17:07:25 +00:00
|
|
|
CSR_API(SrvAttachConsole);
|
2012-10-23 22:31:36 +00:00
|
|
|
CSR_API(SrvFreeConsole);
|
|
|
|
CSR_API(SrvSetConsoleMode);
|
|
|
|
CSR_API(SrvGetConsoleMode);
|
|
|
|
CSR_API(SrvSetConsoleTitle);
|
|
|
|
CSR_API(SrvGetConsoleTitle);
|
|
|
|
CSR_API(SrvGetConsoleHardwareState);
|
|
|
|
CSR_API(SrvSetConsoleHardwareState);
|
|
|
|
CSR_API(SrvGetConsoleWindow);
|
|
|
|
CSR_API(SrvSetConsoleIcon);
|
|
|
|
CSR_API(SrvGetConsoleCP);
|
|
|
|
CSR_API(SrvSetConsoleCP);
|
|
|
|
CSR_API(SrvGetConsoleProcessList);
|
|
|
|
CSR_API(SrvGenerateConsoleCtrlEvent);
|
|
|
|
CSR_API(SrvGetConsoleSelectionInfo);
|
|
|
|
|
|
|
|
/* handle.c */
|
|
|
|
CSR_API(SrvCloseHandle);
|
|
|
|
CSR_API(SrvVerifyConsoleIoHandle);
|
|
|
|
CSR_API(SrvDuplicateHandle);
|
2013-01-02 00:32:20 +00:00
|
|
|
/// CSR_API(CsrGetInputWaitHandle);
|
2012-11-07 21:10:48 +00:00
|
|
|
|
2013-01-16 22:25:12 +00:00
|
|
|
NTSTATUS FASTCALL Win32CsrInitHandlesTable(IN OUT PCONSOLE_PROCESS_DATA ProcessData,
|
|
|
|
OUT PHANDLE pInputHandle,
|
|
|
|
OUT PHANDLE pOutputHandle,
|
|
|
|
OUT PHANDLE pErrorHandle);
|
2013-01-13 17:07:25 +00:00
|
|
|
NTSTATUS FASTCALL Win32CsrInheritHandlesTable(IN PCONSOLE_PROCESS_DATA SourceProcessData,
|
|
|
|
IN PCONSOLE_PROCESS_DATA TargetProcessData);
|
|
|
|
VOID FASTCALL Win32CsrFreeHandlesTable(PCONSOLE_PROCESS_DATA ProcessData);
|
2012-11-07 21:10:48 +00:00
|
|
|
NTSTATUS FASTCALL Win32CsrInsertObject(PCONSOLE_PROCESS_DATA ProcessData,
|
2012-10-23 22:31:36 +00:00
|
|
|
PHANDLE Handle,
|
|
|
|
Object_t *Object,
|
|
|
|
DWORD Access,
|
|
|
|
BOOL Inheritable,
|
|
|
|
DWORD ShareMode);
|
2012-11-07 21:10:48 +00:00
|
|
|
NTSTATUS FASTCALL Win32CsrLockObject(PCONSOLE_PROCESS_DATA ProcessData,
|
2012-10-23 22:31:36 +00:00
|
|
|
HANDLE Handle,
|
2013-01-24 20:48:42 +00:00
|
|
|
Object_t** Object,
|
|
|
|
PCONSOLE_IO_HANDLE* Entry OPTIONAL,
|
2012-10-23 22:31:36 +00:00
|
|
|
DWORD Access,
|
2013-01-22 23:28:51 +00:00
|
|
|
BOOL LockConsole,
|
2013-01-18 22:31:16 +00:00
|
|
|
ULONG Type);
|
2013-01-22 23:28:51 +00:00
|
|
|
VOID FASTCALL Win32CsrUnlockObject(Object_t *Object,
|
|
|
|
BOOL IsConsoleLocked);
|
|
|
|
VOID FASTCALL Win32CsrUnlockConsole(struct _CONSOLE* Console,
|
|
|
|
BOOL IsConsoleLocked);
|
2012-11-07 21:10:48 +00:00
|
|
|
NTSTATUS FASTCALL Win32CsrReleaseObject(PCONSOLE_PROCESS_DATA ProcessData,
|
|
|
|
HANDLE Handle);
|
2013-01-16 22:25:12 +00:00
|
|
|
|
|
|
|
NTSTATUS FASTCALL Win32CsrAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData,
|
|
|
|
PHANDLE pInputHandle,
|
|
|
|
PHANDLE pOutputHandle,
|
|
|
|
PHANDLE pErrorHandle,
|
|
|
|
int ShowCmd,
|
|
|
|
PCSR_PROCESS CsrProcess);
|
2013-01-13 17:07:25 +00:00
|
|
|
VOID FASTCALL Win32CsrReleaseConsole(PCONSOLE_PROCESS_DATA ProcessData);
|
2013-01-18 22:31:16 +00:00
|
|
|
NTSTATUS FASTCALL ConioConsoleFromProcessData(PCONSOLE_PROCESS_DATA ProcessData,
|
2013-01-22 23:28:51 +00:00
|
|
|
struct _CONSOLE** Console,
|
|
|
|
BOOL LockConsole);
|
2012-10-22 23:55:51 +00:00
|
|
|
|
2013-01-02 00:32:20 +00:00
|
|
|
NTSTATUS NTAPI ConsoleNewProcess(PCSR_PROCESS SourceProcess,
|
|
|
|
PCSR_PROCESS TargetProcess);
|
|
|
|
NTSTATUS NTAPI ConsoleConnect(IN PCSR_PROCESS CsrProcess,
|
|
|
|
IN OUT PVOID ConnectionInfo,
|
|
|
|
IN OUT PULONG ConnectionInfoLength);
|
|
|
|
VOID NTAPI ConsoleDisconnect(PCSR_PROCESS Process);
|
|
|
|
|
2012-10-22 23:55:51 +00:00
|
|
|
/* lineinput.c */
|
|
|
|
CSR_API(SrvGetConsoleCommandHistoryLength);
|
|
|
|
CSR_API(SrvGetConsoleCommandHistory);
|
|
|
|
CSR_API(SrvExpungeConsoleCommandHistory);
|
|
|
|
CSR_API(SrvSetConsoleNumberOfCommands);
|
|
|
|
CSR_API(SrvGetConsoleHistory);
|
|
|
|
CSR_API(SrvSetConsoleHistory);
|
|
|
|
|
|
|
|
#endif // __CONSRV_H__
|
|
|
|
|
|
|
|
/* EOF */
|