reactos/dll/cpl/console/font.c
Hermès Bélusca-Maïto 28842d99ad [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

53 lines
1.3 KiB
C

/*
* PROJECT: ReactOS Console Configuration DLL
* LICENSE: GPL - See COPYING in the top level directory
* FILE: dll/win32/console/font.c
* PURPOSE: displays font dialog
* PROGRAMMERS: Johannes Anderwald (johannes.anderwald@student.tugraz.at)
*/
#include "console.h"
INT_PTR
CALLBACK
FontProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
LPDRAWITEMSTRUCT drawItem;
PCONSOLE_PROPS pConInfo = (PCONSOLE_PROPS)GetWindowLongPtr(hwndDlg, DWLP_USER);
UNREFERENCED_PARAMETER(hwndDlg);
UNREFERENCED_PARAMETER(wParam);
switch (uMsg)
{
case WM_INITDIALOG:
{
pConInfo = (PCONSOLE_PROPS)((LPPROPSHEETPAGE)lParam)->lParam;
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo);
return TRUE;
}
case WM_DRAWITEM:
{
drawItem = (LPDRAWITEMSTRUCT)lParam;
if (drawItem->CtlID == IDC_STATIC_FONT_WINDOW_PREVIEW)
{
PaintConsole(drawItem, pConInfo);
}
else if (drawItem->CtlID == IDC_STATIC_SELECT_FONT_PREVIEW)
{
PaintText(drawItem, pConInfo);
}
return TRUE;
}
default:
{
break;
}
}
return FALSE;
}