ReactOS 0.4.15-dev-7704-gc07eb9f
tncon.h File Reference
#include "tparams.h"
Include dependency graph for tncon.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  { SC_UP , SC_DOWN , SC_ESC , SC_MOUSE }
 
enum  {
  TNNOCON , TNPROMPT , TNSCROLLBACK , TNSPAWN ,
  TNDONE
}
 

Functions

int telProcessConsole (NetParams *pParams, KeyTranslator &KeyTrans, TConsole &Console, TNetwork &Network, TMouse &Mouse, Tnclip &Clipboard, HANDLE hThread)
 
WORD scrollkeys ()
 
BOOL WINAPI ControlEventHandler (DWORD)
 
void setTNetwork (TNetwork)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SC_UP 
SC_DOWN 
SC_ESC 
SC_MOUSE 

Definition at line 7 of file tncon.h.

7 {
8 SC_UP,
10 SC_ESC,
12};
@ SC_DOWN
Definition: tncon.h:9
@ SC_UP
Definition: tncon.h:8
@ SC_ESC
Definition: tncon.h:10
@ SC_MOUSE
Definition: tncon.h:11

◆ anonymous enum

anonymous enum
Enumerator
TNNOCON 
TNPROMPT 
TNSCROLLBACK 
TNSPAWN 
TNDONE 

Definition at line 14 of file tncon.h.

14 {
15 TNNOCON,
18 TNSPAWN,
19 TNDONE
20};
@ TNNOCON
Definition: tncon.h:15
@ TNSCROLLBACK
Definition: tncon.h:17
@ TNPROMPT
Definition: tncon.h:16
@ TNDONE
Definition: tncon.h:19
@ TNSPAWN
Definition: tncon.h:18

Function Documentation

◆ ControlEventHandler()

BOOL WINAPI ControlEventHandler ( DWORD  event)

Definition at line 357 of file tncon.cpp.

357 {
358 switch(event) {
359 case CTRL_BREAK_EVENT:
360 // Bryan Montgomery 10/14/98
362 return TRUE;
363 default:
364 return FALSE;
365 }
366}
bool get_control_break_as_c() const
Definition: tnconfig.h:61
int WriteString(const char *str, const int length)
Definition: tnetwork.cpp:53
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
struct _cl_event * event
Definition: glext.h:7739
static TNetwork net
Definition: tncon.cpp:351
TConfig ini
Definition: tnconfig.cpp:45
#define CTRL_BREAK_EVENT
Definition: wincon.h:69

Referenced by Telnet::Open().

◆ scrollkeys()

WORD scrollkeys ( )

Definition at line 320 of file tncon.cpp.

320 {
322 INPUT_RECORD InputRecord;
323 BOOL done = FALSE;
324
325 while (!done) {
326 DWORD dwInput;
327 WaitForSingleObject( hConsole, INFINITE );
328 if (!ReadConsoleInput(hConsole, &InputRecord, 1, &dwInput)){
329 done = TRUE;
330 continue;
331 }
332 if (InputRecord.EventType == KEY_EVENT &&
333 InputRecord.Event.KeyEvent.bKeyDown ) {
334 // Why not just return the key code? (Paul Brannan 12/5/98)
335 return InputRecord.Event.KeyEvent.wVirtualKeyCode;
336 } else if(InputRecord.EventType == MOUSE_EVENT) {
337 if(!InputRecord.Event.MouseEvent.dwEventFlags) {
338 // Put the mouse's X and Y coords back into the input buffer
339 WriteConsoleInput(hConsole, &InputRecord, 1, &dwInput);
340 return SC_MOUSE;
341 }
342 }
343 }
344 return SC_ESC;
345}
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:203
#define INFINITE
Definition: serial.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
MOUSE_EVENT_RECORD MouseEvent
Definition: wincon.h:276
WORD EventType
Definition: wincon.h:273
union _INPUT_RECORD::@3288 Event
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:275
WORD wVirtualKeyCode
Definition: wincon.h:242
DWORD dwEventFlags
Definition: wincon.h:257
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define STD_INPUT_HANDLE
Definition: winbase.h:267
#define ReadConsoleInput
Definition: wincon.h:778
#define MOUSE_EVENT
Definition: wincon.h:129
#define KEY_EVENT
Definition: wincon.h:128
#define WriteConsoleInput
Definition: wincon.h:785

Referenced by TScroller::ScrollBack().

◆ setTNetwork()

void setTNetwork ( TNetwork  tnet)

Definition at line 352 of file tncon.cpp.

352 {
353 net = tnet;
354}

◆ telProcessConsole()

int telProcessConsole ( NetParams pParams,
KeyTranslator KeyTrans,
TConsole Console,
TNetwork Network,
TMouse Mouse,
Tnclip Clipboard,
HANDLE  hThread 
)

Definition at line 199 of file tncon.cpp.

