2008-05-04 09:04:14 +00:00
|
|
|
#ifndef CONSOLE_H__
|
|
|
|
#define CONSOLE_H__
|
|
|
|
|
2014-04-12 14:23:36 +00:00
|
|
|
#include <stdio.h>
|
2017-05-03 23:56:35 +00:00
|
|
|
#include <stdlib.h>
|
2017-04-24 17:01:07 +00:00
|
|
|
#include <wchar.h>
|
[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
|
|
|
|
2014-02-05 18:17:27 +00:00
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
|
2013-01-24 23:00:42 +00:00
|
|
|
#include <windef.h>
|
|
|
|
#include <winbase.h>
|
2017-05-03 23:56:35 +00:00
|
|
|
|
|
|
|
#include <wincon.h>
|
2013-01-24 23:00:42 +00:00
|
|
|
#include <wingdi.h>
|
2017-04-17 23:21:13 +00:00
|
|
|
#include <winnls.h>
|
2015-03-24 23:58:44 +00:00
|
|
|
#include <winreg.h>
|
2017-05-03 23:56:35 +00:00
|
|
|
|
2013-01-24 23:00:42 +00:00
|
|
|
#include <winuser.h>
|
2008-05-04 09:04:14 +00:00
|
|
|
#include <commctrl.h>
|
|
|
|
#include <cpl.h>
|
2013-01-24 23:00:42 +00:00
|
|
|
|
2017-04-24 17:01:07 +00:00
|
|
|
#include <strsafe.h>
|
|
|
|
|
2008-05-04 09:04:14 +00:00
|
|
|
#include "resource.h"
|
|
|
|
|
2014-04-12 14:23:36 +00:00
|
|
|
#define EnableDlgItem(hDlg, nID, bEnable) \
|
|
|
|
EnableWindow(GetDlgItem((hDlg), (nID)), (bEnable))
|
|
|
|
|
2013-03-30 20:40:08 +00:00
|
|
|
/* Shared header with the GUI Terminal Front-End from consrv.dll */
|
2017-05-03 23:56:35 +00:00
|
|
|
#include "concfg.h" // in /winsrv/concfg/
|
2008-05-04 09:04:14 +00:00
|
|
|
|
2014-04-12 14:23:36 +00:00
|
|
|
typedef enum _TEXT_TYPE
|
|
|
|
{
|
|
|
|
Screen,
|
|
|
|
Popup
|
|
|
|
} TEXT_TYPE;
|
|
|
|
|
2015-03-24 23:58:44 +00:00
|
|
|
/* Globals */
|
2017-05-03 23:56:35 +00:00
|
|
|
extern HINSTANCE hApplet;
|
2015-03-24 23:58:44 +00:00
|
|
|
extern PCONSOLE_STATE_INFO ConInfo;
|
2017-05-03 23:56:35 +00:00
|
|
|
extern HFONT hCurrentFont;
|
2008-05-04 09:04:14 +00:00
|
|
|
|
2015-04-05 23:04:42 +00:00
|
|
|
VOID ApplyConsoleInfo(HWND hwndDlg);
|
2017-05-03 23:56:35 +00:00
|
|
|
|
2017-05-08 17:33:33 +00:00
|
|
|
/* Preview Windows */
|
|
|
|
BOOL
|
|
|
|
RegisterWinPrevClass(
|
|
|
|
IN HINSTANCE hInstance);
|
2017-05-03 23:56:35 +00:00
|
|
|
|
|
|
|
BOOL
|
2017-05-08 17:33:33 +00:00
|
|
|
UnRegisterWinPrevClass(
|
|
|
|
IN HINSTANCE hInstance);
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
2017-05-03 23:56:35 +00:00
|
|
|
PaintText(
|
|
|
|
IN LPDRAWITEMSTRUCT drawItem,
|
|
|
|
IN PCONSOLE_STATE_INFO pConInfo,
|
|
|
|
IN TEXT_TYPE TextMode);
|
2008-05-04 09:04:14 +00:00
|
|
|
|
2017-05-03 20:35:12 +00:00
|
|
|
|
|
|
|
struct _LIST_CTL;
|
|
|
|
|
|
|
|
typedef INT (*PLIST_GETCOUNT)(IN struct _LIST_CTL* ListCtl);
|
|
|
|
typedef ULONG_PTR (*PLIST_GETDATA)(IN struct _LIST_CTL* ListCtl, IN INT Index);
|
|
|
|
|
|
|
|
typedef struct _LIST_CTL
|
|
|
|
{
|
|
|
|
HWND hWndList;
|
|
|
|
PLIST_GETCOUNT GetCount;
|
|
|
|
PLIST_GETDATA GetData;
|
|
|
|
} LIST_CTL, *PLIST_CTL;
|
|
|
|
|
|
|
|
UINT
|
|
|
|
BisectListSortedByValueEx(
|
|
|
|
IN PLIST_CTL ListCtl,
|
|
|
|
IN ULONG_PTR Value,
|
|
|
|
IN UINT itemStart,
|
|
|
|
IN UINT itemEnd,
|
|
|
|
OUT PUINT pValueItem OPTIONAL,
|
|
|
|
IN BOOL BisectRightOrLeft);
|
|
|
|
|
|
|
|
UINT
|
|
|
|
BisectListSortedByValue(
|
|
|
|
IN PLIST_CTL ListCtl,
|
|
|
|
IN ULONG_PTR Value,
|
|
|
|
OUT PUINT pValueItem OPTIONAL,
|
|
|
|
IN BOOL BisectRightOrLeft);
|
|
|
|
|
2008-05-04 09:04:14 +00:00
|
|
|
#endif /* CONSOLE_H__ */
|