2012-10-25 20:40:41 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS Console Server DLL
|
2015-10-05 12:21:25 +00:00
|
|
|
* FILE: win32ss/user/winsrv/consrv/consrv.h
|
2012-10-25 20:40:41 +00:00
|
|
|
* 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__
|
|
|
|
|
2014-11-23 15:50:49 +00:00
|
|
|
/* Main header */
|
|
|
|
#include "../winsrv.h"
|
|
|
|
|
2017-05-03 19:57:28 +00:00
|
|
|
#include <strsafe.h>
|
|
|
|
|
2012-10-22 23:55:51 +00:00
|
|
|
/* PSDK/NDK Headers */
|
|
|
|
#define WIN32_NO_STATUS
|
2013-01-28 22:45:53 +00:00
|
|
|
#define _INC_WINDOWS
|
|
|
|
#define COM_NO_WINDOWS_H
|
2014-11-23 15:50:49 +00:00
|
|
|
|
2013-01-28 22:45:53 +00:00
|
|
|
#include <winnls.h>
|
|
|
|
#include <wincon.h>
|
2014-11-23 15:50:49 +00:00
|
|
|
|
2012-10-22 23:55:51 +00:00
|
|
|
#define NTOS_MODE_USER
|
[CONSOLE.DLL-KERNEL32-CONSRV]
Fix the console properties dialog, when launching and transmitting console properties. Before, the properties dialog was directly launched by the console server (consrv), running with CSRSS (System) privileges, what constituted a security hole. Now, I create a remote thread in the running process owning the console for launching the properties dialog (thus it has only user privileges, and not System ones anymore). For that purpose, I basically took the technique described in the following paper (Cesar Cerrudo, "Story of a dumb patch", http://www.argeniss.com/research/MSBugPaper.pdf or http://www.scn.rain.com/~neighorn/PDF/MSBugPaper.pdf), where basically the console server shares the console properties via a shared memory section with the console properties dialog dll. The address of the thread which launches the dialog in the context of the console app is given to the console server the same way as we do for the control handler (called e.g. when you press Ctrl-C, etc...)
Of course this is quite hackish, because you have the GUI interface split between the console server and the console properties dialog dll. Something far more elegant would be to put all the GUI thingie into a dedicated dll or exe, running with the same privileges as the console program itself (a kind of console -- or terminal -- emulator).
[CONSOLE.DLL]
Fix retriving / setting colors.c and other things.
[CONSRV.DLL]
- Fix retrieving / setting console properties from the registry (via the HKCU\Console\* keys), via the shell shortcuts (not totally done at the moment, because somebody has to implement properly that thing : http://msdn.microsoft.com/en-us/library/windows/desktop/bb773359(v=vs.85).aspx (NT_CONSOLE_PROPS structure stored as a shortcut data block) (at application launching time), and via the console properties dialog.
- Few DPRINTs removed.
svn path=/branches/ros-csrss/; revision=58415
2013-03-03 15:35:12 +00:00
|
|
|
#include <ndk/mmfuncs.h>
|
2012-10-22 23:55:51 +00:00
|
|
|
|
|
|
|
/* CONSOLE Headers */
|
|
|
|
#include <win/conmsg.h>
|
2012-10-23 22:31:36 +00:00
|
|
|
|
2013-05-12 00:20:15 +00:00
|
|
|
/* Heap Helpers */
|
|
|
|
#include "heap.h"
|
|
|
|
|
2013-04-07 23:18:59 +00:00
|
|
|
/* Globals */
|
2012-11-07 21:10:48 +00:00
|
|
|
extern HINSTANCE ConSrvDllInstance;
|
2012-10-22 23:55:51 +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.
|
2013-07-06 19:47:53 +00:00
|
|
|
|
|
|
|
HANDLE ConsoleHandle;
|
2014-11-23 14:26:37 +00:00
|
|
|
BOOLEAN ConsoleApp; // TRUE if it is a CUI app, FALSE otherwise.
|
2013-01-02 00:32:20 +00:00
|
|
|
|
2012-12-30 21:02:12 +00:00
|
|
|
RTL_CRITICAL_SECTION HandleTableLock;
|
|
|
|
ULONG HandleTableSize;
|
2013-04-08 21:03:24 +00:00
|
|
|
struct _CONSOLE_IO_HANDLE* /* PCONSOLE_IO_HANDLE */ HandleTable; // Length-varying table
|
2013-01-15 00:02:07 +00:00
|
|
|
|
2014-09-07 22:53:49 +00:00
|
|
|
LPTHREAD_START_ROUTINE CtrlRoutine;
|
|
|
|
LPTHREAD_START_ROUTINE PropRoutine; // We hold the property dialog handler there, till all the GUI thingie moves out from CSRSS.
|
|
|
|
// LPTHREAD_START_ROUTINE ImeRoutine;
|
2012-12-30 21:02:12 +00:00
|
|
|
} CONSOLE_PROCESS_DATA, *PCONSOLE_PROCESS_DATA;
|
|
|
|
|
2017-12-08 22:04:48 +00:00
|
|
|
typedef struct ConsoleInput_t
|
|
|
|
{
|
|
|
|
LIST_ENTRY ListEntry;
|
|
|
|
INPUT_RECORD InputEvent;
|
|
|
|
} ConsoleInput;
|
2014-08-31 14:04:03 +00:00
|
|
|
|
|
|
|
// Helper for code refactoring
|
|
|
|
// #define USE_NEW_CONSOLE_WAY
|
|
|
|
|
|
|
|
#ifndef USE_NEW_CONSOLE_WAY
|
2014-02-04 19:54:42 +00:00
|
|
|
#include "include/conio.h"
|
2014-08-31 14:04:03 +00:00
|
|
|
#else
|
|
|
|
#include "include/conio_winsrv.h"
|
|
|
|
#endif
|
|
|
|
|
2014-04-13 15:13:55 +00:00
|
|
|
#include "include/console.h"
|
|
|
|
#include "include/settings.h"
|
|
|
|
#include "include/term.h"
|
2014-02-04 19:54:42 +00:00
|
|
|
#include "console.h"
|
|
|
|
#include "conoutput.h"
|
|
|
|
#include "handle.h"
|
|
|
|
#include "lineinput.h"
|
|
|
|
|
2014-11-23 15:50:49 +00:00
|
|
|
/* shutdown.c */
|
|
|
|
ULONG
|
|
|
|
NTAPI
|
|
|
|
ConsoleClientShutdown(IN PCSR_PROCESS CsrProcess,
|
|
|
|
IN ULONG Flags,
|
|
|
|
IN BOOLEAN FirstPhase);
|
|
|
|
|
2014-02-04 19:54:42 +00:00
|
|
|
#endif /* __CONSRV_H__ */
|