202{
203 KeyDefType_const keydef;
204 const char *p;
205 int p_len;
206 unsigned int i;
207 int opval;
209
211
212 const DWORD nHandle = 2;
213 HANDLE hHandle[nHandle] = {hConsole, pParams->hExit};
214
215 for (;;) {
216 DWORD dwInput;
217 switch (WaitForMultipleObjects(nHandle, hHandle, FALSE, INFINITE)) {
218 case WAIT_OBJECT_0: {
219
220 // Paul Brannan 7/29/98
221 if(ini.get_input_redir()) {
222 char InputBuffer[10];
223
224 // Correction from Joe Manns <joe.manns@ardenenginneers.com>
225 // to fix race conditions (4/13/99)
226 int bResult;
227 bResult = ReadFile(hConsole, InputBuffer, 10, &dwInput, 0);
228 if(bResult && dwInput == 0) return TNNOCON;
229
230 // no key translation for redirected input
231 Network.WriteString(InputBuffer, dwInput);
232 break;
233 }
234
235 INPUT_RECORD InputRecord[11];
236 if (!ReadConsoleInput(hConsole, &InputRecord[0], 10, &dwInput))
237 return TNPROMPT;
238
239 for (i = 0; (unsigned)i < dwInput; i++){
240 switch (InputRecord[i].EventType) {
241 case KEY_EVENT:{
242 if (KEYEVENT.bKeyDown) {
243
244 WORD keyCode = KEYEVENT.wVirtualKeyCode;
245 DWORD keyState = KEYEVENT.dwControlKeyState;
246
247 // Paul Brannan 5/27/98
248 // Moved the code that was here to FindClosestKey()
249 keydef.szKeyDef = FindClosestKey(keyCode,
250 keyState, KeyTrans);
251
252 if(keydef.szKeyDef) {
253 if(!keydef.op->sendstr)
254 if((opval = do_op(keydef.op->the_op, Network,
255 Clipboard)) != 0)
256 return opval;
257 }
258
259 if(Network.get_line_mode()) {
261 continue;
262 }
263
264 p = keydef.szKeyDef;
265 if (p == NULL) { // if we don't have a translator
266 if(!KEYEVENT_CHAR) continue;
267 p_len = 1;
269 } else {
270 p_len = strlen(p);
271 }
272
273 // Local echo (Paul Brannan 5/16/98)
274 DoEcho(p, p_len, Console, Network, pParams);
275 // Line mode (Paul Brannan 12/31/98)
276 DoLineMode(p, p_len, Console, Network);
277 }
278 }
279 break;
280
281 case MOUSE_EVENT:
282 if(!InputRecord[i].Event.MouseEvent.dwEventFlags) {
283 ResetEvent(pParams->hUnPause);
284 SetEvent(pParams->hPause);
285 while (!*pParams->bNetPaused); // thread paused
286 // SuspendThread(hThread);
287
288 // Put the mouse's X and Y coords back into the
289 // input buffer
291 WriteConsoleInput(hConsole, &InputRecord[i], 1,
292 &Result);
293
294 Mouse.doMouse();
295
296 SetEvent(pParams->hUnPause);
297 // ResumeThread(hThread);
298 }
299 break;
300
301 case FOCUS_EVENT:
302 break;
304 // FIX ME!! This should take care of the window re-sizing bug
305 // Unfortunately, it doesn't.
306 Console.sync();
307 Network.do_naws(Console.GetWidth(), Console.GetHeight());
308 break;
309 }
310
311 } // keep going until no more input
312 break;
313 }
314 default:
315 return TNNOCON;
316 }
317 }
318}
CConsole Console
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int get_input_redir() const
Definition: tnconfig.h:42
bool get_enable_mouse() const
Definition: tnconfig.h:79
@ Network
#define NULL
Definition: types.h:112
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleMode(HANDLE hConsoleHandle, DWORD dwMode)
Definition: console.c:1606
unsigned short WORD
Definition: ntddk_ex.h:93
GLfloat GLfloat p
Definition: glext.h:8902
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
Definition: glfuncs.h:248
@ Mouse
Definition: i8042prt.h:116
static unsigned(__cdecl *hash_bstr)(bstr_t s)
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ EVENT_TYPE EventType
Definition: exfuncs.h:167
volatile int * bNetPaused
Definition: tparams.h:8
HANDLE hExit
Definition: tparams.h:6
HANDLE hPause
Definition: tparams.h:7
HANDLE hUnPause
Definition: tparams.h:7
tn_ops the_op
Definition: tkeydef.h:23
char sendstr
Definition: tkeydef.h:22
DWORD WINAPI WaitForMultipleObjects(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds)
Definition: synch.c:151
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:714
void DoLineMode(const char *p, int p_len, TConsole &Console, TNetwork &Network)
Definition: tncon.cpp:100
#define KEYEVENT_PCHAR
Definition: tncon.cpp:58
int do_op(tn_ops op, TNetwork &Network, Tnclip &Clipboard)
Definition: tncon.cpp:174
#define KEYEVENT_CHAR
Definition: tncon.cpp:55
#define KEYEVENT
Definition: tncon.cpp:49
bool DoLineModeSpecial(char keychar, TConsole &Console, TNetwork &Network, NetParams *pParams)
Definition: tncon.cpp:84
const char * FindClosestKey(WORD keyCode, DWORD keyState, KeyTranslator &KeyTrans)
Definition: tncon.cpp:144
void DoEcho(const char *p, int l, TConsole &Console, TNetwork &Network, NetParams *pParams)
Definition: tncon.cpp:61
const char * szKeyDef
Definition: tkeydef.h:32
const optype * op
Definition: tkeydef.h:33
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953
#define WAIT_OBJECT_0
Definition: winbase.h:406
#define ENABLE_MOUSE_INPUT
Definition: wincon.h:82
#define WINDOW_BUFFER_SIZE_EVENT
Definition: wincon.h:130
#define FOCUS_EVENT
Definition: wincon.h:132
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by Telnet::Resume().