2012-10-22 23:55:51 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS Console Server DLL
|
|
|
|
* FILE: win32ss/user/consrv/init.c
|
|
|
|
* PURPOSE: Initialization
|
|
|
|
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "consrv.h"
|
2012-10-23 22:31:36 +00:00
|
|
|
#include "conio.h"
|
2012-10-22 23:55:51 +00:00
|
|
|
|
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
2012-11-07 21:10:48 +00:00
|
|
|
HINSTANCE ConSrvDllInstance = NULL;
|
2012-10-22 23:55:51 +00:00
|
|
|
// HANDLE BaseApiPort = NULL;
|
|
|
|
|
|
|
|
/* Memory */
|
|
|
|
HANDLE ConSrvHeap = NULL; // Our own heap.
|
|
|
|
// HANDLE BaseSrvSharedHeap = NULL; // Shared heap with CSR. (CsrSrvSharedSectionHeap)
|
|
|
|
// PBASE_STATIC_SERVER_DATA BaseStaticServerData = NULL; // Data that we can share amongst processes. Initialized inside BaseSrvSharedHeap.
|
|
|
|
|
|
|
|
// Windows 2k3 tables, adapted from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3
|
|
|
|
// plus a little bit of Windows 7. It is for testing purposes. After that I will add stubs.
|
|
|
|
// Some names are also deduced from the subsystems/win32/csrss/csrsrv/server.c ones.
|
|
|
|
PCSR_API_ROUTINE ConsoleServerApiDispatchTable[ConsolepMaxApiNumber] =
|
|
|
|
{
|
2012-11-07 21:10:48 +00:00
|
|
|
SrvOpenConsole,
|
2012-10-22 23:55:51 +00:00
|
|
|
SrvGetConsoleInput,
|
|
|
|
SrvWriteConsoleInput,
|
|
|
|
SrvReadConsoleOutput,
|
|
|
|
SrvWriteConsoleOutput,
|
2012-11-07 21:10:48 +00:00
|
|
|
SrvReadConsoleOutputString,
|
|
|
|
SrvWriteConsoleOutputString,
|
|
|
|
SrvFillConsoleOutput,
|
2012-10-22 23:55:51 +00:00
|
|
|
SrvGetConsoleMode,
|
|
|
|
// SrvGetConsoleNumberOfFonts,
|
|
|
|
SrvGetConsoleNumberOfInputEvents,
|
|
|
|
SrvGetConsoleScreenBufferInfo,
|
|
|
|
SrvGetConsoleCursorInfo,
|
|
|
|
// SrvGetConsoleMouseInfo,
|
|
|
|
// SrvGetConsoleFontInfo,
|
|
|
|
// SrvGetConsoleFontSize,
|
|
|
|
// SrvGetConsoleCurrentFont,
|
|
|
|
SrvSetConsoleMode,
|
|
|
|
SrvSetConsoleActiveScreenBuffer,
|
|
|
|
SrvFlushConsoleInputBuffer,
|
|
|
|
// SrvGetLargestConsoleWindowSize,
|
|
|
|
SrvSetConsoleScreenBufferSize,
|
2012-11-07 21:10:48 +00:00
|
|
|
SrvSetConsoleCursorPosition,
|
2012-10-22 23:55:51 +00:00
|
|
|
SrvSetConsoleCursorInfo,
|
|
|
|
// SrvSetConsoleWindowInfo,
|
|
|
|
SrvScrollConsoleScreenBuffer,
|
2012-11-07 21:10:48 +00:00
|
|
|
SrvSetConsoleTextAttribute,
|
2012-10-22 23:55:51 +00:00
|
|
|
// SrvSetConsoleFont,
|
|
|
|
SrvSetConsoleIcon,
|
|
|
|
SrvReadConsole,
|
|
|
|
SrvWriteConsole,
|
|
|
|
SrvDuplicateHandle,
|
|
|
|
// SrvGetHandleInformation,
|
|
|
|
// SrvSetHandleInformation,
|
|
|
|
SrvCloseHandle,
|
|
|
|
SrvVerifyConsoleIoHandle,
|
|
|
|
SrvAllocConsole,
|
|
|
|
SrvFreeConsole,
|
|
|
|
SrvGetConsoleTitle,
|
|
|
|
SrvSetConsoleTitle,
|
|
|
|
SrvCreateConsoleScreenBuffer,
|
|
|
|
// SrvInvalidateBitMapRect,
|
|
|
|
// SrvVDMConsoleOperation,
|
2012-11-07 21:10:48 +00:00
|
|
|
// SrvSetConsoleCursor,
|
2012-10-22 23:55:51 +00:00
|
|
|
// SrvShowConsoleCursor,
|
|
|
|
// SrvConsoleMenuControl,
|
|
|
|
// SrvSetConsolePalette,
|
|
|
|
// SrvSetConsoleDisplayMode,
|
|
|
|
// SrvRegisterConsoleVDM,
|
|
|
|
SrvGetConsoleHardwareState,
|
|
|
|
SrvSetConsoleHardwareState,
|
|
|
|
// SrvGetConsoleDisplayMode,
|
|
|
|
SrvAddConsoleAlias,
|
|
|
|
SrvGetConsoleAlias,
|
|
|
|
SrvGetConsoleAliasesLength,
|
|
|
|
SrvGetConsoleAliasExesLength,
|
|
|
|
SrvGetConsoleAliases,
|
|
|
|
SrvGetConsoleAliasExes,
|
|
|
|
SrvExpungeConsoleCommandHistory,
|
|
|
|
SrvSetConsoleNumberOfCommands,
|
|
|
|
SrvGetConsoleCommandHistoryLength,
|
|
|
|
SrvGetConsoleCommandHistory,
|
|
|
|
// SrvSetConsoleCommandHistoryMode,
|
|
|
|
SrvGetConsoleCP,
|
|
|
|
SrvSetConsoleCP,
|
|
|
|
// SrvSetConsoleKeyShortcuts,
|
|
|
|
// SrvSetConsoleMenuClose,
|
|
|
|
// SrvConsoleNotifyLastClose,
|
|
|
|
SrvGenerateConsoleCtrlEvent,
|
|
|
|
// SrvGetConsoleKeyboardLayoutName,
|
|
|
|
SrvGetConsoleWindow,
|
|
|
|
// SrvGetConsoleCharType,
|
|
|
|
// SrvSetConsoleLocalEUDC,
|
|
|
|
// SrvSetConsoleCursorMode,
|
|
|
|
// SrvGetConsoleCursorMode,
|
|
|
|
// SrvRegisterConsoleOS2,
|
|
|
|
// SrvSetConsoleOS2OemFormat,
|
|
|
|
// SrvGetConsoleNlsMode,
|
|
|
|
// SrvSetConsoleNlsMode,
|
|
|
|
// SrvRegisterConsoleIME,
|
|
|
|
// SrvUnregisterConsoleIME,
|
|
|
|
// SrvGetConsoleLangId,
|
2013-01-13 17:07:25 +00:00
|
|
|
SrvAttachConsole,
|
2012-10-22 23:55:51 +00:00
|
|
|
SrvGetConsoleSelectionInfo,
|
|
|
|
SrvGetConsoleProcessList,
|
|
|
|
SrvGetConsoleHistory,
|
|
|
|
SrvSetConsoleHistory
|
|
|
|
};
|
|
|
|
|
|
|
|
BOOLEAN ConsoleServerApiServerValidTable[ConsolepMaxApiNumber] =
|
|
|
|
{
|
[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
|
|
|
FALSE, // SrvOpenConsole,
|
|
|
|
FALSE, // SrvGetConsoleInput,
|
|
|
|
FALSE, // SrvWriteConsoleInput,
|
|
|
|
FALSE, // SrvReadConsoleOutput,
|
|
|
|
FALSE, // SrvWriteConsoleOutput,
|
|
|
|
FALSE, // SrvReadConsoleOutputString,
|
|
|
|
FALSE, // SrvWriteConsoleOutputString,
|
|
|
|
FALSE, // SrvFillConsoleOutput,
|
|
|
|
FALSE, // SrvGetConsoleMode,
|
2012-10-22 23:55:51 +00:00
|
|
|
// FALSE, // SrvGetConsoleNumberOfFonts,
|
[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
|
|
|
FALSE, // SrvGetConsoleNumberOfInputEvents,
|
|
|
|
FALSE, // SrvGetConsoleScreenBufferInfo,
|
|
|
|
FALSE, // SrvGetConsoleCursorInfo,
|
2012-10-22 23:55:51 +00:00
|
|
|
// FALSE, // SrvGetConsoleMouseInfo,
|
|
|
|
// FALSE, // SrvGetConsoleFontInfo,
|
|
|
|
// FALSE, // SrvGetConsoleFontSize,
|
|
|
|
// FALSE, // SrvGetConsoleCurrentFont,
|
[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
|
|
|
FALSE, // SrvSetConsoleMode,
|
|
|
|
FALSE, // SrvSetConsoleActiveScreenBuffer,
|
|
|
|
FALSE, // SrvFlushConsoleInputBuffer,
|
2012-10-22 23:55:51 +00:00
|
|
|
// FALSE, // SrvGetLargestConsoleWindowSize,
|
[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
|
|
|
FALSE, // SrvSetConsoleScreenBufferSize,
|
|
|
|
FALSE, // SrvSetConsoleCursorPosition,
|
|
|
|
FALSE, // SrvSetConsoleCursorInfo,
|
2012-10-22 23:55:51 +00:00
|
|
|
// FALSE, // SrvSetConsoleWindowInfo,
|
[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
|
|
|
FALSE, // SrvScrollConsoleScreenBuffer,
|
|
|
|
FALSE, // SrvSetConsoleTextAttribute,
|
2012-10-22 23:55:51 +00:00
|
|
|
// FALSE, // SrvSetConsoleFont,
|
[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
|
|
|
FALSE, // SrvSetConsoleIcon,
|
|
|
|
FALSE, // SrvReadConsole,
|
|
|
|
FALSE, // SrvWriteConsole,
|
|
|
|
FALSE, // SrvDuplicateHandle,
|
2012-10-22 23:55:51 +00:00
|
|
|
// FALSE, // SrvGetHandleInformation,
|
|
|
|
// FALSE, // SrvSetHandleInformation,
|
[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
|
|
|
FALSE, // SrvCloseHandle,
|
|
|
|
FALSE, // SrvVerifyConsoleIoHandle,
|
|
|
|
FALSE, // SrvAllocConsole,
|
|
|
|
FALSE, // SrvFreeConsole,
|
|
|
|
FALSE, // SrvGetConsoleTitle,
|
|
|
|
FALSE, // SrvSetConsoleTitle,
|
|
|
|
FALSE, // SrvCreateConsoleScreenBuffer,
|
2012-10-22 23:55:51 +00:00
|
|
|
// FALSE, // SrvInvalidateBitMapRect,
|
|
|
|
// FALSE, // SrvVDMConsoleOperation,
|
2012-11-07 21:10:48 +00:00
|
|
|
// FALSE, // SrvSetConsoleCursor,
|
2012-10-22 23:55:51 +00:00
|
|
|
// FALSE, // SrvShowConsoleCursor,
|
|
|
|
// FALSE, // SrvConsoleMenuControl,
|
|
|
|
// FALSE, // SrvSetConsolePalette,
|
|
|
|
// FALSE, // SrvSetConsoleDisplayMode,
|
|
|
|
// FALSE, // SrvRegisterConsoleVDM,
|
[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
|
|
|
FALSE, // SrvGetConsoleHardwareState,
|
|
|
|
FALSE, // SrvSetConsoleHardwareState,
|
2012-10-22 23:55:51 +00:00
|
|
|
// TRUE, // SrvGetConsoleDisplayMode,
|
[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
|
|
|
FALSE, // SrvAddConsoleAlias,
|
|
|
|
FALSE, // SrvGetConsoleAlias,
|
|
|
|
FALSE, // SrvGetConsoleAliasesLength,
|
|
|
|
FALSE, // SrvGetConsoleAliasExesLength,
|
|
|
|
FALSE, // SrvGetConsoleAliases,
|
|
|
|
FALSE, // SrvGetConsoleAliasExes,
|
|
|
|
FALSE, // SrvExpungeConsoleCommandHistory,
|
|
|
|
FALSE, // SrvSetConsoleNumberOfCommands,
|
|
|
|
FALSE, // SrvGetConsoleCommandHistoryLength,
|
|
|
|
FALSE, // SrvGetConsoleCommandHistory,
|
2012-10-22 23:55:51 +00:00
|
|
|
// FALSE, // SrvSetConsoleCommandHistoryMode,
|
[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
|
|
|
FALSE, // SrvGetConsoleCP,
|
|
|
|
FALSE, // SrvSetConsoleCP,
|
2012-10-22 23:55:51 +00:00
|
|
|
// FALSE, // SrvSetConsoleKeyShortcuts,
|
|
|
|
// FALSE, // SrvSetConsoleMenuClose,
|
|
|
|
// FALSE, // SrvConsoleNotifyLastClose,
|
[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
|
|
|
FALSE, // SrvGenerateConsoleCtrlEvent,
|
2012-10-22 23:55:51 +00:00
|
|
|
// FALSE, // SrvGetConsoleKeyboardLayoutName,
|
[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
|
|
|
FALSE, // SrvGetConsoleWindow,
|
2012-10-22 23:55:51 +00:00
|
|
|
// FALSE, // SrvGetConsoleCharType,
|
|
|
|
// FALSE, // SrvSetConsoleLocalEUDC,
|
|
|
|
// FALSE, // SrvSetConsoleCursorMode,
|
|
|
|
// FALSE, // SrvGetConsoleCursorMode,
|
|
|
|
// FALSE, // SrvRegisterConsoleOS2,
|
|
|
|
// FALSE, // SrvSetConsoleOS2OemFormat,
|
|
|
|
// FALSE, // SrvGetConsoleNlsMode,
|
|
|
|
// FALSE, // SrvSetConsoleNlsMode,
|
|
|
|
// FALSE, // SrvRegisterConsoleIME,
|
|
|
|
// FALSE, // SrvUnregisterConsoleIME,
|
|
|
|
// FALSE, // SrvGetConsoleLangId,
|
[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
|
|
|
FALSE, // SrvAttachConsole,
|
|
|
|
FALSE, // SrvGetConsoleSelectionInfo,
|
|
|
|
FALSE, // SrvGetConsoleProcessList,
|
|
|
|
FALSE, // SrvGetConsoleHistory,
|
|
|
|
FALSE, // SrvSetConsoleHistory
|
2012-10-22 23:55:51 +00:00
|
|
|
|
|
|
|
// FALSE
|
|
|
|
};
|
|
|
|
|
|
|
|
PCHAR ConsoleServerApiNameTable[ConsolepMaxApiNumber] =
|
|
|
|
{
|
2012-11-07 21:10:48 +00:00
|
|
|
"OpenConsole",
|
2012-10-22 23:55:51 +00:00
|
|
|
"GetConsoleInput",
|
|
|
|
"WriteConsoleInput",
|
|
|
|
"ReadConsoleOutput",
|
|
|
|
"WriteConsoleOutput",
|
2012-11-07 21:10:48 +00:00
|
|
|
"ReadConsoleOutputString",
|
|
|
|
"WriteConsoleOutputString",
|
|
|
|
"FillConsoleOutput",
|
2012-10-22 23:55:51 +00:00
|
|
|
"GetConsoleMode",
|
|
|
|
// "GetConsoleNumberOfFonts",
|
|
|
|
"GetConsoleNumberOfInputEvents",
|
|
|
|
"GetConsoleScreenBufferInfo",
|
|
|
|
"GetConsoleCursorInfo",
|
|
|
|
// "GetConsoleMouseInfo",
|
|
|
|
// "GetConsoleFontInfo",
|
|
|
|
// "GetConsoleFontSize",
|
|
|
|
// "GetConsoleCurrentFont",
|
|
|
|
"SetConsoleMode",
|
|
|
|
"SetConsoleActiveScreenBuffer",
|
|
|
|
"FlushConsoleInputBuffer",
|
|
|
|
// "GetLargestConsoleWindowSize",
|
|
|
|
"SetConsoleScreenBufferSize",
|
2012-11-07 21:10:48 +00:00
|
|
|
"SetConsoleCursorPosition",
|
2012-10-22 23:55:51 +00:00
|
|
|
"SetConsoleCursorInfo",
|
|
|
|
// "SetConsoleWindowInfo",
|
|
|
|
"ScrollConsoleScreenBuffer",
|
2012-11-07 21:10:48 +00:00
|
|
|
"SetConsoleTextAttribute",
|
2012-10-22 23:55:51 +00:00
|
|
|
// "SetConsoleFont",
|
|
|
|
"SetConsoleIcon",
|
|
|
|
"ReadConsole",
|
|
|
|
"WriteConsole",
|
|
|
|
"DuplicateHandle",
|
|
|
|
// "GetHandleInformation",
|
|
|
|
// "SetHandleInformation",
|
|
|
|
"CloseHandle",
|
|
|
|
"VerifyConsoleIoHandle",
|
|
|
|
"AllocConsole",
|
|
|
|
"FreeConsole",
|
|
|
|
"GetConsoleTitle",
|
|
|
|
"SetConsoleTitle",
|
|
|
|
"CreateConsoleScreenBuffer",
|
|
|
|
// "InvalidateBitMapRect",
|
|
|
|
// "VDMConsoleOperation",
|
2012-11-07 21:10:48 +00:00
|
|
|
// "SetConsoleCursor",
|
2012-10-22 23:55:51 +00:00
|
|
|
// "ShowConsoleCursor",
|
|
|
|
// "ConsoleMenuControl",
|
|
|
|
// "SetConsolePalette",
|
|
|
|
// "SetConsoleDisplayMode",
|
|
|
|
// "RegisterConsoleVDM",
|
|
|
|
"GetConsoleHardwareState",
|
|
|
|
"SetConsoleHardwareState",
|
|
|
|
// "GetConsoleDisplayMode",
|
|
|
|
"AddConsoleAlias",
|
|
|
|
"GetConsoleAlias",
|
|
|
|
"GetConsoleAliasesLength",
|
|
|
|
"GetConsoleAliasExesLength",
|
|
|
|
"GetConsoleAliases",
|
|
|
|
"GetConsoleAliasExes",
|
|
|
|
"ExpungeConsoleCommandHistory",
|
|
|
|
"SetConsoleNumberOfCommands",
|
|
|
|
"GetConsoleCommandHistoryLength",
|
|
|
|
"GetConsoleCommandHistory",
|
|
|
|
// "SetConsoleCommandHistoryMode",
|
|
|
|
"GetConsoleCP",
|
|
|
|
"SetConsoleCP",
|
|
|
|
// "SetConsoleKeyShortcuts",
|
|
|
|
// "SetConsoleMenuClose",
|
|
|
|
// "ConsoleNotifyLastClose",
|
|
|
|
"GenerateConsoleCtrlEvent",
|
|
|
|
// "GetConsoleKeyboardLayoutName",
|
|
|
|
"GetConsoleWindow",
|
|
|
|
// "GetConsoleCharType",
|
|
|
|
// "SetConsoleLocalEUDC",
|
|
|
|
// "SetConsoleCursorMode",
|
|
|
|
// "GetConsoleCursorMode",
|
|
|
|
// "RegisterConsoleOS2",
|
|
|
|
// "SetConsoleOS2OemFormat",
|
|
|
|
// "GetConsoleNlsMode",
|
|
|
|
// "SetConsoleNlsMode",
|
|
|
|
// "RegisterConsoleIME",
|
|
|
|
// "UnregisterConsoleIME",
|
|
|
|
// "GetConsoleLangId",
|
2013-01-13 17:07:25 +00:00
|
|
|
"AttachConsole",
|
2012-10-22 23:55:51 +00:00
|
|
|
"GetConsoleSelectionInfo",
|
|
|
|
"GetConsoleProcessList",
|
|
|
|
"GetConsoleHistory",
|
|
|
|
"SetConsoleHistory"
|
|
|
|
|
|
|
|
// NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-11-07 21:10:48 +00:00
|
|
|
/*
|
2013-01-24 22:41:33 +00:00
|
|
|
PCSR_API_ROUTINE ConSrvApiDefinitions[] =
|
2012-11-07 21:10:48 +00:00
|
|
|
{
|
|
|
|
CsrGetHandle,
|
|
|
|
CsrGetHandle,
|
|
|
|
CsrCloseHandle,
|
|
|
|
CsrVerifyHandle,
|
|
|
|
CsrDuplicateHandle,
|
|
|
|
CsrGetInputWaitHandle,
|
|
|
|
CsrFillOutputChar,
|
|
|
|
CsrReadInputEvent,
|
|
|
|
CsrWriteConsoleOutputChar,
|
|
|
|
CsrWriteConsoleOutputAttrib,
|
|
|
|
CsrFillOutputAttrib,
|
|
|
|
CsrSetTextAttrib,
|
|
|
|
CsrWriteConsoleOutput,
|
|
|
|
CsrFlushInputBuffer,
|
|
|
|
CsrReadConsoleOutputChar,
|
|
|
|
CsrReadConsoleOutputAttrib,
|
|
|
|
CsrExitReactos,
|
|
|
|
CsrHardwareStateProperty,
|
|
|
|
CsrCreateDesktop,
|
|
|
|
CsrShowDesktop,
|
|
|
|
CsrHideDesktop,
|
|
|
|
CsrSetLogonNotifyWindow,
|
|
|
|
CsrRegisterLogonProcess,
|
|
|
|
CsrGenerateCtrlEvent,
|
|
|
|
};
|
|
|
|
|
2013-01-24 22:41:33 +00:00
|
|
|
static CSRSS_API_DEFINITION ConSrvApiDefinitions[] =
|
2012-11-07 21:10:48 +00:00
|
|
|
{
|
|
|
|
CSRSS_DEFINE_API(GET_INPUT_HANDLE, CsrGetHandle),
|
|
|
|
CSRSS_DEFINE_API(GET_OUTPUT_HANDLE, CsrGetHandle),
|
|
|
|
CSRSS_DEFINE_API(CLOSE_HANDLE, CsrCloseHandle),
|
|
|
|
CSRSS_DEFINE_API(VERIFY_HANDLE, CsrVerifyHandle),
|
|
|
|
CSRSS_DEFINE_API(DUPLICATE_HANDLE, CsrDuplicateHandle),
|
|
|
|
CSRSS_DEFINE_API(GET_INPUT_WAIT_HANDLE, CsrGetInputWaitHandle),
|
|
|
|
CSRSS_DEFINE_API(WRITE_CONSOLE, CsrWriteConsole),
|
|
|
|
CSRSS_DEFINE_API(READ_CONSOLE, CsrReadConsole),
|
|
|
|
CSRSS_DEFINE_API(ALLOC_CONSOLE, CsrAllocConsole),
|
|
|
|
CSRSS_DEFINE_API(FREE_CONSOLE, CsrFreeConsole),
|
|
|
|
CSRSS_DEFINE_API(SCREEN_BUFFER_INFO, CsrGetScreenBufferInfo),
|
|
|
|
CSRSS_DEFINE_API(SET_CURSOR, CsrSetCursor),
|
|
|
|
CSRSS_DEFINE_API(FILL_OUTPUT, CsrFillOutputChar),
|
|
|
|
CSRSS_DEFINE_API(READ_INPUT, CsrReadInputEvent),
|
|
|
|
CSRSS_DEFINE_API(WRITE_CONSOLE_OUTPUT_CHAR, CsrWriteConsoleOutputChar),
|
|
|
|
CSRSS_DEFINE_API(WRITE_CONSOLE_OUTPUT_ATTRIB, CsrWriteConsoleOutputAttrib),
|
|
|
|
CSRSS_DEFINE_API(FILL_OUTPUT_ATTRIB, CsrFillOutputAttrib),
|
|
|
|
CSRSS_DEFINE_API(GET_CURSOR_INFO, CsrGetCursorInfo),
|
|
|
|
CSRSS_DEFINE_API(SET_CURSOR_INFO, CsrSetCursorInfo),
|
|
|
|
CSRSS_DEFINE_API(SET_ATTRIB, CsrSetTextAttrib),
|
|
|
|
CSRSS_DEFINE_API(GET_CONSOLE_MODE, CsrGetConsoleMode),
|
|
|
|
CSRSS_DEFINE_API(SET_CONSOLE_MODE, CsrSetConsoleMode),
|
|
|
|
CSRSS_DEFINE_API(CREATE_SCREEN_BUFFER, CsrCreateScreenBuffer),
|
|
|
|
CSRSS_DEFINE_API(SET_SCREEN_BUFFER, CsrSetScreenBuffer),
|
|
|
|
CSRSS_DEFINE_API(SET_TITLE, CsrSetTitle),
|
|
|
|
CSRSS_DEFINE_API(GET_TITLE, CsrGetTitle),
|
|
|
|
CSRSS_DEFINE_API(WRITE_CONSOLE_OUTPUT, CsrWriteConsoleOutput),
|
|
|
|
CSRSS_DEFINE_API(FLUSH_INPUT_BUFFER, CsrFlushInputBuffer),
|
|
|
|
CSRSS_DEFINE_API(SCROLL_CONSOLE_SCREEN_BUFFER, CsrScrollConsoleScreenBuffer),
|
|
|
|
CSRSS_DEFINE_API(READ_CONSOLE_OUTPUT_CHAR, CsrReadConsoleOutputChar),
|
|
|
|
CSRSS_DEFINE_API(READ_CONSOLE_OUTPUT_ATTRIB, CsrReadConsoleOutputAttrib),
|
|
|
|
CSRSS_DEFINE_API(GET_NUM_INPUT_EVENTS, CsrGetNumberOfConsoleInputEvents),
|
|
|
|
CSRSS_DEFINE_API(EXIT_REACTOS, CsrExitReactos),
|
|
|
|
CSRSS_DEFINE_API(PEEK_CONSOLE_INPUT, CsrPeekConsoleInput),
|
|
|
|
CSRSS_DEFINE_API(READ_CONSOLE_OUTPUT, CsrReadConsoleOutput),
|
|
|
|
CSRSS_DEFINE_API(WRITE_CONSOLE_INPUT, CsrWriteConsoleInput),
|
|
|
|
CSRSS_DEFINE_API(SETGET_CONSOLE_HW_STATE, CsrHardwareStateProperty),
|
|
|
|
CSRSS_DEFINE_API(GET_CONSOLE_WINDOW, CsrGetConsoleWindow),
|
|
|
|
CSRSS_DEFINE_API(CREATE_DESKTOP, CsrCreateDesktop),
|
|
|
|
CSRSS_DEFINE_API(SHOW_DESKTOP, CsrShowDesktop),
|
|
|
|
CSRSS_DEFINE_API(HIDE_DESKTOP, CsrHideDesktop),
|
|
|
|
CSRSS_DEFINE_API(SET_CONSOLE_ICON, CsrSetConsoleIcon),
|
|
|
|
CSRSS_DEFINE_API(SET_LOGON_NOTIFY_WINDOW, CsrSetLogonNotifyWindow),
|
|
|
|
CSRSS_DEFINE_API(REGISTER_LOGON_PROCESS, CsrRegisterLogonProcess),
|
|
|
|
CSRSS_DEFINE_API(GET_CONSOLE_CP, CsrGetConsoleCodePage),
|
|
|
|
CSRSS_DEFINE_API(SET_CONSOLE_CP, CsrSetConsoleCodePage),
|
|
|
|
CSRSS_DEFINE_API(GET_CONSOLE_OUTPUT_CP, CsrGetConsoleOutputCodePage),
|
|
|
|
CSRSS_DEFINE_API(SET_CONSOLE_OUTPUT_CP, CsrSetConsoleOutputCodePage),
|
|
|
|
CSRSS_DEFINE_API(GET_PROCESS_LIST, CsrGetProcessList),
|
|
|
|
CSRSS_DEFINE_API(ADD_CONSOLE_ALIAS, CsrAddConsoleAlias),
|
|
|
|
CSRSS_DEFINE_API(GET_CONSOLE_ALIAS, CsrGetConsoleAlias),
|
|
|
|
CSRSS_DEFINE_API(GET_ALL_CONSOLE_ALIASES, CsrGetAllConsoleAliases),
|
|
|
|
CSRSS_DEFINE_API(GET_ALL_CONSOLE_ALIASES_LENGTH, CsrGetAllConsoleAliasesLength),
|
|
|
|
CSRSS_DEFINE_API(GET_CONSOLE_ALIASES_EXES, CsrGetConsoleAliasesExes),
|
|
|
|
CSRSS_DEFINE_API(GET_CONSOLE_ALIASES_EXES_LENGTH, CsrGetConsoleAliasesExesLength),
|
|
|
|
CSRSS_DEFINE_API(GENERATE_CTRL_EVENT, CsrGenerateCtrlEvent),
|
|
|
|
CSRSS_DEFINE_API(SET_SCREEN_BUFFER_SIZE, CsrSetScreenBufferSize),
|
|
|
|
CSRSS_DEFINE_API(GET_CONSOLE_SELECTION_INFO, CsrGetConsoleSelectionInfo),
|
|
|
|
CSRSS_DEFINE_API(GET_COMMAND_HISTORY_LENGTH, CsrGetCommandHistoryLength),
|
|
|
|
CSRSS_DEFINE_API(GET_COMMAND_HISTORY, CsrGetCommandHistory),
|
|
|
|
CSRSS_DEFINE_API(EXPUNGE_COMMAND_HISTORY, CsrExpungeCommandHistory),
|
|
|
|
CSRSS_DEFINE_API(SET_HISTORY_NUMBER_COMMANDS, CsrSetHistoryNumberCommands),
|
|
|
|
CSRSS_DEFINE_API(GET_HISTORY_INFO, CsrGetHistoryInfo),
|
|
|
|
CSRSS_DEFINE_API(SET_HISTORY_INFO, CsrSetHistoryInfo),
|
|
|
|
{ 0, 0, NULL }
|
|
|
|
};
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2012-10-22 23:55:51 +00:00
|
|
|
/* FUNCTIONS ******************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
VOID WINAPI ConsoleStaticServerThread(PVOID x)
|
|
|
|
{
|
|
|
|
// NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
PPORT_MESSAGE Request = (PPORT_MESSAGE)x;
|
|
|
|
PPORT_MESSAGE Reply = NULL;
|
|
|
|
ULONG MessageType = 0;
|
|
|
|
|
|
|
|
DPRINT("BASESRV: %s called\n", __FUNCTION__);
|
|
|
|
|
|
|
|
MessageType = Request->u2.s2.Type;
|
|
|
|
DPRINT("BASESRV: %s received a message (Type=%d)\n",
|
|
|
|
__FUNCTION__, MessageType);
|
|
|
|
switch (MessageType)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
Reply = Request;
|
|
|
|
/\* Status = *\/ NtReplyPort(BaseApiPort, Reply);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
CSR_SERVER_DLL_INIT(ConServerDllInitialization)
|
|
|
|
{
|
|
|
|
/*
|
2012-10-24 21:37:22 +00:00
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
|
2012-10-22 23:55:51 +00:00
|
|
|
DPRINT("BASSRV: %s(%ld,...) called\n", __FUNCTION__, ArgumentCount);
|
|
|
|
|
2012-10-24 21:37:22 +00:00
|
|
|
// Get the listening port from csrsrv.dll
|
|
|
|
BaseApiPort = CsrQueryApiPort();
|
|
|
|
if (BaseApiPort == NULL) return STATUS_UNSUCCESSFUL;
|
|
|
|
|
|
|
|
// Register our message dispatcher
|
2012-10-22 23:55:51 +00:00
|
|
|
Status = CsrAddStaticServerThread(ConsoleStaticServerThread);
|
|
|
|
if (NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
//TODO initialize the BASE server
|
|
|
|
}
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Initialize memory */
|
|
|
|
ConSrvHeap = RtlGetProcessHeap(); // Initialize our own heap.
|
|
|
|
// BaseSrvSharedHeap = LoadedServerDll->SharedSection; // Get the CSR shared heap.
|
|
|
|
// LoadedServerDll->SharedSection = BaseStaticServerData;
|
|
|
|
|
2013-01-24 22:41:33 +00:00
|
|
|
ConSrvInitConsoleSupport();
|
2012-10-22 23:55:51 +00:00
|
|
|
|
|
|
|
/* Setup the DLL Object */
|
|
|
|
LoadedServerDll->ApiBase = CONSRV_FIRST_API_NUMBER;
|
|
|
|
LoadedServerDll->HighestApiSupported = ConsolepMaxApiNumber;
|
|
|
|
LoadedServerDll->DispatchTable = ConsoleServerApiDispatchTable;
|
|
|
|
LoadedServerDll->ValidTable = ConsoleServerApiServerValidTable;
|
|
|
|
LoadedServerDll->NameTable = ConsoleServerApiNameTable;
|
2012-11-13 21:11:30 +00:00
|
|
|
LoadedServerDll->SizeOfProcessData = sizeof(CONSOLE_PROCESS_DATA);
|
2013-01-24 22:41:33 +00:00
|
|
|
LoadedServerDll->ConnectCallback = ConSrvConnect;
|
|
|
|
LoadedServerDll->DisconnectCallback = ConSrvDisconnect;
|
|
|
|
LoadedServerDll->NewProcessCallback = ConSrvNewProcess;
|
|
|
|
// LoadedServerDll->HardErrorCallback = ConSrvHardError;
|
2012-10-22 23:55:51 +00:00
|
|
|
|
2013-02-10 12:36:57 +00:00
|
|
|
ConSrvDllInstance = LoadedServerDll->ServerHandle;
|
|
|
|
|
2012-10-22 23:55:51 +00:00
|
|
|
/* All done */
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL
|
2012-10-24 21:37:22 +00:00
|
|
|
WINAPI
|
2012-11-07 21:10:48 +00:00
|
|
|
DllMain(IN HINSTANCE hInstanceDll,
|
2012-10-22 23:55:51 +00:00
|
|
|
IN DWORD dwReason,
|
|
|
|
IN LPVOID lpReserved)
|
|
|
|
{
|
|
|
|
UNREFERENCED_PARAMETER(dwReason);
|
|
|
|
UNREFERENCED_PARAMETER(lpReserved);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|