fa40a28de63418be9e53ebb2a0b3878ee621a62d
[reactos.git] / win32ss / user / consrv / consrv.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Console Server DLL
4 * FILE: win32ss/user/consrv/consrv.h
5 * PURPOSE: Main header - Definitions
6 * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
7 */
8
9 #ifndef __CONSRV_H__
10 #define __CONSRV_H__
11
12 #pragma once
13
14 /* PSDK/NDK Headers */
15 #define WIN32_NO_STATUS
16 #include <windows.h>
17 #define NTOS_MODE_USER
18 #include <ndk/ntndk.h>
19
20 /* CSRSS Header */
21 #include <csr/csrsrv.h>
22
23 /* CONSOLE Headers */
24 #include <win/console.h>
25 #include <win/conmsg.h>
26
27 #include "resource.h"
28
29 /* Shared header with console.dll */
30 #include "console.h"
31
32
33 extern HINSTANCE ConSrvDllInstance;
34 extern HANDLE ConSrvHeap;
35 // extern HANDLE BaseSrvSharedHeap;
36 // extern PBASE_STATIC_SERVER_DATA BaseStaticServerData;
37
38
39 /* Common things to input/output/console objects */
40 typedef struct Object_tt
41 {
42 LONG Type;
43 struct tagCSRSS_CONSOLE *Console;
44 LONG AccessRead, AccessWrite;
45 LONG ExclusiveRead, ExclusiveWrite;
46 LONG HandleCount;
47 } Object_t;
48
49
50 typedef struct _CSRSS_HANDLE
51 {
52 Object_t *Object; /* The object on which the handle points to */
53 DWORD Access;
54 BOOL Inheritable;
55 DWORD ShareMode;
56 } CSRSS_HANDLE, *PCSRSS_HANDLE;
57
58
59 #define ConsoleGetPerProcessData(pcsrprocess) \
60 ((PCONSOLE_PROCESS_DATA)((pcsrprocess)->ServerData[CONSRV_SERVERDLL_INDEX]))
61
62 typedef struct _CONSOLE_PROCESS_DATA
63 {
64 LIST_ENTRY ConsoleLink;
65 PCSR_PROCESS Process; // Parent process.
66 HANDLE ConsoleEvent;
67 /* PCSRSS_CONSOLE */ struct tagCSRSS_CONSOLE* Console;
68 /* PCSRSS_CONSOLE */ struct tagCSRSS_CONSOLE* ParentConsole;
69 BOOL bInheritHandles;
70 RTL_CRITICAL_SECTION HandleTableLock;
71 ULONG HandleTableSize;
72 /* PCSRSS_HANDLE */ struct _CSRSS_HANDLE* HandleTable; // Is it a length-varying table or length-fixed ??
73 LPTHREAD_START_ROUTINE CtrlDispatcher;
74 } CONSOLE_PROCESS_DATA, *PCONSOLE_PROCESS_DATA;
75
76
77 /* alias.c */
78 CSR_API(SrvAddConsoleAlias);
79 CSR_API(SrvGetConsoleAlias);
80 CSR_API(SrvGetConsoleAliases);
81 CSR_API(SrvGetConsoleAliasesLength);
82 CSR_API(SrvGetConsoleAliasExes);
83 CSR_API(SrvGetConsoleAliasExesLength);
84
85 /* coninput.c */
86 CSR_API(SrvGetConsoleInput);
87 CSR_API(SrvWriteConsoleInput);
88 CSR_API(SrvReadConsole);
89 CSR_API(SrvFlushConsoleInputBuffer);
90 CSR_API(SrvGetConsoleNumberOfInputEvents);
91
92 /* conoutput.c */
93 CSR_API(SrvReadConsoleOutput);
94 CSR_API(SrvWriteConsoleOutput);
95 CSR_API(SrvReadConsoleOutputString);
96 CSR_API(SrvWriteConsoleOutputString);
97 CSR_API(SrvFillConsoleOutput);
98 CSR_API(SrvWriteConsole);
99 CSR_API(SrvSetConsoleCursorPosition);
100 CSR_API(SrvGetConsoleCursorInfo);
101 CSR_API(SrvSetConsoleCursorInfo);
102 CSR_API(SrvSetConsoleTextAttribute);
103 CSR_API(SrvCreateConsoleScreenBuffer);
104 CSR_API(SrvGetConsoleScreenBufferInfo);
105 CSR_API(SrvSetConsoleActiveScreenBuffer);
106 CSR_API(SrvScrollConsoleScreenBuffer);
107 CSR_API(SrvSetConsoleScreenBufferSize);
108
109 /* console.c */
110 CSR_API(SrvOpenConsole);
111 CSR_API(SrvAllocConsole);
112 CSR_API(SrvFreeConsole);
113 CSR_API(SrvSetConsoleMode);
114 CSR_API(SrvGetConsoleMode);
115 CSR_API(SrvSetConsoleTitle);
116 CSR_API(SrvGetConsoleTitle);
117 CSR_API(SrvGetConsoleHardwareState);
118 CSR_API(SrvSetConsoleHardwareState);
119 CSR_API(SrvGetConsoleWindow);
120 CSR_API(SrvSetConsoleIcon);
121 CSR_API(SrvGetConsoleCP);
122 CSR_API(SrvSetConsoleCP);
123 CSR_API(SrvGetConsoleProcessList);
124 CSR_API(SrvGenerateConsoleCtrlEvent);
125 CSR_API(SrvGetConsoleSelectionInfo);
126
127 /* handle.c */
128 CSR_API(SrvCloseHandle);
129 CSR_API(SrvVerifyConsoleIoHandle);
130 CSR_API(SrvDuplicateHandle);
131 CSR_API(CsrGetInputWaitHandle);
132
133 NTSTATUS NTAPI ConsoleNewProcess(PCSR_PROCESS SourceProcess,
134 PCSR_PROCESS TargetProcess);
135 VOID NTAPI Win32CsrReleaseConsole(PCSR_PROCESS Process);
136
137 NTSTATUS FASTCALL Win32CsrInsertObject(PCONSOLE_PROCESS_DATA ProcessData,
138 PHANDLE Handle,
139 Object_t *Object,
140 DWORD Access,
141 BOOL Inheritable,
142 DWORD ShareMode);
143 NTSTATUS FASTCALL Win32CsrLockObject(PCONSOLE_PROCESS_DATA ProcessData,
144 HANDLE Handle,
145 Object_t **Object,
146 DWORD Access,
147 LONG Type);
148 VOID FASTCALL Win32CsrUnlockObject(Object_t *Object);
149 NTSTATUS FASTCALL Win32CsrReleaseObject(PCONSOLE_PROCESS_DATA ProcessData,
150 HANDLE Handle);
151
152 /* lineinput.c */
153 CSR_API(SrvGetConsoleCommandHistoryLength);
154 CSR_API(SrvGetConsoleCommandHistory);
155 CSR_API(SrvExpungeConsoleCommandHistory);
156 CSR_API(SrvSetConsoleNumberOfCommands);
157 CSR_API(SrvGetConsoleHistory);
158 CSR_API(SrvSetConsoleHistory);
159
160 #endif // __CONSRV_H__
161
162 /* EOF */